treewide: Leverage sdbus++-gen-meson
This makes us more consistent with other projects instead of writing
meson builds for sdbus++ by hand.
Change-Id: I38b69bc67b6a3d80cda1b508a76e106a50d8ab93
Signed-off-by: Willam A. Kennington III <wak@google.com>
diff --git a/test/gen/meson.build b/test/gen/meson.build
new file mode 100644
index 0000000..2756633
--- /dev/null
+++ b/test/gen/meson.build
@@ -0,0 +1,14 @@
+# Generated file; do not modify.
+sdbuspp_gen_meson_ver = run_command(
+ sdbuspp_gen_meson_prog,
+ '--version',
+).stdout().strip().split('\n')[0]
+
+if sdbuspp_gen_meson_ver != 'sdbus++-gen-meson version 4'
+ warning('Generated meson files from wrong version of sdbus++-gen-meson.')
+ warning(
+ 'Expected "sdbus++-gen-meson version 4", got:',
+ sdbuspp_gen_meson_ver
+ )
+endif
+
diff --git a/test/gen/regenerate-meson b/test/gen/regenerate-meson
new file mode 100755
index 0000000..235d551
--- /dev/null
+++ b/test/gen/regenerate-meson
@@ -0,0 +1,4 @@
+#!/bin/bash
+cd "$(dirname "$0")" || exit
+export PATH="${PWD}/../../tools:${PATH}"
+exec sdbus++-gen-meson --command meson --directory ../yaml --output .
diff --git a/test/gen/run-ci b/test/gen/run-ci
new file mode 100755
index 0000000..0a248a0
--- /dev/null
+++ b/test/gen/run-ci
@@ -0,0 +1,15 @@
+#!/bin/bash
+cd "$(dirname "$0")" || exit
+./regenerate-meson || exit
+rc=0
+git --no-pager diff --exit-code -- . || rc=$?
+untracked="$(git ls-files --others --exclude-standard -- .)" || rc=$?
+if [[ -n "${untracked}" ]]; then
+ echo "Untracked files:" >&2
+ echo "${untracked}" >&2
+ rc=1
+fi
+if (( rc != 0 )); then
+ echo "Generated meson files differ from expected values" >&2
+ exit 1
+fi
diff --git a/test/gen/server/Test/meson.build b/test/gen/server/Test/meson.build
new file mode 100644
index 0000000..7a1d3b7
--- /dev/null
+++ b/test/gen/server/Test/meson.build
@@ -0,0 +1,15 @@
+# Generated file; do not modify.
+generated_sources += custom_target(
+ 'server/Test__cpp'.underscorify(),
+ input: [ '../../../yaml/server/Test.interface.yaml', ],
+ output: [ 'server.cpp', 'server.hpp', 'client.hpp', ],
+ depend_files: sdbusplusplus_depfiles,
+ command: [
+ sdbuspp_gen_meson_prog, '--command', 'cpp',
+ '--output', meson.current_build_dir(),
+ '--tool', sdbusplusplus_prog,
+ '--directory', meson.current_source_dir() / '../../../yaml',
+ 'server/Test',
+ ],
+)
+
diff --git a/test/gen/server/meson.build b/test/gen/server/meson.build
new file mode 100644
index 0000000..6ab2512
--- /dev/null
+++ b/test/gen/server/meson.build
@@ -0,0 +1,16 @@
+# Generated file; do not modify.
+subdir('Test')
+generated_others += custom_target(
+ 'server/Test__markdown'.underscorify(),
+ input: [ '../../yaml/server/Test.interface.yaml', ],
+ output: [ 'Test.md' ],
+ depend_files: sdbusplusplus_depfiles,
+ command: [
+ sdbuspp_gen_meson_prog, '--command', 'markdown',
+ '--output', meson.current_build_dir(),
+ '--tool', sdbusplusplus_prog,
+ '--directory', meson.current_source_dir() / '../../yaml',
+ 'server/Test',
+ ],
+)
+