From b26a5ee08879a0c204f2baa4793821b60ad1fd64 Mon Sep 17 00:00:00 2001
From: Mathieu Duponchelle <mathieu@centricular.com>
Date: Mon, 20 Jan 2025 13:23:50 +0100
Subject: [PATCH] docs: explicitly list gir files as depends for generating
 configs

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8324>
---
 subprojects/gst-devtools/docs/meson.build     |  1 +
 .../gst-editing-services/docs/meson.build     |  1 +
 subprojects/gst-plugins-bad/docs/meson.build  | 24 ++++++++++++++++++-
 subprojects/gst-plugins-base/docs/meson.build | 15 ++++++++++++
 subprojects/gst-rtsp-server/docs/meson.build  |  1 +
 subprojects/gstreamer/docs/meson.build        |  5 +++-
 6 files changed, 45 insertions(+), 2 deletions(-)

diff --git a/subprojects/gst-devtools/docs/meson.build b/subprojects/gst-devtools/docs/meson.build
index d8e43bfaac..6ce05562b2 100644
--- a/subprojects/gst-devtools/docs/meson.build
+++ b/subprojects/gst-devtools/docs/meson.build
@@ -89,4 +89,5 @@ lib_hotdoc_config = custom_target(
     '--output', '@OUTPUT@',
   ],
   output: 'hotdoc-lib-configs.json',
+  depends: [validate_gir[0]],
 )
diff --git a/subprojects/gst-editing-services/docs/meson.build b/subprojects/gst-editing-services/docs/meson.build
index 1f9b53539b..adcf884bec 100644
--- a/subprojects/gst-editing-services/docs/meson.build
+++ b/subprojects/gst-editing-services/docs/meson.build
@@ -107,6 +107,7 @@ lib_hotdoc_config = custom_target(
     '--output', '@OUTPUT@',
   ],
   output: 'hotdoc-lib-configs.json',
+  depends: [ges_gir[0]]
 )
 
 doc_source_file = configure_file(output: 'doc_sources.json', configuration: plugin_sources, output_format: 'json')
diff --git a/subprojects/gst-plugins-bad/docs/meson.build b/subprojects/gst-plugins-bad/docs/meson.build
index 89e7bf335c..4419c9eb44 100644
--- a/subprojects/gst-plugins-bad/docs/meson.build
+++ b/subprojects/gst-plugins-bad/docs/meson.build
@@ -106,7 +106,8 @@ libs_doc_c_source_file = configure_file(
 
 libs_doc_gi_conf = {}
 
-libs = []
+libs_doc_depends = []
+
 if build_gir
     libs_doc_gi_conf += {
       'mpegts': mpegts_gir[0].full_path(),
@@ -123,23 +124,43 @@ if build_gir
       'analytics': analytics_gir[0].full_path(),
     }
 
+    libs_doc_depends += [
+      mpegts_gir[0],
+      play_gir[0],
+      player_gir[0],
+      insertbin_gir[0],
+      basecamerabin_gir[0],
+      webrtc_gir[0],
+      audio_gir[0],
+      transcoder_gir[0],
+      codecs_gir[0],
+      dxva_gir[0],
+      mse_gir[0],
+      analytics_gir[0],
+    ]
+
     if get_variable('gst_cuda_gir', []).length() > 0
         libs_doc_gi_conf += {'cuda': gst_cuda_gir[0].full_path()}
+        libs_doc_depends += [gst_cuda_gir[0]]
     endif
 
     if gstva_dep.found()
         libs_doc_gi_conf += {'va': va_gir[0].full_path()}
+        libs_doc_depends += [va_gir[0]]
     else
         libs_doc_gi_conf += {'va': join_paths(meson.global_source_root(), 'girs', 'GstVa-1.0.gir')}
     endif
 
     if gstvulkan_dep.found()
         libs_doc_gi_conf += {'vulkan': vulkan_gir[0].full_path()}
+        libs_doc_depends += [vulkan_gir[0]]
         if enabled_vulkan_winsys.contains('xcb')
             libs_doc_gi_conf += {'vulkan-xcb': vulkan_xcb_gir[0].full_path()}
+            libs_doc_depends += [vulkan_xcb_gir[0]]
         endif
         if enabled_vulkan_winsys.contains('wayland')
             libs_doc_gi_conf += {'vulkan-wayland': vulkan_wayland_gir[0].full_path()}
+            libs_doc_depends += [vulkan_wayland_gir[0]]
         endif
     endif
 endif
@@ -170,6 +191,7 @@ libs_hotdoc_configs = custom_target(
     '--output', '@OUTPUT@',
   ],
   output: 'hotdoc-libs-configs.json',
+  depends: libs_doc_depends,
 )
 
 doc_source_file = configure_file(output: 'doc_sources.json', configuration: plugin_sources, output_format: 'json')
