| # Copyright 2022 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/bazel/remote_services.gni") |
| import("//build/toolchain/rbe.gni") |
| import("//build/toolchain/rbe_modes.gni") |
| |
| import("//build/python/python_host_test.gni") |
| import("//build/python/python_library.gni") |
| |
| # TODO(https://fxbug.dev/342258577): Re-enable mypy type checking after fixing |
| # type errors on the disabled python_library and python_host_test targets. |
| group("tests") { |
| testonly = true |
| |
| deps = [ |
| ":bbtool_test($host_toolchain)", |
| ":build_summary_test($host_toolchain)", |
| ":cl_utils_test($host_toolchain)", |
| ":cxx_link_remote_wrapper_test($host_toolchain)", |
| ":cxx_remote_wrapper_test($host_toolchain)", |
| ":cxx_test($host_toolchain)", |
| ":depfile_test($host_toolchain)", |
| ":dlwrap_test($host_toolchain)", |
| ":fuchsia_test($host_toolchain)", |
| ":linker_test($host_toolchain)", |
| ":output_leak_scanner_test($host_toolchain)", |
| ":prebuilt_tool_remote_wrapper_test($host_toolchain)", |
| ":relativize_args_test($host_toolchain)", |
| ":remote_action_test($host_toolchain)", |
| ":remotetool_test($host_toolchain)", |
| ":rustc_remote_wrapper_test($host_toolchain)", |
| ":rustc_test($host_toolchain)", |
| ":tablefmt_test($host_toolchain)", |
| ":textpb_test($host_toolchain)", |
| ] |
| } |
| |
| if (is_host) { |
| # TODO: python_library() doesn't work with the current source structure. |
| # It wants one __init__.py per library with one library per directory. |
| # As a workaround, we expand lists of sources instead of a proper |
| # dependency tree of libraries. :( |
| _fuchsia_sources = [ "fuchsia.py" ] |
| _cl_utils_sources = [ "cl_utils.py" ] |
| _depfile_sources = [ "depfile.py" ] |
| _output_leak_scanner_sources = |
| [ "output_leak_scanner.py" ] + _fuchsia_sources + _cl_utils_sources |
| _linker_sources = [ "linker.py" ] + _cl_utils_sources + _depfile_sources |
| _tablefmt_sources = [ "tablefmt.py" ] |
| _textpb_sources = [ "textpb.py" ] |
| |
| _bbtool_sources = [ "bbtool.py" ] + _fuchsia_sources + _cl_utils_sources |
| _build_summary_sources = |
| [ "build_summary.py" ] + _tablefmt_sources + _textpb_sources |
| _remotetool_sources = |
| [ "remotetool.py" ] + _fuchsia_sources + _cl_utils_sources |
| _remote_action_sources = |
| [ "remote_action.py" ] + _fuchsia_sources + _cl_utils_sources + |
| [ "output_leak_scanner.py" ] + _depfile_sources + _textpb_sources + |
| [ "remotetool.py" ] |
| _dlwrap_sources = [ "dlwrap.py" ] + _remote_action_sources |
| _cxx_sources = [ "cxx.py" ] + _cl_utils_sources |
| _cxx_link_remote_wrapper_sources = |
| [ "cxx_link_remote_wrapper.py" ] + _cxx_sources + _fuchsia_sources + |
| _linker_sources + _remote_action_sources |
| _cxx_remote_wrapper_sources = |
| [ "cxx_remote_wrapper.py" ] + _cxx_sources + _fuchsia_sources + |
| _cl_utils_sources + _remote_action_sources |
| _rustc_sources = [ "rustc.py" ] + _cl_utils_sources |
| _rustc_remote_wrapper_sources = |
| [ "rustc_remote_wrapper.py" ] + _rustc_sources + _remote_action_sources + |
| _fuchsia_sources + _cl_utils_sources + _linker_sources |
| _prebuilt_tool_remote_wrapper_sources = |
| [ "prebuilt_tool_remote_wrapper.py" ] + _fuchsia_sources + |
| _cl_utils_sources + _remote_action_sources |
| |
| # TODO(b/347995021): fix/workaround mypy test failure on os.setxattr |
| _enable_remote_action_tests = host_os != "mac" |
| |
| python_library("bbtool") { |
| sources = _bbtool_sources |
| } |
| python_host_test("bbtool_test") { |
| main_source = "bbtool_test.py" |
| sources = _bbtool_sources |
| } |
| |
| python_library("build_summary") { |
| sources = _build_summary_sources |
| } |
| python_host_test("build_summary_test") { |
| main_source = "build_summary_test.py" |
| sources = _build_summary_sources |
| } |
| |
| python_library("cl_utils") { |
| sources = _cl_utils_sources |
| } |
| python_host_test("cl_utils_test") { |
| main_source = "cl_utils_test.py" |
| sources = _cl_utils_sources |
| } |
| |
| python_library("cxx") { |
| sources = _cxx_sources |
| } |
| python_host_test("cxx_test") { |
| main_source = "cxx_test.py" |
| sources = _cxx_sources |
| } |
| |
| python_library("cxx_link_remote_wrapper") { |
| sources = _cxx_link_remote_wrapper_sources |
| } |
| python_host_test("cxx_link_remote_wrapper_test") { |
| enable_mypy = _enable_remote_action_tests |
| main_source = "cxx_link_remote_wrapper_test.py" |
| sources = _cxx_link_remote_wrapper_sources |
| } |
| |
| python_library("cxx_remote_wrapper") { |
| sources = _cxx_remote_wrapper_sources |
| } |
| python_host_test("cxx_remote_wrapper_test") { |
| enable_mypy = _enable_remote_action_tests |
| main_source = "cxx_remote_wrapper_test.py" |
| sources = _cxx_remote_wrapper_sources |
| } |
| |
| python_library("depfile") { |
| sources = _depfile_sources |
| } |
| python_host_test("depfile_test") { |
| main_source = "depfile_test.py" |
| sources = _depfile_sources |
| } |
| |
| python_library("dlwrap") { |
| sources = _dlwrap_sources |
| } |
| python_host_test("dlwrap_test") { |
| enable_mypy = _enable_remote_action_tests |
| main_source = "dlwrap_test.py" |
| sources = _dlwrap_sources |
| } |
| |
| python_library("fuchsia") { |
| sources = _fuchsia_sources |
| } |
| python_host_test("fuchsia_test") { |
| main_source = "fuchsia_test.py" |
| sources = _fuchsia_sources |
| } |
| |
| python_library("linker") { |
| sources = _linker_sources |
| } |
| python_host_test("linker_test") { |
| main_source = "linker_test.py" |
| sources = _linker_sources |
| } |
| |
| python_library("output_leak_scanner") { |
| sources = _output_leak_scanner_sources |
| } |
| python_host_test("output_leak_scanner_test") { |
| main_source = "output_leak_scanner_test.py" |
| sources = _output_leak_scanner_sources |
| } |
| |
| python_library("prebuilt_tool_remote_wrapper") { |
| sources = _prebuilt_tool_remote_wrapper_sources |
| } |
| python_host_test("prebuilt_tool_remote_wrapper_test") { |
| enable_mypy = _enable_remote_action_tests |
| main_source = "prebuilt_tool_remote_wrapper_test.py" |
| sources = _prebuilt_tool_remote_wrapper_sources |
| } |
| |
| python_library("relativize_args") { |
| sources = [ "relativize_args.py" ] |
| } |
| python_host_test("relativize_args_test") { |
| main_source = "relativize_args_test.py" |
| sources = [ "relativize_args.py" ] |
| } |
| |
| python_library("remote_action") { |
| sources = _remote_action_sources |
| } |
| python_host_test("remote_action_test") { |
| enable_mypy = _enable_remote_action_tests |
| main_source = "remote_action_test.py" |
| sources = _remote_action_sources |
| } |
| |
| python_library("remotetool") { |
| sources = _remotetool_sources |
| } |
| python_host_test("remotetool_test") { |
| main_source = "remotetool_test.py" |
| sources = _remotetool_sources |
| } |
| |
| python_library("rustc") { |
| sources = _rustc_sources |
| } |
| python_host_test("rustc_test") { |
| main_source = "rustc_test.py" |
| sources = _rustc_sources |
| } |
| |
| python_library("rustc_remote_wrapper") { |
| sources = _rustc_remote_wrapper_sources |
| } |
| python_host_test("rustc_remote_wrapper_test") { |
| enable_mypy = _enable_remote_action_tests |
| main_source = "rustc_remote_wrapper_test.py" |
| sources = _rustc_remote_wrapper_sources |
| } |
| |
| python_library("tablefmt") { |
| sources = _tablefmt_sources |
| } |
| python_host_test("tablefmt_test") { |
| main_source = "tablefmt_test.py" |
| sources = _tablefmt_sources |
| } |
| |
| python_library("textpb") { |
| sources = _textpb_sources |
| } |
| python_host_test("textpb_test") { |
| main_source = "textpb_test.py" |
| sources = _textpb_sources |
| } |
| } |
| |
| if (current_toolchain == default_toolchain) { |
| # List all of the RBE related settings after modes have been applied |
| # and resolved. |
| # TODO(b/346845227): the final override and source-of-truth still lies |
| # with the global variables, but this will eventually migrate to using |
| # the corresponding variables in the `rbe_settings` scope. |
| generated_file("rbe_settings.json") { |
| contents = { |
| mode = rbe_mode |
| settings = rbe_settings |
| final = { |
| # after considering top-level overrides |
| bazel_enable = enable_bazel_remote_rbe |
| |
| # LINT.IfChange |
| bazel_download_outputs = bazel_rbe_download_outputs |
| |
| # LINT.ThenChange(//build/regenerator.py) |
| cxx_download_objects = cxx_rbe_download_obj_files |
| cxx_enable = cxx_rbe_enable |
| cxx_exec_strategy = cxx_rbe_exec_strategy |
| cxx_minimalist_wrapper = cxx_rbe_minimalist_wrapper |
| link_download_unstripped_outputs = link_rbe_download_unstripped_outputs |
| link_enable = link_rbe_enable |
| link_exec_strategy = link_rbe_exec_strategy |
| rust_download_rlibs = rust_rbe_download_rlibs |
| rust_download_unstripped_binaries = |
| rust_rbe_download_unstripped_binaries |
| rust_enable = rust_rbe_enable |
| rust_exec_strategy = rust_rbe_exec_strategy |
| |
| # derived values: |
| |
| # The following is used by lib/vars.sh to auto-startup reproxy. |
| needs_reproxy = cxx_enable || link_enable || rust_enable |
| |
| # Set the following to true if any remote build service is used. |
| needs_auth = |
| needs_reproxy || bazel_enable || bazel_upload_build_events != "" |
| } |
| } |
| output_conversion = "json" |
| outputs = [ "$root_build_dir/rbe_settings.json" ] |
| } |
| } |