build: support registry generation

sdbus++-gen-meson version 10 adds support for redfish registry
generation and greatly simplifies the install directives.

Regenerate the YAML meson files and modify the base meson.build
as necessary.  Also, format meson.build with `meson format`.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I77586fca7742d5468803913cb45276ca57271655
diff --git a/gen/xyz/openbmc_project/State/meson.build b/gen/xyz/openbmc_project/State/meson.build
index 3115b3c..247f9c4 100644
--- a/gen/xyz/openbmc_project/State/meson.build
+++ b/gen/xyz/openbmc_project/State/meson.build
@@ -1,6 +1,23 @@
 # Generated file; do not modify.
 subdir('BMC')
-generated_others += custom_target(
+subdir('BMCRedundancy')
+subdir('Boot')
+subdir('Cable')
+subdir('Chassis')
+subdir('Decorator')
+subdir('Drive')
+subdir('Host')
+subdir('Leak')
+subdir('OperatingSystem')
+subdir('PowerOnHours')
+subdir('ScheduledHostTransition')
+subdir('Shutdown')
+subdir('SystemdTarget')
+subdir('Watchdog')
+
+sdbusplus_current_path = 'xyz/openbmc_project/State'
+
+generated_markdown += custom_target(
     'xyz/openbmc_project/State/BMC__markdown'.underscorify(),
     input: [ '../../../../yaml/xyz/openbmc_project/State/BMC.errors.yaml', '../../../../yaml/xyz/openbmc_project/State/BMC.interface.yaml',  ],
     output: [ 'BMC.md' ],
@@ -12,10 +29,12 @@
         '--directory', meson.current_source_dir() / '../../../../yaml',
         'xyz/openbmc_project/State/BMC',
     ],
+    install: should_generate_markdown,
+    install_dir: [inst_markdown_dir / sdbusplus_current_path],
+    build_by_default: should_generate_markdown,
 )
 
-subdir('BMCRedundancy')
-generated_others += custom_target(
+generated_markdown += custom_target(
     'xyz/openbmc_project/State/BMCRedundancy__markdown'.underscorify(),
     input: [ '../../../../yaml/xyz/openbmc_project/State/BMCRedundancy.interface.yaml',  ],
     output: [ 'BMCRedundancy.md' ],
@@ -27,11 +46,12 @@
         '--directory', meson.current_source_dir() / '../../../../yaml',
         'xyz/openbmc_project/State/BMCRedundancy',
     ],
+    install: should_generate_markdown,
+    install_dir: [inst_markdown_dir / sdbusplus_current_path],
+    build_by_default: should_generate_markdown,
 )
 
-subdir('Boot')
-subdir('Cable')
-generated_others += custom_target(
+generated_markdown += custom_target(
     'xyz/openbmc_project/State/Cable__markdown'.underscorify(),
     input: [ '../../../../yaml/xyz/openbmc_project/State/Cable.events.yaml',  ],
     output: [ 'Cable.md' ],
@@ -43,10 +63,29 @@
         '--directory', meson.current_source_dir() / '../../../../yaml',
         'xyz/openbmc_project/State/Cable',
     ],
+    install: should_generate_markdown,
+    install_dir: [inst_markdown_dir / sdbusplus_current_path],
+    build_by_default: should_generate_markdown,
 )
 
-subdir('Chassis')
-generated_others += custom_target(
+generated_registry += custom_target(
+    'xyz/openbmc_project/State/Cable__registry'.underscorify(),
+    input: [ '../../../../yaml/xyz/openbmc_project/State/Cable.events.yaml',  ],
+    output: [ 'Cable.json' ],
+    depend_files: sdbusplusplus_depfiles,
+    command: [
+        sdbuspp_gen_meson_prog, '--command', 'registry',
+        '--output', meson.current_build_dir(),
+        '--tool', sdbusplusplus_prog,
+        '--directory', meson.current_source_dir() / '../../../../yaml',
+        'xyz/openbmc_project/State/Cable',
+    ],
+    install: should_generate_registry,
+    install_dir: [inst_registry_dir / sdbusplus_current_path],
+    build_by_default: should_generate_registry,
+)
+
+generated_markdown += custom_target(
     'xyz/openbmc_project/State/Chassis__markdown'.underscorify(),
     input: [ '../../../../yaml/xyz/openbmc_project/State/Chassis.errors.yaml', '../../../../yaml/xyz/openbmc_project/State/Chassis.interface.yaml',  ],
     output: [ 'Chassis.md' ],
@@ -58,11 +97,12 @@
         '--directory', meson.current_source_dir() / '../../../../yaml',
         'xyz/openbmc_project/State/Chassis',
     ],
+    install: should_generate_markdown,
+    install_dir: [inst_markdown_dir / sdbusplus_current_path],
+    build_by_default: should_generate_markdown,
 )
 