diff --git a/subprojects/gst-plugins-base/docs/meson.build b/subprojects/gst-plugins-base/docs/meson.build
index 6c97c89f55..93665027da 100644
--- a/subprojects/gst-plugins-base/docs/meson.build
+++ b/subprojects/gst-plugins-base/docs/meson.build
@@ -101,16 +101,30 @@ libs_doc_gi_conf = {
   'video': video_gir[0].full_path(),
 }
 
+libs_doc_depends = [
+  app_gir[0],
+  audio_gir[0],
+  pbutils_gir[0],
+  rtp_gir[0],
+  rtsp_gir[0],
+  sdp_gir[0],
+  tag_gir[0],
+  video_gir[0],
+]
+
 if build_gstgl
   libs_doc_gi_conf += {'gl': gl_gir[0].full_path()}
   if enabled_gl_platforms.contains('egl')
     libs_doc_gi_conf += {'gl-egl': gl_egl_gir[0].full_path()}
+    libs_doc_depends += [gl_egl_gir[0]]
   endif
   if enabled_gl_winsys.contains('x11')
     libs_doc_gi_conf += {'gl-x11': gl_x11_gir[0].full_path()}
+    libs_doc_depends += [gl_x11_gir[0]]
   endif
   if enabled_gl_winsys.contains('wayland')
     libs_doc_gi_conf += {'gl-wayland': gl_wayland_gir[0].full_path()}
+    libs_doc_depends += [gl_wayland_gir[0]]
   endif
 endif
 
@@ -138,6 +152,7 @@ libs_hotdoc_configs = custom_target(
     '--output', '@OUTPUT@',
   ],
   output: 'hotdoc-libs-configs.json',
+  depends: libs_doc_depends,
 )
 
 doc_source_file = configure_file(output: 'doc_sources.json', configuration: plugin_sources, output_format: 'json')
diff --git a/subprojects/gst-rtsp-server/docs/meson.build b/subprojects/gst-rtsp-server/docs/meson.build
index 02c950834f..7d0caf68ed 100644
--- a/subprojects/gst-rtsp-server/docs/meson.build
+++ b/subprojects/gst-rtsp-server/docs/meson.build
@@ -91,6 +91,7 @@ lib_hotdoc_config = custom_target(
     '--output', '@OUTPUT@',
   ],
   output: 'hotdoc-lib-configs.json',
+  depends: [rtsp_server_gir[0]],
 )
 
 doc_source_file = configure_file(output: 'doc_sources.json', configuration: plugin_sources, output_format: 'json')
diff --git a/subprojects/gstreamer/docs/meson.build b/subprojects/gstreamer/docs/meson.build
index 913bdea38b..1bcdf80e5b 100644
--- a/subprojects/gstreamer/docs/meson.build
+++ b/subprojects/gstreamer/docs/meson.build
@@ -110,7 +110,8 @@ gst_doc_source_file = configure_file(
 gst_doc_gi_source_file = configure_file(
   output: 'gst_doc_gi_sources.json',
   configuration: {'gst': gst_gir[0].full_path()},
-  output_format: 'json')
+  output_format: 'json'
+)
 
 lib_hotdoc_config = custom_target(
   'build-gst-hotdoc-configs',
@@ -129,6 +130,7 @@ lib_hotdoc_config = custom_target(
     '--output', '@OUTPUT@',
   ],
   output: 'hotdoc-gst-configs.json',
+  depends: [gst_gir[0]],
 )
 
 libs_doc_source_file = configure_file(
@@ -163,6 +165,7 @@ libs_hotdoc_configs = custom_target(
     '--output', '@OUTPUT@',
   ],
   output: 'hotdoc-libs-configs.json',
+  depends: [gst_base_gir[0], gst_controller_gir[0], gst_net_gir[0], gst_check_gir[0]],
 )
 
 doc_source_file = configure_file(output: 'doc_sources.json', configuration: plugin_sources, output_format: 'json')