| # Copyright 2019 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. |
| |
| import("//build/config/fuchsia/zircon.gni") |
| import("//build/testing/platforms.gni") |
| |
| declare_args() { |
| # If you add package labels to this variable, the packages will be included in |
| # the 'base' package set, which represents the set of packages that are part |
| # of an OTA. These pacakages are updated as an atomic unit during an OTA |
| # process and are immutable and are a superset of the TCB (Trusted Computing |
| # Base) for a product. These packages are never evicted by the system. |
| base_package_labels = [] |
| |
| # If you add package labels to this variable, the packages will be included |
| # in the 'cache' package set, which represents an additional set of software |
| # that is made available on disk immediately after paving and in factory |
| # flows. These packages are not updated with an OTA, but instead are updated |
| # ephemerally. This cache of software can be evicted by the system if storage |
| # pressure arises or other policies indicate. |
| cache_package_labels = [] |
| |
| # If you add package labels to this variable, the packages will be included |
| # in the 'universe' package set, which represents all software that is |
| # produced that is to be published to a package repository or to the SDK by |
| # the build. The build system ensures that the universe package set includes |
| # the base and cache package sets, which means you do not need to redundantly |
| # include those labels in this variable. |
| universe_package_labels = [] |
| |
| # A list of package labels to include in the 'base' package set. Used by the |
| # board definition rather than the product definition. |
| board_package_labels = [] |
| |
| # Does nothing. |
| # |
| # Will be removed after 30 April 2019. |
| allow_layer_guesswork = false |
| board_packages = [] |
| } |
| |
| # Write a file that can be sourced by `fx`. This file is produced |
| # by `gn gen` and is not known to Ninja at all, so it has nothing to |
| # do with the build itself. Its sole purpose is to leave bread |
| # crumbs about the settings `gn gen` used for `fx` to use later. |
| _relative_build_dir = rebase_path(root_build_dir, "//", "//") |
| _fx_config_lines = [ |
| "# Generated by `gn gen`.", |
| "FUCHSIA_BUILD_DIR='${_relative_build_dir}'", |
| "FUCHSIA_ARCH='${target_cpu}'", |
| ] |
| write_file("$root_build_dir/fx.config", _fx_config_lines) |
| |
| # This file indicates what Ninja invocation must be done to build Zircon |
| # prerequisites before *any* Ninja invocation for this build. |
| write_file("$root_build_dir/zircon.json", |
| { |
| dir = rebase_path(zircon_root_build_dir, root_build_dir) |
| targets = [ "legacy-$target_cpu" ] |
| }, |
| "json") |
| |
| # Permit dependencies on testonly targets from packages. |
| testonly = true |
| |
| group("default") { |
| deps = [ |
| "//build/images:packages", |
| "//sdk", |
| ":build_time_checks", |
| ] |
| if (base_package_labels != [] || cache_package_labels != []) { |
| deps += [ "//build/images" ] |
| } |
| if (universe_package_labels != []) { |
| deps += [ "//build/images:updates" ] |
| } |
| } |
| |
| group("build_time_checks") { |
| deps = [ |
| "//tools/fidlgen_llcpp_zircon:validate", |
| ] |
| } |
| |
| group("recovery_image") { |
| deps = [ |
| "build/images/recovery", |
| ] |
| } |
| |
| # TODO(joshuaseaton|mcgrathr): Make this a formal build_api_module. |
| # |
| # Aggregates metadata about all tests within the build graph to create a |
| # top-level manifest. |
| generated_file("tests") { |
| outputs = [ |
| "$root_build_dir/tests.json", |
| ] |
| data_keys = [ "test_spec" ] |
| output_conversion = "json" |
| deps = [ |
| "//build/images:packages", |
| "//sdk", |
| ] |
| } |
| |
| # Aggregates metadata about all fuzz targets within the build graph to create a |
| # top-level manifest. |
| generated_file("fuzzers") { |
| outputs = [ |
| "$root_build_dir/fuzzers.json", |
| ] |
| data_keys = [ "fuzz_spec" ] |
| output_conversion = "json" |
| deps = [ |
| "//build/images:packages", |
| ] |
| } |
| |
| group("breakpad_symbols") { |
| public_deps = [ |
| "//build/gn:breakpad_symbols", |
| ] |
| } |
| |
| group("package_archive") { |
| public_deps = [ |
| "//build/gn:package_archive", |
| ] |
| } |
| |
| # Generates a JSON manifest of the platforms available for testing, along with |
| # their properties. |
| target_platforms = [] |
| foreach(platform, test_platforms) { |
| if (!defined(platform.cpu) || platform.cpu == current_cpu) { |
| target_platforms += [ platform ] |
| } |
| } |
| write_file("$root_build_dir/platforms.json", target_platforms, "json") |
| |
| # These groups exist at the root of the build so relative labels specified |
| # through GN args are interpreted as if they were absolute. |
| group("additional_base_packages") { |
| testonly = true |
| visibility = [ "//build/images:monolith_packages" ] |
| public_deps = base_package_labels + board_package_labels |
| } |
| |
| group("additional_cache_packages") { |
| testonly = true |
| visibility = [ "//build/images:preinstall_packages" ] |
| public_deps = cache_package_labels |
| } |
| |
| group("additional_universe_packages") { |
| testonly = true |
| visibility = [ "//build/images:available_packages" ] |
| public_deps = universe_package_labels |
| } |