blob: a7b13c61bd20ac5282bb3b60bb7dec855a9889cd [file] [log] [blame]
# Copyright 2018 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Definitions to build each of the Fuchsia SDKs.
import("//build/bazel/bazel_fuchsia_sdk.gni")
import("//build/config/build_api_module.gni")
import("//build/config/fuchsia/platform_version.gni")
import("//build/config/fuchsia/target_api_level.gni")
import("//build/dart/toolchain.gni")
import("//build/fidl/toolchain.gni")
import("//build/sdk/config.gni")
import("//build/sdk/idk.gni")
import("//build/sdk/idk_archive.gni")
import("//build/sdk/idk_subbuilds.gni")
import("//build/sdk/sdk_collection.gni")
import("//build/sdk/sdk_documentation.gni")
import("//build/sdk/sdk_final_manifest_golden.gni")
import("//build/sdk/sdk_molecule.gni")
import("//build/sdk/sdk_version_history.gni")
import("//tools/check-licenses/build/license_data.gni")
import("config.gni")
visibility = [ ":*" ]
# There is currently no need to build the IDK with a toolchain other than
# `default_toolchain`. The following assert prevents accidentally adding
# dependencies that cause this file and the many SDK-specific rules to be
# processed in other toolchains.
# None of the Fuchsia targets are binaries that would have variants applied.
# The host tools may be built with toolchain variants.
assert(current_toolchain == default_toolchain || is_host,
"Unexpected target toolchain")
# Log a message if a non-default set of API levels or CPU architecture will be
# built as this reduces the compatibility coverage of the build and should not
# happen in infra. Ensure the messages are only logged once per build.
if (current_toolchain == default_toolchain) {
if (override_idk_buildable_api_levels != false) {
print(
"IDK build supported API levels is overridden: ${platform_version.idk_buildable_api_levels}. Compatibility with other levels cannot be checked.")
}
# Ignore default list or an override that exactly matches (including order).
if (idk_target_cpus != idk_target_cpus_default) {
print("IDK build only covers a subset of target CPUs: ${idk_target_cpus}.")
}
}
# Verify that `current_build_target_api_level` is actually supported.
if (current_build_target_api_level != "PLATFORM") {
_override_is_supported = false
foreach(supported_level, platform_version.idk_buildable_api_levels) {
if (supported_level == current_build_target_api_level) {
_override_is_supported = true
}
}
# TODO(https://fxbug.dev/330709069): We should actually assert this, but doing
# so breaks some builders that are out of sync with the support levels. We
# should remove those builders and make this an assertion.
if (!_override_is_supported) {
print(
"`current_build_target_api_level` (${current_build_target_api_level}) is not one of the supported API levels: ${platform_version.idk_buildable_api_levels}")
print("Attempting to build anyways, but this may not go well...")
}
}
# A list of sdk_collection() targets that correspond to all
# IDK targets in the "public" and "partner" category. For now
# this is only the Fuchsia Core IDK, with the exceptional addition
# of //sdk:zircon_sysroot. See the documentation comment for the
# latter to understand why this is needed.
#
# Note that //sdk:zircon_sysroot simply depends on
# //zircon/public/sysroot/sdk:sysroot_sdk which is already
# a transitive dependency of //sdk:core, so technically adding
# this target here only ensures that `fx build sdk` will
# also create $OUTPUT_DIR/sdk/exported/zircon_sysroot/ by
# default, and should not affect other uses of _sdk_public_deps.
_sdk_public_deps = [
":core",
":zircon_sysroot",
]
# This default target should depend on all public or partner IDKs.
group("sdk") {
visibility += [ "//:*" ]
testonly = true
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 item 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") {
visibility += [ "//:*" ]
testonly = true
data_keys = [ "sdk_source_set_sources" ]
deps = _sdk_public_deps
}
if (current_toolchain == default_toolchain) {
# Generates compatibility testing goldens for FIDL libraries in the IDK.
# TODO(https://fxbug.dev/324656719): Ensure this covers APIs, libraries, etc.
# that are not present at all levels, especially "PLATFORM".
group("generate_compatibility_goldens") {
visibility += [ "//scripts/versioning:*" ]
testonly = true
deps = [ "//sdk" ]
}
}
# Contains the list of all plasa fragment files, which have a dump of the
# public API surfaces.
generated_file("plasa_manifest") {
visibility += [ "//sdk/ctf/plasa:*" ]
testonly = true
data_keys = [ "plasa" ]
outputs = [ "$root_build_dir/manifest.plasa.json" ]
output_conversion = "json"
deps = _sdk_public_deps
}
# Generates, validates, and archive the "final" IDK, including prebuilt binaries
# for several target_cpu architectures and API levels.
group("final_fuchsia_idk") {
visibility += [ "*" ]
deps = [
":final_fuchsia_idk.archive",
":final_fuchsia_idk.exported",
":final_fuchsia_idk.validation",
]
testonly = true
}
idk_subbuilds("core_idk_subbuilds") {
sdk_collection_label = ":core"
visibility += [ "//build/bazel/bazel_sdk:idk" ]
}
# This targets generates a "final" IDK archive, including prebuilt binaries for
# several target_cpu architectures.
idk("final_fuchsia_idk.exported") {
visibility += [ "*" ]
output_name = "fuchsia_idk"
sdk_collection_label = ":core"
idk_subbuilds_label = ":core_idk_subbuilds"
target_cpus = idk_target_cpus
api_levels = platform_version.idk_buildable_api_levels
# TODO(https://fxbug.dev/306723826): Deal with the fact that the mac builders
# are too slow to enable this setting, and therefore the mac IDK won't have
# per-api-level prebuilts.
if (host_os == "mac") {
api_levels = []
}
}
idk_archive("final_fuchsia_idk.archive") {
visibility += [ "*" ]
idk = ":final_fuchsia_idk.exported"
idk_output_name = "fuchsia_idk"
}
group("final_fuchsia_idk.validation") {
deps = []
if (host_os == "linux") {
deps += [
# Not everything builds on the mac builders, so not everything shows up in
# the golden files.
#
# TODO(https://fxbug.dev/306723826): Deal with the fact that the mac
# builders are inconsistent.
":final_fuchsia_idk_manifest_golden",
# Run the Bazel SDK test suite against the final exported directory,
# TODO(https://fxbug.dev/42075205): Make the Bazel SDK test suite runnable on MacOS!
":final_fuchsia_idk_bazel_sdk_tests",
]
}
testonly = true
}
foreach(cpu, idk_target_cpus) {
# This target runs the test suite against a locally-generated IDK
# (which includes support for all target architectures), but only
# for target_cpu. E.g. `bazel_sdk_tests_arm64` will run the
# test suite with a build configuration that generates Fuchsia/arm64
# binaries.
run_fuchsia_bazel_sdk_tests("final_fuchsia_idk_bazel_sdk_tests_${cpu}") {
target_cpu = cpu
idk_exported_path = "$root_build_dir/sdk/exported/fuchsia_idk"
idk_exported_target = "//sdk:final_fuchsia_idk.exported"
# Use shared output_base and output_user_root between CPU-specific test runs.
output_base = "$target_out_dir/output_base"
output_user_root = "$target_out_dir/output_user_root"
}
}
# This target runs the test suite against each target architecture
# supported by the IDK. Currently, this runs multiple instances of
# the test suite, one per target cpu. This is a dependency of
# //sdk:final_fuchsia_idk.validation.
group("final_fuchsia_idk_bazel_sdk_tests") {
testonly = true
deps = []
foreach(cpu, idk_target_cpus) {
deps += [ ":final_fuchsia_idk_bazel_sdk_tests_${cpu}" ]
}
}
# This target generate a Fuchsia Bazel SDK directory directly
# from the content of the Core IDK. This requires a working Bazel
# workspace, but its output does not depend on the content of the
# @fuchsia_sdk repository used by the platform build.
#
generate_fuchsia_bazel_sdk("final_fuchsia_sdk") {
idk_export_target = "//sdk:final_fuchsia_idk.exported"
idk_export_dir = "$root_build_dir/sdk/exported/fuchsia_idk"
}
foreach(cpu, idk_target_cpus) {
run_fuchsia_bazel_sdk_tests("final_fuchsia_sdk_tests_$cpu") {
fuchsia_sdk_target = ":final_fuchsia_sdk"
}
}
# Verify the content of the final_fuchsia_sdk target by running
# the Bazel SDK test suite with it for all supported target cpus.
group("final_fuchsia_sdk_tests") {
testonly = true
deps = []
foreach(cpu, idk_target_cpus) {
deps += [ ":final_fuchsia_sdk_tests_$cpu" ]
}
# NOTE: For now, nothing should depend on the :final_fuchsia_sdk_test
# target, except //:root_targets. This ensures the target is always
# defined in the GN graph, but can only be built explicitly.
visibility = []
visibility = [ "*" ]
}
sdk_final_manifest_golden("final_fuchsia_idk_manifest_golden") {
golden = "manifests/fuchsia_idk.manifest"
idk_name = "fuchsia_idk"
idk_exported_label = ":final_fuchsia_idk.exported"
}
# NOTHING TO SEE HERE FOLKS.
#
# This build rule is an implementation detail. It should probably get
# consolidated with ":final_fuchsia_idk".
sdk_collection("core") {
visibility += [ "*" ]
category = "partner"
id = sdk_id
deps = [
# NOTE: Don't add any other sdk_molecules here. Instead, add atoms to the
# :fuchsia_idk_atoms sdk_molecule.
":fuchsia_idk_atoms",
]
}
if (!is_host) {
# A "molecule" of SDK atoms exposing the APIs and ABI of the Fuchsia platform.
# It is built for each API level supported in the IDK and at "PLATFORM",
# though the dependencies are very different in each of those cases.
#
# Due to limitations of the build system at the GN/Bazel boundary, this cannot
# contain testonly atoms. Libraries and packages for use in tests absolutely
# belong in the IDK, but unfortunately, before they can be added, the
# `testonly` attribute must be removed.
sdk_molecule("fuchsia_idk_atoms") {
visibility += [ "//vendor/*" ]
category = "partner"
if (current_build_target_api_level == "PLATFORM") {
deps = [ ":fuchsia_idk_atoms_for_main_platform_build" ]
} else {
deps = [ ":fuchsia_idk_atoms_for_each_api_level" ]
}
# Successfully building at each API level, including PLATFORM, is the test.
non_sdk_deps = [ "//zircon/system:availability_test" ]
}
# Prebuilt libraries and packages that are built exclusively for the API
# levels that SDK users can target (not "PLATFORM").
# Note: This target can be built at "PLATFORM" for development purposes.
sdk_molecule("fuchsia_idk_atoms_for_each_api_level") {
category = "partner"
deps = [
":core_cc_prebuilt_libraries",
":core_packages",
":core_sysroot",
]
}
if (current_build_target_api_level == "PLATFORM") {
# These rules are processed at least once for the primary target CPU,
# which may not match the host_cpu. They may also be processed for
# additional CPU architectures when building the final IDK.
sdk_molecule("fuchsia_idk_atoms_for_main_platform_build") {
category = "partner"
deps = [
# Do not add to this list. Instead, add new items to
# :fuchsia_idk_atoms_independent_of_api_level_for_one_cpu_arch,
# which verifies there are no API level dependencies.
# There are very limited exceptions that do depend on API level but are
# only built at "PLATFORM".
":fuchsia_idk_atoms_built_only_at_platform_for_each_cpu_arch",
# Atoms in :fuchsia_idk_atoms_for_each_api_level that currently must
# also be built at "PLATFORM" for backwards compatibility with IDK users
# that do not yet know about per-API-level prebuilts.
#
# TODO(https://fxbug.dev/310006516): Remove these once all IDK users are
# using the per-API-level artifacts.
":core_cc_prebuilt_libraries",
":core_sysroot",
]
if (!sdk_inside_sub_build) {
deps += [
":fuchsia_idk_atoms_built_only_at_platform_for_one_cpu_arch",
":fuchsia_idk_atoms_independent_of_api_level_for_one_cpu_arch",
# IDK atoms that are host tools. They must currently support all
# Supported API levels and thus only need to be built once.
# TODO(https://fxbug.dev/349889250): Move host tools to
# :fuchsia_idk_atoms_at_platform_for_host_cpu_arch_only and/or
# :fuchsia_idk_atoms_for_each_api_level as appropriate.
":host_tools_for_configured_host_cpus",
# These host tests are (currently) unversioned and only need to be
# built once.
# TODO(https://fxbug.dev/330373943): Move once tests are versioned.
":fuchsia_idk_atoms_host_tests",
]
}
}
# Do not add dependencies to this target without a really good reason.
# Most dependencies should be built at every API level (add to
# :fuchsia_idk_atoms_for_each_api_level) or be verifiably independent of the
# API level and target CPU architecture (add to
# :fuchsia_idk_atoms_independent_of_api_level_for_one_cpu_arch).
#
# IDK atoms that must be built at "PLATFORM" for each CPU architecture.
sdk_molecule("fuchsia_idk_atoms_built_only_at_platform_for_each_cpu_arch") {
category = "partner"
deps = [
# The C++ source libraries must be buildable at each supported API level
# but are only built once (per target CPU architecture).
# TODO(https://fxbug.dev/42083950): Ensure the libraries build and are
# complete at all API levels.
":core_cc_source_libraries",
# TODO(https://fxbug.dev/327223536): `loadable_modules` (a.k.a., the
# "Vulkan layers") support being built at individual API levels, but
# each of the subbuilds currently puts the build files at the same path,
# so all but one of them gets clobbered. Give `loadable_modules` the
# proper per-API-level treatment and move this to
# :fuchsia_idk_atoms_for_each_api_level.
":core_loadable_modules",
]
}
# The rules below only need to be processed once when building the final
# IDK. Since sub-builds change the `target_cpu`, this cannot be used as
# a condition. While, `host_cpu` does not change in sub-builds, using that
# would require extra processing and building when it does not match the
# primary target CPU. Therefore, use `sdk_inside_sub_build`.
# TODO(https://fxbug.dev/310006516): Once this and the issues in
# `fuchsia_idk_atoms_built_only_at_platform_for_each_cpu_arch` are addressed
# sub-builds will never target "PLATFORM" and this logic and GN variable
# can be removed.
if (!sdk_inside_sub_build) {
# Do not add dependencies to this target without a really good reason.
# Most such dependencies should be verifiably independent of the API level
# and (not verifiable) CPU architecture (add to
# :fuchsia_idk_atoms_independent_of_api_level_for_one_cpu_arch).
#
# IDK atoms that must be built at "PLATFORM" but only once (for one CPU
# architecture).
# The resulting artifacts should be independent of the CPU architecture,
# though that cannot be enforced.
sdk_molecule(
"fuchsia_idk_atoms_built_only_at_platform_for_one_cpu_arch") {
category = "partner"
deps = [
# This target compiles the FIDL files, but the output used in the IDK
# is not specific to any API level or CPU architecture.
"//sdk/fidl",
# Some generated documentation depends on FIDL and thus cannot be in
# :fuchsia_idk_atoms_independent_of_api_level_and_target_cpu_arch.
"//tools/docsgen:ref_docs_sdk",
]
}
# IDK atoms that are independent of a specific API level and only need to
# be built once (for one CPU architecture).
# The former is enforced (as much as practical) by an assert_no_deps.
# The resulting artifacts should be independent of the CPU architecture,
# though that cannot be enforced. The target CPU architecture is used.
sdk_molecule(
"fuchsia_idk_atoms_independent_of_api_level_for_one_cpu_arch") {
category = "partner"
# The following serve as a proxy for the building of FIDL files. A
# dependency on these suggests that there is a dependency on FIDL
# interface(s), which would likely mean that the code must be built at
# each API level and should be in a different molecule.
assert_no_deps = [
"//tools/fidl/fidl_api_diff:host",
"//tools/fidl/fidl_api_summarize:fidl_api_summarize($host_toolchain)",
"//tools/fidl/fidlc:fidl-lint.host",
]
deps = [
":core_bindlib",
":core_dart_library",
":core_data",
":core_documentation",
":core_licenses",
":version_history_sdk($default_toolchain)",
"//sdk/devices",
"//sdk/docs",
]
}
} # end if (!sdk_inside_sub_build)
} # end if (current_build_target_api_level == "PLATFORM")
} # end if (!is_host)
sdk_molecule("fuchsia_idk_atoms_host_tests") {
category = "partner"
deps = [ ":core_experimental_python_e2e_tests" ]
}
group("tests_no_e2e") {
visibility += [ "*" ]
testonly = true
assert_no_deps = e2e_test_libs
deps = [
"//sdk/ctf/plasa:tests",
"//sdk/lib:tests",
"//tools/fidl/abi-compat:check-compatibility",
]
}
group("tests") {
visibility += [ "*" ]
testonly = true
deps = [
":tests_no_e2e",
# `testing:tests` contains unit tests for sl4f, which depend on sl4f so it
# can't live inside `test_no_e2e`.
"//sdk/testing:tests",
]
}
# Version history does not differ by toolchain.
if (current_toolchain == default_toolchain) {
sdk_version_history("version_history") {
visibility += [ "*" ]
id = "sdk://version_history"
category = "partner"
source = "version_history.json"
}
}
# License/rights related information for the SDK.
sdk_documentation("open_source") {
name = "open_source"
category = "public"
files = []
foreach(file,
[
"AUTHORS",
"LICENSE",
"PATENTS",
]) {
files += [
{
source = "//$file"
dest = file
},
]
}
}
# Licensing information for the 'libc'-style musl library.
sdk_documentation("musl_license") {
name = "musl_license"
category = "public"
files = [
{
source = "//zircon/third_party/ulib/musl/COPYRIGHT"
dest = "COPYRIGHT.musl"
},
]
}
# Build this target to generate a NOTICE file for the SDK.
# Uncomment the next line, build it, then manually copy the output
# to "//tools/check-licenses/assets/sdk/NOTICE.fuchsia"
# TODO(https://fxbug.dev/42053181): Build the NOTICE file automatically during SDK generation.
#
#license_data("sdk_notice_gen") {
# target = "//sdk"
#}
# Notice file for all contents in the Fuchsia SDK.
# TODO(https://fxbug.dev/42053181): Replace this with individual notices for each SDK element.
sdk_documentation("sdk_notice") {
name = "sdk_notice"
category = "public"
files = [
{
source = "//tools/check-licenses/assets/sdk/NOTICE.fuchsia"
dest = "NOTICE.fuchsia"
},
]
}
# A tiny SDK collection used to export the content of the Zircon sysroot
# This is only needed because several other parts of the Fuchsia build
# depend on $OUTPUT_DIR/sdk/exported/zircon_sysroot/ to be available
# and properly populated, see [1] for all details.
#
# Note that //zircon/public/sysroot/sdk:sysroot_sdk is already
# a transitive dependency of //sdk:core, so using the content of
# $OUTPUT_DIR/sdk/exported/core/ would be equivalent, except that
# this directory is much longer to build (since it contains host tools).
#
# [1] https://cs.opensource.google/search?q=zircon_sysroot&ss=fuchsia%2Ffuchsia
sdk_collection("zircon_sysroot") {
# This collection is not included in any SDK and could be a standard `group()`
# except that there are shell scripts that expect
# `$OUTPUT_DIR/sdk/exported/zircon_sysroot/` to be populated,
# TODO(https://fxbug.dev/331962496): Find a solution that doesn't depend on
# sdk_* templates.
category = "excluded"
deps = [ "//zircon/public/sysroot/sdk:sysroot_sdk" ]
}
if (is_host) {
# Tools and data used on a host development machine (usually Linux or macOS).
sdk_molecule("host_tools_for_single_toolchain") {
visibility += [ "//tools/docsgen:invoke_clidoc" ]
category = "partner"
deps = [
"//src/developer/debug/zxdb:zxdb_sdk",
"//src/developer/ffx:bin_sdk",
"//src/developer/ffx/plugins/agis:sdk",
"//src/developer/ffx/plugins/assembly:sdk",
"//src/developer/ffx/plugins/audio:sdk",
"//src/developer/ffx/plugins/component:sdk",
"//src/developer/ffx/plugins/coverage:sdk",
"//src/developer/ffx/plugins/debug:sdk",
"//src/developer/ffx/plugins/driver:sdk",
"//src/developer/ffx/plugins/emulator:sdk",
"//src/developer/ffx/plugins/emulator:uefi_internal",
"//src/developer/ffx/plugins/fuzz:sdk",
"//src/developer/ffx/plugins/inspect:sdk",
"//src/developer/ffx/plugins/log:sdk",
"//src/developer/ffx/plugins/package:sdk",
"//src/developer/ffx/plugins/process:sdk",
"//src/developer/ffx/plugins/product:sdk",
"//src/developer/ffx/plugins/profile:sdk",
"//src/developer/ffx/plugins/repository:sdk",
"//src/developer/ffx/plugins/scrutiny:sdk",
"//src/developer/ffx/plugins/session:sdk",
"//src/developer/ffx/plugins/setui:sdk",
"//src/developer/ffx/plugins/test:sdk",
"//src/developer/ffx/plugins/trace:sdk",
"//src/developer/ffx/plugins/wlan:sdk",
"//src/developer/ffx/tools/starnix:sdk",
"//src/performance/trace2json:bin_sdk",
"//src/storage/bin/fvm:fvm_sdk",
"//src/storage/blobfs/tools:blobfs_sdk",
"//src/storage/minfs/tools:minfs_sdk",
"//src/storage/tools/blobfs-compression:blobfs-compression_sdk",
"//src/sys/pkg/bin/far:bin_sdk",
"//src/sys/pkg/bin/pm:pm_bin_sdk",
"//src/sys/pkg/testing/fake-omaha-client:bin_sdk",
"//tools/bindc:bindc_sdk",
"//tools/bootserver_old:bootserver_sdk",
"//tools/cmc:cmc_sdk",
"//tools/configc:configc_sdk",
"//tools/fidl/fidlc:fidl-format_sdk",
"//tools/fidl/fidlc:fidlc_sdk",
"//tools/fidl/fidlgen_cpp:fidlgen_cpp_sdk",
"//tools/fidl/fidlgen_hlcpp:fidlgen_hlcpp_sdk",
"//tools/fidl/fidlgen_rust:fidlgen_rust_sdk",
"//tools/fidlcat:fidlcat_sdk",
"//tools/fuchsia-sdk-run:fuchsia-sdk-run_sdk",
"//tools/funnel:funnel_sdk",
"//tools/net/device-finder:device-finder_sdk",
"//tools/sdk-tools/fpublish:fpublish_sdk",
"//tools/sdk-tools/fserve:fserve_sdk",
"//tools/sdk-tools/fssh:fssh_sdk",
"//tools/symbolizer:sdk",
"//zircon/tools/merkleroot:merkleroot_sdk",
"//zircon/tools/zbi:zbi_sdk",
# TODO(https://fxbug.dev/42177692): Remove these once the emulators are available independently.
"//src/developer/ffx/plugins/emulator:aemu_internal",
"//src/developer/ffx/plugins/emulator:qemu_internal",
]
}
} else {
# Contains :host_tools_for_single_toolchain for all host toolchains that this
# build is configured to include. Always includes host tools for
# `host_toolchain`, and includes host tools for other host toolchains when
# `sdk_cross_compile_host_tools` is true.
sdk_molecule("host_tools_for_configured_host_cpus") {
category = "partner"
_toolchains = []
if (host_os == "linux" && sdk_cross_compile_host_tools) {
_required_target_cpus = [
"x64",
"arm64",
]
_skipped_target_cpus = idk_target_cpus_default - idk_target_cpus
assert(
_skipped_target_cpus == _skipped_target_cpus + _required_target_cpus -
_required_target_cpus,
"`idk_target_cpus` must include all CPUs for which host tools are being cross-compiled: ${idk_target_cpus} vs. ${_required_target_cpus}")
_toolchains += [
host_x64_toolchain,
host_arm64_toolchain,
]
} else {
_toolchains = [ host_toolchain ]
}
deps = []
foreach(toolchain, _toolchains) {
deps += [ ":host_tools_for_single_toolchain($toolchain)" ]
}
}
} # end if (is_host)
sdk_molecule("core_bindlib") {
category = "partner"
deps = [
"//src/devices/bind/fuchsia:fuchsia_sdk",
"//src/devices/bind/fuchsia.acpi:fuchsia.acpi_sdk",
"//src/devices/bind/fuchsia.adc:fuchsia.adc_sdk",
"//src/devices/bind/fuchsia.amlogic.platform:fuchsia.amlogic.platform_sdk",
"//src/devices/bind/fuchsia.amlogic.platform.a311d:fuchsia.amlogic.platform.a311d_sdk",
"//src/devices/bind/fuchsia.amlogic.platform.meson:fuchsia.amlogic.platform.meson_sdk",
"//src/devices/bind/fuchsia.arm.platform:fuchsia.arm.platform_sdk",
"//src/devices/bind/fuchsia.block:fuchsia.block_sdk",
"//src/devices/bind/fuchsia.broadcom.platform:fuchsia.broadcom.platform_sdk",
"//src/devices/bind/fuchsia.broadcom.platform.sdio:fuchsia.broadcom.platform.sdio_sdk",
"//src/devices/bind/fuchsia.clock:fuchsia.clock_sdk",
"//src/devices/bind/fuchsia.designware.platform:fuchsia.designware.platform_sdk",
"//src/devices/bind/fuchsia.devicetree:fuchsia.devicetree_sdk",
"//src/devices/bind/fuchsia.ethernet:fuchsia.ethernet_sdk",
"//src/devices/bind/fuchsia.focaltech.platform:fuchsia.focaltech.platform_sdk",
"//src/devices/bind/fuchsia.google.platform:fuchsia.google.platform_sdk",
"//src/devices/bind/fuchsia.gpio:fuchsia.gpio_sdk",
"//src/devices/bind/fuchsia.i2c:fuchsia.i2c_sdk",
"//src/devices/bind/fuchsia.khadas.platform:fuchsia.khadas.platform_sdk",
"//src/devices/bind/fuchsia.nxp.platform:fuchsia.nxp.platform_sdk",
"//src/devices/bind/fuchsia.pci:fuchsia.pci_sdk",
"//src/devices/bind/fuchsia.platform:fuchsia.platform_sdk",
"//src/devices/bind/fuchsia.power:fuchsia.power_sdk",
"//src/devices/bind/fuchsia.pwm:fuchsia.pwm_sdk",
"//src/devices/bind/fuchsia.realtek.platform:fuchsia.realtek.platform_sdk",
"//src/devices/bind/fuchsia.register:fuchsia.register_sdk",
"//src/devices/bind/fuchsia.regulator:fuchsia.regulator_sdk",
"//src/devices/bind/fuchsia.sdio:fuchsia.sdio_sdk",
"//src/devices/bind/fuchsia.serial:fuchsia.serial_sdk",
"//src/devices/bind/fuchsia.sysmem:fuchsia.sysmem_sdk",
"//src/devices/bind/fuchsia.test:fuchsia.test_sdk",
"//src/devices/bind/fuchsia.test.platform:fuchsia.test.platform_sdk",
"//src/devices/bind/fuchsia.ti.platform:fuchsia.ti.platform_sdk",
"//src/devices/bind/fuchsia.usb.phy:fuchsia.usb.phy_sdk",
"//src/devices/bind/fuchsia.verisilicon.platform:fuchsia.verisilicon.platform_sdk",
]
}
sdk_molecule("core_packages") {
category = "partner"
deps = [
"//src/graphics/examples/vkproto/cmd-buf-benchmark:cmd-buf-benchmark-test-sdk",
"//src/graphics/examples/vkproto/driver-tests:vkproto-driver-test-sdk",
"//src/graphics/magma/tests/integration:magma_conformance_tests_sdk",
"//src/graphics/tests/benchmark:vkcopy-test-sdk",
"//src/graphics/tests/vkext:vkext-test-sdk",
"//src/graphics/tests/vkloop:vkloop-test-sdk",
"//src/graphics/tests/vkreadback:vkreadback_test_sdk",
"//src/lib/fuchsia-component-test/realm_builder_server:realm_builder_server_sdk",
"//src/performance/memory/heapdump/collector:collector_sdk",
]
}
sdk_molecule("core_data") {
category = "partner"
deps = [
# TODO(ddorwin): Rename these to make it clear that they are data (e.g., _shards).
"//sdk/lib/driver_component:driver_component",
"//sdk/lib/heapdump_instrumentation:heapdump_instrumentation_shard",
"//sdk/lib/inspect",
"//sdk/lib/sys/component:realm_builder_shard_sdk",
"//sdk/lib/syslog",
"//sdk/lib/vulkan",
"//src/developer/ffx/lib/symbol-index:symbol-index-sdk",
]
}
sdk_molecule("core_documentation") {
category = "partner"
deps = [ "//third_party/Vulkan-Loader:vulkan_license" ]
}
sdk_molecule("core_loadable_modules") {
category = "partner"
deps = [ "//src/lib/vulkan:vulkan_layers" ]
}
sdk_molecule("core_dart_library") {
category = "partner"
deps = [ "//sdk/testing/sl4f/client:client_sdk($dart_toolchain)" ]
}
sdk_molecule("core_experimental_python_e2e_tests") {
category = "partner"
deps =
[ "//src/tests/end_to_end/rtc:rtc_conformance_test_sdk($host_toolchain)" ]
}
# C/C++ code that must be provided as prebuilt libraries for each supported API
# level. Must export symbols with C linkage.
sdk_molecule("core_cc_prebuilt_libraries") {
category = "partner"
deps = [
"//sdk/lib/fdio:fdio_sdk",
"//sdk/lib/magma_client:magma_client_sdk",
"//sdk/lib/svc:svc_sdk",
"//sdk/lib/vfs/internal:vfs_internal_sdk",
"//sdk/lib/virtgralloc:virtgralloc_headers_sdk",
"//src/devices/bin/driver_runtime:driver_runtime_sdk",
"//src/performance/memory/heapdump/instrumentation:instrumentation_sdk",
"//third_party/Vulkan-Loader:libvulkan_sdk",
"//zircon/system/ulib/async-default:async-default_sdk",
"//zircon/system/ulib/async-loop:async-loop-default_sdk",
"//zircon/system/ulib/sync:sync_sdk",
"//zircon/system/ulib/syslog:syslog_sdk",
"//zircon/system/ulib/trace-engine:trace-engine_sdk",
"//zircon/system/ulib/trace-provider:trace-provider-so_sdk",
"//zircon/system/ulib/trace-vthread:trace-vthread_sdk",
]
}
# C/C++ code that is provided as source in the SDK. Must be buildable at each
# supported API level, though this is not part of the build.
# Prefer providing source code if all dependencies are available in the SDK.
sdk_molecule("core_cc_source_libraries") {
category = "partner"
deps = [
"//sdk/lib/async-loop-testing/cpp:cpp_sdk",
"//sdk/lib/async_patterns/cpp:cpp_sdk",
"//sdk/lib/async_patterns/testing/cpp:cpp_sdk",
"//sdk/lib/component/incoming/cpp:cpp_sdk",
"//sdk/lib/component/outgoing/cpp:cpp_sdk",
"//sdk/lib/driver/component/cpp:cpp_sdk",
"//sdk/lib/driver/devfs/cpp:cpp_sdk",
"//sdk/lib/driver/testing/cpp:cpp_sdk",
"//sdk/lib/fidl/cpp:cpp_sdk",
"//sdk/lib/fidl/cpp/wire:wire_sdk",
"//sdk/lib/fidl_driver:fidl_driver_natural_sdk",
"//sdk/lib/fidl_driver:fidl_driver_sdk",
"//sdk/lib/fit-promise:fit-promise_sdk",
"//sdk/lib/input_report_reader:input_report_reader_sdk",
"//sdk/lib/inspect/component/cpp:cpp_sdk",
"//sdk/lib/magma_common:magma_common_sdk",
"//sdk/lib/media/cpp:cpp_sdk",
"//sdk/lib/stdcompat:stdcompat_sdk",
"//sdk/lib/sys/component/cpp/testing:cpp_library_sdk",
"//sdk/lib/sys/cpp:cpp_sdk",
"//sdk/lib/sys/cpp/testing:cpp_sdk",
"//sdk/lib/sys/testing:testing_sdk",
"//sdk/lib/syslog/structured_backend:structured_backend_sdk",
"//sdk/lib/trace",
"//sdk/lib/ui/scenic/cpp:cpp_sdk",
"//sdk/lib/ui/scenic/cpp/testing:testing_sdk",
"//sdk/lib/vfs/cpp:cpp_sdk",
"//sdk/lib/zbi-format:zbi-format_sdk",
"//src/devices/lib/mmio:mmio_sdk",
"//src/lib/fidl/cpp:cpp_sdk",
"//src/lib/fidl/cpp:hlcpp_conversion_sdk",
"//src/lib/fidl/cpp:natural_ostream_sdk",
"//src/lib/memory_barriers:memory_barriers_sdk",
"//zircon/system/ulib/async:async-cpp_sdk",
"//zircon/system/ulib/async:async_sdk",
"//zircon/system/ulib/async-loop:async-loop-cpp_sdk",
"//zircon/system/ulib/async-loop:async-loop_sdk",
"//zircon/system/ulib/async-testing:async-testing_sdk",
"//zircon/system/ulib/hwreg:hwreg_sdk_sdk",
"//zircon/system/ulib/inspect:inspect_sdk",
"//zircon/system/ulib/trace:trace_sdk",
]
}
sdk_molecule("core_sysroot") {
category = "partner"
deps = [ "//zircon/public/sysroot/sdk:sysroot_sdk" ]
}
# License/copyright files for the SDK.
sdk_molecule("core_licenses") {
category = "partner"
deps = [
":musl_license",
":open_source",
":sdk_notice",
]
}
#
# BEGIN @internal_sdk
# DO NOT ADD anything here! This will soon be removed.
# See https://fxbug.dev/333907106.
#
sdk_molecule("platform_fidls") {
visibility += [ ":platform" ]
category = "internal"
deps = [
"//sdk/fidl/fuchsia.bluetooth.host:fuchsia.bluetooth.host_sdk($fidl_toolchain)",
"//sdk/fidl/fuchsia.boot:fuchsia.boot_sdk($fidl_toolchain)",
"//sdk/fidl/fuchsia.buttons:fuchsia.buttons_sdk($fidl_toolchain)",
"//sdk/fidl/fuchsia.debugger:fuchsia.debugger_sdk($fidl_toolchain)",
"//sdk/fidl/fuchsia.device:fuchsia.device_sdk($fidl_toolchain)",
"//sdk/fidl/fuchsia.exception:fuchsia.exception_sdk($fidl_toolchain)",
"//sdk/fidl/fuchsia.hardware.adcimpl:fuchsia.hardware.adcimpl_sdk($fidl_toolchain)",
"//sdk/fidl/fuchsia.hardware.amlogiccanvas:fuchsia.hardware.amlogiccanvas_sdk($fidl_toolchain)",
"//sdk/fidl/fuchsia.hardware.backlight:fuchsia.hardware.backlight_sdk($fidl_toolchain)",
"//sdk/fidl/fuchsia.hardware.block:fuchsia.hardware.block_sdk($fidl_toolchain)",
"//sdk/fidl/fuchsia.hardware.block.driver:fuchsia.hardware.block.driver_sdk($fidl_toolchain)",
"//sdk/fidl/fuchsia.hardware.bluetooth:fuchsia.hardware.bluetooth_sdk($fidl_toolchain)",
"//sdk/fidl/fuchsia.hardware.clock:fuchsia.hardware.clock_sdk($fidl_toolchain)",
"//sdk/fidl/fuchsia.hardware.clockimpl:fuchsia.hardware.clockimpl_sdk($fidl_toolchain)",
"//sdk/fidl/fuchsia.hardware.cpu.ctrl:fuchsia.hardware.cpu.ctrl_sdk($fidl_toolchain)",
"//sdk/fidl/fuchsia.hardware.display:fuchsia.hardware.display_sdk($fidl_toolchain)",
"//sdk/fidl/fuchsia.hardware.ethernet.board:fuchsia.hardware.ethernet.board_sdk($fidl_toolchain)",
"//sdk/fidl/fuchsia.hardware.gpio:fuchsia.hardware.gpio_sdk($fidl_toolchain)",
"//sdk/fidl/fuchsia.hardware.gpioimpl:fuchsia.hardware.gpioimpl_sdk($fidl_toolchain)",
"//sdk/fidl/fuchsia.hardware.gpu.amlogic:fuchsia.hardware.gpu.amlogic_sdk($fidl_toolchain)",
"//sdk/fidl/fuchsia.hardware.gpu.mali:fuchsia.hardware.gpu.mali_sdk($fidl_toolchain)",
"//sdk/fidl/fuchsia.hardware.hrtimer:fuchsia.hardware.hrtimer_sdk($fidl_toolchain)",
"//sdk/fidl/fuchsia.hardware.i2c.businfo:fuchsia.hardware.i2c.businfo_sdk($fidl_toolchain)",
"//sdk/fidl/fuchsia.hardware.i2cimpl:fuchsia.hardware.i2cimpl_sdk($fidl_toolchain)",
"//sdk/fidl/fuchsia.hardware.network.driver:fuchsia.hardware.network.driver_sdk($fidl_toolchain)",
"//sdk/fidl/fuchsia.hardware.platform.bus:fuchsia.hardware.platform.bus_sdk($fidl_toolchain)",
"//sdk/fidl/fuchsia.hardware.platform.device:fuchsia.hardware.platform.device_sdk($fidl_toolchain)",
"//sdk/fidl/fuchsia.hardware.power:fuchsia.hardware.power_sdk($fidl_toolchain)",
"//sdk/fidl/fuchsia.hardware.powersource:fuchsia.hardware.powersource_sdk($fidl_toolchain)",
"//sdk/fidl/fuchsia.hardware.powersource.test:fuchsia.hardware.powersource.test_sdk($fidl_toolchain)",
"//sdk/fidl/fuchsia.hardware.pwm:fuchsia.hardware.pwm_sdk($fidl_toolchain)",
"//sdk/fidl/fuchsia.hardware.registers:fuchsia.hardware.registers_sdk($fidl_toolchain)",
"//sdk/fidl/fuchsia.hardware.sdio:fuchsia.hardware.sdio_sdk($fidl_toolchain)",
"//sdk/fidl/fuchsia.hardware.sdmmc:fuchsia.hardware.sdmmc_sdk($fidl_toolchain)",
"//sdk/fidl/fuchsia.hardware.serial:fuchsia.hardware.serial_sdk($fidl_toolchain)",
"//sdk/fidl/fuchsia.hardware.serialimpl:fuchsia.hardware.serialimpl_sdk($fidl_toolchain)",
"//sdk/fidl/fuchsia.hardware.spi:fuchsia.hardware.spi_sdk($fidl_toolchain)",
"//sdk/fidl/fuchsia.hardware.suspend:fuchsia.hardware.suspend_sdk($fidl_toolchain)",
"//sdk/fidl/fuchsia.hardware.sysmem:fuchsia.hardware.sysmem_sdk($fidl_toolchain)",
"//sdk/fidl/fuchsia.hardware.thermal:fuchsia.hardware.thermal_sdk($fidl_toolchain)",
"//sdk/fidl/fuchsia.hardware.usb.dci:fuchsia.hardware.usb.dci_sdk($fidl_toolchain)",
"//sdk/fidl/fuchsia.hardware.usb.hci:fuchsia.hardware.usb.hci_sdk($fidl_toolchain)",
"//sdk/fidl/fuchsia.hardware.usb.peripheral:fuchsia.hardware.usb.peripheral_sdk($fidl_toolchain)",
"//sdk/fidl/fuchsia.hardware.usb.phy:fuchsia.hardware.usb.phy_sdk($fidl_toolchain)",
"//sdk/fidl/fuchsia.hardware.vreg:fuchsia.hardware.vreg_sdk($fidl_toolchain)",
"//sdk/fidl/fuchsia.power.battery:fuchsia.power.battery_sdk($fidl_toolchain)",
"//sdk/fidl/fuchsia.power.broker:fuchsia.power.broker_sdk($fidl_toolchain)",
"//sdk/fidl/fuchsia.power.system:fuchsia.power.system_sdk($fidl_toolchain)",
"//sdk/fidl/fuchsia.scheduler:fuchsia.scheduler_sdk($fidl_toolchain)",
"//sdk/fidl/fuchsia.sys2:fuchsia.sys2_sdk($fidl_toolchain)",
"//sdk/fidl/fuchsia.test.manager:fuchsia.test.manager_sdk($fidl_toolchain)",
"//sdk/fidl/fuchsia.wlan.device:fuchsia.wlan.device_sdk($fidl_toolchain)",
"//sdk/fidl/fuchsia.wlan.fullmac:fuchsia.wlan.fullmac_sdk($fidl_toolchain)",
]
}
# This SDK molecule is a collection of libraries only available to the in-tree
# Bazel build. See //sdk:platform.
sdk_molecule("platform_libs") {
visibility += [ ":platform" ]
category = "internal"
deps = [
":version_history_sdk($default_toolchain)",
"//sdk/lib/driver/devicetree/manager:manager_sdk",
"//sdk/lib/driver/devicetree/testing:board-test-helper_sdk",
"//sdk/lib/driver/devicetree/visitors:driver-visitor_sdk",
"//sdk/lib/driver/devicetree/visitors:load-visitors_sdk",
"//sdk/lib/driver/devicetree/visitors:registration_sdk",
"//sdk/lib/driver/devicetree/visitors/default:default_sdk",
"//sdk/lib/driver/devicetree/visitors/drivers:all-driver-visitors_sdk",
"//src/devices/lib/mmio:test_helper_sdk",
"//src/devices/registers/testing/mock-registers:mock-registers_sdk",
"//src/devices/testing/fake-bti:fake-bti_sdk",
"//src/devices/testing/fake-mmio-reg:fake-mmio-reg_sdk",
"//src/devices/testing/mock-mmio-reg:mock-mmio-reg_sdk",
"//zircon/system/ulib/fzl:fzl_sdk",
]
}
# A collection of SDK atoms used to populate the @internal_sdk Bazel
# repository. Only used for the GN > Bazel migration of the build system.
# Content are bound to change a lot. Nothing else should rely on this.
# See https://fxrev.dev/737558 and https://fxbug.dev/42064359.
sdk_collection("platform") {
visibility += [ "//build/bazel/*" ]
category = "internal"
id = sdk_id
deps = [
":platform_fidls",
":platform_libs",
]
}
#
# END @internal_sdk
#
if (is_host) {
# A collection that only contains host tools that are used by the
# Fuchsia build system itself. In particular, this is where
# `ffx` will pick companion host tools when running in-tree.
sdk_collection("host_tools.internal") {
# This (sorta) restricts the use of this group to instances of the
# `ffx_action()` template, which uses the group below (which doesn't have
# visibility restrictions to have a dependency on this group.)
visibility = []
visibility = [ "//src/developer/ffx/build:internal_sdk_tools_for_ffx" ]
# Though ffx_action() depends on the manifest generated by this rule, this
# collection is not included in any SDK.
# TODO(https://fxbug.dev/317385989): Find a solution that doesn't depend on
# sdk_* templates.
category = "excluded"
id = sdk_id
# This is a collection of host tools that are used _by_ ffx itself to
# perform actions within the build. As such, it CANNOT have a dependency
# the main ffx binary, or any of the subtools, or it will cause all
# ffx_action()'s using subtools to be dependent on the compilation of the
# main ffx binary (and/or all subtools), adding minutes to any incremental
# build of an ffx subtool.
assert_no_deps = [
"//src/developer/ffx:bin_sdk",
"//src/developer/ffx:ffx_tool",
"//src/developer/ffx/frontends/ffx:ffx_bin($host_toolchain)",
]
deps = [
"//src/developer/debug/zxdb:zxdb_sdk",
"//src/storage/bin/fvm:fvm_sdk",
"//src/storage/blobfs/tools:blobfs_sdk",
"//src/storage/minfs/tools:minfs_sdk",
"//src/storage/tools/blobfs-compression:blobfs-compression_sdk",
"//src/sys/pkg/bin/far:bin_sdk",
"//src/sys/pkg/bin/pm:pm_bin_sdk",
"//tools/bootserver_old:bootserver_sdk",
"//tools/cmc:cmc_sdk",
"//tools/fidl/fidlc:fidl-format_sdk",
"//tools/fidl/fidlc:fidlc_sdk",
"//tools/fidl/fidlgen_hlcpp:fidlgen_hlcpp_sdk",
"//tools/fidlcat:fidlcat_sdk",
"//tools/net/device-finder:device-finder_sdk",
"//tools/symbolizer:sdk",
"//zircon/tools/merkleroot:merkleroot_sdk",
"//zircon/tools/zbi:zbi_sdk",
]
}
} # end if (is_host)
# Host tools necessary to build the IDK. Keep this minimal, so IDK subbuilds can
# start running as quickly as possible.
#
# This rule copies each of the tools listed below into
# `$root_build_dir/sdk/idk_build_tools`. For example, a tool like `cmc` will
# appear in `$root_build_dir/sdk/idk_build_tools/host_x64/cmc` on an x64 host.
# SDK subbuilds will look for host tools in that directory, so they will only
# have access to binaries that they explicitly depend on via this rule.
copy("idk_build_tools") {
visibility += [
"//build/*",
"//sdk/firmware:*",
"//vendor/*",
]
sources = [
"$host_out_dir/bindc",
"$host_out_dir/cmc",
"$host_out_dir/configc",
"$host_out_dir/far",
"$host_out_dir/ffx-package_unversioned",
"$host_out_dir/fidl-format",
"$host_out_dir/fidl-lint",
"$host_out_dir/fidl_api_diff",
"$host_out_dir/fidl_api_summarize",
"$host_out_dir/fidlc",
"$host_out_dir/fidlgen_cpp",
"$host_out_dir/fidlgen_hlcpp",
"$host_out_dir/fidlgen_rust",
"$host_out_dir/json_merge",
"$host_out_dir/measure-tape",
"$host_out_dir/package-tool",
"$host_out_dir/zither",
]
# Looks like `host_x64`.
_rebased_host_dir = rebase_path(host_out_dir, root_build_dir)
outputs = [ "$root_build_dir/sdk/idk_build_tools/${_rebased_host_dir}/{{source_file_part}}" ]
deps = [
"//build/tools/json_merge($host_toolchain)",
"//src/developer/ffx/plugins/package:ffx_package_tool($host_toolchain)",
"//src/sys/pkg/bin/far:bin($host_toolchain)",
"//src/sys/pkg/bin/package-tool($host_toolchain)",
"//tools/bindc:bin($host_toolchain)",
"//tools/cmc:cmc($host_toolchain)",
"//tools/configc:configc($host_toolchain)",
"//tools/fidl/fidl_api_diff($host_toolchain)",
"//tools/fidl/fidl_api_summarize($host_toolchain)",
"//tools/fidl/fidlc:fidl-format($host_toolchain)",
"//tools/fidl/fidlc:fidl-lint($host_toolchain)",
"//tools/fidl/fidlc($host_toolchain)",
"//tools/fidl/fidlgen_cpp($host_toolchain)",
"//tools/fidl/fidlgen_hlcpp($host_toolchain)",
"//tools/fidl/fidlgen_rust($host_toolchain)",
"//tools/fidl/measure-tape/src:measure-tape($host_toolchain)",
"//zircon/tools/zither($host_toolchain)",
]
}
# Controls the maximum number of simultaneous subbuilds.
pool("subbuild_pool") {
depth = sdk_max_simultaneous_sub_builds
}
# These markers are used to define dependencies on FIDL bindings
# so host tools can assert_no_deps to make sure all host tools
# in the SDK are only using FIDL libraries included in the SDK.
group("marker-cts") {
visibility += [ "*" ]
}
group("marker-excluded") {
visibility += [ "*" ]
}
group("marker-experimental") {
visibility += [ "*" ]
}
group("marker-internal") {
visibility += [ "*" ]
}
group("marker-unknown") {
visibility += [ "*" ]
}
group("marker-partner") {
visibility += [ "*" ]
}
group("marker-partner_internal") {
visibility += [ "*" ]
}
group("marker-public") {
visibility += [ "*" ]
}
# Marker for the allow list for use in a subtool.
group("marker-allowed-for-ffx-subtool") {
visibility += [ "*" ]
}
# Marker for the allow list for use in Lacewing.
group("marker-allowed-for-host-test") {
visibility += [ "*" ]
}