-subdir('Decorator')
-subdir('Drive')
-generated_others += custom_target(
+generated_markdown += custom_target(
     'xyz/openbmc_project/State/Drive__markdown'.underscorify(),
     input: [ '../../../../yaml/xyz/openbmc_project/State/Drive.interface.yaml',  ],
     output: [ 'Drive.md' ],
@@ -74,10 +114,12 @@
         '--directory', meson.current_source_dir() / '../../../../yaml',
         'xyz/openbmc_project/State/Drive',
     ],
+    install: should_generate_markdown,
+    install_dir: [inst_markdown_dir / sdbusplus_current_path],
+    build_by_default: should_generate_markdown,
 )
 
-subdir('Host')
-generated_others += custom_target(
+generated_markdown += custom_target(
     'xyz/openbmc_project/State/Host__markdown'.underscorify(),
     input: [ '../../../../yaml/xyz/openbmc_project/State/Host.errors.yaml', '../../../../yaml/xyz/openbmc_project/State/Host.interface.yaml',  ],
     output: [ 'Host.md' ],
@@ -89,12 +131,12 @@
         '--directory', meson.current_source_dir() / '../../../../yaml',
         'xyz/openbmc_project/State/Host',
     ],
+    install: should_generate_markdown,
+    install_dir: [inst_markdown_dir / sdbusplus_current_path],
+    build_by_default: should_generate_markdown,
 )
 
-subdir('Leak')
-subdir('OperatingSystem')
-subdir('PowerOnHours')
-generated_others += custom_target(
+generated_markdown += custom_target(
     'xyz/openbmc_project/State/PowerOnHours__markdown'.underscorify(),
     input: [ '../../../../yaml/xyz/openbmc_project/State/PowerOnHours.interface.yaml',  ],
     output: [ 'PowerOnHours.md' ],
@@ -106,10 +148,12 @@
         '--directory', meson.current_source_dir() / '../../../../yaml',
         'xyz/openbmc_project/State/PowerOnHours',
     ],
+    install: should_generate_markdown,
+    install_dir: [inst_markdown_dir / sdbusplus_current_path],
+    build_by_default: should_generate_markdown,
 )
 
-subdir('ScheduledHostTransition')
-generated_others += custom_target(
+generated_markdown += custom_target(
     'xyz/openbmc_project/State/ScheduledHostTransition__markdown'.underscorify(),
     input: [ '../../../../yaml/xyz/openbmc_project/State/ScheduledHostTransition.interface.yaml',  ],
     output: [ 'ScheduledHostTransition.md' ],
@@ -121,11 +165,12 @@
         '--directory', meson.current_source_dir() / '../../../../yaml',
         'xyz/openbmc_project/State/ScheduledHostTransition',
     ],
+    install: should_generate_markdown,
+    install_dir: [inst_markdown_dir / sdbusplus_current_path],
+    build_by_default: should_generate_markdown,
 )
 
-subdir('Shutdown')
-subdir('SystemdTarget')
-generated_others += custom_target(
+generated_markdown += custom_target(
     'xyz/openbmc_project/State/SystemdTarget__markdown'.underscorify(),
     input: [ '../../../../yaml/xyz/openbmc_project/State/SystemdTarget.errors.yaml',  ],
     output: [ 'SystemdTarget.md' ],
@@ -137,10 +182,12 @@
         '--directory', meson.current_source_dir() / '../../../../yaml',
         'xyz/openbmc_project/State/SystemdTarget',
     ],
+    install: should_generate_markdown,
+    install_dir: [inst_markdown_dir / sdbusplus_current_path],
+    build_by_default: should_generate_markdown,
 )
 
-subdir('Watchdog')
-generated_others += custom_target(
+generated_markdown += custom_target(
     'xyz/openbmc_project/State/Watchdog__markdown'.underscorify(),
     input: [ '../../../../yaml/xyz/openbmc_project/State/Watchdog.interface.yaml',  ],
     output: [ 'Watchdog.md' ],
@@ -152,5 +199,8 @@
         '--directory', meson.current_source_dir() / '../../../../yaml',
         'xyz/openbmc_project/State/Watchdog',
     ],
+    install: should_generate_markdown,
+    install_dir: [inst_markdown_dir / sdbusplus_current_path],
+    build_by_default: should_generate_markdown,
 )