| # 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") |
| |
| # Collect the source files that are dependencies of the create_gn_rules.py |
| # script, below. Unfortunately, exec_script cannot use a depfile produced |
| # by the script and only supports a separately computed list of dependencies. |
| zircon_files = |
| exec_script("//build/zircon/list_source_files.py", [], "list lines") |
| |
| supporting_templates = [ |
| "//build/zircon/boards.mako", |
| "//build/zircon/header.mako", |
| "//build/zircon/host_tool.mako", |
| "//build/zircon/main.mako", |
| "//build/zircon/shared_library.mako", |
| "//build/zircon/source_library.mako", |
| "//build/zircon/static_library.mako", |
| "//build/zircon/sysroot.mako", |
| ] |
| |
| # The following script generates GN build files for Zircon objects. It is |
| # placed before everything else so that //zircon targets are available in |
| # due time. See //build/zircon/README.md for more details. |
| exec_script("//build/zircon/create_gn_rules.py", |
| [ |
| "--out", |
| rebase_path("//zircon/public"), |
| "--zircon-build", |
| rebase_path(zircon_root_build_dir), |
| "--zircon-manifest", |
| rebase_path("$zircon_root_build_dir/export/manifest-$target_cpu"), |
| ], |
| "", |
| zircon_files + supporting_templates) |
| |
| # 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) |
| |
| # Forwarding targets to things defined in //build/gn that are referred to by |
| # infrastructure. |
| # TODO(jamesr): Move definition from //build/gn to here after updating infra. |
| |
| # Permit dependencies on testonly targets from packages. |
| testonly = true |
| |
| group("default") { |
| public_deps = [ |
| "//build/gn:default", |
| ] |
| } |
| |
| group("host_tests") { |
| visibility = [] |
| public_deps = [ |
| "//build/gn:host_tests", |
| ] |
| } |
| |
| group("tests") { |
| public_deps = [ |
| "//build/gn:tests", |
| ] |
| } |
| |
| group("pseudo_tests") { |
| public_deps = [ |
| "//build/gn:pseudo_tests", |
| ] |
| } |
| |
| group("copy_host_tests") { |
| public_deps = [ |
| "//build/gn:copy_host_tests", |
| ] |
| } |
| |
| 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") |