[build][sdk] Generate sdk_source_set_list.json build API file.
This CL ensures that "fx gen" will generate a new build API file
named "sdk_source_set_list.json" which lists all source and headers
files that participate in sdk_source_set() instances that are
reachable from the //sdk:sdk top-level group.
Bug: 73828
Bug: 68618
Change-Id: I022b595e0e7edba35e40ce9b2357f5559c004048
Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/511222
Commit-Queue: David Turner <digit@google.com>
Reviewed-by: Ina Huh <ihuh@google.com>
Reviewed-by: Kevin Cho <chok@google.com>
diff --git a/build/cpp/sdk_source_set.gni b/build/cpp/sdk_source_set.gni
index f9e904f..952a94d 100644
--- a/build/cpp/sdk_source_set.gni
+++ b/build/cpp/sdk_source_set.gni
@@ -238,6 +238,11 @@
if (defined(invoker.non_sdk_deps)) {
non_sdk_deps += invoker.non_sdk_deps
}
+
+ metadata = {
+ # Used by the //sdk:sdk_source_set_list build API module.
+ sdk_source_set_sources = rebase_path(all_sources + all_headers, "//")
+ }
}
}
diff --git a/sdk/BUILD.gn b/sdk/BUILD.gn
index f8c1f63..09164ce 100644
--- a/sdk/BUILD.gn
+++ b/sdk/BUILD.gn
@@ -3,6 +3,7 @@
# found in the LICENSE file.
import("//build/banjo/toolchain.gni")
+import("//build/config/build_api_module.gni")
import("//build/dart/fidl_move.gni")
import("//build/dart/toolchain.gni")
import("//build/fidl/toolchain.gni")
@@ -10,19 +11,33 @@
import("//build/sdk/sdk_documentation.gni")
import("config.gni")
+_sdk_public_deps = [
+ ":bootstrap",
+ ":core",
+ ":e2e_testing",
+ ":modular_testing",
+ ":zircon_sysroot",
+]
+
# This default target should contain all public or partner SDKs.
# Any public or partner SDKs added to this target should also be
# added to ALLOWED_CTS_SDKS in //sdk/cts/build/allowed_cts_deps.gni.
group("sdk") {
testonly = true
- public_deps = [
- ":bootstrap",
- ":core",
- ":e2e_testing",
- ":modular_testing",
- ":zircon_sysroot",
- ]
+ public_deps = _sdk_public_deps
+ data_deps = [ ":sdk_source_set_list" ]
+}
+
+# This file contains the list of all source files used in sdk_source_set()
+# targets reachable from //sdk:sdk. The schema is simply a JSON list, where
+# each iteam is the path to a single source file, relative to the source
+# directory. Path are not sorted and appear in order of metadata walk, which
+# is unstable.
+build_api_module("sdk_source_set_list") {
+ testonly = true
+ data_keys = [ "sdk_source_set_sources" ]
+ deps = _sdk_public_deps
}
group("sdk.modular") {