| load("@bazel_skylib//rules:write_file.bzl", "write_file") | |
| load("//cc/toolchains:cc_toolchain.bzl", "cc_toolchain") | |
| load("//cc/toolchains:cc_toolchain_alias.bzl", "cc_toolchain_alias") | |
| load(":generated_tool_path_test.bzl", "generated_tool_cc_toolchain_config", "maybe_define_generated_tool_path_targets") | |
| package(default_visibility = ["//visibility:private"]) | |
| constraint_setting(name = "toolchain_selector") | |
| constraint_value( | |
| name = "use_test_toolchain", | |
| constraint_setting = ":toolchain_selector", | |
| ) | |
| platform( | |
| name = "test_platform", | |
| constraint_values = [":use_test_toolchain"], | |
| ) | |
| filegroup(name = "empty") | |
| # A compiler wrapper generated by the build, as used by e.g. the Apple C++ toolchain. | |
| write_file( | |
| name = "gcc", | |
| out = "gcc.sh", | |
| content = [ | |
| "#!/bin/sh", | |
| "exit 0", | |
| ], | |
| is_executable = True, | |
| ) | |
| generated_tool_cc_toolchain_config( | |
| name = "config", | |
| gcc = ":gcc", | |
| ) | |
| cc_toolchain( | |
| name = "cc_toolchain", | |
| all_files = ":gcc", | |
| ar_files = ":empty", | |
| as_files = ":empty", | |
| compiler_files = ":gcc", | |
| dwp_files = ":empty", | |
| linker_files = ":empty", | |
| objcopy_files = ":empty", | |
| strip_files = ":empty", | |
| toolchain_config = ":config", | |
| toolchain_identifier = "generated-tool-path-test", | |
| ) | |
| toolchain( | |
| name = "cc_toolchain_registration", | |
| target_compatible_with = [":use_test_toolchain"], | |
| toolchain = ":cc_toolchain", | |
| toolchain_type = "//cc:toolchain_type", | |
| ) | |
| cc_toolchain_alias(name = "current_cc_toolchain") | |
| maybe_define_generated_tool_path_targets() |