Introduce --incompatible_disable_crosstool_file flag.
Issue #5380
RELNOTES: Added --incompatible_disable_crosstool_file (https://github.com/bazelbuild/bazel/issues/7320)
PiperOrigin-RevId: 232264088
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainProviderHelper.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainProviderHelper.java
index dc1f4de..3924691 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainProviderHelper.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainProviderHelper.java
@@ -405,6 +405,12 @@
SkyKey ccSupportKey = null;
CToolchain toolchain = null;
+ if (cppConfiguration.disableCrosstool() && attributes.getCcToolchainConfigInfo() == null) {
+ ruleContext.ruleError(
+ "cc_toolchain.toolchain_config attribute must be specified. See "
+ + "https://github.com/bazelbuild/bazel/issues/7320 for details.");
+ }
+
if (cppConfiguration.enableCcToolchainConfigInfoFromSkylark()
&& attributes.getCcToolchainConfigInfo() != null) {
if (fdoZip != null) {
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java
index af4c80e..925a1ea 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java
@@ -605,4 +605,8 @@
public boolean enableLegacyCcProvider() {
return !cppOptions.disableLegacyCcProvider;
}
+
+ public boolean disableCrosstool() {
+ return cppOptions.disableCrosstool;
+ }
}
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppOptions.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppOptions.java
index 4b2198f..8140a76 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppOptions.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppOptions.java
@@ -782,6 +782,22 @@
public boolean enableCcToolchainConfigInfoFromSkylark;
@Option(
+ name = "incompatible_disable_crosstool_file",
+ defaultValue = "false",
+ documentationCategory = OptionDocumentationCategory.TOOLCHAIN,
+ effectTags = {OptionEffectTag.LOADING_AND_ANALYSIS},
+ metadataTags = {
+ OptionMetadataTag.TRIGGERED_BY_ALL_INCOMPATIBLE_CHANGES,
+ OptionMetadataTag.INCOMPATIBLE_CHANGE
+ },
+ help =
+ "If true, Bazel will not allow using the CROSSTOOL file for cc toolchain"
+ + " configuration. Instead, cc_toolchain should have a toolchain_config attribute"
+ + " that points to a rule written in Starlark that provides a CcToolchainConfigInfo"
+ + " provider. See https://github.com/bazelbuild/bazel/issues/7320 for more info.")
+ public boolean disableCrosstool;
+
+ @Option(
name = "experimental_includes_attribute_subpackage_traversal",
defaultValue = "true",
documentationCategory = OptionDocumentationCategory.UNDOCUMENTED,
@@ -908,6 +924,7 @@
host.disableLegacyCcProvider = disableLegacyCcProvider;
host.removeCpuCompilerCcToolchainAttributes = removeCpuCompilerCcToolchainAttributes;
host.disableLegacyCrosstoolFields = disableLegacyCrosstoolFields;
+ host.disableCrosstool = disableCrosstool;
host.enableCcToolchainResolution = enableCcToolchainResolution;
return host;
}
diff --git a/tools/cpp/BUILD b/tools/cpp/BUILD
index 20224eb..8644c36 100644
--- a/tools/cpp/BUILD
+++ b/tools/cpp/BUILD
@@ -16,6 +16,8 @@
licenses(["notice"]) # Apache 2.0
+load(":cc_toolchain_config.bzl", "cc_toolchain_config")
+
# The toolchain type used to distinguish cc toolchains.
toolchain_type(name = "toolchain_type")
@@ -120,9 +122,16 @@
static_runtime_libs = [":empty"],
strip_files = ":empty",
supports_param_files = 1,
+ toolchain_config = ":local_linux",
toolchain_identifier = "local_linux",
)
+cc_toolchain_config(
+ name = "local_linux",
+ compiler = "compiler",
+ cpu = "local",
+)
+
toolchain(
name = "cc-toolchain-local",
exec_compatible_with = [
@@ -147,6 +156,7 @@
static_runtime_libs = [":empty"],
strip_files = ":empty",
supports_param_files = 1,
+ toolchain_config = ":local_linux",
toolchain_identifier = "local_linux",
)
@@ -176,6 +186,7 @@
static_runtime_libs = [":empty"],
strip_files = ":empty",
supports_param_files = 1,
+ toolchain_config = ":local_linux",
toolchain_identifier = "local_linux",
)
@@ -205,6 +216,7 @@
static_runtime_libs = [":empty"],
strip_files = ":empty",
supports_param_files = 1,
+ toolchain_config = ":local_linux",
toolchain_identifier = "local_linux",
)
@@ -236,9 +248,16 @@
static_runtime_libs = [":empty"],
strip_files = ":empty",
supports_param_files = 0,
+ toolchain_config = ":local_darwin",
toolchain_identifier = "local_darwin",
)
+cc_toolchain_config(
+ name = "local_darwin",
+ compiler = "compiler",
+ cpu = "darwin",
+)
+
toolchain(
name = "cc-toolchain-darwin",
exec_compatible_with = [
@@ -267,9 +286,16 @@
static_runtime_libs = [":empty"],
strip_files = ":empty",
supports_param_files = 0,
+ toolchain_config = ":local_freebsd",
toolchain_identifier = "local_freebsd",
)
+cc_toolchain_config(
+ name = "local_freebsd",
+ compiler = "compiler",
+ cpu = "freebsd",
+)
+
toolchain(
name = "cc-toolchain-freebsd",
exec_compatible_with = [
@@ -298,9 +324,16 @@
static_runtime_libs = [":empty"],
strip_files = ":empty",
supports_param_files = 0,
+ toolchain_config = ":local_windows_msys64",
toolchain_identifier = "local_windows_msys64",
)
+cc_toolchain_config(
+ name = "local_windows_msys64",
+ compiler = "windows_msys64",
+ cpu = "x64_windows",
+)
+
toolchain(
name = "cc-toolchain-x64_windows",
exec_compatible_with = [
@@ -329,9 +362,16 @@
static_runtime_libs = [":empty"],
strip_files = ":empty",
supports_param_files = 1,
+ toolchain_config = ":vc_14_0_x64",
toolchain_identifier = "vc_14_0_x64",
)
+cc_toolchain_config(
+ name = "vc_14_0_x64",
+ compiler = "cl",
+ cpu = "x64_windows_msvc",
+)
+
toolchain(
name = "cc-toolchain-x64_windows_msvc",
exec_compatible_with = [
diff --git a/tools/cpp/BUILD.empty b/tools/cpp/BUILD.empty
index 2984663..577f0b8 100644
--- a/tools/cpp/BUILD.empty
+++ b/tools/cpp/BUILD.empty
@@ -14,6 +14,8 @@
package(default_visibility = ["//visibility:public"])
+load("@bazel_tools//tools/cpp:cc_toolchain_config.bzl", "cc_toolchain_config")
+
cc_library(
name = "malloc",
)
@@ -34,6 +36,7 @@
cc_toolchain(
name = "local",
toolchain_identifier = "local",
+ toolchain_config = ":local_config",
all_files = ":empty",
ar_files = ":empty",
as_files = ":empty",
@@ -43,3 +46,9 @@
objcopy_files = ":empty",
strip_files = ":empty",
)
+
+cc_toolchain_config(
+ name = "local_config",
+ cpu = "local",
+ compiler = "compiler",
+)
diff --git a/tools/cpp/BUILD.static.freebsd b/tools/cpp/BUILD.static.freebsd
index fc383ce..5dd2a8e 100644
--- a/tools/cpp/BUILD.static.freebsd
+++ b/tools/cpp/BUILD.static.freebsd
@@ -16,6 +16,8 @@
package(default_visibility = ["//visibility:public"])
+load("@bazel_tools//tools/cpp:cc_toolchain_config.bzl", "cc_toolchain_config")
+
cc_library(
name = "malloc",
)
@@ -39,6 +41,7 @@
cc_toolchain(
name = "cc-compiler-freebsd",
toolchain_identifier = "local_freebsd",
+ toolchain_config = ":local_freebsd",
all_files = ":empty",
ar_files = ":empty",
as_files = ":empty",
@@ -50,6 +53,12 @@
supports_param_files = 0,
)
+cc_toolchain_config(
+ name = "local_freebsd",
+ cpu = "freebsd",
+ compiler = "compiler",
+)
+
toolchain(
name = "cc-toolchain-freebsd",
exec_compatible_with = [
@@ -67,6 +76,7 @@
cc_toolchain(
name = "cc-compiler-armeabi-v7a",
toolchain_identifier = "stub_armeabi-v7a",
+ toolchain_config = ":stub_armeabi-v7a",
all_files = ":empty",
ar_files = ":empty",
as_files = ":empty",
@@ -78,6 +88,12 @@
supports_param_files = 0,
)
+cc_toolchain_config(
+ name = "stub_armeabi-v7a",
+ cpu = "armeabi-v7a",
+ compiler = "compiler",
+)
+
toolchain(
name = "cc-toolchain-armeabi-v7a",
exec_compatible_with = [
diff --git a/tools/cpp/BUILD.static.windows b/tools/cpp/BUILD.static.windows
index 986799c..749e2fb 100644
--- a/tools/cpp/BUILD.static.windows
+++ b/tools/cpp/BUILD.static.windows
@@ -16,6 +16,8 @@
package(default_visibility = ["//visibility:public"])
+load(":cc_toolchain_config.bzl", "cc_toolchain_config")
+
cc_library(
name = "malloc",
)
@@ -42,6 +44,7 @@
cc_toolchain(
name = "cc-compiler-x64_windows_msys",
toolchain_identifier = "msys_x64",
+ toolchain_config = ":msys_x64",
all_files = ":empty",
ar_files = ":empty",
as_files = ":empty",
@@ -53,6 +56,12 @@
supports_param_files = 1,
)
+cc_toolchain_config(
+ name = "msys_x64",
+ cpu = "x64_windows",
+ compiler = "msys-gcc",
+)
+
toolchain(
name = "cc-toolchain-x64_windows_msys",
exec_compatible_with = [
@@ -71,6 +80,7 @@
cc_toolchain(
name = "cc-compiler-x64_windows_mingw",
toolchain_identifier = "msys_x64_mingw",
+ toolchain_config = ":msys_x64_mingw",
all_files = ":empty",
ar_files = ":empty",
as_files = ":empty",
@@ -82,6 +92,12 @@
supports_param_files = 0,
)
+cc_toolchain_config(
+ name = "msys_x64_mingw",
+ cpu = "x64_windows",
+ compiler = "mingw-gcc",
+)
+
toolchain(
name = "cc-toolchain-x64_windows_mingw",
exec_compatible_with = [
@@ -100,6 +116,7 @@
cc_toolchain(
name = "cc-compiler-x64_windows",
toolchain_identifier = "msvc_x64",
+ toolchain_config = ":msvc_x64",
all_files = ":empty",
ar_files = ":empty",
as_files = ":empty",
@@ -111,6 +128,12 @@
supports_param_files = 1,
)
+cc_toolchain_config(
+ name = "msvc_x64",
+ cpu = "x64_windows",
+ compiler = "msvc-cl",
+)
+
toolchain(
name = "cc-toolchain-x64_windows",
exec_compatible_with = [
@@ -128,6 +151,7 @@
cc_toolchain(
name = "cc-compiler-armeabi-v7a",
toolchain_identifier = "stub_armeabi-v7a",
+ toolchain_config = ":stub_armeabi-v7a",
all_files = ":empty",
ar_files = ":empty",
as_files = ":empty",
@@ -139,6 +163,12 @@
supports_param_files = 1,
)
+cc_toolchain_config(
+ name = "stub_armeabi-v7a",
+ cpu = "armeabi-v7a",
+ compiler = "compiler",
+)
+
toolchain(
name = "cc-toolchain-armeabi-v7a",
exec_compatible_with = [
diff --git a/tools/cpp/BUILD.tpl b/tools/cpp/BUILD.tpl
index 2a1bba1..ee9fd3d 100644
--- a/tools/cpp/BUILD.tpl
+++ b/tools/cpp/BUILD.tpl
@@ -16,6 +16,8 @@
package(default_visibility = ["//visibility:public"])
+load(":cc_toolchain_config.bzl", "cc_toolchain_config")
+
licenses(["notice"]) # Apache 2.0
cc_library(
@@ -53,6 +55,7 @@
cc_toolchain(
name = "cc-compiler-%{name}",
toolchain_identifier = "%{cc_toolchain_identifier}",
+ toolchain_config = ":%{cc_toolchain_identifier}",
all_files = ":compiler_deps",
ar_files = ":empty",
as_files = ":empty",
@@ -64,6 +67,12 @@
supports_param_files = %{supports_param_files},
)
+cc_toolchain_config(
+ name = "%{cc_toolchain_identifier}",
+ cpu = "%{target_cpu}",
+ compiler = "%{compiler}",
+)
+
toolchain(
name = "cc-toolchain-%{name}",
exec_compatible_with = [
@@ -80,6 +89,7 @@
cc_toolchain(
name = "cc-compiler-armeabi-v7a",
toolchain_identifier = "stub_armeabi-v7a",
+ toolchain_config = ":stub_armeabi-v7a",
all_files = ":empty",
ar_files = ":empty",
as_files = ":empty",
@@ -91,6 +101,12 @@
supports_param_files = 1,
)
+cc_toolchain_config(
+ name = "stub_armeabi-v7a",
+ cpu = "armeabi-v7a",
+ compiler = "compiler",
+)
+
toolchain(
name = "cc-toolchain-armeabi-v7a",
exec_compatible_with = [
diff --git a/tools/cpp/cc_configure.bzl b/tools/cpp/cc_configure.bzl
index abcd07a..9d30b42 100644
--- a/tools/cpp/cc_configure.bzl
+++ b/tools/cpp/cc_configure.bzl
@@ -25,7 +25,7 @@
def cc_autoconf_impl(repository_ctx, overriden_tools = dict()):
paths = resolve_labels(repository_ctx, [
"@bazel_tools//tools/cpp:BUILD.static.freebsd",
- "@bazel_tools//tools/cpp:CROSSTOOL",
+ "@bazel_tools//tools/cpp:cc_toolchain_config.bzl",
"@bazel_tools//tools/cpp:dummy_toolchain.bzl",
])
@@ -33,17 +33,18 @@
paths["@bazel_tools//tools/cpp:dummy_toolchain.bzl"],
"dummy_toolchain.bzl",
)
+
env = repository_ctx.os.environ
cpu_value = get_cpu_value(repository_ctx)
if "BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN" in env and env["BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN"] == "1":
- repository_ctx.symlink(Label("@bazel_tools//tools/cpp:CROSSTOOL.empty"), "CROSSTOOL")
+ repository_ctx.symlink(paths["@bazel_tools//tools/cpp:cc_toolchain_config.bzl"], "cc_toolchain_config.bzl")
repository_ctx.symlink(Label("@bazel_tools//tools/cpp:BUILD.empty"), "BUILD")
elif cpu_value == "freebsd":
# This is defaulting to the static crosstool, we should eventually
# autoconfigure this platform too. Theorically, FreeBSD should be
# straightforward to add but we cannot run it in a docker container so
# skipping until we have proper tests for FreeBSD.
- repository_ctx.symlink(paths["@bazel_tools//tools/cpp:CROSSTOOL"], "CROSSTOOL")
+ repository_ctx.symlink(paths["@bazel_tools//tools/cpp:cc_toolchain_config.bzl"], "cc_toolchain_config.bzl")
repository_ctx.symlink(paths["@bazel_tools//tools/cpp:BUILD.static.freebsd"], "BUILD")
elif cpu_value == "x64_windows":
# TODO(ibiryukov): overriden_tools are only supported in configure_unix_toolchain.
diff --git a/tools/cpp/cc_toolchain_config.bzl b/tools/cpp/cc_toolchain_config.bzl
new file mode 100644
index 0000000..f043a28
--- /dev/null
+++ b/tools/cpp/cc_toolchain_config.bzl
@@ -0,0 +1,1486 @@
+# Copyright 2019 The Bazel Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""A Starlark cc_toolchain configuration rule"""
+
+load(
+ "@bazel_tools//tools/cpp:cc_toolchain_config_lib.bzl",
+ "action_config",
+ "artifact_name_pattern",
+ "env_entry",
+ "env_set",
+ "feature",
+ "feature_set",
+ "flag_group",
+ "flag_set",
+ "make_variable",
+ "tool",
+ "tool_path",
+ "variable_with_value",
+ "with_feature_set",
+)
+load(
+ "@bazel_tools//tools/build_defs/cc:action_names.bzl",
+ _ASSEMBLE_ACTION_NAME = "ASSEMBLE_ACTION_NAME",
+ _CLIF_MATCH_ACTION_NAME = "CLIF_MATCH_ACTION_NAME",
+ _CPP_COMPILE_ACTION_NAME = "CPP_COMPILE_ACTION_NAME",
+ _CPP_HEADER_PARSING_ACTION_NAME = "CPP_HEADER_PARSING_ACTION_NAME",
+ _CPP_LINK_DYNAMIC_LIBRARY_ACTION_NAME = "CPP_LINK_DYNAMIC_LIBRARY_ACTION_NAME",
+ _CPP_LINK_EXECUTABLE_ACTION_NAME = "CPP_LINK_EXECUTABLE_ACTION_NAME",
+ _CPP_LINK_NODEPS_DYNAMIC_LIBRARY_ACTION_NAME = "CPP_LINK_NODEPS_DYNAMIC_LIBRARY_ACTION_NAME",
+ _CPP_LINK_STATIC_LIBRARY_ACTION_NAME = "CPP_LINK_STATIC_LIBRARY_ACTION_NAME",
+ _CPP_MODULE_CODEGEN_ACTION_NAME = "CPP_MODULE_CODEGEN_ACTION_NAME",
+ _CPP_MODULE_COMPILE_ACTION_NAME = "CPP_MODULE_COMPILE_ACTION_NAME",
+ _C_COMPILE_ACTION_NAME = "C_COMPILE_ACTION_NAME",
+ _LINKSTAMP_COMPILE_ACTION_NAME = "LINKSTAMP_COMPILE_ACTION_NAME",
+ _LTO_BACKEND_ACTION_NAME = "LTO_BACKEND_ACTION_NAME",
+ _LTO_INDEXING_ACTION_NAME = "LTO_INDEXING_ACTION_NAME",
+ _PREPROCESS_ASSEMBLE_ACTION_NAME = "PREPROCESS_ASSEMBLE_ACTION_NAME",
+ _STRIP_ACTION_NAME = "STRIP_ACTION_NAME",
+)
+
+all_compile_actions = [
+ _C_COMPILE_ACTION_NAME,
+ _CPP_COMPILE_ACTION_NAME,
+ _LINKSTAMP_COMPILE_ACTION_NAME,
+ _ASSEMBLE_ACTION_NAME,
+ _PREPROCESS_ASSEMBLE_ACTION_NAME,
+ _CPP_HEADER_PARSING_ACTION_NAME,
+ _CPP_MODULE_COMPILE_ACTION_NAME,
+ _CPP_MODULE_CODEGEN_ACTION_NAME,
+ _CLIF_MATCH_ACTION_NAME,
+ _LTO_BACKEND_ACTION_NAME,
+]
+
+all_cpp_compile_actions = [
+ _CPP_COMPILE_ACTION_NAME,
+ _LINKSTAMP_COMPILE_ACTION_NAME,
+ _CPP_HEADER_PARSING_ACTION_NAME,
+ _CPP_MODULE_COMPILE_ACTION_NAME,
+ _CPP_MODULE_CODEGEN_ACTION_NAME,
+ _CLIF_MATCH_ACTION_NAME,
+]
+
+preprocessor_compile_actions = [
+ _C_COMPILE_ACTION_NAME,
+ _CPP_COMPILE_ACTION_NAME,
+ _LINKSTAMP_COMPILE_ACTION_NAME,
+ _PREPROCESS_ASSEMBLE_ACTION_NAME,
+ _CPP_HEADER_PARSING_ACTION_NAME,
+ _CPP_MODULE_COMPILE_ACTION_NAME,
+ _CLIF_MATCH_ACTION_NAME,
+]
+
+codegen_compile_actions = [
+ _C_COMPILE_ACTION_NAME,
+ _CPP_COMPILE_ACTION_NAME,
+ _LINKSTAMP_COMPILE_ACTION_NAME,
+ _ASSEMBLE_ACTION_NAME,
+ _PREPROCESS_ASSEMBLE_ACTION_NAME,
+ _CPP_MODULE_CODEGEN_ACTION_NAME,
+ _LTO_BACKEND_ACTION_NAME,
+]
+
+all_link_actions = [
+ _CPP_LINK_EXECUTABLE_ACTION_NAME,
+ _CPP_LINK_DYNAMIC_LIBRARY_ACTION_NAME,
+ _CPP_LINK_NODEPS_DYNAMIC_LIBRARY_ACTION_NAME,
+]
+
+def _impl(ctx):
+ if (ctx.attr.cpu == "darwin"):
+ toolchain_identifier = "local_darwin"
+ elif (ctx.attr.cpu == "freebsd"):
+ toolchain_identifier = "local_freebsd"
+ elif (ctx.attr.cpu == "local"):
+ toolchain_identifier = "local_linux"
+ elif (ctx.attr.cpu == "x64_windows" and ctx.attr.compiler == "windows_clang"):
+ toolchain_identifier = "local_windows_clang"
+ elif (ctx.attr.cpu == "x64_windows" and ctx.attr.compiler == "windows_mingw"):
+ toolchain_identifier = "local_windows_mingw"
+ elif (ctx.attr.cpu == "x64_windows" and ctx.attr.compiler == "windows_msys64"):
+ toolchain_identifier = "local_windows_msys64"
+ elif (ctx.attr.cpu == "x64_windows" and ctx.attr.compiler == "windows_msys64_mingw64"):
+ toolchain_identifier = "local_windows_msys64_mingw64"
+ elif (ctx.attr.cpu == "armeabi-v7a"):
+ toolchain_identifier = "stub_armeabi-v7a"
+ elif (ctx.attr.cpu == "x64_windows_msvc"):
+ toolchain_identifier = "vc_14_0_x64"
+ else:
+ fail("Unreachable")
+
+ if (ctx.attr.cpu == "armeabi-v7a"):
+ host_system_name = "armeabi-v7a"
+ elif (ctx.attr.cpu == "darwin" or
+ ctx.attr.cpu == "freebsd" or
+ ctx.attr.cpu == "local" or
+ ctx.attr.cpu == "x64_windows" or
+ ctx.attr.cpu == "x64_windows_msvc"):
+ host_system_name = "local"
+ else:
+ fail("Unreachable")
+
+ if (ctx.attr.cpu == "armeabi-v7a"):
+ target_system_name = "armeabi-v7a"
+ elif (ctx.attr.cpu == "darwin" or
+ ctx.attr.cpu == "freebsd" or
+ ctx.attr.cpu == "local" or
+ ctx.attr.cpu == "x64_windows" or
+ ctx.attr.cpu == "x64_windows_msvc"):
+ target_system_name = "local"
+ else:
+ fail("Unreachable")
+
+ if (ctx.attr.cpu == "armeabi-v7a"):
+ target_cpu = "armeabi-v7a"
+ elif (ctx.attr.cpu == "darwin"):
+ target_cpu = "darwin"
+ elif (ctx.attr.cpu == "freebsd"):
+ target_cpu = "freebsd"
+ elif (ctx.attr.cpu == "local"):
+ target_cpu = "local"
+ elif (ctx.attr.cpu == "x64_windows"):
+ target_cpu = "x64_windows"
+ elif (ctx.attr.cpu == "x64_windows_msvc"):
+ target_cpu = "x64_windows_msvc"
+ else:
+ fail("Unreachable")
+
+ if (ctx.attr.cpu == "armeabi-v7a"):
+ target_libc = "armeabi-v7a"
+ elif (ctx.attr.cpu == "freebsd" or
+ ctx.attr.cpu == "local" or
+ ctx.attr.cpu == "x64_windows"):
+ target_libc = "local"
+ elif (ctx.attr.cpu == "darwin"):
+ target_libc = "macosx"
+ elif (ctx.attr.cpu == "x64_windows_msvc"):
+ target_libc = "msvcrt140"
+ else:
+ fail("Unreachable")
+
+ if (ctx.attr.cpu == "x64_windows_msvc"):
+ compiler = "cl"
+ elif (ctx.attr.cpu == "armeabi-v7a" or
+ ctx.attr.cpu == "darwin" or
+ ctx.attr.cpu == "freebsd" or
+ ctx.attr.cpu == "local"):
+ compiler = "compiler"
+ elif (ctx.attr.cpu == "x64_windows" and ctx.attr.compiler == "windows_clang"):
+ compiler = "windows_clang"
+ elif (ctx.attr.cpu == "x64_windows" and ctx.attr.compiler == "windows_mingw"):
+ compiler = "windows_mingw"
+ elif (ctx.attr.cpu == "x64_windows" and ctx.attr.compiler == "windows_msys64"):
+ compiler = "windows_msys64"
+ elif (ctx.attr.cpu == "x64_windows" and ctx.attr.compiler == "windows_msys64_mingw64"):
+ compiler = "windows_msys64_mingw64"
+ else:
+ fail("Unreachable")
+
+ if (ctx.attr.cpu == "armeabi-v7a"):
+ abi_version = "armeabi-v7a"
+ elif (ctx.attr.cpu == "darwin" or
+ ctx.attr.cpu == "freebsd" or
+ ctx.attr.cpu == "local" or
+ ctx.attr.cpu == "x64_windows" or
+ ctx.attr.cpu == "x64_windows_msvc"):
+ abi_version = "local"
+ else:
+ fail("Unreachable")
+
+ if (ctx.attr.cpu == "armeabi-v7a"):
+ abi_libc_version = "armeabi-v7a"
+ elif (ctx.attr.cpu == "darwin" or
+ ctx.attr.cpu == "freebsd" or
+ ctx.attr.cpu == "local" or
+ ctx.attr.cpu == "x64_windows" or
+ ctx.attr.cpu == "x64_windows_msvc"):
+ abi_libc_version = "local"
+ else:
+ fail("Unreachable")
+
+ cc_target_os = None
+
+ builtin_sysroot = None
+
+ if (ctx.attr.cpu == "darwin" or
+ ctx.attr.cpu == "freebsd" or
+ ctx.attr.cpu == "local"):
+ objcopy_embed_data_action = action_config(
+ action_name = "objcopy_embed_data",
+ enabled = True,
+ tools = [tool(path = "/usr/bin/objcopy")],
+ )
+ elif (ctx.attr.cpu == "x64_windows" and ctx.attr.compiler == "windows_clang"):
+ objcopy_embed_data_action = action_config(
+ action_name = "objcopy_embed_data",
+ enabled = True,
+ tools = [tool(path = "C:/Program Files (x86)/LLVM/bin/objcopy")],
+ )
+ elif (ctx.attr.cpu == "x64_windows" and ctx.attr.compiler == "windows_mingw"):
+ objcopy_embed_data_action = action_config(
+ action_name = "objcopy_embed_data",
+ enabled = True,
+ tools = [tool(path = "C:/mingw/bin/objcopy")],
+ )
+ elif (ctx.attr.cpu == "x64_windows" and ctx.attr.compiler == "windows_msys64_mingw64"):
+ objcopy_embed_data_action = action_config(
+ action_name = "objcopy_embed_data",
+ enabled = True,
+ tools = [tool(path = "C:/tools/msys64/mingw64/bin/objcopy")],
+ )
+ elif (ctx.attr.cpu == "x64_windows" and ctx.attr.compiler == "windows_msys64"):
+ objcopy_embed_data_action = action_config(
+ action_name = "objcopy_embed_data",
+ enabled = True,
+ tools = [tool(path = "C:/tools/msys64/usr/bin/objcopy")],
+ )
+
+ c_compile_action = action_config(
+ action_name = _C_COMPILE_ACTION_NAME,
+ implies = [
+ "compiler_input_flags",
+ "compiler_output_flags",
+ "default_compile_flags",
+ "user_compile_flags",
+ "sysroot",
+ "unfiltered_compile_flags",
+ ],
+ tools = [tool(path = "wrapper/bin/msvc_cl.bat")],
+ )
+
+ cpp_compile_action = action_config(
+ action_name = _CPP_COMPILE_ACTION_NAME,
+ implies = [
+ "compiler_input_flags",
+ "compiler_output_flags",
+ "default_compile_flags",
+ "user_compile_flags",
+ "sysroot",
+ "unfiltered_compile_flags",
+ ],
+ tools = [tool(path = "wrapper/bin/msvc_cl.bat")],
+ )
+
+ if (ctx.attr.cpu == "armeabi-v7a"):
+ action_configs = []
+ elif (ctx.attr.cpu == "x64_windows_msvc"):
+ action_configs = [c_compile_action, cpp_compile_action]
+ elif (ctx.attr.cpu == "darwin" or
+ ctx.attr.cpu == "freebsd" or
+ ctx.attr.cpu == "local" or
+ ctx.attr.cpu == "x64_windows"):
+ action_configs = [objcopy_embed_data_action]
+ else:
+ fail("Unreachable")
+
+ random_seed_feature = feature(name = "random_seed")
+
+ compiler_output_flags_feature = feature(
+ name = "compiler_output_flags",
+ flag_sets = [
+ flag_set(
+ actions = [_ASSEMBLE_ACTION_NAME],
+ flag_groups = [
+ flag_group(
+ flags = ["/Fo%{output_file}", "/Zi"],
+ expand_if_available = "output_file",
+ expand_if_not_available = "output_assembly_file",
+ ),
+ ],
+ ),
+ flag_set(
+ actions = [
+ _PREPROCESS_ASSEMBLE_ACTION_NAME,
+ _C_COMPILE_ACTION_NAME,
+ _CPP_COMPILE_ACTION_NAME,
+ _CPP_HEADER_PARSING_ACTION_NAME,
+ _CPP_MODULE_COMPILE_ACTION_NAME,
+ _CPP_MODULE_CODEGEN_ACTION_NAME,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = ["/Fo%{output_file}"],
+ expand_if_available = "output_file",
+ expand_if_not_available = "output_assembly_file",
+ ),
+ flag_group(
+ flags = ["/Fa%{output_file}"],
+ expand_if_available = "output_file",
+ ),
+ flag_group(
+ flags = ["/P", "/Fi%{output_file}"],
+ expand_if_available = "output_file",
+ ),
+ ],
+ ),
+ ],
+ )
+
+ if (ctx.attr.cpu == "local"):
+ default_link_flags_feature = feature(
+ name = "default_link_flags",
+ enabled = True,
+ flag_sets = [
+ flag_set(
+ actions = all_link_actions,
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-lstdc++",
+ "-Wl,-z,relro,-z,now",
+ "-no-canonical-prefixes",
+ "-pass-exit-codes",
+ ],
+ ),
+ ],
+ ),
+ flag_set(
+ actions = all_link_actions,
+ flag_groups = [flag_group(flags = ["-Wl,--gc-sections"])],
+ with_features = [with_feature_set(features = ["opt"])],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "freebsd"):
+ default_link_flags_feature = feature(
+ name = "default_link_flags",
+ enabled = True,
+ flag_sets = [
+ flag_set(
+ actions = all_link_actions,
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-lstdc++",
+ "-Wl,-z,relro,-z,now",
+ "-no-canonical-prefixes",
+ ],
+ ),
+ ],
+ ),
+ flag_set(
+ actions = all_link_actions,
+ flag_groups = [flag_group(flags = ["-Wl,--gc-sections"])],
+ with_features = [with_feature_set(features = ["opt"])],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "darwin"):
+ default_link_flags_feature = feature(
+ name = "default_link_flags",
+ enabled = True,
+ flag_sets = [
+ flag_set(
+ actions = all_link_actions,
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-lstdc++",
+ "-undefined",
+ "dynamic_lookup",
+ "-headerpad_max_install_names",
+ "-no-canonical-prefixes",
+ ],
+ ),
+ ],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "x64_windows" and ctx.attr.compiler == "windows_msys64"):
+ default_link_flags_feature = feature(
+ name = "default_link_flags",
+ enabled = True,
+ flag_sets = [
+ flag_set(
+ actions = all_link_actions,
+ flag_groups = [flag_group(flags = ["-lstdc++"])],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "x64_windows_msvc"):
+ default_link_flags_feature = feature(
+ name = "default_link_flags",
+ enabled = True,
+ flag_sets = [
+ flag_set(
+ actions = all_link_actions,
+ flag_groups = [flag_group(flags = ["-m64"])],
+ ),
+ ],
+ )
+
+ if (ctx.attr.cpu == "darwin" or
+ ctx.attr.cpu == "freebsd"):
+ unfiltered_compile_flags_feature = feature(
+ name = "unfiltered_compile_flags",
+ enabled = True,
+ flag_sets = [
+ flag_set(
+ actions = [
+ _ASSEMBLE_ACTION_NAME,
+ _PREPROCESS_ASSEMBLE_ACTION_NAME,
+ _LINKSTAMP_COMPILE_ACTION_NAME,
+ _C_COMPILE_ACTION_NAME,
+ _CPP_COMPILE_ACTION_NAME,
+ _CPP_HEADER_PARSING_ACTION_NAME,
+ _CPP_MODULE_COMPILE_ACTION_NAME,
+ _CPP_MODULE_CODEGEN_ACTION_NAME,
+ _LTO_BACKEND_ACTION_NAME,
+ _CLIF_MATCH_ACTION_NAME,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-no-canonical-prefixes",
+ "-Wno-builtin-macro-redefined",
+ "-D__DATE__=\"redacted\"",
+ "-D__TIMESTAMP__=\"redacted\"",
+ "-D__TIME__=\"redacted\"",
+ ],
+ ),
+ ],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "local"):
+ unfiltered_compile_flags_feature = feature(
+ name = "unfiltered_compile_flags",
+ enabled = True,
+ flag_sets = [
+ flag_set(
+ actions = [
+ _ASSEMBLE_ACTION_NAME,
+ _PREPROCESS_ASSEMBLE_ACTION_NAME,
+ _LINKSTAMP_COMPILE_ACTION_NAME,
+ _C_COMPILE_ACTION_NAME,
+ _CPP_COMPILE_ACTION_NAME,
+ _CPP_HEADER_PARSING_ACTION_NAME,
+ _CPP_MODULE_COMPILE_ACTION_NAME,
+ _CPP_MODULE_CODEGEN_ACTION_NAME,
+ _LTO_BACKEND_ACTION_NAME,
+ _CLIF_MATCH_ACTION_NAME,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-no-canonical-prefixes",
+ "-fno-canonical-system-headers",
+ "-Wno-builtin-macro-redefined",
+ "-D__DATE__=\"redacted\"",
+ "-D__TIMESTAMP__=\"redacted\"",
+ "-D__TIME__=\"redacted\"",
+ ],
+ ),
+ ],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "x64_windows_msvc"):
+ unfiltered_compile_flags_feature = feature(
+ name = "unfiltered_compile_flags",
+ flag_sets = [
+ flag_set(
+ actions = [
+ _ASSEMBLE_ACTION_NAME,
+ _PREPROCESS_ASSEMBLE_ACTION_NAME,
+ _C_COMPILE_ACTION_NAME,
+ _CPP_COMPILE_ACTION_NAME,
+ _CPP_HEADER_PARSING_ACTION_NAME,
+ _CPP_MODULE_COMPILE_ACTION_NAME,
+ _CPP_MODULE_CODEGEN_ACTION_NAME,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = ["%{unfiltered_compile_flags}"],
+ iterate_over = "unfiltered_compile_flags",
+ expand_if_available = "unfiltered_compile_flags",
+ ),
+ ],
+ ),
+ ],
+ )
+
+ supports_pic_feature = feature(name = "supports_pic", enabled = True)
+
+ if (ctx.attr.cpu == "darwin"):
+ default_compile_flags_feature = feature(
+ name = "default_compile_flags",
+ enabled = True,
+ flag_sets = [
+ flag_set(
+ actions = [
+ _ASSEMBLE_ACTION_NAME,
+ _PREPROCESS_ASSEMBLE_ACTION_NAME,
+ _LINKSTAMP_COMPILE_ACTION_NAME,
+ _C_COMPILE_ACTION_NAME,
+ _CPP_COMPILE_ACTION_NAME,
+ _CPP_HEADER_PARSING_ACTION_NAME,
+ _CPP_MODULE_COMPILE_ACTION_NAME,
+ _CPP_MODULE_CODEGEN_ACTION_NAME,
+ _LTO_BACKEND_ACTION_NAME,
+ _CLIF_MATCH_ACTION_NAME,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-D_FORTIFY_SOURCE=1",
+ "-fstack-protector",
+ "-fcolor-diagnostics",
+ "-Wall",
+ "-Wthread-safety",
+ "-Wself-assign",
+ "-fno-omit-frame-pointer",
+ ],
+ ),
+ ],
+ ),
+ flag_set(
+ actions = [
+ _ASSEMBLE_ACTION_NAME,
+ _PREPROCESS_ASSEMBLE_ACTION_NAME,
+ _LINKSTAMP_COMPILE_ACTION_NAME,
+ _C_COMPILE_ACTION_NAME,
+ _CPP_COMPILE_ACTION_NAME,
+ _CPP_HEADER_PARSING_ACTION_NAME,
+ _CPP_MODULE_COMPILE_ACTION_NAME,
+ _CPP_MODULE_CODEGEN_ACTION_NAME,
+ _LTO_BACKEND_ACTION_NAME,
+ _CLIF_MATCH_ACTION_NAME,
+ ],
+ flag_groups = [flag_group(flags = ["-g"])],
+ with_features = [with_feature_set(features = ["dbg"])],
+ ),
+ flag_set(
+ actions = [
+ _ASSEMBLE_ACTION_NAME,
+ _PREPROCESS_ASSEMBLE_ACTION_NAME,
+ _LINKSTAMP_COMPILE_ACTION_NAME,
+ _C_COMPILE_ACTION_NAME,
+ _CPP_COMPILE_ACTION_NAME,
+ _CPP_HEADER_PARSING_ACTION_NAME,
+ _CPP_MODULE_COMPILE_ACTION_NAME,
+ _CPP_MODULE_CODEGEN_ACTION_NAME,
+ _LTO_BACKEND_ACTION_NAME,
+ _CLIF_MATCH_ACTION_NAME,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-g0",
+ "-O2",
+ "-DNDEBUG",
+ "-ffunction-sections",
+ "-fdata-sections",
+ ],
+ ),
+ ],
+ with_features = [with_feature_set(features = ["opt"])],
+ ),
+ flag_set(
+ actions = [
+ _LINKSTAMP_COMPILE_ACTION_NAME,
+ _CPP_COMPILE_ACTION_NAME,
+ _CPP_HEADER_PARSING_ACTION_NAME,
+ _CPP_MODULE_COMPILE_ACTION_NAME,
+ _CPP_MODULE_CODEGEN_ACTION_NAME,
+ _LTO_BACKEND_ACTION_NAME,
+ _CLIF_MATCH_ACTION_NAME,
+ ],
+ flag_groups = [flag_group(flags = ["-std=c++0x"])],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "local"):
+ default_compile_flags_feature = feature(
+ name = "default_compile_flags",
+ enabled = True,
+ flag_sets = [
+ flag_set(
+ actions = [
+ _ASSEMBLE_ACTION_NAME,
+ _PREPROCESS_ASSEMBLE_ACTION_NAME,
+ _LINKSTAMP_COMPILE_ACTION_NAME,
+ _C_COMPILE_ACTION_NAME,
+ _CPP_COMPILE_ACTION_NAME,
+ _CPP_HEADER_PARSING_ACTION_NAME,
+ _CPP_MODULE_COMPILE_ACTION_NAME,
+ _CPP_MODULE_CODEGEN_ACTION_NAME,
+ _LTO_BACKEND_ACTION_NAME,
+ _CLIF_MATCH_ACTION_NAME,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-U_FORTIFY_SOURCE",
+ "-D_FORTIFY_SOURCE=1",
+ "-fstack-protector",
+ "-Wall",
+ "-Wunused-but-set-parameter",
+ "-Wno-free-nonheap-object",
+ "-fno-omit-frame-pointer",
+ ],
+ ),
+ ],
+ ),
+ flag_set(
+ actions = [
+ _ASSEMBLE_ACTION_NAME,
+ _PREPROCESS_ASSEMBLE_ACTION_NAME,
+ _LINKSTAMP_COMPILE_ACTION_NAME,
+ _C_COMPILE_ACTION_NAME,
+ _CPP_COMPILE_ACTION_NAME,
+ _CPP_HEADER_PARSING_ACTION_NAME,
+ _CPP_MODULE_COMPILE_ACTION_NAME,
+ _CPP_MODULE_CODEGEN_ACTION_NAME,
+ _LTO_BACKEND_ACTION_NAME,
+ _CLIF_MATCH_ACTION_NAME,
+ ],
+ flag_groups = [flag_group(flags = ["-g"])],
+ with_features = [with_feature_set(features = ["dbg"])],
+ ),
+ flag_set(
+ actions = [
+ _ASSEMBLE_ACTION_NAME,
+ _PREPROCESS_ASSEMBLE_ACTION_NAME,
+ _LINKSTAMP_COMPILE_ACTION_NAME,
+ _C_COMPILE_ACTION_NAME,
+ _CPP_COMPILE_ACTION_NAME,
+ _CPP_HEADER_PARSING_ACTION_NAME,
+ _CPP_MODULE_COMPILE_ACTION_NAME,
+ _CPP_MODULE_CODEGEN_ACTION_NAME,
+ _LTO_BACKEND_ACTION_NAME,
+ _CLIF_MATCH_ACTION_NAME,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-g0",
+ "-O2",
+ "-DNDEBUG",
+ "-ffunction-sections",
+ "-fdata-sections",
+ ],
+ ),
+ ],
+ with_features = [with_feature_set(features = ["opt"])],
+ ),
+ flag_set(
+ actions = [
+ _LINKSTAMP_COMPILE_ACTION_NAME,
+ _CPP_COMPILE_ACTION_NAME,
+ _CPP_HEADER_PARSING_ACTION_NAME,
+ _CPP_MODULE_COMPILE_ACTION_NAME,
+ _CPP_MODULE_CODEGEN_ACTION_NAME,
+ _LTO_BACKEND_ACTION_NAME,
+ _CLIF_MATCH_ACTION_NAME,
+ ],
+ flag_groups = [flag_group(flags = ["-std=c++0x"])],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "freebsd"):
+ default_compile_flags_feature = feature(
+ name = "default_compile_flags",
+ enabled = True,
+ flag_sets = [
+ flag_set(
+ actions = [
+ _ASSEMBLE_ACTION_NAME,
+ _PREPROCESS_ASSEMBLE_ACTION_NAME,
+ _LINKSTAMP_COMPILE_ACTION_NAME,
+ _C_COMPILE_ACTION_NAME,
+ _CPP_COMPILE_ACTION_NAME,
+ _CPP_HEADER_PARSING_ACTION_NAME,
+ _CPP_MODULE_COMPILE_ACTION_NAME,
+ _CPP_MODULE_CODEGEN_ACTION_NAME,
+ _LTO_BACKEND_ACTION_NAME,
+ _CLIF_MATCH_ACTION_NAME,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-U_FORTIFY_SOURCE",
+ "-D_FORTIFY_SOURCE=1",
+ "-fstack-protector",
+ "-Wall",
+ "-fno-omit-frame-pointer",
+ ],
+ ),
+ ],
+ ),
+ flag_set(
+ actions = [
+ _ASSEMBLE_ACTION_NAME,
+ _PREPROCESS_ASSEMBLE_ACTION_NAME,
+ _LINKSTAMP_COMPILE_ACTION_NAME,
+ _C_COMPILE_ACTION_NAME,
+ _CPP_COMPILE_ACTION_NAME,
+ _CPP_HEADER_PARSING_ACTION_NAME,
+ _CPP_MODULE_COMPILE_ACTION_NAME,
+ _CPP_MODULE_CODEGEN_ACTION_NAME,
+ _LTO_BACKEND_ACTION_NAME,
+ _CLIF_MATCH_ACTION_NAME,
+ ],
+ flag_groups = [flag_group(flags = ["-g"])],
+ with_features = [with_feature_set(features = ["dbg"])],
+ ),
+ flag_set(
+ actions = [
+ _ASSEMBLE_ACTION_NAME,
+ _PREPROCESS_ASSEMBLE_ACTION_NAME,
+ _LINKSTAMP_COMPILE_ACTION_NAME,
+ _C_COMPILE_ACTION_NAME,
+ _CPP_COMPILE_ACTION_NAME,
+ _CPP_HEADER_PARSING_ACTION_NAME,
+ _CPP_MODULE_COMPILE_ACTION_NAME,
+ _CPP_MODULE_CODEGEN_ACTION_NAME,
+ _LTO_BACKEND_ACTION_NAME,
+ _CLIF_MATCH_ACTION_NAME,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-g0",
+ "-O2",
+ "-DNDEBUG",
+ "-ffunction-sections",
+ "-fdata-sections",
+ ],
+ ),
+ ],
+ with_features = [with_feature_set(features = ["opt"])],
+ ),
+ flag_set(
+ actions = [
+ _LINKSTAMP_COMPILE_ACTION_NAME,
+ _CPP_COMPILE_ACTION_NAME,
+ _CPP_HEADER_PARSING_ACTION_NAME,
+ _CPP_MODULE_COMPILE_ACTION_NAME,
+ _CPP_MODULE_CODEGEN_ACTION_NAME,
+ _LTO_BACKEND_ACTION_NAME,
+ _CLIF_MATCH_ACTION_NAME,
+ ],
+ flag_groups = [flag_group(flags = ["-std=c++0x"])],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "x64_windows_msvc"):
+ default_compile_flags_feature = feature(
+ name = "default_compile_flags",
+ enabled = True,
+ flag_sets = [
+ flag_set(
+ actions = [
+ _ASSEMBLE_ACTION_NAME,
+ _PREPROCESS_ASSEMBLE_ACTION_NAME,
+ _LINKSTAMP_COMPILE_ACTION_NAME,
+ _C_COMPILE_ACTION_NAME,
+ _CPP_COMPILE_ACTION_NAME,
+ _CPP_HEADER_PARSING_ACTION_NAME,
+ _CPP_MODULE_COMPILE_ACTION_NAME,
+ _CPP_MODULE_CODEGEN_ACTION_NAME,
+ _LTO_BACKEND_ACTION_NAME,
+ _CLIF_MATCH_ACTION_NAME,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-m64",
+ "/D__inline__=__inline",
+ "/DCOMPILER_MSVC",
+ "/DNOGDI",
+ "/DNOMINMAX",
+ "/DPRAGMA_SUPPORTED",
+ "/D_WIN32_WINNT=0x0601",
+ "/D_CRT_SECURE_NO_DEPRECATE",
+ "/D_CRT_SECURE_NO_WARNINGS",
+ "/D_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS",
+ "/D_USE_MATH_DEFINES",
+ "/nologo",
+ "/bigobj",
+ "/Zm500",
+ "/J",
+ "/Gy",
+ "/GF",
+ "/W3",
+ "/EHsc",
+ "/wd4351",
+ "/wd4291",
+ "/wd4250",
+ "/wd4996",
+ ],
+ ),
+ ],
+ ),
+ flag_set(
+ actions = [
+ _ASSEMBLE_ACTION_NAME,
+ _PREPROCESS_ASSEMBLE_ACTION_NAME,
+ _LINKSTAMP_COMPILE_ACTION_NAME,
+ _C_COMPILE_ACTION_NAME,
+ _CPP_COMPILE_ACTION_NAME,
+ _CPP_HEADER_PARSING_ACTION_NAME,
+ _CPP_MODULE_COMPILE_ACTION_NAME,
+ _CPP_MODULE_CODEGEN_ACTION_NAME,
+ _LTO_BACKEND_ACTION_NAME,
+ _CLIF_MATCH_ACTION_NAME,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = ["/DDEBUG=1", "-g", "/Od", "-Xcompilation-mode=dbg"],
+ ),
+ ],
+ with_features = [with_feature_set(features = ["dbg"])],
+ ),
+ flag_set(
+ actions = [
+ _ASSEMBLE_ACTION_NAME,
+ _PREPROCESS_ASSEMBLE_ACTION_NAME,
+ _LINKSTAMP_COMPILE_ACTION_NAME,
+ _C_COMPILE_ACTION_NAME,
+ _CPP_COMPILE_ACTION_NAME,
+ _CPP_HEADER_PARSING_ACTION_NAME,
+ _CPP_MODULE_COMPILE_ACTION_NAME,
+ _CPP_MODULE_CODEGEN_ACTION_NAME,
+ _LTO_BACKEND_ACTION_NAME,
+ _CLIF_MATCH_ACTION_NAME,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = ["/DNDEBUG", "/Od", "-Xcompilation-mode=fastbuild"],
+ ),
+ ],
+ with_features = [with_feature_set(features = ["fastbuild"])],
+ ),
+ flag_set(
+ actions = [
+ _ASSEMBLE_ACTION_NAME,
+ _PREPROCESS_ASSEMBLE_ACTION_NAME,
+ _LINKSTAMP_COMPILE_ACTION_NAME,
+ _C_COMPILE_ACTION_NAME,
+ _CPP_COMPILE_ACTION_NAME,
+ _CPP_HEADER_PARSING_ACTION_NAME,
+ _CPP_MODULE_COMPILE_ACTION_NAME,
+ _CPP_MODULE_CODEGEN_ACTION_NAME,
+ _LTO_BACKEND_ACTION_NAME,
+ _CLIF_MATCH_ACTION_NAME,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = ["/DNDEBUG", "/O2", "-Xcompilation-mode=opt"],
+ ),
+ ],
+ with_features = [with_feature_set(features = ["opt"])],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "x64_windows" and ctx.attr.compiler == "windows_clang" or
+ ctx.attr.cpu == "x64_windows" and ctx.attr.compiler == "windows_mingw" or
+ ctx.attr.cpu == "x64_windows" and ctx.attr.compiler == "windows_msys64_mingw64"):
+ default_compile_flags_feature = feature(
+ name = "default_compile_flags",
+ enabled = True,
+ flag_sets = [
+ flag_set(
+ actions = [
+ _LINKSTAMP_COMPILE_ACTION_NAME,
+ _CPP_COMPILE_ACTION_NAME,
+ _CPP_HEADER_PARSING_ACTION_NAME,
+ _CPP_MODULE_COMPILE_ACTION_NAME,
+ _CPP_MODULE_CODEGEN_ACTION_NAME,
+ _LTO_BACKEND_ACTION_NAME,
+ _CLIF_MATCH_ACTION_NAME,
+ ],
+ flag_groups = [flag_group(flags = ["-std=c++0x"])],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "x64_windows" and ctx.attr.compiler == "windows_msys64"):
+ default_compile_flags_feature = feature(
+ name = "default_compile_flags",
+ enabled = True,
+ flag_sets = [
+ flag_set(
+ actions = [
+ _LINKSTAMP_COMPILE_ACTION_NAME,
+ _CPP_COMPILE_ACTION_NAME,
+ _CPP_HEADER_PARSING_ACTION_NAME,
+ _CPP_MODULE_COMPILE_ACTION_NAME,
+ _CPP_MODULE_CODEGEN_ACTION_NAME,
+ _LTO_BACKEND_ACTION_NAME,
+ _CLIF_MATCH_ACTION_NAME,
+ ],
+ flag_groups = [flag_group(flags = ["-std=gnu++0x"])],
+ ),
+ ],
+ )
+
+ opt_feature = feature(name = "opt")
+
+ supports_dynamic_linker_feature = feature(name = "supports_dynamic_linker", enabled = True)
+
+ objcopy_embed_flags_feature = feature(
+ name = "objcopy_embed_flags",
+ enabled = True,
+ flag_sets = [
+ flag_set(
+ actions = ["objcopy_embed_data"],
+ flag_groups = [flag_group(flags = ["-I", "binary"])],
+ ),
+ ],
+ )
+
+ dbg_feature = feature(name = "dbg")
+
+ if (ctx.attr.cpu == "darwin" or
+ ctx.attr.cpu == "freebsd" or
+ ctx.attr.cpu == "local"):
+ user_compile_flags_feature = feature(
+ name = "user_compile_flags",
+ enabled = True,
+ flag_sets = [
+ flag_set(
+ actions = [
+ _ASSEMBLE_ACTION_NAME,
+ _PREPROCESS_ASSEMBLE_ACTION_NAME,
+ _LINKSTAMP_COMPILE_ACTION_NAME,
+ _C_COMPILE_ACTION_NAME,
+ _CPP_COMPILE_ACTION_NAME,
+ _CPP_HEADER_PARSING_ACTION_NAME,
+ _CPP_MODULE_COMPILE_ACTION_NAME,
+ _CPP_MODULE_CODEGEN_ACTION_NAME,
+ _LTO_BACKEND_ACTION_NAME,
+ _CLIF_MATCH_ACTION_NAME,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = ["%{user_compile_flags}"],
+ iterate_over = "user_compile_flags",
+ expand_if_available = "user_compile_flags",
+ ),
+ ],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "x64_windows_msvc"):
+ user_compile_flags_feature = feature(
+ name = "user_compile_flags",
+ flag_sets = [
+ flag_set(
+ actions = [
+ _ASSEMBLE_ACTION_NAME,
+ _PREPROCESS_ASSEMBLE_ACTION_NAME,
+ _C_COMPILE_ACTION_NAME,
+ _CPP_COMPILE_ACTION_NAME,
+ _CPP_HEADER_PARSING_ACTION_NAME,
+ _CPP_MODULE_COMPILE_ACTION_NAME,
+ _CPP_MODULE_CODEGEN_ACTION_NAME,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = ["%{user_compile_flags}"],
+ iterate_over = "user_compile_flags",
+ expand_if_available = "user_compile_flags",
+ ),
+ ],
+ ),
+ ],
+ )
+
+ if (ctx.attr.cpu == "darwin" or
+ ctx.attr.cpu == "freebsd" or
+ ctx.attr.cpu == "local"):
+ sysroot_feature = feature(
+ name = "sysroot",
+ enabled = True,
+ flag_sets = [
+ flag_set(
+ actions = [
+ _PREPROCESS_ASSEMBLE_ACTION_NAME,
+ _LINKSTAMP_COMPILE_ACTION_NAME,
+ _C_COMPILE_ACTION_NAME,
+ _CPP_COMPILE_ACTION_NAME,
+ _CPP_HEADER_PARSING_ACTION_NAME,
+ _CPP_MODULE_COMPILE_ACTION_NAME,
+ _CPP_MODULE_CODEGEN_ACTION_NAME,
+ _LTO_BACKEND_ACTION_NAME,
+ _CLIF_MATCH_ACTION_NAME,
+ _CPP_LINK_EXECUTABLE_ACTION_NAME,
+ _CPP_LINK_DYNAMIC_LIBRARY_ACTION_NAME,
+ _CPP_LINK_NODEPS_DYNAMIC_LIBRARY_ACTION_NAME,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = ["--sysroot=%{sysroot}"],
+ expand_if_available = "sysroot",
+ ),
+ ],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "x64_windows_msvc"):
+ sysroot_feature = feature(
+ name = "sysroot",
+ flag_sets = [
+ flag_set(
+ actions = [
+ _ASSEMBLE_ACTION_NAME,
+ _PREPROCESS_ASSEMBLE_ACTION_NAME,
+ _C_COMPILE_ACTION_NAME,
+ _CPP_COMPILE_ACTION_NAME,
+ _CPP_HEADER_PARSING_ACTION_NAME,
+ _CPP_MODULE_COMPILE_ACTION_NAME,
+ _CPP_MODULE_CODEGEN_ACTION_NAME,
+ _CPP_LINK_EXECUTABLE_ACTION_NAME,
+ _CPP_LINK_DYNAMIC_LIBRARY_ACTION_NAME,
+ _CPP_LINK_NODEPS_DYNAMIC_LIBRARY_ACTION_NAME,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = ["--sysroot=%{sysroot}"],
+ iterate_over = "sysroot",
+ expand_if_available = "sysroot",
+ ),
+ ],
+ ),
+ ],
+ )
+
+ include_paths_feature = feature(
+ name = "include_paths",
+ flag_sets = [
+ flag_set(
+ actions = [
+ _PREPROCESS_ASSEMBLE_ACTION_NAME,
+ _C_COMPILE_ACTION_NAME,
+ _CPP_COMPILE_ACTION_NAME,
+ _CPP_HEADER_PARSING_ACTION_NAME,
+ _CPP_MODULE_COMPILE_ACTION_NAME,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = ["/I%{quote_include_paths}"],
+ iterate_over = "quote_include_paths",
+ ),
+ flag_group(
+ flags = ["/I%{include_paths}"],
+ iterate_over = "include_paths",
+ ),
+ flag_group(
+ flags = ["/I%{system_include_paths}"],
+ iterate_over = "system_include_paths",
+ ),
+ ],
+ ),
+ ],
+ )
+
+ dependency_file_feature = feature(
+ name = "dependency_file",
+ flag_sets = [
+ flag_set(
+ actions = [
+ _ASSEMBLE_ACTION_NAME,
+ _PREPROCESS_ASSEMBLE_ACTION_NAME,
+ _C_COMPILE_ACTION_NAME,
+ _CPP_COMPILE_ACTION_NAME,
+ _CPP_MODULE_COMPILE_ACTION_NAME,
+ _CPP_HEADER_PARSING_ACTION_NAME,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = ["/DEPENDENCY_FILE", "%{dependency_file}"],
+ expand_if_available = "dependency_file",
+ ),
+ ],
+ ),
+ ],
+ )
+
+ compiler_input_flags_feature = feature(
+ name = "compiler_input_flags",
+ flag_sets = [
+ flag_set(
+ actions = [
+ _ASSEMBLE_ACTION_NAME,
+ _PREPROCESS_ASSEMBLE_ACTION_NAME,
+ _C_COMPILE_ACTION_NAME,
+ _CPP_COMPILE_ACTION_NAME,
+ _CPP_HEADER_PARSING_ACTION_NAME,
+ _CPP_MODULE_COMPILE_ACTION_NAME,
+ _CPP_MODULE_CODEGEN_ACTION_NAME,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = ["/c", "%{source_file}"],
+ expand_if_available = "source_file",
+ ),
+ ],
+ ),
+ ],
+ )
+
+ fastbuild_feature = feature(name = "fastbuild")
+
+ if (ctx.attr.cpu == "x64_windows" and ctx.attr.compiler == "windows_msys64"):
+ features = [
+ default_compile_flags_feature,
+ default_link_flags_feature,
+ supports_dynamic_linker_feature,
+ objcopy_embed_flags_feature,
+ ]
+ elif (ctx.attr.cpu == "darwin"):
+ features = [
+ default_compile_flags_feature,
+ default_link_flags_feature,
+ supports_dynamic_linker_feature,
+ supports_pic_feature,
+ objcopy_embed_flags_feature,
+ dbg_feature,
+ opt_feature,
+ user_compile_flags_feature,
+ sysroot_feature,
+ unfiltered_compile_flags_feature,
+ ]
+ elif (ctx.attr.cpu == "freebsd" or
+ ctx.attr.cpu == "local"):
+ features = [
+ default_compile_flags_feature,
+ default_link_flags_feature,
+ supports_dynamic_linker_feature,
+ supports_pic_feature,
+ objcopy_embed_flags_feature,
+ opt_feature,
+ dbg_feature,
+ user_compile_flags_feature,
+ sysroot_feature,
+ unfiltered_compile_flags_feature,
+ ]
+ elif (ctx.attr.cpu == "x64_windows" and ctx.attr.compiler == "windows_clang" or
+ ctx.attr.cpu == "x64_windows" and ctx.attr.compiler == "windows_mingw" or
+ ctx.attr.cpu == "x64_windows" and ctx.attr.compiler == "windows_msys64_mingw64"):
+ features = [
+ default_compile_flags_feature,
+ supports_dynamic_linker_feature,
+ objcopy_embed_flags_feature,
+ ]
+ elif (ctx.attr.cpu == "x64_windows_msvc"):
+ features = [
+ default_link_flags_feature,
+ random_seed_feature,
+ default_compile_flags_feature,
+ include_paths_feature,
+ dependency_file_feature,
+ user_compile_flags_feature,
+ sysroot_feature,
+ unfiltered_compile_flags_feature,
+ compiler_output_flags_feature,
+ compiler_input_flags_feature,
+ dbg_feature,
+ fastbuild_feature,
+ opt_feature,
+ ]
+ elif (ctx.attr.cpu == "armeabi-v7a"):
+ features = [supports_dynamic_linker_feature, supports_pic_feature]
+
+ if (ctx.attr.cpu == "armeabi-v7a"):
+ cxx_builtin_include_directories = []
+ elif (ctx.attr.cpu == "darwin"):
+ cxx_builtin_include_directories = ["/"]
+ elif (ctx.attr.cpu == "freebsd"):
+ cxx_builtin_include_directories = ["/usr/lib/clang", "/usr/local/include", "/usr/include"]
+ elif (ctx.attr.cpu == "local" or
+ ctx.attr.cpu == "x64_windows" and ctx.attr.compiler == "windows_clang"):
+ cxx_builtin_include_directories = ["/usr/lib/gcc/", "/usr/local/include", "/usr/include"]
+ elif (ctx.attr.cpu == "x64_windows_msvc"):
+ cxx_builtin_include_directories = [
+ "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/INCLUDE",
+ "C:/Program Files (x86)/Windows Kits/10/include/",
+ "C:/Program Files (x86)/Windows Kits/8.1/include/",
+ "C:/Program Files (x86)/GnuWin32/include/",
+ "C:/python_27_amd64/files/include",
+ ]
+ elif (ctx.attr.cpu == "x64_windows" and ctx.attr.compiler == "windows_mingw"):
+ cxx_builtin_include_directories = ["C:/mingw/include", "C:/mingw/lib/gcc"]
+ elif (ctx.attr.cpu == "x64_windows" and ctx.attr.compiler == "windows_msys64_mingw64"):
+ cxx_builtin_include_directories = ["C:/tools/msys64/mingw64/x86_64-w64-mingw32/include"]
+ elif (ctx.attr.cpu == "x64_windows" and ctx.attr.compiler == "windows_msys64"):
+ cxx_builtin_include_directories = ["C:/tools/msys64/", "/usr/"]
+ else:
+ fail("Unreachable")
+
+ artifact_name_patterns = []
+
+ make_variables = []
+
+ if (ctx.attr.cpu == "x64_windows" and ctx.attr.compiler == "windows_msys64_mingw64"):
+ tool_paths = [
+ tool_path(
+ name = "ar",
+ path = "C:/tools/msys64/mingw64/bin/ar",
+ ),
+ tool_path(
+ name = "compat-ld",
+ path = "C:/tools/msys64/mingw64/bin/ld",
+ ),
+ tool_path(
+ name = "cpp",
+ path = "C:/tools/msys64/mingw64/bin/cpp",
+ ),
+ tool_path(
+ name = "dwp",
+ path = "C:/tools/msys64/mingw64/bin/dwp",
+ ),
+ tool_path(
+ name = "gcc",
+ path = "C:/tools/msys64/mingw64/bin/gcc",
+ ),
+ tool_path(
+ name = "gcov",
+ path = "C:/tools/msys64/mingw64/bin/gcov",
+ ),
+ tool_path(
+ name = "ld",
+ path = "C:/tools/msys64/mingw64/bin/ld",
+ ),
+ tool_path(
+ name = "nm",
+ path = "C:/tools/msys64/mingw64/bin/nm",
+ ),
+ tool_path(
+ name = "objcopy",
+ path = "C:/tools/msys64/mingw64/bin/objcopy",
+ ),
+ tool_path(
+ name = "objdump",
+ path = "C:/tools/msys64/mingw64/bin/objdump",
+ ),
+ tool_path(
+ name = "strip",
+ path = "C:/tools/msys64/mingw64/bin/strip",
+ ),
+ ]
+ elif (ctx.attr.cpu == "armeabi-v7a"):
+ tool_paths = [
+ tool_path(name = "ar", path = "/bin/false"),
+ tool_path(name = "compat-ld", path = "/bin/false"),
+ tool_path(name = "cpp", path = "/bin/false"),
+ tool_path(name = "dwp", path = "/bin/false"),
+ tool_path(name = "gcc", path = "/bin/false"),
+ tool_path(name = "gcov", path = "/bin/false"),
+ tool_path(name = "ld", path = "/bin/false"),
+ tool_path(name = "nm", path = "/bin/false"),
+ tool_path(name = "objcopy", path = "/bin/false"),
+ tool_path(name = "objdump", path = "/bin/false"),
+ tool_path(name = "strip", path = "/bin/false"),
+ ]
+ elif (ctx.attr.cpu == "freebsd"):
+ tool_paths = [
+ tool_path(name = "ar", path = "/usr/bin/ar"),
+ tool_path(name = "compat-ld", path = "/usr/bin/ld"),
+ tool_path(name = "cpp", path = "/usr/bin/cpp"),
+ tool_path(name = "dwp", path = "/usr/bin/dwp"),
+ tool_path(name = "gcc", path = "/usr/bin/clang"),
+ tool_path(name = "gcov", path = "/usr/bin/gcov"),
+ tool_path(name = "ld", path = "/usr/bin/ld"),
+ tool_path(name = "nm", path = "/usr/bin/nm"),
+ tool_path(name = "objcopy", path = "/usr/bin/objcopy"),
+ tool_path(name = "objdump", path = "/usr/bin/objdump"),
+ tool_path(name = "strip", path = "/usr/bin/strip"),
+ ]
+ elif (ctx.attr.cpu == "local"):
+ tool_paths = [
+ tool_path(name = "ar", path = "/usr/bin/ar"),
+ tool_path(name = "compat-ld", path = "/usr/bin/ld"),
+ tool_path(name = "cpp", path = "/usr/bin/cpp"),
+ tool_path(name = "dwp", path = "/usr/bin/dwp"),
+ tool_path(name = "gcc", path = "/usr/bin/gcc"),
+ tool_path(name = "gcov", path = "/usr/bin/gcov"),
+ tool_path(name = "ld", path = "/usr/bin/ld"),
+ tool_path(name = "nm", path = "/usr/bin/nm"),
+ tool_path(name = "objcopy", path = "/usr/bin/objcopy"),
+ tool_path(name = "objdump", path = "/usr/bin/objdump"),
+ tool_path(name = "strip", path = "/usr/bin/strip"),
+ ]
+ elif (ctx.attr.cpu == "darwin"):
+ tool_paths = [
+ tool_path(name = "ar", path = "/usr/bin/libtool"),
+ tool_path(name = "compat-ld", path = "/usr/bin/ld"),
+ tool_path(name = "cpp", path = "/usr/bin/cpp"),
+ tool_path(name = "dwp", path = "/usr/bin/dwp"),
+ tool_path(name = "gcc", path = "osx_cc_wrapper.sh"),
+ tool_path(name = "gcov", path = "/usr/bin/gcov"),
+ tool_path(name = "ld", path = "/usr/bin/ld"),
+ tool_path(name = "nm", path = "/usr/bin/nm"),
+ tool_path(name = "objcopy", path = "/usr/bin/objcopy"),
+ tool_path(name = "objdump", path = "/usr/bin/objdump"),
+ tool_path(name = "strip", path = "/usr/bin/strip"),
+ ]
+ elif (ctx.attr.cpu == "x64_windows" and ctx.attr.compiler == "windows_clang"):
+ tool_paths = [
+ tool_path(name = "ar", path = "C:/mingw/bin/ar"),
+ tool_path(
+ name = "compat-ld",
+ path = "C:/Program Files (x86)/LLVM/bin/ld",
+ ),
+ tool_path(
+ name = "cpp",
+ path = "C:/Program Files (x86)/LLVM/bin/cpp",
+ ),
+ tool_path(
+ name = "dwp",
+ path = "C:/Program Files (x86)/LLVM/bin/dwp",
+ ),
+ tool_path(
+ name = "gcc",
+ path = "C:/Program Files (x86)/LLVM/bin/clang",
+ ),
+ tool_path(
+ name = "gcov",
+ path = "C:/Program Files (x86)/LLVM/bin/gcov",
+ ),
+ tool_path(
+ name = "ld",
+ path = "C:/Program Files (x86)/LLVM/bin/ld",
+ ),
+ tool_path(
+ name = "nm",
+ path = "C:/Program Files (x86)/LLVM/bin/nm",
+ ),
+ tool_path(
+ name = "objcopy",
+ path = "C:/Program Files (x86)/LLVM/bin/objcopy",
+ ),
+ tool_path(
+ name = "objdump",
+ path = "C:/Program Files (x86)/LLVM/bin/objdump",
+ ),
+ tool_path(
+ name = "strip",
+ path = "C:/Program Files (x86)/LLVM/bin/strip",
+ ),
+ ]
+ elif (ctx.attr.cpu == "x64_windows" and ctx.attr.compiler == "windows_mingw"):
+ tool_paths = [
+ tool_path(name = "ar", path = "C:/mingw/bin/ar"),
+ tool_path(name = "compat-ld", path = "C:/mingw/bin/ld"),
+ tool_path(name = "cpp", path = "C:/mingw/bin/cpp"),
+ tool_path(name = "dwp", path = "C:/mingw/bin/dwp"),
+ tool_path(name = "gcc", path = "C:/mingw/bin/gcc"),
+ tool_path(name = "gcov", path = "C:/mingw/bin/gcov"),
+ tool_path(name = "ld", path = "C:/mingw/bin/ld"),
+ tool_path(name = "nm", path = "C:/mingw/bin/nm"),
+ tool_path(name = "objcopy", path = "C:/mingw/bin/objcopy"),
+ tool_path(name = "objdump", path = "C:/mingw/bin/objdump"),
+ tool_path(name = "strip", path = "C:/mingw/bin/strip"),
+ ]
+ elif (ctx.attr.cpu == "x64_windows" and ctx.attr.compiler == "windows_msys64"):
+ tool_paths = [
+ tool_path(name = "ar", path = "C:/tools/msys64/usr/bin/ar"),
+ tool_path(
+ name = "compat-ld",
+ path = "C:/tools/msys64/usr/bin/ld",
+ ),
+ tool_path(
+ name = "cpp",
+ path = "C:/tools/msys64/usr/bin/cpp",
+ ),
+ tool_path(
+ name = "dwp",
+ path = "C:/tools/msys64/usr/bin/dwp",
+ ),
+ tool_path(
+ name = "gcc",
+ path = "C:/tools/msys64/usr/bin/gcc",
+ ),
+ tool_path(
+ name = "gcov",
+ path = "C:/tools/msys64/usr/bin/gcov",
+ ),
+ tool_path(name = "ld", path = "C:/tools/msys64/usr/bin/ld"),
+ tool_path(name = "nm", path = "C:/tools/msys64/usr/bin/nm"),
+ tool_path(
+ name = "objcopy",
+ path = "C:/tools/msys64/usr/bin/objcopy",
+ ),
+ tool_path(
+ name = "objdump",
+ path = "C:/tools/msys64/usr/bin/objdump",
+ ),
+ tool_path(
+ name = "strip",
+ path = "C:/tools/msys64/usr/bin/strip",
+ ),
+ ]
+ elif (ctx.attr.cpu == "x64_windows_msvc"):
+ tool_paths = [
+ tool_path(name = "ar", path = "wrapper/bin/msvc_link.bat"),
+ tool_path(name = "cpp", path = "wrapper/bin/msvc_cl.bat"),
+ tool_path(name = "gcc", path = "wrapper/bin/msvc_cl.bat"),
+ tool_path(name = "gcov", path = "wrapper/bin/msvc_nop.bat"),
+ tool_path(name = "ld", path = "wrapper/bin/msvc_link.bat"),
+ tool_path(name = "nm", path = "wrapper/bin/msvc_nop.bat"),
+ tool_path(
+ name = "objcopy",
+ path = "wrapper/bin/msvc_nop.bat",
+ ),
+ tool_path(
+ name = "objdump",
+ path = "wrapper/bin/msvc_nop.bat",
+ ),
+ tool_path(
+ name = "strip",
+ path = "wrapper/bin/msvc_nop.bat",
+ ),
+ ]
+ else:
+ fail("Unreachable")
+
+ out = ctx.actions.declare_file(ctx.label.name)
+ ctx.actions.write(out, "Fake executable")
+ return [
+ cc_common.create_cc_toolchain_config_info(
+ ctx = ctx,
+ features = features,
+ action_configs = action_configs,
+ artifact_name_patterns = artifact_name_patterns,
+ cxx_builtin_include_directories = cxx_builtin_include_directories,
+ toolchain_identifier = toolchain_identifier,
+ host_system_name = host_system_name,
+ target_system_name = target_system_name,
+ target_cpu = target_cpu,
+ target_libc = target_libc,
+ compiler = compiler,
+ abi_version = abi_version,
+ abi_libc_version = abi_libc_version,
+ tool_paths = tool_paths,
+ make_variables = make_variables,
+ builtin_sysroot = builtin_sysroot,
+ cc_target_os = cc_target_os,
+ ),
+ DefaultInfo(
+ executable = out,
+ ),
+ ]
+
+cc_toolchain_config = rule(
+ implementation = _impl,
+ attrs = {
+ "cpu": attr.string(mandatory = True),
+ "compiler": attr.string(),
+ },
+ provides = [CcToolchainConfigInfo],
+ executable = True,
+)
diff --git a/tools/cpp/cc_toolchain_config.bzl.tpl b/tools/cpp/cc_toolchain_config.bzl.tpl
new file mode 100644
index 0000000..c1d085e
--- /dev/null
+++ b/tools/cpp/cc_toolchain_config.bzl.tpl
@@ -0,0 +1,1668 @@
+# Copyright 2019 The Bazel Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""A Starlark cc_toolchain configuration rule"""
+load("@bazel_tools//tools/cpp:cc_toolchain_config_lib.bzl",
+ "action_config",
+ "artifact_name_pattern",
+ "env_entry",
+ "env_set",
+ "feature",
+ "feature_set",
+ "flag_group",
+ "flag_set",
+ "make_variable",
+ "tool",
+ "tool_path",
+ "variable_with_value",
+ "with_feature_set",
+ )
+load("@bazel_tools//tools/build_defs/cc:action_names.bzl", "ACTION_NAMES")
+
+
+all_compile_actions = [
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.linkstamp_compile,
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ACTION_NAMES.clif_match,
+ ACTION_NAMES.lto_backend,
+]
+
+all_cpp_compile_actions = [
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.linkstamp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ACTION_NAMES.clif_match,
+]
+
+preprocessor_compile_actions = [
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.linkstamp_compile,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.clif_match,
+]
+
+codegen_compile_actions = [
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.linkstamp_compile,
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.cpp_module_codegen,
+ ACTION_NAMES.lto_backend,
+]
+
+all_link_actions = [
+ ACTION_NAMES.cpp_link_executable,
+ ACTION_NAMES.cpp_link_dynamic_library,
+ ACTION_NAMES.cpp_link_nodeps_dynamic_library,
+]
+
+def _windows_msvc_impl(ctx):
+ toolchain_identifier = "msvc_x64"
+ host_system_name = "local"
+ target_system_name = "local"
+ target_cpu = "x64_windows"
+ target_libc = "msvcrt"
+ compiler = "msvc-cl"
+ abi_version = "local"
+ abi_libc_version = "local"
+ cc_target_os = None
+ builtin_sysroot = None
+
+ cxx_builtin_include_directories = [
+%{cxx_builtin_include_directories}
+ ]
+
+ cpp_link_nodeps_dynamic_library_action = action_config(
+ action_name = ACTION_NAMES.cpp_link_nodeps_dynamic_library,
+ implies = [
+ "nologo",
+ "shared_flag",
+ "linkstamps",
+ "output_execpath_flags",
+ "input_param_flags",
+ "user_link_flags",
+ "default_link_flags",
+ "linker_subsystem_flag",
+ "linker_param_file",
+ "msvc_env",
+ "no_stripping",
+ "has_configured_linker_path",
+ "def_file",
+ ],
+ tools = [tool(path = "%{msvc_link_path}")],
+ )
+
+ cpp_link_static_library_action = action_config(
+ action_name = ACTION_NAMES.cpp_link_static_library,
+ implies = [
+ "nologo",
+ "archiver_flags",
+ "input_param_flags",
+ "linker_param_file",
+ "msvc_env",
+ ],
+ tools = [tool(path = "%{msvc_lib_path}")],
+ )
+
+ assemble_action = action_config(
+ action_name = ACTION_NAMES.assemble,
+ implies = [
+ "compiler_input_flags",
+ "compiler_output_flags",
+ "nologo",
+ "msvc_env",
+ "sysroot",
+ ],
+ tools = [tool(path = "%{msvc_ml_path}")],
+ )
+
+ preprocess_assemble_action = action_config(
+ action_name = ACTION_NAMES.preprocess_assemble,
+ implies = [
+ "compiler_input_flags",
+ "compiler_output_flags",
+ "nologo",
+ "msvc_env",
+ "sysroot",
+ ],
+ tools = [tool(path = "%{msvc_ml_path}")],
+ )
+
+ c_compile_action = action_config(
+ action_name = ACTION_NAMES.c_compile,
+ implies = [
+ "compiler_input_flags",
+ "compiler_output_flags",
+ "default_compile_flags",
+ "nologo",
+ "msvc_env",
+ "parse_showincludes",
+ "user_compile_flags",
+ "sysroot",
+ "unfiltered_compile_flags",
+ ],
+ tools = [tool(path = "%{msvc_cl_path}")],
+ )
+
+ cpp_compile_action = action_config(
+ action_name = ACTION_NAMES.cpp_compile,
+ implies = [
+ "compiler_input_flags",
+ "compiler_output_flags",
+ "default_compile_flags",
+ "nologo",
+ "msvc_env",
+ "parse_showincludes",
+ "user_compile_flags",
+ "sysroot",
+ "unfiltered_compile_flags",
+ ],
+ tools = [tool(path = "%{msvc_cl_path}")],
+ )
+
+ cpp_link_executable_action = action_config(
+ action_name = ACTION_NAMES.cpp_link_executable,
+ implies = [
+ "nologo",
+ "linkstamps",
+ "output_execpath_flags",
+ "input_param_flags",
+ "user_link_flags",
+ "default_link_flags",
+ "linker_subsystem_flag",
+ "linker_param_file",
+ "msvc_env",
+ "no_stripping",
+ ],
+ tools = [tool(path = "%{msvc_link_path}")],
+ )
+
+ cpp_link_dynamic_library_action = action_config(
+ action_name = ACTION_NAMES.cpp_link_dynamic_library,
+ implies = [
+ "nologo",
+ "shared_flag",
+ "linkstamps",
+ "output_execpath_flags",
+ "input_param_flags",
+ "user_link_flags",
+ "default_link_flags",
+ "linker_subsystem_flag",
+ "linker_param_file",
+ "msvc_env",
+ "no_stripping",
+ "has_configured_linker_path",
+ "def_file",
+ ],
+ tools = [tool(path = "%{msvc_link_path}")],
+ )
+
+ action_configs = [
+ assemble_action,
+ preprocess_assemble_action,
+ c_compile_action,
+ cpp_compile_action,
+ cpp_link_executable_action,
+ cpp_link_dynamic_library_action,
+ cpp_link_nodeps_dynamic_library_action,
+ cpp_link_static_library_action,
+ ]
+
+ msvc_link_env_feature = feature(
+ name = "msvc_link_env",
+ env_sets = [
+ env_set(
+ actions = all_link_actions +
+ [ACTION_NAMES.cpp_link_static_library],
+ env_entries = [env_entry(key = "LIB", value = "%{msvc_env_lib}")],
+ ),
+ ],
+ )
+
+ shared_flag_feature = feature(
+ name = "shared_flag",
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.cpp_link_dynamic_library,
+ ACTION_NAMES.cpp_link_nodeps_dynamic_library,
+ ],
+ flag_groups = [flag_group(flags = ["/DLL"])],
+ ),
+ ],
+ )
+
+ determinism_feature = feature(
+ name = "determinism",
+ enabled = True,
+ flag_sets = [
+ flag_set(
+ actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile],
+ flag_groups = [
+ flag_group(
+ flags = [
+ "/wd4117",
+ "-D__DATE__=\"redacted\"",
+ "-D__TIMESTAMP__=\"redacted\"",
+ "-D__TIME__=\"redacted\"",
+ ],
+ ),
+ ],
+ ),
+ ],
+ )
+
+ sysroot_feature = feature(
+ name = "sysroot",
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ACTION_NAMES.cpp_link_executable,
+ ACTION_NAMES.cpp_link_dynamic_library,
+ ACTION_NAMES.cpp_link_nodeps_dynamic_library,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = ["--sysroot=%{sysroot}"],
+ iterate_over = "sysroot",
+ expand_if_available = "sysroot",
+ ),
+ ],
+ ),
+ ],
+ )
+
+ unfiltered_compile_flags_feature = feature(
+ name = "unfiltered_compile_flags",
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = ["%{unfiltered_compile_flags}"],
+ iterate_over = "unfiltered_compile_flags",
+ expand_if_available = "unfiltered_compile_flags",
+ ),
+ ],
+ ),
+ ],
+ )
+
+ copy_dynamic_libraries_to_binary_feature = feature(name = "copy_dynamic_libraries_to_binary")
+
+ input_param_flags_feature = feature(
+ name = "input_param_flags",
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.cpp_link_dynamic_library,
+ ACTION_NAMES.cpp_link_nodeps_dynamic_library,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = ["/IMPLIB:%{interface_library_output_path}"],
+ expand_if_available = "interface_library_output_path",
+ ),
+ ],
+ ),
+ flag_set(
+ actions = all_link_actions,
+ flag_groups = [
+ flag_group(
+ flags = ["%{libopts}"],
+ iterate_over = "libopts",
+ expand_if_available = "libopts",
+ ),
+ ],
+ ),
+ flag_set(
+ actions = all_link_actions +
+ [ACTION_NAMES.cpp_link_static_library],
+ flag_groups = [
+ flag_group(
+ iterate_over = "libraries_to_link",
+ flag_groups = [
+ flag_group(
+ iterate_over = "libraries_to_link.object_files",
+ flag_groups = [flag_group(flags = ["%{libraries_to_link.object_files}"])],
+ expand_if_equal = variable_with_value(
+ name = "libraries_to_link.type",
+ value = "object_file_group",
+ ),
+ ),
+ flag_group(
+ flag_groups = [flag_group(flags = ["%{libraries_to_link.name}"])],
+ expand_if_equal = variable_with_value(
+ name = "libraries_to_link.type",
+ value = "object_file",
+ ),
+ ),
+ flag_group(
+ flag_groups = [flag_group(flags = ["%{libraries_to_link.name}"])],
+ expand_if_equal = variable_with_value(
+ name = "libraries_to_link.type",
+ value = "interface_library",
+ ),
+ ),
+ flag_group(
+ flag_groups = [
+ flag_group(
+ flags = ["%{libraries_to_link.name}"],
+ expand_if_false = "libraries_to_link.is_whole_archive",
+ ),
+ flag_group(
+ flags = ["/WHOLEARCHIVE:%{libraries_to_link.name}"],
+ expand_if_true = "libraries_to_link.is_whole_archive",
+ ),
+ ],
+ expand_if_equal = variable_with_value(
+ name = "libraries_to_link.type",
+ value = "static_library",
+ ),
+ ),
+ ],
+ expand_if_available = "libraries_to_link",
+ ),
+ ],
+ ),
+ ],
+ )
+
+ fastbuild_feature = feature(
+ name = "fastbuild",
+ flag_sets = [
+ flag_set(
+ actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile],
+ flag_groups = [flag_group(flags = ["/Od", "/Z7"])],
+ ),
+ flag_set(
+ actions = all_link_actions,
+ flag_groups = [
+ flag_group(
+ flags = ["%{fastbuild_mode_debug}", "/INCREMENTAL:NO"],
+ ),
+ ],
+ ),
+ ],
+ implies = ["generate_pdb_file"],
+ )
+
+ user_compile_flags_feature = feature(
+ name = "user_compile_flags",
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = ["%{user_compile_flags}"],
+ iterate_over = "user_compile_flags",
+ expand_if_available = "user_compile_flags",
+ ),
+ ],
+ ),
+ ],
+ )
+
+ archiver_flags_feature = feature(
+ name = "archiver_flags",
+ flag_sets = [
+ flag_set(
+ actions = [ACTION_NAMES.cpp_link_static_library],
+ flag_groups = [
+ flag_group(
+ flags = ["/OUT:%{output_execpath}"],
+ expand_if_available = "output_execpath",
+ ),
+ ],
+ ),
+ ],
+ )
+
+ default_link_flags_feature = feature(
+ name = "default_link_flags",
+ enabled = True,
+ flag_sets = [
+ flag_set(
+ actions = all_link_actions,
+ flag_groups = [flag_group(flags = ["/MACHINE:X64"])],
+ ),
+ ],
+ )
+
+ static_link_msvcrt_feature = feature(name = "static_link_msvcrt")
+
+ dynamic_link_msvcrt_debug_feature = feature(
+ name = "dynamic_link_msvcrt_debug",
+ flag_sets = [
+ flag_set(
+ actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile],
+ flag_groups = [flag_group(flags = ["/MDd"])],
+ ),
+ flag_set(
+ actions = all_link_actions,
+ flag_groups = [flag_group(flags = ["/DEFAULTLIB:msvcrtd.lib"])],
+ ),
+ ],
+ requires = [feature_set(features = ["dbg"])],
+ )
+
+ dbg_feature = feature(
+ name = "dbg",
+ flag_sets = [
+ flag_set(
+ actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile],
+ flag_groups = [flag_group(flags = ["/Od", "/Z7"])],
+ ),
+ flag_set(
+ actions = all_link_actions,
+ flag_groups = [
+ flag_group(
+ flags = ["%{dbg_mode_debug}", "/INCREMENTAL:NO"],
+ ),
+ ],
+ ),
+ ],
+ implies = ["generate_pdb_file"],
+ )
+
+ opt_feature = feature(
+ name = "opt",
+ flag_sets = [
+ flag_set(
+ actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile],
+ flag_groups = [flag_group(flags = ["/O2"])],
+ ),
+ ],
+ implies = ["frame_pointer"],
+ )
+
+ supports_interface_shared_libraries_feature = feature(
+ name = "supports_interface_shared_libraries",
+ enabled = True,
+ )
+
+ user_link_flags_feature = feature(
+ name = "user_link_flags",
+ flag_sets = [
+ flag_set(
+ actions = all_link_actions,
+ flag_groups = [
+ flag_group(
+ flags = ["%{user_link_flags}"],
+ iterate_over = "user_link_flags",
+ expand_if_available = "user_link_flags",
+ ),
+ ],
+ ),
+ ],
+ )
+
+ default_compile_flags_feature = feature(
+ name = "default_compile_flags",
+ enabled = True,
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.linkstamp_compile,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ACTION_NAMES.lto_backend,
+ ACTION_NAMES.clif_match,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = [
+ "/DCOMPILER_MSVC",
+ "/DNOMINMAX",
+ "/D_WIN32_WINNT=0x0601",
+ "/D_CRT_SECURE_NO_DEPRECATE",
+ "/D_CRT_SECURE_NO_WARNINGS",
+ "/bigobj",
+ "/Zm500",
+ "/EHsc",
+ "/wd4351",
+ "/wd4291",
+ "/wd4250",
+ "/wd4996",
+ ],
+ ),
+ ],
+ ),
+ ],
+ )
+
+ msvc_compile_env_feature = feature(
+ name = "msvc_compile_env",
+ env_sets = [
+ env_set(
+ actions = [
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ],
+ env_entries = [env_entry(key = "INCLUDE", value = "%{msvc_env_include}")],
+ ),
+ ],
+ )
+
+ preprocessor_defines_feature = feature(
+ name = "preprocessor_defines",
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = ["/D%{preprocessor_defines}"],
+ iterate_over = "preprocessor_defines",
+ ),
+ ],
+ ),
+ ],
+ )
+
+ generate_pdb_file_feature = feature(
+ name = "generate_pdb_file",
+ requires = [
+ feature_set(features = ["dbg"]),
+ feature_set(features = ["fastbuild"]),
+ ],
+ )
+
+ output_execpath_flags_feature = feature(
+ name = "output_execpath_flags",
+ flag_sets = [
+ flag_set(
+ actions = all_link_actions,
+ flag_groups = [
+ flag_group(
+ flags = ["/OUT:%{output_execpath}"],
+ expand_if_available = "output_execpath",
+ ),
+ ],
+ ),
+ ],
+ )
+
+ dynamic_link_msvcrt_no_debug_feature = feature(
+ name = "dynamic_link_msvcrt_no_debug",
+ flag_sets = [
+ flag_set(
+ actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile],
+ flag_groups = [flag_group(flags = ["/MD"])],
+ ),
+ flag_set(
+ actions = all_link_actions,
+ flag_groups = [flag_group(flags = ["/DEFAULTLIB:msvcrt.lib"])],
+ ),
+ ],
+ requires = [
+ feature_set(features = ["fastbuild"]),
+ feature_set(features = ["opt"]),
+ ],
+ )
+
+ disable_assertions_feature = feature(
+ name = "disable_assertions",
+ enabled = True,
+ flag_sets = [
+ flag_set(
+ actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile],
+ flag_groups = [flag_group(flags = ["/DNDEBUG"])],
+ with_features = [with_feature_set(features = ["opt"])],
+ ),
+ ],
+ )
+
+ has_configured_linker_path_feature = feature(name = "has_configured_linker_path")
+
+ supports_dynamic_linker_feature = feature(name = "supports_dynamic_linker", enabled = True)
+
+ no_stripping_feature = feature(name = "no_stripping")
+
+ linker_param_file_feature = feature(
+ name = "linker_param_file",
+ flag_sets = [
+ flag_set(
+ actions = all_link_actions +
+ [ACTION_NAMES.cpp_link_static_library],
+ flag_groups = [
+ flag_group(
+ flags = ["@%{linker_param_file}"],
+ expand_if_available = "linker_param_file",
+ ),
+ ],
+ ),
+ ],
+ )
+
+ ignore_noisy_warnings_feature = feature(
+ name = "ignore_noisy_warnings",
+ enabled = True,
+ flag_sets = [
+ flag_set(
+ actions = [ACTION_NAMES.cpp_link_static_library],
+ flag_groups = [flag_group(flags = ["/ignore:4221"])],
+ ),
+ ],
+ )
+
+ no_legacy_features_feature = feature(name = "no_legacy_features")
+
+ parse_showincludes_feature = feature(
+ name = "parse_showincludes",
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ],
+ flag_groups = [flag_group(flags = ["/showIncludes"])],
+ ),
+ ],
+ )
+
+ static_link_msvcrt_no_debug_feature = feature(
+ name = "static_link_msvcrt_no_debug",
+ flag_sets = [
+ flag_set(
+ actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile],
+ flag_groups = [flag_group(flags = ["/MT"])],
+ ),
+ flag_set(
+ actions = all_link_actions,
+ flag_groups = [flag_group(flags = ["/DEFAULTLIB:libcmt.lib"])],
+ ),
+ ],
+ requires = [
+ feature_set(features = ["fastbuild"]),
+ feature_set(features = ["opt"]),
+ ],
+ )
+
+ treat_warnings_as_errors_feature = feature(
+ name = "treat_warnings_as_errors",
+ flag_sets = [
+ flag_set(
+ actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile],
+ flag_groups = [flag_group(flags = ["/WX"])],
+ ),
+ ],
+ )
+
+ windows_export_all_symbols_feature = feature(name = "windows_export_all_symbols")
+
+ no_windows_export_all_symbols_feature = feature(name = "no_windows_export_all_symbols")
+
+ include_paths_feature = feature(
+ name = "include_paths",
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = ["/I%{quote_include_paths}"],
+ iterate_over = "quote_include_paths",
+ ),
+ flag_group(
+ flags = ["/I%{include_paths}"],
+ iterate_over = "include_paths",
+ ),
+ flag_group(
+ flags = ["/I%{system_include_paths}"],
+ iterate_over = "system_include_paths",
+ ),
+ ],
+ ),
+ ],
+ )
+
+ linkstamps_feature = feature(
+ name = "linkstamps",
+ flag_sets = [
+ flag_set(
+ actions = all_link_actions,
+ flag_groups = [
+ flag_group(
+ flags = ["%{linkstamp_paths}"],
+ iterate_over = "linkstamp_paths",
+ expand_if_available = "linkstamp_paths",
+ ),
+ ],
+ ),
+ ],
+ )
+
+ targets_windows_feature = feature(
+ name = "targets_windows",
+ enabled = True,
+ implies = ["copy_dynamic_libraries_to_binary"],
+ )
+
+ linker_subsystem_flag_feature = feature(
+ name = "linker_subsystem_flag",
+ flag_sets = [
+ flag_set(
+ actions = all_link_actions,
+ flag_groups = [flag_group(flags = ["/SUBSYSTEM:CONSOLE"])],
+ ),
+ ],
+ )
+
+ static_link_msvcrt_debug_feature = feature(
+ name = "static_link_msvcrt_debug",
+ flag_sets = [
+ flag_set(
+ actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile],
+ flag_groups = [flag_group(flags = ["/MTd"])],
+ ),
+ flag_set(
+ actions = all_link_actions,
+ flag_groups = [flag_group(flags = ["/DEFAULTLIB:libcmtd.lib"])],
+ ),
+ ],
+ requires = [feature_set(features = ["dbg"])],
+ )
+
+ frame_pointer_feature = feature(
+ name = "frame_pointer",
+ flag_sets = [
+ flag_set(
+ actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile],
+ flag_groups = [flag_group(flags = ["/Oy-"])],
+ ),
+ ],
+ )
+
+ compiler_output_flags_feature = feature(
+ name = "compiler_output_flags",
+ flag_sets = [
+ flag_set(
+ actions = [ACTION_NAMES.assemble],
+ flag_groups = [
+ flag_group(
+ flag_groups = [
+ flag_group(
+ flags = ["/Fo%{output_file}", "/Zi"],
+ expand_if_available = "output_file",
+ expand_if_not_available = "output_assembly_file",
+ ),
+ ],
+ expand_if_not_available = "output_preprocess_file",
+ ),
+ ],
+ ),
+ flag_set(
+ actions = [
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ],
+ flag_groups = [
+ flag_group(
+ flag_groups = [
+ flag_group(
+ flags = ["/Fo%{output_file}"],
+ expand_if_not_available = "output_preprocess_file",
+ ),
+ ],
+ expand_if_available = "output_file",
+ expand_if_not_available = "output_assembly_file",
+ ),
+ flag_group(
+ flag_groups = [
+ flag_group(
+ flags = ["/Fa%{output_file}"],
+ expand_if_available = "output_assembly_file",
+ ),
+ ],
+ expand_if_available = "output_file",
+ ),
+ flag_group(
+ flag_groups = [
+ flag_group(
+ flags = ["/P", "/Fi%{output_file}"],
+ expand_if_available = "output_preprocess_file",
+ ),
+ ],
+ expand_if_available = "output_file",
+ ),
+ ],
+ ),
+ ],
+ )
+
+ nologo_feature = feature(
+ name = "nologo",
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.cpp_link_executable,
+ ACTION_NAMES.cpp_link_dynamic_library,
+ ACTION_NAMES.cpp_link_nodeps_dynamic_library,
+ ACTION_NAMES.cpp_link_static_library,
+ ],
+ flag_groups = [flag_group(flags = ["/nologo"])],
+ ),
+ ],
+ )
+
+ smaller_binary_feature = feature(
+ name = "smaller_binary",
+ enabled = True,
+ flag_sets = [
+ flag_set(
+ actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile],
+ flag_groups = [flag_group(flags = ["/Gy", "/Gw"])],
+ with_features = [with_feature_set(features = ["opt"])],
+ ),
+ flag_set(
+ actions = all_link_actions,
+ flag_groups = [flag_group(flags = ["/OPT:ICF", "/OPT:REF"])],
+ with_features = [with_feature_set(features = ["opt"])],
+ ),
+ ],
+ )
+
+ compiler_input_flags_feature = feature(
+ name = "compiler_input_flags",
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = ["/c", "%{source_file}"],
+ expand_if_available = "source_file",
+ ),
+ ],
+ ),
+ ],
+ )
+
+ def_file_feature = feature(
+ name = "def_file",
+ flag_sets = [
+ flag_set(
+ actions = all_link_actions,
+ flag_groups = [
+ flag_group(
+ flags = ["/DEF:%{def_file_path}", "/ignore:4070"],
+ expand_if_available = "def_file_path",
+ ),
+ ],
+ ),
+ ],
+ )
+
+ msvc_env_feature = feature(
+ name = "msvc_env",
+ env_sets = [
+ env_set(
+ actions = [
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.cpp_link_executable,
+ ACTION_NAMES.cpp_link_dynamic_library,
+ ACTION_NAMES.cpp_link_nodeps_dynamic_library,
+ ACTION_NAMES.cpp_link_static_library,
+ ],
+ env_entries = [
+ env_entry(key = "PATH", value = "%{msvc_env_path}"),
+ env_entry(key = "TMP", value = "%{msvc_env_tmp}"),
+ env_entry(key = "TEMP", value = "%{msvc_env_tmp}"),
+ ],
+ ),
+ ],
+ implies = ["msvc_compile_env", "msvc_link_env"],
+ )
+
+ features = [
+ no_legacy_features_feature,
+ nologo_feature,
+ has_configured_linker_path_feature,
+ no_stripping_feature,
+ targets_windows_feature,
+ copy_dynamic_libraries_to_binary_feature,
+ default_compile_flags_feature,
+ msvc_env_feature,
+ msvc_compile_env_feature,
+ msvc_link_env_feature,
+ include_paths_feature,
+ preprocessor_defines_feature,
+ parse_showincludes_feature,
+ generate_pdb_file_feature,
+ shared_flag_feature,
+ linkstamps_feature,
+ output_execpath_flags_feature,
+ archiver_flags_feature,
+ input_param_flags_feature,
+ linker_subsystem_flag_feature,
+ user_link_flags_feature,
+ default_link_flags_feature,
+ linker_param_file_feature,
+ static_link_msvcrt_feature,
+ static_link_msvcrt_no_debug_feature,
+ dynamic_link_msvcrt_no_debug_feature,
+ static_link_msvcrt_debug_feature,
+ dynamic_link_msvcrt_debug_feature,
+ dbg_feature,
+ fastbuild_feature,
+ opt_feature,
+ frame_pointer_feature,
+ disable_assertions_feature,
+ determinism_feature,
+ treat_warnings_as_errors_feature,
+ smaller_binary_feature,
+ ignore_noisy_warnings_feature,
+ user_compile_flags_feature,
+ sysroot_feature,
+ unfiltered_compile_flags_feature,
+ compiler_output_flags_feature,
+ compiler_input_flags_feature,
+ def_file_feature,
+ windows_export_all_symbols_feature,
+ no_windows_export_all_symbols_feature,
+ supports_dynamic_linker_feature,
+ supports_interface_shared_libraries_feature,
+ ]
+
+ artifact_name_patterns = [
+ artifact_name_pattern(
+ category_name = "object_file",
+ prefix = "",
+ extension = ".obj",
+ ),
+ artifact_name_pattern(
+ category_name = "static_library",
+ prefix = "",
+ extension = ".lib",
+ ),
+ artifact_name_pattern(
+ category_name = "alwayslink_static_library",
+ prefix = "",
+ extension = ".lo.lib",
+ ),
+ artifact_name_pattern(
+ category_name = "executable",
+ prefix = "",
+ extension = ".exe",
+ ),
+ artifact_name_pattern(
+ category_name = "dynamic_library",
+ prefix = "",
+ extension = ".dll",
+ ),
+ artifact_name_pattern(
+ category_name = "interface_library",
+ prefix = "",
+ extension = ".if.lib",
+ ),
+ ]
+
+ make_variables = []
+
+ tool_paths = [
+ tool_path(name = "ar", path = "%{msvc_lib_path}"),
+ tool_path(name = "ml", path = "%{msvc_ml_path}"),
+ tool_path(name = "cpp", path = "%{msvc_cl_path}"),
+ tool_path(name = "gcc", path = "%{msvc_cl_path}"),
+ tool_path(name = "gcov", path = "wrapper/bin/msvc_nop.bat"),
+ tool_path(name = "ld", path = "%{msvc_link_path}"),
+ tool_path(name = "nm", path = "wrapper/bin/msvc_nop.bat"),
+ tool_path(
+ name = "objcopy",
+ path = "wrapper/bin/msvc_nop.bat",
+ ),
+ tool_path(
+ name = "objdump",
+ path = "wrapper/bin/msvc_nop.bat",
+ ),
+ tool_path(
+ name = "strip",
+ path = "wrapper/bin/msvc_nop.bat",
+ ),
+ ]
+
+ return cc_common.create_cc_toolchain_config_info(
+ ctx = ctx,
+ features = features,
+ action_configs = action_configs,
+ artifact_name_patterns = artifact_name_patterns,
+ cxx_builtin_include_directories = cxx_builtin_include_directories,
+ toolchain_identifier = toolchain_identifier,
+ host_system_name = host_system_name,
+ target_system_name = target_system_name,
+ target_cpu = target_cpu,
+ target_libc = target_libc,
+ compiler = compiler,
+ abi_version = abi_version,
+ abi_libc_version = abi_libc_version,
+ tool_paths = tool_paths,
+ make_variables = make_variables,
+ builtin_sysroot = builtin_sysroot,
+ cc_target_os = None,
+ )
+
+def _windows_msys_mingw_impl(ctx):
+ toolchain_identifier = "msys_x64_mingw"
+ host_system_name = "local"
+ target_system_name = "local"
+ target_cpu = "x64_windows"
+ target_libc = "mingw"
+ compiler = "mingw-gcc"
+ abi_version = "local"
+ abi_libc_version = "local"
+ cc_target_os = None
+ builtin_sysroot = None
+ action_configs = []
+
+ targets_windows_feature = feature(
+ name = "targets_windows",
+ implies = ["copy_dynamic_libraries_to_binary"],
+ enabled = True,
+ )
+
+ copy_dynamic_libraries_to_binary_feature = feature(name= "copy_dynamic_libraries_to_binary")
+
+ gcc_env_feature = feature(
+ name = "gcc_env",
+ enabled = True,
+ env_sets = [
+ env_set (
+ actions = [
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.cpp_link_executable,
+ ACTION_NAMES.cpp_link_dynamic_library,
+ ACTION_NAMES.cpp_link_nodeps_dynamic_library,
+ ACTION_NAMES.cpp_link_static_library,
+ ],
+ env_entries = [
+ env_entry(key = "PATH", value = "%{mingw_tool_bin_path}")
+ ],
+ ),
+ ],
+ )
+
+ msys_mingw_flags = [
+ %{msys_x64_mingw_cxx_content}
+ ]
+ msys_mingw_link_flags = [
+ %{msys_x64_mingw_link_content}
+ ]
+
+ default_compile_flags_feature = feature(
+ name = "default_compile_flags",
+ enabled = True,
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.linkstamp_compile,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ACTION_NAMES.lto_backend,
+ ACTION_NAMES.clif_match,
+ ],
+ ),
+ flag_set(
+ actions = [
+ ACTION_NAMES.linkstamp_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ACTION_NAMES.lto_backend,
+ ACTION_NAMES.clif_match,
+ ],
+ flag_groups = ([flag_group(flags = msys_mingw_flags)] if msys_mingw_flags else []),
+ ),
+ ],
+ )
+
+ default_link_flags_feature = feature(
+ name = "default_link_flags",
+ enabled = True,
+ flag_sets = [
+ flag_set(
+ actions = all_link_actions,
+ flag_groups = ([flag_group(flags = msys_mingw_link_flags)] if msys_mingw_link_flags else []),
+ ),
+ ],
+ )
+
+ supports_dynamic_linker_feature = feature(name = "supports_dynamic_linker", enabled = True)
+
+ features = [
+ targets_windows_feature,
+ copy_dynamic_libraries_to_binary_feature,
+ gcc_env_feature,
+ default_compile_flags_feature,
+ default_link_flags_feature,
+ supports_dynamic_linker_feature,
+ ]
+
+ cxx_builtin_include_directories = [
+%{mingw_cxx_builtin_include_directories}
+ ]
+
+ artifact_name_patterns = [
+ artifact_name_pattern(
+ category_name = "executable",
+ prefix = "",
+ extension = ".exe",
+ ),
+ ]
+
+ make_variables = []
+ tool_paths = [
+%{mingw_tool_paths}
+ ]
+
+ return cc_common.create_cc_toolchain_config_info(
+ ctx = ctx,
+ features = features,
+ action_configs = action_configs,
+ artifact_name_patterns = artifact_name_patterns,
+ cxx_builtin_include_directories = cxx_builtin_include_directories,
+ toolchain_identifier = toolchain_identifier,
+ host_system_name = host_system_name,
+ target_system_name = target_system_name,
+ target_cpu = target_cpu,
+ target_libc = target_libc,
+ compiler = compiler,
+ abi_version = abi_version,
+ abi_libc_version = abi_libc_version,
+ tool_paths = tool_paths,
+ make_variables = make_variables,
+ builtin_sysroot = builtin_sysroot,
+ cc_target_os = cc_target_os)
+
+
+def _armeabi_impl(ctx):
+ toolchain_identifier = "stub_armeabi-v7a"
+ host_system_name = "armeabi-v7a"
+ target_system_name = "armeabi-v7a"
+ target_cpu = "armeabi-v7a"
+ target_libc = "armeabi-v7a"
+ compiler = "compiler"
+ abi_version = "armeabi-v7a"
+ abi_libc_version = "armeabi-v7a"
+ cc_target_os = None
+ builtin_sysroot = None
+ action_configs = []
+
+ supports_pic_feature = feature(name = "supports_pic", enabled = True)
+ supports_dynamic_linker_feature = feature(name = "supports_dynamic_linker", enabled = True)
+ features = [supports_dynamic_linker_feature, supports_pic_feature]
+
+ cxx_builtin_include_directories = []
+ artifact_name_patterns = []
+ make_variables = []
+
+ tool_paths = [
+ tool_path(name = "ar", path = "/bin/false"),
+ tool_path(name = "compat-ld", path = "/bin/false"),
+ tool_path(name = "cpp", path = "/bin/false"),
+ tool_path(name = "dwp", path = "/bin/false"),
+ tool_path(name = "gcc", path = "/bin/false"),
+ tool_path(name = "gcov", path = "/bin/false"),
+ tool_path(name = "ld", path = "/bin/false"),
+ tool_path(name = "nm", path = "/bin/false"),
+ tool_path(name = "objcopy", path = "/bin/false"),
+ tool_path(name = "objdump", path = "/bin/false"),
+ tool_path(name = "strip", path = "/bin/false"),
+ ]
+
+ return cc_common.create_cc_toolchain_config_info(
+ ctx = ctx,
+ features = features,
+ action_configs = action_configs,
+ artifact_name_patterns = artifact_name_patterns,
+ cxx_builtin_include_directories = cxx_builtin_include_directories,
+ toolchain_identifier = toolchain_identifier,
+ host_system_name = host_system_name,
+ target_system_name = target_system_name,
+ target_cpu = target_cpu,
+ target_libc = target_libc,
+ compiler = compiler,
+ abi_version = abi_version,
+ abi_libc_version = abi_libc_version,
+ tool_paths = tool_paths,
+ make_variables = make_variables,
+ builtin_sysroot = builtin_sysroot,
+ cc_target_os = cc_target_os
+ )
+
+def _impl(ctx):
+ if ctx.attr.cpu == "armeabi-v7a":
+ return _armeabi_impl(ctx)
+ elif ctx.attr.cpu == "x64_windows" and ctx.attr.compiler == "msvc-cl":
+ return _windows_msvc_impl(ctx)
+ elif ctx.attr.cpu == "x64_windows" and ctx.attr.compiler == "mingw-gcc":
+ return _windows_msys_mingw_impl(ctx)
+
+ tool_paths = [
+%{tool_paths}
+ ]
+
+ cxx_builtin_include_directories = [
+%{cxx_builtin_include_directories}
+ ]
+
+ action_configs = []
+
+ compile_flags = [
+ %{compile_content}
+ ]
+
+ dbg_compile_flags = [
+ %{dbg_compile_content}
+ ]
+
+ opt_compile_flags = [
+ %{opt_compile_content}
+ ]
+
+ cxx_flags = [
+ %{cxx_content}
+ ]
+
+ link_flags = [
+ %{link_content}
+ ]
+
+ opt_link_flags = [
+ %{opt_link_content}
+ ]
+
+ unfiltered_compile_flags = [
+ %{unfiltered_content}
+ ]
+
+ targets_windows_feature = feature(
+ name = "targets_windows",
+ implies = ["copy_dynamic_libraries_to_binary"],
+ enabled = True,
+ )
+
+ copy_dynamic_libraries_to_binary_feature = feature(name= "copy_dynamic_libraries_to_binary")
+
+ gcc_env_feature = feature(
+ name = "gcc_env",
+ enabled = True,
+ env_sets = [
+ env_set (
+ actions = [
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.cpp_link_executable,
+ ACTION_NAMES.cpp_link_dynamic_library,
+ ACTION_NAMES.cpp_link_nodeps_dynamic_library,
+ ACTION_NAMES.cpp_link_static_library,
+ ],
+ env_entries = [
+ env_entry(key = "PATH", value = "%{tool_bin_path}")
+ ],
+ ),
+ ],
+ )
+
+ windows_features = [
+ targets_windows_feature,
+ copy_dynamic_libraries_to_binary_feature,
+ gcc_env_feature,
+ ]
+
+ %{coverage_feature}
+
+ supports_pic_feature = feature(
+ name = "supports_pic",
+ enabled = True,
+ )
+ supports_start_end_lib_feature = feature(
+ name = "supports_start_end_lib",
+ enabled = True,
+ )
+
+ default_compile_flags_feature = feature(
+ name = "default_compile_flags",
+ enabled = True,
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.linkstamp_compile,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ACTION_NAMES.lto_backend,
+ ACTION_NAMES.clif_match,
+ ],
+ flag_groups = ([flag_group(flags = compile_flags)] if compile_flags else []),
+ ),
+ flag_set(
+ actions = [
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.linkstamp_compile,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ACTION_NAMES.lto_backend,
+ ACTION_NAMES.clif_match,
+ ],
+ flag_groups = ([flag_group(flags = dbg_compile_flags)] if dbg_compile_flags else []),
+ with_features = [with_feature_set(features = ["dbg"])],
+ ),
+ flag_set(
+ actions = [
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.linkstamp_compile,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ACTION_NAMES.lto_backend,
+ ACTION_NAMES.clif_match,
+ ],
+ flag_groups = ([flag_group(flags = opt_compile_flags)] if opt_compile_flags else []),
+ with_features = [with_feature_set(features = ["opt"])],
+ ),
+ flag_set(
+ actions = [
+ ACTION_NAMES.linkstamp_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ACTION_NAMES.lto_backend,
+ ACTION_NAMES.clif_match,
+ ],
+ flag_groups = ([flag_group(flags = cxx_flags)] if cxx_flags else []),
+ ),
+ ],
+ )
+
+ default_link_flags_feature = feature(
+ name = "default_link_flags",
+ enabled = True,
+ flag_sets = [
+ flag_set(
+ actions = all_link_actions,
+ flag_groups = ([flag_group(flags = link_flags)] if link_flags else []),
+ ),
+ flag_set(
+ actions = all_link_actions,
+ flag_groups = ([flag_group(flags = opt_link_flags)] if opt_link_flags else []),
+ with_features = [with_feature_set(features = ["opt"])],
+ ),
+ ],
+ )
+
+ dbg_feature = feature(name = "dbg")
+
+ opt_feature = feature(name = "opt")
+
+ sysroot_feature = feature(
+ name = "sysroot",
+ enabled = True,
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.linkstamp_compile,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ACTION_NAMES.lto_backend,
+ ACTION_NAMES.clif_match,
+ ACTION_NAMES.cpp_link_executable,
+ ACTION_NAMES.cpp_link_dynamic_library,
+ ACTION_NAMES.cpp_link_nodeps_dynamic_library,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = ["--sysroot=%{sysroot}"],
+ expand_if_available = "sysroot",
+ ),
+ ],
+ ),
+ ],
+ )
+
+ fdo_optimize_feature = feature(
+ name = "fdo_optimize",
+ flag_sets = [
+ flag_set(
+ actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile],
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-fprofile-use=%{fdo_profile_path}",
+ "-fprofile-correction",
+ ],
+ expand_if_available = "fdo_profile_path",
+ ),
+ ],
+ ),
+ ],
+ provides = ["profile"],
+ )
+
+ supports_dynamic_linker_feature = feature(name = "supports_dynamic_linker", enabled = True)
+
+ user_compile_flags_feature = feature(
+ name = "user_compile_flags",
+ enabled = True,
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.linkstamp_compile,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ACTION_NAMES.lto_backend,
+ ACTION_NAMES.clif_match,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = ["%{user_compile_flags}"],
+ iterate_over = "user_compile_flags",
+ expand_if_available = "user_compile_flags",
+ ),
+ ],
+ ),
+ ],
+ )
+
+ unfiltered_compile_flags_feature = feature(
+ name = "unfiltered_compile_flags",
+ enabled = True,
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.linkstamp_compile,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ACTION_NAMES.lto_backend,
+ ACTION_NAMES.clif_match,
+ ],
+ flag_groups = ([flag_group(flags = unfiltered_compile_flags)] if unfiltered_compile_flags else []),
+ ),
+ ],
+ )
+
+ features = %{use_windows_features}[
+ supports_pic_feature,
+ %{supports_start_end_lib}
+ %{use_coverage_feature}
+ default_compile_flags_feature,
+ default_link_flags_feature,
+ fdo_optimize_feature,
+ supports_dynamic_linker_feature,
+ dbg_feature,
+ opt_feature,
+ user_compile_flags_feature,
+ sysroot_feature,
+ unfiltered_compile_flags_feature,
+ ]
+
+ artifact_name_patterns = [
+%{artifact_name_patterns}
+ ]
+
+ make_variables = []
+
+ return cc_common.create_cc_toolchain_config_info(
+ ctx = ctx,
+ features = features,
+ action_configs = action_configs,
+ artifact_name_patterns = artifact_name_patterns,
+ cxx_builtin_include_directories = cxx_builtin_include_directories,
+ toolchain_identifier = "%{toolchain_identifier}",
+ host_system_name = "%{host_system_name}",
+ target_system_name = "%{target_system_name}",
+ target_cpu = "%{target_cpu}",
+ target_libc = "%{target_libc}",
+ compiler = "%{compiler}",
+ abi_version = "%{abi_version}",
+ abi_libc_version = "%{abi_libc_version}",
+ tool_paths = tool_paths,
+ make_variables = make_variables,
+ builtin_sysroot = "%{builtin_sysroot}",
+ cc_target_os = None,
+ )
+
+cc_toolchain_config = rule(
+ implementation = _impl,
+ attrs = {
+ "cpu" : attr.string(mandatory = True),
+ "compiler": attr.string(),
+ },
+ provides = [CcToolchainConfigInfo],
+)
diff --git a/tools/cpp/lib_cc_configure.bzl b/tools/cpp/lib_cc_configure.bzl
index 3bce481..db9a634 100644
--- a/tools/cpp/lib_cc_configure.bzl
+++ b/tools/cpp/lib_cc_configure.bzl
@@ -202,3 +202,6 @@
def build_flags(flags):
"""Convert `flags` to a string of flag fields."""
return "\n".join([" flag: '" + flag + "'" for flag in flags])
+
+def get_starlark_list(values):
+ return "\"" + "\",\n \"".join(values) + "\""
diff --git a/tools/cpp/osx_cc_configure.bzl b/tools/cpp/osx_cc_configure.bzl
index aef9e34..fca2434 100644
--- a/tools/cpp/osx_cc_configure.bzl
+++ b/tools/cpp/osx_cc_configure.bzl
@@ -54,7 +54,7 @@
"@bazel_tools//tools/objc:make_hashed_objlist.py",
"@bazel_tools//tools/objc:xcrunwrapper.sh",
"@bazel_tools//tools/osx/crosstool:BUILD.tpl",
- "@bazel_tools//tools/osx/crosstool:CROSSTOOL.tpl",
+ "@bazel_tools//tools/osx/crosstool:cc_toolchain_config.bzl.tpl",
"@bazel_tools//tools/osx/crosstool:osx_archs.bzl",
"@bazel_tools//tools/osx/crosstool:wrapped_ar.tpl",
"@bazel_tools//tools/osx/crosstool:wrapped_clang.cc",
@@ -148,13 +148,13 @@
escaped_include_paths = _get_escaped_xcode_cxx_inc_directories(repository_ctx, cc, xcode_toolchains)
escaped_cxx_include_directories = []
for path in escaped_include_paths:
- escaped_cxx_include_directories.append(("cxx_builtin_include_directory: \"%s\"" % path))
+ escaped_cxx_include_directories.append((" \"%s\"," % path))
if xcodeloc_err:
escaped_cxx_include_directories.append("# Error: " + xcodeloc_err + "\n")
repository_ctx.template(
- "CROSSTOOL",
- paths["@bazel_tools//tools/osx/crosstool:CROSSTOOL.tpl"],
- {"%{cxx_builtin_include_directory}": "\n".join(escaped_cxx_include_directories)},
+ "cc_toolchain_config.bzl",
+ paths["@bazel_tools//tools/osx/crosstool:cc_toolchain_config.bzl.tpl"],
+ {"%{cxx_builtin_include_directories}": "\n".join(escaped_cxx_include_directories)},
)
else:
configure_unix_toolchain(repository_ctx, cpu_value = "darwin", overriden_tools = overriden_tools)
diff --git a/tools/cpp/unix_cc_configure.bzl b/tools/cpp/unix_cc_configure.bzl
index 52b04ed..588e33b 100644
--- a/tools/cpp/unix_cc_configure.bzl
+++ b/tools/cpp/unix_cc_configure.bzl
@@ -18,9 +18,9 @@
"@bazel_tools//tools/cpp:lib_cc_configure.bzl",
"auto_configure_fail",
"auto_configure_warning",
- "build_flags",
"escape_string",
"get_env_var",
+ "get_starlark_list",
"resolve_labels",
"split_escaped",
"which",
@@ -76,6 +76,10 @@
"""Build the list of %-escaped tool_path for the CROSSTOOL file."""
return [" tool_path { name: \"%s\" path: \"%s\" }" % (k, escape_string(d[k])) for k in d]
+def _build_tool_path_starlark(d):
+ """Build the list of %-escaped tool_path for the Starlark rule."""
+ return "\n".join([" tool_path ( name= \"%s\", path= \"%s\" )," % (k, escape_string(d[k])) for k in d])
+
def _find_tool(repository_ctx, tool, overriden_tools):
"""Find a tool for repository, taking overriden tools into account."""
if tool in overriden_tools:
@@ -235,45 +239,48 @@
enable_warning = False,
)
if darwin or use_llvm_cov:
- compile_flags = """flag_group {
- flag: '-fprofile-instr-generate'
- flag: '-fcoverage-mapping'
- }"""
- link_flags = """flag_group {
- flag: '-fprofile-instr-generate'
- }"""
+ compile_flags = """flag_group (
+ flags = ["-fprofile-instr-generate", "-fcoverage-mapping"],
+ ),"""
+ link_flags = """flag_group (flags = ["-fprofile-instr-generate"]),"""
else:
# gcc requires --coverage being passed for compilation and linking
# https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html#Instrumentation-Options
- compile_flags = """flag_group {
- flag: '--coverage'
- }"""
- link_flags = """flag_group {
- flag: '--coverage'
- }"""
+ compile_flags = """flag_group (flags = ["--coverage"]),"""
+ link_flags = """flag_group (flags = ["--coverage"]),"""
# Note that we also set --coverage for c++-link-nodeps-dynamic-library. The
# generated code contains references to gcov symbols, and the dynamic linker
# can't resolve them unless the library is linked against gcov.
return """
- feature {
- name: 'coverage'
- provides: 'profile'
- flag_set {
- action: 'preprocess-assemble'
- action: 'c-compile'
- action: 'c++-compile'
- action: 'c++-header-parsing'
- action: 'c++-module-compile'
- """ + compile_flags + """
- }
- flag_set {
- action: 'c++-link-dynamic-library'
- action: 'c++-link-nodeps-dynamic-library'
- action: 'c++-link-executable'
- """ + link_flags + """
- }
- }
+ coverage_feature = feature (
+ name = "coverage",
+ provides = ["profile"],
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ],
+ flag_groups = [
+ """ + compile_flags + """
+ ],
+ ),
+ flag_set (
+ actions = [
+ ACTION_NAMES.cpp_link_dynamic_library,
+ ACTION_NAMES.cpp_link_nodeps_dynamic_library,
+ ACTION_NAMES.cpp_link_executable,
+ ],
+ flag_groups = [
+ """ + link_flags + """
+ ],
+ ),
+ ],
+ )
"""
def _find_generic(repository_ctx, name, env_name, overriden_tools, warn = False, silent = False):
@@ -314,7 +321,7 @@
"""Configure C++ toolchain on Unix platforms."""
paths = resolve_labels(repository_ctx, [
"@bazel_tools//tools/cpp:BUILD.tpl",
- "@bazel_tools//tools/cpp:CROSSTOOL.tpl",
+ "@bazel_tools//tools/cpp:cc_toolchain_config.bzl.tpl",
"@bazel_tools//tools/cpp:linux_cc_wrapper.sh.tpl",
"@bazel_tools//tools/cpp:osx_cc_wrapper.sh.tpl",
])
@@ -354,6 +361,7 @@
"compiler",
False,
),
+ "%{target_cpu}": escape_string(get_env_var(repository_ctx, "BAZEL_TARGET_CPU", cpu_value, False)),
},
)
@@ -379,49 +387,40 @@
else:
# cc is inside the repository, don't set -B.
bin_search_flag = []
+
repository_ctx.template(
- "CROSSTOOL",
- paths["@bazel_tools//tools/cpp:CROSSTOOL.tpl"],
+ "cc_toolchain_config.bzl",
+ paths["@bazel_tools//tools/cpp:cc_toolchain_config.bzl.tpl"],
{
- "%{cpu}": escape_string(cpu_value),
- "%{default_toolchain_name}": escape_string(cc_toolchain_identifier),
- "%{toolchain_name}": escape_string(cc_toolchain_identifier),
- "%{top_level_content}": "\n".join(_build_tool_path(tool_paths)) + "\n".join(
- [
- _field("abi_version", escape_string(get_env_var(repository_ctx, "ABI_VERSION", "local", False))),
- _field("abi_version", escape_string(get_env_var(repository_ctx, "ABI_VERSION", "local", False))),
- _field("abi_libc_version", escape_string(get_env_var(repository_ctx, "ABI_LIBC_VERSION", "local", False))),
- _field("builtin_sysroot", ""),
- _field("compiler", escape_string(get_env_var(repository_ctx, "BAZEL_COMPILER", "compiler", False))),
- _field("host_system_name", escape_string(get_env_var(repository_ctx, "BAZEL_HOST_SYSTEM", "local", False))),
- _field("target_libc", "macosx" if darwin else escape_string(get_env_var(repository_ctx, "BAZEL_TARGET_LIBC", "local", False))),
- _field("target_cpu", escape_string(get_env_var(repository_ctx, "BAZEL_TARGET_CPU", cpu_value, False))),
- _field("target_system_name", escape_string(get_env_var(repository_ctx, "BAZEL_TARGET_SYSTEM", "local", False))),
- _field(
- "cxx_builtin_include_directory",
- _uniq(
- get_escaped_cxx_inc_directories(repository_ctx, cc, "-xc") +
- get_escaped_cxx_inc_directories(repository_ctx, cc, "-xc++", cxx_opts) +
- get_escaped_cxx_inc_directories(
- repository_ctx,
- cc,
- "-xc",
- _get_no_canonical_prefixes_opt(repository_ctx, cc),
- ) +
- get_escaped_cxx_inc_directories(
- repository_ctx,
- cc,
- "-xc++",
- cxx_opts + _get_no_canonical_prefixes_opt(repository_ctx, cc),
- ),
- ),
+ "%{toolchain_identifier}": escape_string(cc_toolchain_identifier),
+ "%{abi_version}": escape_string(get_env_var(repository_ctx, "ABI_VERSION", "local", False)),
+ "%{abi_libc_version}": escape_string(get_env_var(repository_ctx, "ABI_LIBC_VERSION", "local", False)),
+ "%{builtin_sysroot}": "",
+ "%{compiler}": escape_string(get_env_var(repository_ctx, "BAZEL_COMPILER", "compiler", False)),
+ "%{host_system_name}": escape_string(get_env_var(repository_ctx, "BAZEL_HOST_SYSTEM", "local", False)),
+ "%{target_libc}": "macosx" if darwin else escape_string(get_env_var(repository_ctx, "BAZEL_TARGET_LIBC", "local", False)),
+ "%{target_cpu}": escape_string(get_env_var(repository_ctx, "BAZEL_TARGET_CPU", cpu_value, False)),
+ "%{target_system_name}": escape_string(get_env_var(repository_ctx, "BAZEL_TARGET_SYSTEM", "local", False)),
+ "%{tool_paths}": _build_tool_path_starlark(tool_paths),
+ "%{cxx_builtin_include_directories}": get_starlark_list(
+ _uniq(
+ get_escaped_cxx_inc_directories(repository_ctx, cc, "-xc") +
+ get_escaped_cxx_inc_directories(repository_ctx, cc, "-xc++", cxx_opts) +
+ get_escaped_cxx_inc_directories(
+ repository_ctx,
+ cc,
+ "-xc",
+ _get_no_canonical_prefixes_opt(repository_ctx, cc),
+ ) +
+ get_escaped_cxx_inc_directories(
+ repository_ctx,
+ cc,
+ "-xc++",
+ cxx_opts + _get_no_canonical_prefixes_opt(repository_ctx, cc),
),
- _feature("supports_pic", True),
- _feature("supports_start_end_lib", True) if supports_gold_linker else "",
- _coverage_feature(repository_ctx, darwin),
- ],
+ ),
),
- "%{compile_content}": build_flags(
+ "%{compile_content}": get_starlark_list(
[
# Security hardening requires optimization.
# We need to undef it as some distributions now have it enabled by default.
@@ -446,8 +445,8 @@
"-fno-omit-frame-pointer",
],
),
- "%{cxx_content}": build_flags(cxx_opts + _escaped_cplus_include_paths(repository_ctx)),
- "%{link_content}": build_flags((
+ "%{cxx_content}": get_starlark_list(cxx_opts + _escaped_cplus_include_paths(repository_ctx)),
+ "%{link_content}": get_starlark_list((
["-fuse-ld=gold"] if supports_gold_linker else []
) + _add_linker_option_if_supported(
repository_ctx,
@@ -475,7 +474,7 @@
"-pass-exit-codes",
)
) + link_opts),
- "%{opt_compile_content}": build_flags(
+ "%{opt_compile_content}": get_starlark_list(
[
# No debug symbols.
# Maybe we should enable https://gcc.gnu.org/wiki/DebugFission for opt or
@@ -500,7 +499,7 @@
"-fdata-sections",
],
),
- "%{opt_link_content}": build_flags(
+ "%{opt_link_content}": get_starlark_list(
[] if darwin else _add_linker_option_if_supported(
repository_ctx,
cc,
@@ -508,7 +507,7 @@
"-gc-sections",
),
),
- "%{unfiltered_content}": build_flags(
+ "%{unfiltered_content}": get_starlark_list(
_get_no_canonical_prefixes_opt(repository_ctx, cc) + [
# Make C++ compilation deterministic. Use linkstamping instead of these
# compiler symbols.
@@ -518,7 +517,7 @@
"-D__TIME__=\\\"redacted\\\"",
],
),
- "%{dbg_compile_content}": build_flags(["-g"]),
+ "%{dbg_compile_content}": get_starlark_list(["-g"]),
"%{msvc_env_tmp}": "",
"%{msvc_env_path}": "",
"%{msvc_env_include}": "",
@@ -527,9 +526,18 @@
"%{msvc_ml_path}": "",
"%{msvc_link_path}": "",
"%{msvc_lib_path}": "",
- "%{msys_x64_mingw_top_level_content}": "",
"%{msys_x64_mingw_cxx_content}": "",
"%{msys_x64_mingw_link_content}": "",
- "%{msvc_x64_top_level_content}": "",
+ "%{dbg_mode_debug}": "",
+ "%{fastbuild_mode_debug}": "",
+ "%{coverage_feature}": _coverage_feature(repository_ctx, darwin),
+ "%{use_coverage_feature}": "coverage_feature,",
+ "%{supports_start_end_lib}": "supports_start_end_lib_feature," if supports_gold_linker else "",
+ "%{use_windows_features}": "",
+ "%{mingw_tool_paths}": "",
+ "%{mingw_cxx_builtin_include_directories}": "",
+ "%{artifact_name_patterns}": "",
+ "%{tool_bin_path}": "NOT_USED",
+ "%{mingw_tool_bin_path}": "NOT_USED",
},
)
diff --git a/tools/cpp/windows_cc_configure.bzl b/tools/cpp/windows_cc_configure.bzl
index 4247839..952d9fe 100644
--- a/tools/cpp/windows_cc_configure.bzl
+++ b/tools/cpp/windows_cc_configure.bzl
@@ -18,10 +18,10 @@
"@bazel_tools//tools/cpp:lib_cc_configure.bzl",
"auto_configure_fail",
"auto_configure_warning",
- "build_flags",
"escape_string",
"execute",
"get_env_var",
+ "get_starlark_list",
"is_cc_configure_debug",
"resolve_labels",
)
@@ -31,8 +31,8 @@
if is_cc_configure_debug(repository_ctx):
auto_configure_warning(msg)
-def _get_escaped_windows_msys_crosstool_content(repository_ctx, use_mingw = False):
- """Return the content of msys crosstool."""
+def _get_escaped_windows_msys_starlark_content(repository_ctx, use_mingw = False):
+ """Return the content of msys cc toolchain rule."""
bazel_sh = get_env_var(repository_ctx, "BAZEL_SH", "", False).replace("\\", "/").lower()
tokens = bazel_sh.rsplit("/", 1)
msys_root = ""
@@ -50,54 +50,22 @@
tool_path[tool] = tool_bin_path + "/" + tool
else:
tool_path[tool] = "msys_gcc_installation_error.bat"
-
- return (((
- ' abi_version: "local"\n' +
- ' abi_libc_version: "local"\n' +
- ' builtin_sysroot: ""\n' +
- ' compiler: "msys-gcc"\n' +
- ' host_system_name: "local"\n' +
- " needsPic: false\n" +
- ' target_libc: "msys"\n' +
- ' target_cpu: "x64_windows"\n' +
- ' target_system_name: "local"\n'
- ) if not use_mingw else "") +
- ' tool_path { name: "ar" path: "%s" }\n' % tool_path["ar"] +
- ' tool_path { name: "compat-ld" path: "%s" }\n' % tool_path["ld"] +
- ' tool_path { name: "cpp" path: "%s" }\n' % tool_path["cpp"] +
- ' tool_path { name: "dwp" path: "%s" }\n' % tool_path["dwp"] +
- ' tool_path { name: "gcc" path: "%s" }\n' % tool_path["gcc"] +
- ' tool_path { name: "gcov" path: "%s" }\n' % tool_path["gcov"] +
- ' tool_path { name: "ld" path: "%s" }\n' % tool_path["ld"] +
- ' tool_path { name: "nm" path: "%s" }\n' % tool_path["nm"] +
- ' tool_path { name: "objcopy" path: "%s" }\n' % tool_path["objcopy"] +
- ' tool_path { name: "objdump" path: "%s" }\n' % tool_path["objdump"] +
- ' tool_path { name: "strip" path: "%s" }\n' % tool_path["strip"] +
- ((' cxx_builtin_include_directory: "%s/"\n' % tool_path_prefix) if msys_root else "") +
- ' artifact_name_pattern { category_name: "executable" prefix: "" extension: ".exe"}\n' +
- ' feature { name: "targets_windows" implies: "copy_dynamic_libraries_to_binary" enabled: true }\n' +
- ' feature { name: "copy_dynamic_libraries_to_binary" }\n' +
- " feature {\n" +
- " name: 'gcc_env'\n" +
- " enabled: true\n" +
- " env_set {\n" +
- ' action: "c-compile"\n' +
- ' action: "c++-compile"\n' +
- ' action: "c++-module-compile"\n' +
- ' action: "c++-module-codegen"\n' +
- ' action: "c++-header-parsing"\n' +
- ' action: "assemble"\n' +
- ' action: "preprocess-assemble"\n' +
- ' action: "c++-link-executable"\n' +
- ' action: "c++-link-dynamic-library"\n' +
- ' action: "c++-link-nodeps-dynamic-library"\n' +
- ' action: "c++-link-static-library"\n' +
- " env_entry {\n" +
- ' key: "PATH"\n' +
- ' value: "%s"\n' % tool_bin_path +
- " }\n" +
- " }\n" +
- " }")
+ tool_paths = (
+ ' tool_path (name= "ar", path= "%s"),\n' % tool_path["ar"] +
+ ' tool_path (name= "compat-ld", path= "%s"),\n' % tool_path["ld"] +
+ ' tool_path (name= "cpp", path= "%s"),\n' % tool_path["cpp"] +
+ ' tool_path (name= "dwp", path= "%s"),\n' % tool_path["dwp"] +
+ ' tool_path (name= "gcc", path= "%s"),\n' % tool_path["gcc"] +
+ ' tool_path (name= "gcov", path= "%s"),\n' % tool_path["gcov"] +
+ ' tool_path (name= "ld", path= "%s"),\n' % tool_path["ld"] +
+ ' tool_path (name= "nm", path= "%s"),\n' % tool_path["nm"] +
+ ' tool_path (name= "objcopy", path= "%s"),\n' % tool_path["objcopy"] +
+ ' tool_path (name= "objdump", path= "%s"),\n' % tool_path["objdump"] +
+ ' tool_path (name= "strip", path= "%s"),\n' % tool_path["strip"]
+ )
+ include_directories = (' "%s/",\n ' % tool_path_prefix) if msys_root else ""
+ artifact_name_patterns = ' artifact_name_pattern(category_name="executable", prefix="", extension=".exe"),'
+ return tool_paths, tool_bin_path, include_directories, artifact_name_patterns
def _get_system_root(repository_ctx):
"""Get System root path on Windows, default is C:\\\Windows. Doesn't %-escape the result."""
@@ -350,8 +318,7 @@
"""Configure C++ toolchain on Windows."""
paths = resolve_labels(repository_ctx, [
"@bazel_tools//tools/cpp:BUILD.static.windows",
- "@bazel_tools//tools/cpp:CROSSTOOL",
- "@bazel_tools//tools/cpp:CROSSTOOL.tpl",
+ "@bazel_tools//tools/cpp:cc_toolchain_config.bzl.tpl",
"@bazel_tools//tools/cpp:vc_installation_error.bat.tpl",
"@bazel_tools//tools/cpp:msys_gcc_installation_error.bat",
])
@@ -386,14 +353,14 @@
{"%{vc_error_message}": message},
)
+ tool_paths_mingw, tool_bin_path_mingw, inc_dir_mingw, _ = _get_escaped_windows_msys_starlark_content(repository_ctx, use_mingw = True)
+ tool_paths, tool_bin_path, inc_dir, artifact_patterns = _get_escaped_windows_msys_starlark_content(repository_ctx)
if not vc_path or missing_tools:
repository_ctx.template(
- "CROSSTOOL",
- paths["@bazel_tools//tools/cpp:CROSSTOOL.tpl"],
+ "cc_toolchain_config.bzl",
+ paths["@bazel_tools//tools/cpp:cc_toolchain_config.bzl.tpl"],
{
- "%{cpu}": "x64_windows",
- "%{default_toolchain_name}": "msvc_x64",
- "%{toolchain_name}": "msys_x64",
+ "%{toolchain_identifier}": "msys_x64",
"%{msvc_env_tmp}": "",
"%{msvc_env_path}": "",
"%{msvc_env_include}": "",
@@ -402,20 +369,36 @@
"%{msvc_ml_path}": "vc_installation_error.bat",
"%{msvc_link_path}": "vc_installation_error.bat",
"%{msvc_lib_path}": "vc_installation_error.bat",
- "%{msys_x64_mingw_top_level_content}": _get_escaped_windows_msys_crosstool_content(repository_ctx, use_mingw = True),
- "%{msys_x64_mingw_cxx_content}": build_flags(["-std=gnu++0x"]),
- "%{msys_x64_mingw_link_content}": build_flags(["-lstdc++"]),
+ "%{msys_x64_mingw_cxx_content}": get_starlark_list(["-std=gnu++0x"]),
+ "%{msys_x64_mingw_link_content}": get_starlark_list(["-lstdc++"]),
"%{dbg_mode_debug}": "/DEBUG",
"%{fastbuild_mode_debug}": "/DEBUG",
- "%{top_level_content}": _get_escaped_windows_msys_crosstool_content(repository_ctx),
"%{compile_content}": "",
- "%{cxx_content}": build_flags(["-std=gnu++0x"]),
- "%{link_content}": build_flags(["-lstdc++"]),
+ "%{cxx_content}": get_starlark_list(["-std=gnu++0x"]),
+ "%{link_content}": get_starlark_list(["-lstdc++"]),
"%{opt_compile_content}": "",
"%{opt_link_content}": "",
"%{unfiltered_content}": "",
"%{dbg_compile_content}": "",
- "%{msvc_x64_top_level_content}": "",
+ "%{cxx_builtin_include_directories}": inc_dir,
+ "%{mingw_cxx_builtin_include_directories}": inc_dir_mingw,
+ "%{coverage_feature}": "",
+ "%{use_coverage_feature}": "",
+ "%{supports_start_end_lib}": "",
+ "%{use_windows_features}": "windows_features + ",
+ "%{abi_version}": "local",
+ "%{abi_libc_version}": "local",
+ "%{builtin_sysroot}": "",
+ "%{compiler}": "msys-gcc",
+ "%{host_system_name}": "local",
+ "%{target_libc}": "msys",
+ "%{target_cpu}": "x64_windows",
+ "%{target_system_name}": "local",
+ "%{tool_paths}": tool_paths,
+ "%{mingw_tool_paths}": tool_paths_mingw,
+ "%{artifact_name_patterns}": artifact_patterns,
+ "%{tool_bin_path}": tool_bin_path,
+ "%{mingw_tool_bin_path}": tool_bin_path_mingw,
},
)
return
@@ -451,24 +434,22 @@
for path in escaped_include_paths.split(";"):
if path:
- escaped_cxx_include_directories.append("cxx_builtin_include_directory: \"%s\"" % path)
+ escaped_cxx_include_directories.append("\"%s\"" % path)
if llvm_path:
clang_version = _get_clang_version(repository_ctx, cl_path)
clang_dir = llvm_path + "\\lib\\clang\\" + clang_version
clang_include_path = (clang_dir + "\\include").replace("\\", "\\\\")
- escaped_cxx_include_directories.append("cxx_builtin_include_directory: \"%s\"" % clang_include_path)
+ escaped_cxx_include_directories.append("\"%s\"" % clang_include_path)
clang_lib_path = (clang_dir + "\\lib\\windows").replace("\\", "\\\\")
escaped_lib_paths = escaped_lib_paths + ";" + clang_lib_path
support_debug_fastlink = _is_support_debug_fastlink(repository_ctx, link_path)
repository_ctx.template(
- "CROSSTOOL",
- paths["@bazel_tools//tools/cpp:CROSSTOOL.tpl"],
+ "cc_toolchain_config.bzl",
+ paths["@bazel_tools//tools/cpp:cc_toolchain_config.bzl.tpl"],
{
- "%{cpu}": "x64_windows",
- "%{default_toolchain_name}": "msvc_x64",
- "%{toolchain_name}": "msys_x64",
+ "%{toolchain_identifier}": "msys_x64",
"%{msvc_env_tmp}": escaped_tmp_dir,
"%{msvc_env_path}": escaped_paths,
"%{msvc_env_include}": escaped_include_paths,
@@ -479,17 +460,33 @@
"%{msvc_lib_path}": lib_path,
"%{dbg_mode_debug}": "/DEBUG:FULL" if support_debug_fastlink else "/DEBUG",
"%{fastbuild_mode_debug}": "/DEBUG:FASTLINK" if support_debug_fastlink else "/DEBUG",
- "%{top_level_content}": _get_escaped_windows_msys_crosstool_content(repository_ctx),
- "%{msys_x64_mingw_top_level_content}": _get_escaped_windows_msys_crosstool_content(repository_ctx, use_mingw = True),
- "%{msys_x64_mingw_cxx_content}": build_flags(["-std=gnu++0x"]),
- "%{msys_x64_mingw_link_content}": build_flags(["-lstdc++"]),
+ "%{msys_x64_mingw_cxx_content}": get_starlark_list(["-std=gnu++0x"]),
+ "%{msys_x64_mingw_link_content}": get_starlark_list(["-lstdc++"]),
"%{compile_content}": "",
- "%{cxx_content}": build_flags(["-std=gnu++0x"]),
- "%{link_content}": build_flags(["-lstdc++"]),
+ "%{cxx_content}": get_starlark_list(["-std=gnu++0x"]),
+ "%{link_content}": get_starlark_list(["-lstdc++"]),
"%{opt_compile_content}": "",
"%{opt_link_content}": "",
"%{unfiltered_content}": "",
"%{dbg_compile_content}": "",
- "%{msvc_x64_top_level_content}": "\n".join(escaped_cxx_include_directories),
+ "%{cxx_builtin_include_directories}": inc_dir + ",\n ".join(escaped_cxx_include_directories),
+ "%{mingw_cxx_builtin_include_directories}": inc_dir_mingw + ",\n ".join(escaped_cxx_include_directories),
+ "%{coverage_feature}": "",
+ "%{use_coverage_feature}": "",
+ "%{supports_start_end_lib}": "",
+ "%{use_windows_features}": "windows_features + ",
+ "%{abi_version}": "local",
+ "%{abi_libc_version}": "local",
+ "%{builtin_sysroot}": "",
+ "%{compiler}": "msys-gcc",
+ "%{host_system_name}": "local",
+ "%{target_libc}": "msys",
+ "%{target_cpu}": "x64_windows",
+ "%{target_system_name}": "local",
+ "%{tool_paths}": tool_paths,
+ "%{mingw_tool_paths}": tool_paths_mingw,
+ "%{artifact_name_patterns}": artifact_patterns,
+ "%{tool_bin_path}": tool_bin_path,
+ "%{mingw_tool_bin_path}": tool_bin_path_mingw,
},
)
diff --git a/tools/osx/crosstool/BUILD.tpl b/tools/osx/crosstool/BUILD.tpl
index 9a694d2..6f49c97 100644
--- a/tools/osx/crosstool/BUILD.tpl
+++ b/tools/osx/crosstool/BUILD.tpl
@@ -1,6 +1,7 @@
package(default_visibility = ["//visibility:public"])
load(":osx_archs.bzl", "OSX_TOOLS_ARCHS")
+load(":cc_toolchain_config.bzl", "cc_toolchain_config")
CC_TOOLCHAINS = [(
cpu + "|compiler",
@@ -56,6 +57,9 @@
toolchain_identifier = (
arch if arch != "armeabi-v7a" else "stub_armeabi-v7a"
),
+ toolchain_config = ":" + (
+ arch if arch != "armeabi-v7a" else "stub_armeabi-v7a"
+ ),
all_files = ":osx_tools_" + arch,
ar_files = ":empty",
as_files = ":empty",
@@ -70,6 +74,15 @@
]
[
+ cc_toolchain_config(
+ name = (arch if arch != "armeabi-v7a" else "stub_armeabi-v7a"),
+ cpu = arch,
+ compiler = "compiler",
+ )
+ for arch in OSX_TOOLS_ARCHS
+]
+
+[
toolchain(
name = "cc-toolchain-" + arch,
exec_compatible_with = [
diff --git a/tools/osx/crosstool/cc_toolchain_config.bzl.tpl b/tools/osx/crosstool/cc_toolchain_config.bzl.tpl
new file mode 100644
index 0000000..2dd5d2f
--- /dev/null
+++ b/tools/osx/crosstool/cc_toolchain_config.bzl.tpl
@@ -0,0 +1,5722 @@
+# Copyright 2019 The Bazel Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+load("@bazel_tools//tools/cpp:cc_toolchain_config_lib.bzl",
+ "action_config",
+ "env_entry",
+ "env_set",
+ "feature",
+ "feature_set",
+ "flag_group",
+ "flag_set",
+ "make_variable",
+ "tool",
+ "tool_path",
+ "variable_with_value",
+ "with_feature_set",
+)
+load("@bazel_tools//tools/build_defs/cc:action_names.bzl", "ACTION_NAMES")
+
+def _impl(ctx):
+ if (ctx.attr.cpu == "darwin_x86_64"):
+ toolchain_identifier = "darwin_x86_64"
+ elif (ctx.attr.cpu == "ios_arm64"):
+ toolchain_identifier = "ios_arm64"
+ elif (ctx.attr.cpu == "ios_arm64e"):
+ toolchain_identifier = "ios_arm64e"
+ elif (ctx.attr.cpu == "ios_armv7"):
+ toolchain_identifier = "ios_armv7"
+ elif (ctx.attr.cpu == "ios_i386"):
+ toolchain_identifier = "ios_i386"
+ elif (ctx.attr.cpu == "ios_x86_64"):
+ toolchain_identifier = "ios_x86_64"
+ elif (ctx.attr.cpu == "armeabi-v7a"):
+ toolchain_identifier = "stub_armeabi-v7a"
+ elif (ctx.attr.cpu == "tvos_arm64"):
+ toolchain_identifier = "tvos_arm64"
+ elif (ctx.attr.cpu == "tvos_x86_64"):
+ toolchain_identifier = "tvos_x86_64"
+ elif (ctx.attr.cpu == "watchos_arm64_32"):
+ toolchain_identifier = "watchos_arm64_32"
+ elif (ctx.attr.cpu == "watchos_armv7k"):
+ toolchain_identifier = "watchos_armv7k"
+ elif (ctx.attr.cpu == "watchos_i386"):
+ toolchain_identifier = "watchos_i386"
+ elif (ctx.attr.cpu == "watchos_x86_64"):
+ toolchain_identifier = "watchos_x86_64"
+ else:
+ fail("Unreachable")
+
+ if (ctx.attr.cpu == "armeabi-v7a"):
+ host_system_name = "armeabi-v7a"
+ elif (ctx.attr.cpu == "darwin_x86_64"
+ or ctx.attr.cpu == "ios_arm64"
+ or ctx.attr.cpu == "ios_arm64e"
+ or ctx.attr.cpu == "ios_armv7"
+ or ctx.attr.cpu == "ios_i386"
+ or ctx.attr.cpu == "ios_x86_64"
+ or ctx.attr.cpu == "tvos_arm64"
+ or ctx.attr.cpu == "tvos_x86_64"
+ or ctx.attr.cpu == "watchos_arm64_32"
+ or ctx.attr.cpu == "watchos_armv7k"
+ or ctx.attr.cpu == "watchos_i386"
+ or ctx.attr.cpu == "watchos_x86_64"):
+ host_system_name = "x86_64-apple-macosx"
+ else:
+ fail("Unreachable")
+
+ if (ctx.attr.cpu == "ios_arm64"):
+ target_system_name = "arm64-apple-ios"
+ elif (ctx.attr.cpu == "tvos_arm64"):
+ target_system_name = "arm64-apple-tvos"
+ elif (ctx.attr.cpu == "watchos_arm64_32"):
+ target_system_name = "arm64_32-apple-watchos"
+ elif (ctx.attr.cpu == "ios_arm64e"):
+ target_system_name = "arm64e-apple-ios"
+ elif (ctx.attr.cpu == "armeabi-v7a"):
+ target_system_name = "armeabi-v7a"
+ elif (ctx.attr.cpu == "ios_armv7"):
+ target_system_name = "armv7-apple-ios"
+ elif (ctx.attr.cpu == "watchos_armv7k"):
+ target_system_name = "armv7-apple-watchos"
+ elif (ctx.attr.cpu == "ios_i386"):
+ target_system_name = "i386-apple-ios"
+ elif (ctx.attr.cpu == "watchos_i386"):
+ target_system_name = "i386-apple-watchos"
+ elif (ctx.attr.cpu == "ios_x86_64"):
+ target_system_name = "x86_64-apple-ios"
+ elif (ctx.attr.cpu == "darwin_x86_64"):
+ target_system_name = "x86_64-apple-macosx"
+ elif (ctx.attr.cpu == "tvos_x86_64"):
+ target_system_name = "x86_64-apple-tvos"
+ elif (ctx.attr.cpu == "watchos_x86_64"):
+ target_system_name = "x86_64-apple-watchos"
+ else:
+ fail("Unreachable")
+
+ if (ctx.attr.cpu == "armeabi-v7a"):
+ target_cpu = "armeabi-v7a"
+ elif (ctx.attr.cpu == "darwin_x86_64"):
+ target_cpu = "darwin_x86_64"
+ elif (ctx.attr.cpu == "ios_arm64"):
+ target_cpu = "ios_arm64"
+ elif (ctx.attr.cpu == "ios_arm64e"):
+ target_cpu = "ios_arm64e"
+ elif (ctx.attr.cpu == "ios_armv7"):
+ target_cpu = "ios_armv7"
+ elif (ctx.attr.cpu == "ios_i386"):
+ target_cpu = "ios_i386"
+ elif (ctx.attr.cpu == "ios_x86_64"):
+ target_cpu = "ios_x86_64"
+ elif (ctx.attr.cpu == "tvos_arm64"):
+ target_cpu = "tvos_arm64"
+ elif (ctx.attr.cpu == "tvos_x86_64"):
+ target_cpu = "tvos_x86_64"
+ elif (ctx.attr.cpu == "watchos_arm64_32"):
+ target_cpu = "watchos_arm64_32"
+ elif (ctx.attr.cpu == "watchos_armv7k"):
+ target_cpu = "watchos_armv7k"
+ elif (ctx.attr.cpu == "watchos_i386"):
+ target_cpu = "watchos_i386"
+ elif (ctx.attr.cpu == "watchos_x86_64"):
+ target_cpu = "watchos_x86_64"
+ else:
+ fail("Unreachable")
+
+ if (ctx.attr.cpu == "armeabi-v7a"):
+ target_libc = "armeabi-v7a"
+ elif (ctx.attr.cpu == "ios_arm64"
+ or ctx.attr.cpu == "ios_arm64e"
+ or ctx.attr.cpu == "ios_armv7"
+ or ctx.attr.cpu == "ios_i386"
+ or ctx.attr.cpu == "ios_x86_64"):
+ target_libc = "ios"
+ elif (ctx.attr.cpu == "darwin_x86_64"):
+ target_libc = "macosx"
+ elif (ctx.attr.cpu == "tvos_arm64"
+ or ctx.attr.cpu == "tvos_x86_64"):
+ target_libc = "tvos"
+ elif (ctx.attr.cpu == "watchos_arm64_32"
+ or ctx.attr.cpu == "watchos_armv7k"
+ or ctx.attr.cpu == "watchos_i386"
+ or ctx.attr.cpu == "watchos_x86_64"):
+ target_libc = "watchos"
+ else:
+ fail("Unreachable")
+
+ compiler = "compiler"
+
+ if (ctx.attr.cpu == "armeabi-v7a"):
+ abi_version = "armeabi-v7a"
+ elif (ctx.attr.cpu == "darwin_x86_64"):
+ abi_version = "darwin_x86_64"
+ elif (ctx.attr.cpu == "ios_arm64"
+ or ctx.attr.cpu == "ios_arm64e"
+ or ctx.attr.cpu == "ios_armv7"
+ or ctx.attr.cpu == "ios_i386"
+ or ctx.attr.cpu == "ios_x86_64"
+ or ctx.attr.cpu == "tvos_arm64"
+ or ctx.attr.cpu == "tvos_x86_64"
+ or ctx.attr.cpu == "watchos_arm64_32"
+ or ctx.attr.cpu == "watchos_armv7k"
+ or ctx.attr.cpu == "watchos_i386"
+ or ctx.attr.cpu == "watchos_x86_64"):
+ abi_version = "local"
+ else:
+ fail("Unreachable")
+
+ if (ctx.attr.cpu == "armeabi-v7a"):
+ abi_libc_version = "armeabi-v7a"
+ elif (ctx.attr.cpu == "darwin_x86_64"):
+ abi_libc_version = "darwin_x86_64"
+ elif (ctx.attr.cpu == "ios_arm64"
+ or ctx.attr.cpu == "ios_arm64e"
+ or ctx.attr.cpu == "ios_armv7"
+ or ctx.attr.cpu == "ios_i386"
+ or ctx.attr.cpu == "ios_x86_64"
+ or ctx.attr.cpu == "tvos_arm64"
+ or ctx.attr.cpu == "tvos_x86_64"
+ or ctx.attr.cpu == "watchos_arm64_32"
+ or ctx.attr.cpu == "watchos_armv7k"
+ or ctx.attr.cpu == "watchos_i386"
+ or ctx.attr.cpu == "watchos_x86_64"):
+ abi_libc_version = "local"
+ else:
+ fail("Unreachable")
+
+ cc_target_os = "apple"
+
+ builtin_sysroot = None
+
+ all_compile_actions = [
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.linkstamp_compile,
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ACTION_NAMES.clif_match,
+ ACTION_NAMES.lto_backend,
+ ]
+
+ all_cpp_compile_actions = [
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.linkstamp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ACTION_NAMES.clif_match,
+ ]
+
+ preprocessor_compile_actions = [
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.linkstamp_compile,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.clif_match,
+ ]
+
+ codegen_compile_actions = [
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.linkstamp_compile,
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.cpp_module_codegen,
+ ACTION_NAMES.lto_backend,
+ ]
+
+ all_link_actions = [
+ ACTION_NAMES.cpp_link_executable,
+ ACTION_NAMES.cpp_link_dynamic_library,
+ ACTION_NAMES.cpp_link_nodeps_dynamic_library,
+ ]
+
+ strip_action = action_config(
+ action_name = ACTION_NAMES.strip,
+ flag_sets = [
+ flag_set(
+ flag_groups = [
+ flag_group(flags = ["-S", "-o", "%{output_file}"]),
+ flag_group(
+ flags = ["%{stripopts}"],
+ iterate_over = "stripopts",
+ ),
+ flag_group(flags = ["%{input_file}"]),
+ ],
+ ),
+ ],
+ tools = [tool(path = "/usr/bin/strip")],
+ )
+
+ if (ctx.attr.cpu == "tvos_arm64"
+ or ctx.attr.cpu == "tvos_x86_64"):
+ cpp_header_parsing_action = action_config(
+ action_name = ACTION_NAMES.cpp_header_parsing,
+ implies = [
+ "preprocessor_defines",
+ "include_system_dirs",
+ "version_min",
+ "objc_arc",
+ "no_objc_arc",
+ "apple_env",
+ "user_compile_flags",
+ "sysroot",
+ "unfiltered_compile_flags",
+ "compiler_input_flags",
+ "compiler_output_flags",
+ "unfiltered_cxx_flags",
+ ],
+ tools = [
+ tool(
+ path = "wrapped_clang",
+ execution_requirements = ["requires-darwin"],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "armeabi-v7a"
+ or ctx.attr.cpu == "darwin_x86_64"
+ or ctx.attr.cpu == "ios_arm64"
+ or ctx.attr.cpu == "ios_arm64e"
+ or ctx.attr.cpu == "ios_armv7"
+ or ctx.attr.cpu == "ios_i386"
+ or ctx.attr.cpu == "ios_x86_64"
+ or ctx.attr.cpu == "watchos_arm64_32"
+ or ctx.attr.cpu == "watchos_armv7k"
+ or ctx.attr.cpu == "watchos_i386"
+ or ctx.attr.cpu == "watchos_x86_64"):
+ cpp_header_parsing_action = action_config(
+ action_name = ACTION_NAMES.cpp_header_parsing,
+ implies = [
+ "preprocessor_defines",
+ "include_system_dirs",
+ "version_min",
+ "objc_arc",
+ "no_objc_arc",
+ "apple_env",
+ "user_compile_flags",
+ "sysroot",
+ "unfiltered_compile_flags",
+ "compiler_input_flags",
+ "compiler_output_flags",
+ ],
+ tools = [
+ tool(
+ path = "wrapped_clang",
+ execution_requirements = ["requires-darwin"],
+ ),
+ ],
+ )
+
+ if (ctx.attr.cpu == "armeabi-v7a"
+ or ctx.attr.cpu == "watchos_arm64_32"):
+ objc_compile_action = action_config(
+ action_name = ACTION_NAMES.objc_compile,
+ flag_sets = [
+ flag_set(
+ flag_groups = [flag_group(flags = ["-arch", "<architecture>"])],
+ ),
+ ],
+ implies = [
+ "compiler_input_flags",
+ "compiler_output_flags",
+ "objc_actions",
+ "apply_default_compiler_flags",
+ "apply_default_warnings",
+ "framework_paths",
+ "preprocessor_defines",
+ "include_system_dirs",
+ "version_min",
+ "objc_arc",
+ "no_objc_arc",
+ "apple_env",
+ "user_compile_flags",
+ "sysroot",
+ "unfiltered_compile_flags",
+ ],
+ tools = [
+ tool(
+ path = "wrapped_clang",
+ execution_requirements = ["requires-darwin"],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "ios_arm64"
+ or ctx.attr.cpu == "tvos_arm64"):
+ objc_compile_action = action_config(
+ action_name = ACTION_NAMES.objc_compile,
+ flag_sets = [
+ flag_set(
+ flag_groups = [flag_group(flags = ["-arch", "arm64"])],
+ ),
+ ],
+ implies = [
+ "compiler_input_flags",
+ "compiler_output_flags",
+ "objc_actions",
+ "apply_default_compiler_flags",
+ "apply_default_warnings",
+ "framework_paths",
+ "preprocessor_defines",
+ "include_system_dirs",
+ "version_min",
+ "objc_arc",
+ "no_objc_arc",
+ "apple_env",
+ "user_compile_flags",
+ "sysroot",
+ "unfiltered_compile_flags",
+ ],
+ tools = [
+ tool(
+ path = "wrapped_clang",
+ execution_requirements = ["requires-darwin"],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "ios_arm64e"):
+ objc_compile_action = action_config(
+ action_name = ACTION_NAMES.objc_compile,
+ flag_sets = [
+ flag_set(
+ flag_groups = [flag_group(flags = ["-arch", "arm64e"])],
+ ),
+ ],
+ implies = [
+ "compiler_input_flags",
+ "compiler_output_flags",
+ "objc_actions",
+ "apply_default_compiler_flags",
+ "apply_default_warnings",
+ "framework_paths",
+ "preprocessor_defines",
+ "include_system_dirs",
+ "version_min",
+ "objc_arc",
+ "no_objc_arc",
+ "apple_env",
+ "user_compile_flags",
+ "sysroot",
+ "unfiltered_compile_flags",
+ ],
+ tools = [
+ tool(
+ path = "wrapped_clang",
+ execution_requirements = ["requires-darwin"],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "ios_armv7"):
+ objc_compile_action = action_config(
+ action_name = ACTION_NAMES.objc_compile,
+ flag_sets = [
+ flag_set(
+ flag_groups = [flag_group(flags = ["-arch", "armv7"])],
+ ),
+ ],
+ implies = [
+ "compiler_input_flags",
+ "compiler_output_flags",
+ "objc_actions",
+ "apply_default_compiler_flags",
+ "apply_default_warnings",
+ "framework_paths",
+ "preprocessor_defines",
+ "include_system_dirs",
+ "version_min",
+ "objc_arc",
+ "no_objc_arc",
+ "apple_env",
+ "user_compile_flags",
+ "sysroot",
+ "unfiltered_compile_flags",
+ ],
+ tools = [
+ tool(
+ path = "wrapped_clang",
+ execution_requirements = ["requires-darwin"],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "watchos_armv7k"):
+ objc_compile_action = action_config(
+ action_name = ACTION_NAMES.objc_compile,
+ flag_sets = [
+ flag_set(
+ flag_groups = [flag_group(flags = ["-arch", "armv7k"])],
+ ),
+ ],
+ implies = [
+ "compiler_input_flags",
+ "compiler_output_flags",
+ "objc_actions",
+ "apply_default_compiler_flags",
+ "apply_default_warnings",
+ "framework_paths",
+ "preprocessor_defines",
+ "include_system_dirs",
+ "version_min",
+ "objc_arc",
+ "no_objc_arc",
+ "apple_env",
+ "user_compile_flags",
+ "sysroot",
+ "unfiltered_compile_flags",
+ ],
+ tools = [
+ tool(
+ path = "wrapped_clang",
+ execution_requirements = ["requires-darwin"],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "ios_i386"
+ or ctx.attr.cpu == "watchos_i386"):
+ objc_compile_action = action_config(
+ action_name = ACTION_NAMES.objc_compile,
+ flag_sets = [
+ flag_set(
+ flag_groups = [flag_group(flags = ["-arch", "i386"])],
+ ),
+ ],
+ implies = [
+ "compiler_input_flags",
+ "compiler_output_flags",
+ "objc_actions",
+ "apply_default_compiler_flags",
+ "apply_default_warnings",
+ "framework_paths",
+ "preprocessor_defines",
+ "include_system_dirs",
+ "version_min",
+ "objc_arc",
+ "no_objc_arc",
+ "apple_env",
+ "user_compile_flags",
+ "sysroot",
+ "unfiltered_compile_flags",
+ "apply_simulator_compiler_flags",
+ ],
+ tools = [
+ tool(
+ path = "wrapped_clang",
+ execution_requirements = ["requires-darwin"],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "ios_x86_64"
+ or ctx.attr.cpu == "tvos_x86_64"
+ or ctx.attr.cpu == "watchos_x86_64"):
+ objc_compile_action = action_config(
+ action_name = ACTION_NAMES.objc_compile,
+ flag_sets = [
+ flag_set(
+ flag_groups = [flag_group(flags = ["-arch", "x86_64"])],
+ ),
+ ],
+ implies = [
+ "compiler_input_flags",
+ "compiler_output_flags",
+ "objc_actions",
+ "apply_default_compiler_flags",
+ "apply_default_warnings",
+ "framework_paths",
+ "preprocessor_defines",
+ "include_system_dirs",
+ "version_min",
+ "objc_arc",
+ "no_objc_arc",
+ "apple_env",
+ "user_compile_flags",
+ "sysroot",
+ "unfiltered_compile_flags",
+ "apply_simulator_compiler_flags",
+ ],
+ tools = [
+ tool(
+ path = "wrapped_clang",
+ execution_requirements = ["requires-darwin"],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "darwin_x86_64"):
+ objc_compile_action = action_config(
+ action_name = ACTION_NAMES.objc_compile,
+ flag_sets = [
+ flag_set(
+ flag_groups = [flag_group(flags = ["-arch", "x86_64"])],
+ ),
+ ],
+ implies = [
+ "compiler_input_flags",
+ "compiler_output_flags",
+ "objc_actions",
+ "apply_default_compiler_flags",
+ "apply_default_warnings",
+ "framework_paths",
+ "preprocessor_defines",
+ "include_system_dirs",
+ "version_min",
+ "objc_arc",
+ "no_objc_arc",
+ "apple_env",
+ "user_compile_flags",
+ "sysroot",
+ "unfiltered_compile_flags",
+ ],
+ tools = [
+ tool(
+ path = "wrapped_clang",
+ execution_requirements = ["requires-darwin"],
+ ),
+ ],
+ )
+
+ if (ctx.attr.cpu == "armeabi-v7a"
+ or ctx.attr.cpu == "watchos_arm64_32"):
+ objcpp_executable_action = action_config(
+ action_name = "objc++-executable",
+ flag_sets = [
+ flag_set(
+ flag_groups = [
+ flag_group(flags = ["-stdlib=libc++", "-std=gnu++11"]),
+ flag_group(flags = ["-arch", "<architecture>"]),
+ flag_group(
+ flags = [
+ "-Xlinker",
+ "-objc_abi_version",
+ "-Xlinker",
+ "2",
+ "-Xlinker",
+ "-rpath",
+ "-Xlinker",
+ "@executable_path/Frameworks",
+ "-fobjc-link-runtime",
+ "-ObjC",
+ ],
+ ),
+ flag_group(
+ flags = ["-framework", "%{framework_names}"],
+ iterate_over = "framework_names",
+ ),
+ flag_group(
+ flags = ["-weak_framework", "%{weak_framework_names}"],
+ iterate_over = "weak_framework_names",
+ ),
+ flag_group(
+ flags = ["-l%{library_names}"],
+ iterate_over = "library_names",
+ ),
+ flag_group(flags = ["-filelist", "%{filelist}"]),
+ flag_group(flags = ["-o", "%{linked_binary}"]),
+ flag_group(
+ flags = ["-force_load", "%{force_load_exec_paths}"],
+ iterate_over = "force_load_exec_paths",
+ ),
+ flag_group(
+ flags = ["%{dep_linkopts}"],
+ iterate_over = "dep_linkopts",
+ ),
+ flag_group(
+ flags = ["-Wl,%{attr_linkopts}"],
+ iterate_over = "attr_linkopts",
+ ),
+ ],
+ ),
+ ],
+ implies = [
+ "include_system_dirs",
+ "framework_paths",
+ "version_min",
+ "strip_debug_symbols",
+ "apple_env",
+ "apply_implicit_frameworks",
+ ],
+ tools = [
+ tool(
+ path = "wrapped_clang_pp",
+ execution_requirements = ["requires-darwin"],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "ios_arm64"
+ or ctx.attr.cpu == "tvos_arm64"):
+ objcpp_executable_action = action_config(
+ action_name = "objc++-executable",
+ flag_sets = [
+ flag_set(
+ flag_groups = [
+ flag_group(flags = ["-stdlib=libc++", "-std=gnu++11"]),
+ flag_group(flags = ["-arch", "arm64"]),
+ flag_group(
+ flags = [
+ "-Xlinker",
+ "-objc_abi_version",
+ "-Xlinker",
+ "2",
+ "-Xlinker",
+ "-rpath",
+ "-Xlinker",
+ "@executable_path/Frameworks",
+ "-fobjc-link-runtime",
+ "-ObjC",
+ ],
+ ),
+ flag_group(
+ flags = ["-framework", "%{framework_names}"],
+ iterate_over = "framework_names",
+ ),
+ flag_group(
+ flags = ["-weak_framework", "%{weak_framework_names}"],
+ iterate_over = "weak_framework_names",
+ ),
+ flag_group(
+ flags = ["-l%{library_names}"],
+ iterate_over = "library_names",
+ ),
+ flag_group(flags = ["-filelist", "%{filelist}"]),
+ flag_group(flags = ["-o", "%{linked_binary}"]),
+ flag_group(
+ flags = ["-force_load", "%{force_load_exec_paths}"],
+ iterate_over = "force_load_exec_paths",
+ ),
+ flag_group(
+ flags = ["%{dep_linkopts}"],
+ iterate_over = "dep_linkopts",
+ ),
+ flag_group(
+ flags = ["-Wl,%{attr_linkopts}"],
+ iterate_over = "attr_linkopts",
+ ),
+ ],
+ ),
+ ],
+ implies = [
+ "include_system_dirs",
+ "framework_paths",
+ "version_min",
+ "strip_debug_symbols",
+ "apple_env",
+ "apply_implicit_frameworks",
+ ],
+ tools = [
+ tool(
+ path = "wrapped_clang_pp",
+ execution_requirements = ["requires-darwin"],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "ios_arm64e"):
+ objcpp_executable_action = action_config(
+ action_name = "objc++-executable",
+ flag_sets = [
+ flag_set(
+ flag_groups = [
+ flag_group(flags = ["-stdlib=libc++", "-std=gnu++11"]),
+ flag_group(flags = ["-arch", "arm64e"]),
+ flag_group(
+ flags = [
+ "-Xlinker",
+ "-objc_abi_version",
+ "-Xlinker",
+ "2",
+ "-Xlinker",
+ "-rpath",
+ "-Xlinker",
+ "@executable_path/Frameworks",
+ "-fobjc-link-runtime",
+ "-ObjC",
+ ],
+ ),
+ flag_group(
+ flags = ["-framework", "%{framework_names}"],
+ iterate_over = "framework_names",
+ ),
+ flag_group(
+ flags = ["-weak_framework", "%{weak_framework_names}"],
+ iterate_over = "weak_framework_names",
+ ),
+ flag_group(
+ flags = ["-l%{library_names}"],
+ iterate_over = "library_names",
+ ),
+ flag_group(flags = ["-filelist", "%{filelist}"]),
+ flag_group(flags = ["-o", "%{linked_binary}"]),
+ flag_group(
+ flags = ["-force_load", "%{force_load_exec_paths}"],
+ iterate_over = "force_load_exec_paths",
+ ),
+ flag_group(
+ flags = ["%{dep_linkopts}"],
+ iterate_over = "dep_linkopts",
+ ),
+ flag_group(
+ flags = ["-Wl,%{attr_linkopts}"],
+ iterate_over = "attr_linkopts",
+ ),
+ ],
+ ),
+ ],
+ implies = [
+ "include_system_dirs",
+ "framework_paths",
+ "version_min",
+ "strip_debug_symbols",
+ "apple_env",
+ "apply_implicit_frameworks",
+ ],
+ tools = [
+ tool(
+ path = "wrapped_clang_pp",
+ execution_requirements = ["requires-darwin"],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "ios_armv7"):
+ objcpp_executable_action = action_config(
+ action_name = "objc++-executable",
+ flag_sets = [
+ flag_set(
+ flag_groups = [
+ flag_group(flags = ["-stdlib=libc++", "-std=gnu++11"]),
+ flag_group(flags = ["-arch", "armv7"]),
+ flag_group(
+ flags = [
+ "-Xlinker",
+ "-objc_abi_version",
+ "-Xlinker",
+ "2",
+ "-Xlinker",
+ "-rpath",
+ "-Xlinker",
+ "@executable_path/Frameworks",
+ "-fobjc-link-runtime",
+ "-ObjC",
+ ],
+ ),
+ flag_group(
+ flags = ["-framework", "%{framework_names}"],
+ iterate_over = "framework_names",
+ ),
+ flag_group(
+ flags = ["-weak_framework", "%{weak_framework_names}"],
+ iterate_over = "weak_framework_names",
+ ),
+ flag_group(
+ flags = ["-l%{library_names}"],
+ iterate_over = "library_names",
+ ),
+ flag_group(flags = ["-filelist", "%{filelist}"]),
+ flag_group(flags = ["-o", "%{linked_binary}"]),
+ flag_group(
+ flags = ["-force_load", "%{force_load_exec_paths}"],
+ iterate_over = "force_load_exec_paths",
+ ),
+ flag_group(
+ flags = ["%{dep_linkopts}"],
+ iterate_over = "dep_linkopts",
+ ),
+ flag_group(
+ flags = ["-Wl,%{attr_linkopts}"],
+ iterate_over = "attr_linkopts",
+ ),
+ ],
+ ),
+ ],
+ implies = [
+ "include_system_dirs",
+ "framework_paths",
+ "version_min",
+ "strip_debug_symbols",
+ "apple_env",
+ "apply_implicit_frameworks",
+ ],
+ tools = [
+ tool(
+ path = "wrapped_clang_pp",
+ execution_requirements = ["requires-darwin"],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "watchos_armv7k"):
+ objcpp_executable_action = action_config(
+ action_name = "objc++-executable",
+ flag_sets = [
+ flag_set(
+ flag_groups = [
+ flag_group(flags = ["-stdlib=libc++", "-std=gnu++11"]),
+ flag_group(flags = ["-arch", "armv7k"]),
+ flag_group(
+ flags = [
+ "-Xlinker",
+ "-objc_abi_version",
+ "-Xlinker",
+ "2",
+ "-Xlinker",
+ "-rpath",
+ "-Xlinker",
+ "@executable_path/Frameworks",
+ "-fobjc-link-runtime",
+ "-ObjC",
+ ],
+ ),
+ flag_group(
+ flags = ["-framework", "%{framework_names}"],
+ iterate_over = "framework_names",
+ ),
+ flag_group(
+ flags = ["-weak_framework", "%{weak_framework_names}"],
+ iterate_over = "weak_framework_names",
+ ),
+ flag_group(
+ flags = ["-l%{library_names}"],
+ iterate_over = "library_names",
+ ),
+ flag_group(flags = ["-filelist", "%{filelist}"]),
+ flag_group(flags = ["-o", "%{linked_binary}"]),
+ flag_group(
+ flags = ["-force_load", "%{force_load_exec_paths}"],
+ iterate_over = "force_load_exec_paths",
+ ),
+ flag_group(
+ flags = ["%{dep_linkopts}"],
+ iterate_over = "dep_linkopts",
+ ),
+ flag_group(
+ flags = ["-Wl,%{attr_linkopts}"],
+ iterate_over = "attr_linkopts",
+ ),
+ ],
+ ),
+ ],
+ implies = [
+ "include_system_dirs",
+ "framework_paths",
+ "version_min",
+ "strip_debug_symbols",
+ "apple_env",
+ "apply_implicit_frameworks",
+ ],
+ tools = [
+ tool(
+ path = "wrapped_clang_pp",
+ execution_requirements = ["requires-darwin"],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "ios_i386"
+ or ctx.attr.cpu == "watchos_i386"):
+ objcpp_executable_action = action_config(
+ action_name = "objc++-executable",
+ flag_sets = [
+ flag_set(
+ flag_groups = [
+ flag_group(flags = ["-stdlib=libc++", "-std=gnu++11"]),
+ flag_group(flags = ["-arch", "i386"]),
+ flag_group(
+ flags = [
+ "-Xlinker",
+ "-objc_abi_version",
+ "-Xlinker",
+ "2",
+ "-Xlinker",
+ "-rpath",
+ "-Xlinker",
+ "@executable_path/Frameworks",
+ "-fobjc-link-runtime",
+ "-ObjC",
+ ],
+ ),
+ flag_group(
+ flags = ["-framework", "%{framework_names}"],
+ iterate_over = "framework_names",
+ ),
+ flag_group(
+ flags = ["-weak_framework", "%{weak_framework_names}"],
+ iterate_over = "weak_framework_names",
+ ),
+ flag_group(
+ flags = ["-l%{library_names}"],
+ iterate_over = "library_names",
+ ),
+ flag_group(flags = ["-filelist", "%{filelist}"]),
+ flag_group(flags = ["-o", "%{linked_binary}"]),
+ flag_group(
+ flags = ["-force_load", "%{force_load_exec_paths}"],
+ iterate_over = "force_load_exec_paths",
+ ),
+ flag_group(
+ flags = ["%{dep_linkopts}"],
+ iterate_over = "dep_linkopts",
+ ),
+ flag_group(
+ flags = ["-Wl,%{attr_linkopts}"],
+ iterate_over = "attr_linkopts",
+ ),
+ ],
+ ),
+ ],
+ implies = [
+ "include_system_dirs",
+ "framework_paths",
+ "version_min",
+ "strip_debug_symbols",
+ "apple_env",
+ "apply_implicit_frameworks",
+ ],
+ tools = [
+ tool(
+ path = "wrapped_clang_pp",
+ execution_requirements = ["requires-darwin"],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "darwin_x86_64"
+ or ctx.attr.cpu == "ios_x86_64"
+ or ctx.attr.cpu == "tvos_x86_64"
+ or ctx.attr.cpu == "watchos_x86_64"):
+ objcpp_executable_action = action_config(
+ action_name = "objc++-executable",
+ flag_sets = [
+ flag_set(
+ flag_groups = [
+ flag_group(flags = ["-stdlib=libc++", "-std=gnu++11"]),
+ flag_group(flags = ["-arch", "x86_64"]),
+ flag_group(
+ flags = [
+ "-Xlinker",
+ "-objc_abi_version",
+ "-Xlinker",
+ "2",
+ "-Xlinker",
+ "-rpath",
+ "-Xlinker",
+ "@executable_path/Frameworks",
+ "-fobjc-link-runtime",
+ "-ObjC",
+ ],
+ ),
+ flag_group(
+ flags = ["-framework", "%{framework_names}"],
+ iterate_over = "framework_names",
+ ),
+ flag_group(
+ flags = ["-weak_framework", "%{weak_framework_names}"],
+ iterate_over = "weak_framework_names",
+ ),
+ flag_group(
+ flags = ["-l%{library_names}"],
+ iterate_over = "library_names",
+ ),
+ flag_group(flags = ["-filelist", "%{filelist}"]),
+ flag_group(flags = ["-o", "%{linked_binary}"]),
+ flag_group(
+ flags = ["-force_load", "%{force_load_exec_paths}"],
+ iterate_over = "force_load_exec_paths",
+ ),
+ flag_group(
+ flags = ["%{dep_linkopts}"],
+ iterate_over = "dep_linkopts",
+ ),
+ flag_group(
+ flags = ["-Wl,%{attr_linkopts}"],
+ iterate_over = "attr_linkopts",
+ ),
+ ],
+ ),
+ ],
+ implies = [
+ "include_system_dirs",
+ "framework_paths",
+ "version_min",
+ "strip_debug_symbols",
+ "apple_env",
+ "apply_implicit_frameworks",
+ ],
+ tools = [
+ tool(
+ path = "wrapped_clang_pp",
+ execution_requirements = ["requires-darwin"],
+ ),
+ ],
+ )
+
+ if (ctx.attr.cpu == "tvos_arm64"
+ or ctx.attr.cpu == "tvos_x86_64"):
+ cpp_link_dynamic_library_action = action_config(
+ action_name = ACTION_NAMES.cpp_link_dynamic_library,
+ implies = [
+ "contains_objc_source",
+ "has_configured_linker_path",
+ "symbol_counts",
+ "shared_flag",
+ "linkstamps",
+ "output_execpath_flags",
+ "runtime_root_flags",
+ "input_param_flags",
+ "strip_debug_symbols",
+ "linker_param_file",
+ "version_min",
+ "apple_env",
+ "sysroot",
+ "cpp_linker_flags",
+ ],
+ tools = [
+ tool(
+ path = "cc_wrapper.sh",
+ execution_requirements = ["requires-darwin"],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "armeabi-v7a"
+ or ctx.attr.cpu == "darwin_x86_64"
+ or ctx.attr.cpu == "ios_arm64"
+ or ctx.attr.cpu == "ios_arm64e"
+ or ctx.attr.cpu == "ios_armv7"
+ or ctx.attr.cpu == "ios_i386"
+ or ctx.attr.cpu == "ios_x86_64"
+ or ctx.attr.cpu == "watchos_arm64_32"
+ or ctx.attr.cpu == "watchos_armv7k"
+ or ctx.attr.cpu == "watchos_i386"
+ or ctx.attr.cpu == "watchos_x86_64"):
+ cpp_link_dynamic_library_action = action_config(
+ action_name = ACTION_NAMES.cpp_link_dynamic_library,
+ implies = [
+ "contains_objc_source",
+ "has_configured_linker_path",
+ "symbol_counts",
+ "shared_flag",
+ "linkstamps",
+ "output_execpath_flags",
+ "runtime_root_flags",
+ "input_param_flags",
+ "strip_debug_symbols",
+ "linker_param_file",
+ "version_min",
+ "apple_env",
+ "sysroot",
+ ],
+ tools = [
+ tool(
+ path = "cc_wrapper.sh",
+ execution_requirements = ["requires-darwin"],
+ ),
+ ],
+ )
+
+ cpp_link_static_library_action = action_config(
+ action_name = ACTION_NAMES.cpp_link_static_library,
+ implies = [
+ "runtime_root_flags",
+ "archiver_flags",
+ "input_param_flags",
+ "linker_param_file",
+ "apple_env",
+ ],
+ tools = [
+ tool(
+ path = "wrapped_ar",
+ execution_requirements = ["requires-darwin"],
+ ),
+ ],
+ )
+
+ if (ctx.attr.cpu == "tvos_arm64"
+ or ctx.attr.cpu == "tvos_x86_64"):
+ c_compile_action = action_config(
+ action_name = ACTION_NAMES.c_compile,
+ implies = [
+ "preprocessor_defines",
+ "include_system_dirs",
+ "version_min",
+ "objc_arc",
+ "no_objc_arc",
+ "apple_env",
+ "user_compile_flags",
+ "sysroot",
+ "unfiltered_compile_flags",
+ "compiler_input_flags",
+ "compiler_output_flags",
+ "unfiltered_cxx_flags",
+ ],
+ tools = [
+ tool(
+ path = "wrapped_clang",
+ execution_requirements = ["requires-darwin"],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "armeabi-v7a"
+ or ctx.attr.cpu == "darwin_x86_64"
+ or ctx.attr.cpu == "ios_arm64"
+ or ctx.attr.cpu == "ios_arm64e"
+ or ctx.attr.cpu == "ios_armv7"
+ or ctx.attr.cpu == "ios_i386"
+ or ctx.attr.cpu == "ios_x86_64"
+ or ctx.attr.cpu == "watchos_arm64_32"
+ or ctx.attr.cpu == "watchos_armv7k"
+ or ctx.attr.cpu == "watchos_i386"
+ or ctx.attr.cpu == "watchos_x86_64"):
+ c_compile_action = action_config(
+ action_name = ACTION_NAMES.c_compile,
+ implies = [
+ "preprocessor_defines",
+ "include_system_dirs",
+ "version_min",
+ "objc_arc",
+ "no_objc_arc",
+ "apple_env",
+ "user_compile_flags",
+ "sysroot",
+ "unfiltered_compile_flags",
+ "compiler_input_flags",
+ "compiler_output_flags",
+ ],
+ tools = [
+ tool(
+ path = "wrapped_clang",
+ execution_requirements = ["requires-darwin"],
+ ),
+ ],
+ )
+
+ if (ctx.attr.cpu == "tvos_arm64"
+ or ctx.attr.cpu == "tvos_x86_64"):
+ cpp_compile_action = action_config(
+ action_name = ACTION_NAMES.cpp_compile,
+ implies = [
+ "preprocessor_defines",
+ "include_system_dirs",
+ "version_min",
+ "objc_arc",
+ "no_objc_arc",
+ "apple_env",
+ "user_compile_flags",
+ "sysroot",
+ "unfiltered_compile_flags",
+ "compiler_input_flags",
+ "compiler_output_flags",
+ "unfiltered_cxx_flags",
+ ],
+ tools = [
+ tool(
+ path = "wrapped_clang",
+ execution_requirements = ["requires-darwin"],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "armeabi-v7a"
+ or ctx.attr.cpu == "darwin_x86_64"
+ or ctx.attr.cpu == "ios_arm64"
+ or ctx.attr.cpu == "ios_arm64e"
+ or ctx.attr.cpu == "ios_armv7"
+ or ctx.attr.cpu == "ios_i386"
+ or ctx.attr.cpu == "ios_x86_64"
+ or ctx.attr.cpu == "watchos_arm64_32"
+ or ctx.attr.cpu == "watchos_armv7k"
+ or ctx.attr.cpu == "watchos_i386"
+ or ctx.attr.cpu == "watchos_x86_64"):
+ cpp_compile_action = action_config(
+ action_name = ACTION_NAMES.cpp_compile,
+ implies = [
+ "preprocessor_defines",
+ "include_system_dirs",
+ "version_min",
+ "objc_arc",
+ "no_objc_arc",
+ "apple_env",
+ "user_compile_flags",
+ "sysroot",
+ "unfiltered_compile_flags",
+ "compiler_input_flags",
+ "compiler_output_flags",
+ ],
+ tools = [
+ tool(
+ path = "wrapped_clang",
+ execution_requirements = ["requires-darwin"],
+ ),
+ ],
+ )
+
+ if (ctx.attr.cpu == "armeabi-v7a"
+ or ctx.attr.cpu == "watchos_arm64_32"):
+ objcpp_compile_action = action_config(
+ action_name = ACTION_NAMES.objcpp_compile,
+ flag_sets = [
+ flag_set(
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-arch",
+ "<architecture>",
+ "-stdlib=libc++",
+ "-std=gnu++11",
+ ],
+ ),
+ ],
+ ),
+ ],
+ implies = [
+ "compiler_input_flags",
+ "compiler_output_flags",
+ "apply_default_compiler_flags",
+ "apply_default_warnings",
+ "framework_paths",
+ "preprocessor_defines",
+ "include_system_dirs",
+ "version_min",
+ "objc_arc",
+ "no_objc_arc",
+ "apple_env",
+ "user_compile_flags",
+ "sysroot",
+ "unfiltered_compile_flags",
+ ],
+ tools = [
+ tool(
+ path = "wrapped_clang",
+ execution_requirements = ["requires-darwin"],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "ios_arm64"
+ or ctx.attr.cpu == "tvos_arm64"):
+ objcpp_compile_action = action_config(
+ action_name = ACTION_NAMES.objcpp_compile,
+ flag_sets = [
+ flag_set(
+ flag_groups = [
+ flag_group(
+ flags = ["-arch", "arm64", "-stdlib=libc++", "-std=gnu++11"],
+ ),
+ ],
+ ),
+ ],
+ implies = [
+ "compiler_input_flags",
+ "compiler_output_flags",
+ "apply_default_compiler_flags",
+ "apply_default_warnings",
+ "framework_paths",
+ "preprocessor_defines",
+ "include_system_dirs",
+ "version_min",
+ "objc_arc",
+ "no_objc_arc",
+ "apple_env",
+ "user_compile_flags",
+ "sysroot",
+ "unfiltered_compile_flags",
+ ],
+ tools = [
+ tool(
+ path = "wrapped_clang",
+ execution_requirements = ["requires-darwin"],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "ios_arm64e"):
+ objcpp_compile_action = action_config(
+ action_name = ACTION_NAMES.objcpp_compile,
+ flag_sets = [
+ flag_set(
+ flag_groups = [
+ flag_group(
+ flags = ["-arch", "arm64e", "-stdlib=libc++", "-std=gnu++11"],
+ ),
+ ],
+ ),
+ ],
+ implies = [
+ "compiler_input_flags",
+ "compiler_output_flags",
+ "apply_default_compiler_flags",
+ "apply_default_warnings",
+ "framework_paths",
+ "preprocessor_defines",
+ "include_system_dirs",
+ "version_min",
+ "objc_arc",
+ "no_objc_arc",
+ "apple_env",
+ "user_compile_flags",
+ "sysroot",
+ "unfiltered_compile_flags",
+ ],
+ tools = [
+ tool(
+ path = "wrapped_clang",
+ execution_requirements = ["requires-darwin"],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "ios_armv7"):
+ objcpp_compile_action = action_config(
+ action_name = ACTION_NAMES.objcpp_compile,
+ flag_sets = [
+ flag_set(
+ flag_groups = [
+ flag_group(
+ flags = ["-arch", "armv7", "-stdlib=libc++", "-std=gnu++11"],
+ ),
+ ],
+ ),
+ ],
+ implies = [
+ "compiler_input_flags",
+ "compiler_output_flags",
+ "apply_default_compiler_flags",
+ "apply_default_warnings",
+ "framework_paths",
+ "preprocessor_defines",
+ "include_system_dirs",
+ "version_min",
+ "objc_arc",
+ "no_objc_arc",
+ "apple_env",
+ "user_compile_flags",
+ "sysroot",
+ "unfiltered_compile_flags",
+ ],
+ tools = [
+ tool(
+ path = "wrapped_clang",
+ execution_requirements = ["requires-darwin"],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "watchos_armv7k"):
+ objcpp_compile_action = action_config(
+ action_name = ACTION_NAMES.objcpp_compile,
+ flag_sets = [
+ flag_set(
+ flag_groups = [
+ flag_group(
+ flags = ["-arch", "armv7k", "-stdlib=libc++", "-std=gnu++11"],
+ ),
+ ],
+ ),
+ ],
+ implies = [
+ "compiler_input_flags",
+ "compiler_output_flags",
+ "apply_default_compiler_flags",
+ "apply_default_warnings",
+ "framework_paths",
+ "preprocessor_defines",
+ "include_system_dirs",
+ "version_min",
+ "objc_arc",
+ "no_objc_arc",
+ "apple_env",
+ "user_compile_flags",
+ "sysroot",
+ "unfiltered_compile_flags",
+ ],
+ tools = [
+ tool(
+ path = "wrapped_clang",
+ execution_requirements = ["requires-darwin"],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "ios_i386"
+ or ctx.attr.cpu == "watchos_i386"):
+ objcpp_compile_action = action_config(
+ action_name = ACTION_NAMES.objcpp_compile,
+ flag_sets = [
+ flag_set(
+ flag_groups = [
+ flag_group(
+ flags = ["-arch", "i386", "-stdlib=libc++", "-std=gnu++11"],
+ ),
+ ],
+ ),
+ ],
+ implies = [
+ "compiler_input_flags",
+ "compiler_output_flags",
+ "apply_default_compiler_flags",
+ "apply_default_warnings",
+ "framework_paths",
+ "preprocessor_defines",
+ "include_system_dirs",
+ "version_min",
+ "objc_arc",
+ "no_objc_arc",
+ "apple_env",
+ "user_compile_flags",
+ "sysroot",
+ "unfiltered_compile_flags",
+ "apply_simulator_compiler_flags",
+ ],
+ tools = [
+ tool(
+ path = "wrapped_clang",
+ execution_requirements = ["requires-darwin"],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "ios_x86_64"
+ or ctx.attr.cpu == "tvos_x86_64"
+ or ctx.attr.cpu == "watchos_x86_64"):
+ objcpp_compile_action = action_config(
+ action_name = ACTION_NAMES.objcpp_compile,
+ flag_sets = [
+ flag_set(
+ flag_groups = [
+ flag_group(
+ flags = ["-arch", "x86_64", "-stdlib=libc++", "-std=gnu++11"],
+ ),
+ ],
+ ),
+ ],
+ implies = [
+ "compiler_input_flags",
+ "compiler_output_flags",
+ "apply_default_compiler_flags",
+ "apply_default_warnings",
+ "framework_paths",
+ "preprocessor_defines",
+ "include_system_dirs",
+ "version_min",
+ "objc_arc",
+ "no_objc_arc",
+ "apple_env",
+ "user_compile_flags",
+ "sysroot",
+ "unfiltered_compile_flags",
+ "apply_simulator_compiler_flags",
+ ],
+ tools = [
+ tool(
+ path = "wrapped_clang",
+ execution_requirements = ["requires-darwin"],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "darwin_x86_64"):
+ objcpp_compile_action = action_config(
+ action_name = ACTION_NAMES.objcpp_compile,
+ flag_sets = [
+ flag_set(
+ flag_groups = [
+ flag_group(
+ flags = ["-arch", "x86_64", "-stdlib=libc++", "-std=gnu++11"],
+ ),
+ ],
+ ),
+ ],
+ implies = [
+ "compiler_input_flags",
+ "compiler_output_flags",
+ "apply_default_compiler_flags",
+ "apply_default_warnings",
+ "framework_paths",
+ "preprocessor_defines",
+ "include_system_dirs",
+ "version_min",
+ "objc_arc",
+ "no_objc_arc",
+ "apple_env",
+ "user_compile_flags",
+ "sysroot",
+ "unfiltered_compile_flags",
+ ],
+ tools = [
+ tool(
+ path = "wrapped_clang",
+ execution_requirements = ["requires-darwin"],
+ ),
+ ],
+ )
+
+ if (ctx.attr.cpu == "tvos_arm64"
+ or ctx.attr.cpu == "tvos_x86_64"):
+ assemble_action = action_config(
+ action_name = ACTION_NAMES.assemble,
+ implies = [
+ "objc_arc",
+ "no_objc_arc",
+ "include_system_dirs",
+ "apple_env",
+ "user_compile_flags",
+ "sysroot",
+ "unfiltered_compile_flags",
+ "compiler_input_flags",
+ "compiler_output_flags",
+ "unfiltered_cxx_flags",
+ ],
+ tools = [
+ tool(
+ path = "wrapped_clang",
+ execution_requirements = ["requires-darwin"],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "armeabi-v7a"
+ or ctx.attr.cpu == "darwin_x86_64"
+ or ctx.attr.cpu == "ios_arm64"
+ or ctx.attr.cpu == "ios_arm64e"
+ or ctx.attr.cpu == "ios_armv7"
+ or ctx.attr.cpu == "ios_i386"
+ or ctx.attr.cpu == "ios_x86_64"
+ or ctx.attr.cpu == "watchos_arm64_32"
+ or ctx.attr.cpu == "watchos_armv7k"
+ or ctx.attr.cpu == "watchos_i386"
+ or ctx.attr.cpu == "watchos_x86_64"):
+ assemble_action = action_config(
+ action_name = ACTION_NAMES.assemble,
+ implies = [
+ "objc_arc",
+ "no_objc_arc",
+ "include_system_dirs",
+ "apple_env",
+ "user_compile_flags",
+ "sysroot",
+ "unfiltered_compile_flags",
+ "compiler_input_flags",
+ "compiler_output_flags",
+ ],
+ tools = [
+ tool(
+ path = "wrapped_clang",
+ execution_requirements = ["requires-darwin"],
+ ),
+ ],
+ )
+
+ if (ctx.attr.cpu == "tvos_arm64"
+ or ctx.attr.cpu == "tvos_x86_64"):
+ preprocess_assemble_action = action_config(
+ action_name = ACTION_NAMES.preprocess_assemble,
+ implies = [
+ "preprocessor_defines",
+ "include_system_dirs",
+ "version_min",
+ "objc_arc",
+ "no_objc_arc",
+ "apple_env",
+ "user_compile_flags",
+ "sysroot",
+ "unfiltered_compile_flags",
+ "compiler_input_flags",
+ "compiler_output_flags",
+ "unfiltered_cxx_flags",
+ ],
+ tools = [
+ tool(
+ path = "wrapped_clang",
+ execution_requirements = ["requires-darwin"],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "armeabi-v7a"
+ or ctx.attr.cpu == "darwin_x86_64"
+ or ctx.attr.cpu == "ios_arm64"
+ or ctx.attr.cpu == "ios_arm64e"
+ or ctx.attr.cpu == "ios_armv7"
+ or ctx.attr.cpu == "ios_i386"
+ or ctx.attr.cpu == "ios_x86_64"
+ or ctx.attr.cpu == "watchos_arm64_32"
+ or ctx.attr.cpu == "watchos_armv7k"
+ or ctx.attr.cpu == "watchos_i386"
+ or ctx.attr.cpu == "watchos_x86_64"):
+ preprocess_assemble_action = action_config(
+ action_name = ACTION_NAMES.preprocess_assemble,
+ implies = [
+ "preprocessor_defines",
+ "include_system_dirs",
+ "version_min",
+ "objc_arc",
+ "no_objc_arc",
+ "apple_env",
+ "user_compile_flags",
+ "sysroot",
+ "unfiltered_compile_flags",
+ "compiler_input_flags",
+ "compiler_output_flags",
+ ],
+ tools = [
+ tool(
+ path = "wrapped_clang",
+ execution_requirements = ["requires-darwin"],
+ ),
+ ],
+ )
+
+ if (ctx.attr.cpu == "armeabi-v7a"
+ or ctx.attr.cpu == "watchos_arm64_32"):
+ objc_archive_action = action_config(
+ action_name = "objc-archive",
+ flag_sets = [
+ flag_set(
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-no_warning_for_no_symbols",
+ "-static",
+ "-filelist",
+ "%{obj_list_path}",
+ "-arch_only",
+ "<architecture>",
+ "-syslibroot",
+ "%{sdk_dir}",
+ "-o",
+ "%{archive_path}",
+ ],
+ ),
+ ],
+ ),
+ ],
+ implies = ["apple_env"],
+ tools = [
+ tool(
+ path = "libtool",
+ execution_requirements = ["requires-darwin"],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "ios_arm64"
+ or ctx.attr.cpu == "tvos_arm64"):
+ objc_archive_action = action_config(
+ action_name = "objc-archive",
+ flag_sets = [
+ flag_set(
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-no_warning_for_no_symbols",
+ "-static",
+ "-filelist",
+ "%{obj_list_path}",
+ "-arch_only",
+ "arm64",
+ "-syslibroot",
+ "%{sdk_dir}",
+ "-o",
+ "%{archive_path}",
+ ],
+ ),
+ ],
+ ),
+ ],
+ implies = ["apple_env"],
+ tools = [
+ tool(
+ path = "libtool",
+ execution_requirements = ["requires-darwin"],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "ios_arm64e"):
+ objc_archive_action = action_config(
+ action_name = "objc-archive",
+ flag_sets = [
+ flag_set(
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-no_warning_for_no_symbols",
+ "-static",
+ "-filelist",
+ "%{obj_list_path}",
+ "-arch_only",
+ "arm64e",
+ "-syslibroot",
+ "%{sdk_dir}",
+ "-o",
+ "%{archive_path}",
+ ],
+ ),
+ ],
+ ),
+ ],
+ implies = ["apple_env"],
+ tools = [
+ tool(
+ path = "libtool",
+ execution_requirements = ["requires-darwin"],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "ios_armv7"):
+ objc_archive_action = action_config(
+ action_name = "objc-archive",
+ flag_sets = [
+ flag_set(
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-no_warning_for_no_symbols",
+ "-static",
+ "-filelist",
+ "%{obj_list_path}",
+ "-arch_only",
+ "armv7",
+ "-syslibroot",
+ "%{sdk_dir}",
+ "-o",
+ "%{archive_path}",
+ ],
+ ),
+ ],
+ ),
+ ],
+ implies = ["apple_env"],
+ tools = [
+ tool(
+ path = "libtool",
+ execution_requirements = ["requires-darwin"],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "watchos_armv7k"):
+ objc_archive_action = action_config(
+ action_name = "objc-archive",
+ flag_sets = [
+ flag_set(
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-no_warning_for_no_symbols",
+ "-static",
+ "-filelist",
+ "%{obj_list_path}",
+ "-arch_only",
+ "armv7k",
+ "-syslibroot",
+ "%{sdk_dir}",
+ "-o",
+ "%{archive_path}",
+ ],
+ ),
+ ],
+ ),
+ ],
+ implies = ["apple_env"],
+ tools = [
+ tool(
+ path = "libtool",
+ execution_requirements = ["requires-darwin"],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "ios_i386"
+ or ctx.attr.cpu == "watchos_i386"):
+ objc_archive_action = action_config(
+ action_name = "objc-archive",
+ flag_sets = [
+ flag_set(
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-no_warning_for_no_symbols",
+ "-static",
+ "-filelist",
+ "%{obj_list_path}",
+ "-arch_only",
+ "i386",
+ "-syslibroot",
+ "%{sdk_dir}",
+ "-o",
+ "%{archive_path}",
+ ],
+ ),
+ ],
+ ),
+ ],
+ implies = ["apple_env"],
+ tools = [
+ tool(
+ path = "libtool",
+ execution_requirements = ["requires-darwin"],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "darwin_x86_64"
+ or ctx.attr.cpu == "ios_x86_64"
+ or ctx.attr.cpu == "tvos_x86_64"
+ or ctx.attr.cpu == "watchos_x86_64"):
+ objc_archive_action = action_config(
+ action_name = "objc-archive",
+ flag_sets = [
+ flag_set(
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-no_warning_for_no_symbols",
+ "-static",
+ "-filelist",
+ "%{obj_list_path}",
+ "-arch_only",
+ "x86_64",
+ "-syslibroot",
+ "%{sdk_dir}",
+ "-o",
+ "%{archive_path}",
+ ],
+ ),
+ ],
+ ),
+ ],
+ implies = ["apple_env"],
+ tools = [
+ tool(
+ path = "libtool",
+ execution_requirements = ["requires-darwin"],
+ ),
+ ],
+ )
+
+ if (ctx.attr.cpu == "armeabi-v7a"
+ or ctx.attr.cpu == "watchos_arm64_32"):
+ objc_executable_action = action_config(
+ action_name = "objc-executable",
+ flag_sets = [
+ flag_set(
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-Xlinker",
+ "-objc_abi_version",
+ "-Xlinker",
+ "2",
+ "-Xlinker",
+ "-rpath",
+ "-Xlinker",
+ "@executable_path/Frameworks",
+ "-fobjc-link-runtime",
+ "-ObjC",
+ ],
+ ),
+ ],
+ with_features = [with_feature_set(not_features = ["kernel_extension"])],
+ ),
+ flag_set(
+ flag_groups = [
+ flag_group(flags = ["-arch", "<architecture>"]),
+ flag_group(
+ flags = ["-framework", "%{framework_names}"],
+ iterate_over = "framework_names",
+ ),
+ flag_group(
+ flags = ["-weak_framework", "%{weak_framework_names}"],
+ iterate_over = "weak_framework_names",
+ ),
+ flag_group(
+ flags = ["-l%{library_names}"],
+ iterate_over = "library_names",
+ ),
+ flag_group(flags = ["-filelist", "%{filelist}"]),
+ flag_group(flags = ["-o", "%{linked_binary}"]),
+ flag_group(
+ flags = ["-force_load", "%{force_load_exec_paths}"],
+ iterate_over = "force_load_exec_paths",
+ ),
+ flag_group(
+ flags = ["%{dep_linkopts}"],
+ iterate_over = "dep_linkopts",
+ ),
+ flag_group(
+ flags = ["-Wl,%{attr_linkopts}"],
+ iterate_over = "attr_linkopts",
+ ),
+ ],
+ ),
+ ],
+ implies = [
+ "include_system_dirs",
+ "framework_paths",
+ "version_min",
+ "strip_debug_symbols",
+ "apple_env",
+ "apply_implicit_frameworks",
+ ],
+ tools = [
+ tool(
+ path = "wrapped_clang",
+ execution_requirements = ["requires-darwin"],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "ios_arm64"
+ or ctx.attr.cpu == "tvos_arm64"):
+ objc_executable_action = action_config(
+ action_name = "objc-executable",
+ flag_sets = [
+ flag_set(
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-Xlinker",
+ "-objc_abi_version",
+ "-Xlinker",
+ "2",
+ "-Xlinker",
+ "-rpath",
+ "-Xlinker",
+ "@executable_path/Frameworks",
+ "-fobjc-link-runtime",
+ "-ObjC",
+ ],
+ ),
+ ],
+ with_features = [with_feature_set(not_features = ["kernel_extension"])],
+ ),
+ flag_set(
+ flag_groups = [
+ flag_group(flags = ["-arch", "arm64"]),
+ flag_group(
+ flags = ["-framework", "%{framework_names}"],
+ iterate_over = "framework_names",
+ ),
+ flag_group(
+ flags = ["-weak_framework", "%{weak_framework_names}"],
+ iterate_over = "weak_framework_names",
+ ),
+ flag_group(
+ flags = ["-l%{library_names}"],
+ iterate_over = "library_names",
+ ),
+ flag_group(flags = ["-filelist", "%{filelist}"]),
+ flag_group(flags = ["-o", "%{linked_binary}"]),
+ flag_group(
+ flags = ["-force_load", "%{force_load_exec_paths}"],
+ iterate_over = "force_load_exec_paths",
+ ),
+ flag_group(
+ flags = ["%{dep_linkopts}"],
+ iterate_over = "dep_linkopts",
+ ),
+ flag_group(
+ flags = ["-Wl,%{attr_linkopts}"],
+ iterate_over = "attr_linkopts",
+ ),
+ ],
+ ),
+ ],
+ implies = [
+ "include_system_dirs",
+ "framework_paths",
+ "version_min",
+ "strip_debug_symbols",
+ "apple_env",
+ "apply_implicit_frameworks",
+ ],
+ tools = [
+ tool(
+ path = "wrapped_clang",
+ execution_requirements = ["requires-darwin"],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "ios_arm64e"):
+ objc_executable_action = action_config(
+ action_name = "objc-executable",
+ flag_sets = [
+ flag_set(
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-Xlinker",
+ "-objc_abi_version",
+ "-Xlinker",
+ "2",
+ "-Xlinker",
+ "-rpath",
+ "-Xlinker",
+ "@executable_path/Frameworks",
+ "-fobjc-link-runtime",
+ "-ObjC",
+ ],
+ ),
+ ],
+ with_features = [with_feature_set(not_features = ["kernel_extension"])],
+ ),
+ flag_set(
+ flag_groups = [
+ flag_group(flags = ["-arch", "arm64e"]),
+ flag_group(
+ flags = ["-framework", "%{framework_names}"],
+ iterate_over = "framework_names",
+ ),
+ flag_group(
+ flags = ["-weak_framework", "%{weak_framework_names}"],
+ iterate_over = "weak_framework_names",
+ ),
+ flag_group(
+ flags = ["-l%{library_names}"],
+ iterate_over = "library_names",
+ ),
+ flag_group(flags = ["-filelist", "%{filelist}"]),
+ flag_group(flags = ["-o", "%{linked_binary}"]),
+ flag_group(
+ flags = ["-force_load", "%{force_load_exec_paths}"],
+ iterate_over = "force_load_exec_paths",
+ ),
+ flag_group(
+ flags = ["%{dep_linkopts}"],
+ iterate_over = "dep_linkopts",
+ ),
+ flag_group(
+ flags = ["-Wl,%{attr_linkopts}"],
+ iterate_over = "attr_linkopts",
+ ),
+ ],
+ ),
+ ],
+ implies = [
+ "include_system_dirs",
+ "framework_paths",
+ "version_min",
+ "strip_debug_symbols",
+ "apple_env",
+ "apply_implicit_frameworks",
+ ],
+ tools = [
+ tool(
+ path = "wrapped_clang",
+ execution_requirements = ["requires-darwin"],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "ios_armv7"):
+ objc_executable_action = action_config(
+ action_name = "objc-executable",
+ flag_sets = [
+ flag_set(
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-Xlinker",
+ "-objc_abi_version",
+ "-Xlinker",
+ "2",
+ "-Xlinker",
+ "-rpath",
+ "-Xlinker",
+ "@executable_path/Frameworks",
+ "-fobjc-link-runtime",
+ "-ObjC",
+ ],
+ ),
+ ],
+ with_features = [with_feature_set(not_features = ["kernel_extension"])],
+ ),
+ flag_set(
+ flag_groups = [
+ flag_group(flags = ["-arch", "armv7"]),
+ flag_group(
+ flags = ["-framework", "%{framework_names}"],
+ iterate_over = "framework_names",
+ ),
+ flag_group(
+ flags = ["-weak_framework", "%{weak_framework_names}"],
+ iterate_over = "weak_framework_names",
+ ),
+ flag_group(
+ flags = ["-l%{library_names}"],
+ iterate_over = "library_names",
+ ),
+ flag_group(flags = ["-filelist", "%{filelist}"]),
+ flag_group(flags = ["-o", "%{linked_binary}"]),
+ flag_group(
+ flags = ["-force_load", "%{force_load_exec_paths}"],
+ iterate_over = "force_load_exec_paths",
+ ),
+ flag_group(
+ flags = ["%{dep_linkopts}"],
+ iterate_over = "dep_linkopts",
+ ),
+ flag_group(
+ flags = ["-Wl,%{attr_linkopts}"],
+ iterate_over = "attr_linkopts",
+ ),
+ ],
+ ),
+ ],
+ implies = [
+ "include_system_dirs",
+ "framework_paths",
+ "version_min",
+ "strip_debug_symbols",
+ "apple_env",
+ "apply_implicit_frameworks",
+ ],
+ tools = [
+ tool(
+ path = "wrapped_clang",
+ execution_requirements = ["requires-darwin"],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "watchos_armv7k"):
+ objc_executable_action = action_config(
+ action_name = "objc-executable",
+ flag_sets = [
+ flag_set(
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-Xlinker",
+ "-objc_abi_version",
+ "-Xlinker",
+ "2",
+ "-Xlinker",
+ "-rpath",
+ "-Xlinker",
+ "@executable_path/Frameworks",
+ "-fobjc-link-runtime",
+ "-ObjC",
+ ],
+ ),
+ ],
+ with_features = [with_feature_set(not_features = ["kernel_extension"])],
+ ),
+ flag_set(
+ flag_groups = [
+ flag_group(flags = ["-arch", "armv7k"]),
+ flag_group(
+ flags = ["-framework", "%{framework_names}"],
+ iterate_over = "framework_names",
+ ),
+ flag_group(
+ flags = ["-weak_framework", "%{weak_framework_names}"],
+ iterate_over = "weak_framework_names",
+ ),
+ flag_group(
+ flags = ["-l%{library_names}"],
+ iterate_over = "library_names",
+ ),
+ flag_group(flags = ["-filelist", "%{filelist}"]),
+ flag_group(flags = ["-o", "%{linked_binary}"]),
+ flag_group(
+ flags = ["-force_load", "%{force_load_exec_paths}"],
+ iterate_over = "force_load_exec_paths",
+ ),
+ flag_group(
+ flags = ["%{dep_linkopts}"],
+ iterate_over = "dep_linkopts",
+ ),
+ flag_group(
+ flags = ["-Wl,%{attr_linkopts}"],
+ iterate_over = "attr_linkopts",
+ ),
+ ],
+ ),
+ ],
+ implies = [
+ "include_system_dirs",
+ "framework_paths",
+ "version_min",
+ "strip_debug_symbols",
+ "apple_env",
+ "apply_implicit_frameworks",
+ ],
+ tools = [
+ tool(
+ path = "wrapped_clang",
+ execution_requirements = ["requires-darwin"],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "ios_i386"
+ or ctx.attr.cpu == "watchos_i386"):
+ objc_executable_action = action_config(
+ action_name = "objc-executable",
+ flag_sets = [
+ flag_set(
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-Xlinker",
+ "-objc_abi_version",
+ "-Xlinker",
+ "2",
+ "-Xlinker",
+ "-rpath",
+ "-Xlinker",
+ "@executable_path/Frameworks",
+ "-fobjc-link-runtime",
+ "-ObjC",
+ ],
+ ),
+ ],
+ with_features = [with_feature_set(not_features = ["kernel_extension"])],
+ ),
+ flag_set(
+ flag_groups = [
+ flag_group(flags = ["-arch", "i386"]),
+ flag_group(
+ flags = ["-framework", "%{framework_names}"],
+ iterate_over = "framework_names",
+ ),
+ flag_group(
+ flags = ["-weak_framework", "%{weak_framework_names}"],
+ iterate_over = "weak_framework_names",
+ ),
+ flag_group(
+ flags = ["-l%{library_names}"],
+ iterate_over = "library_names",
+ ),
+ flag_group(flags = ["-filelist", "%{filelist}"]),
+ flag_group(flags = ["-o", "%{linked_binary}"]),
+ flag_group(
+ flags = ["-force_load", "%{force_load_exec_paths}"],
+ iterate_over = "force_load_exec_paths",
+ ),
+ flag_group(
+ flags = ["%{dep_linkopts}"],
+ iterate_over = "dep_linkopts",
+ ),
+ flag_group(
+ flags = ["-Wl,%{attr_linkopts}"],
+ iterate_over = "attr_linkopts",
+ ),
+ ],
+ ),
+ ],
+ implies = [
+ "include_system_dirs",
+ "framework_paths",
+ "version_min",
+ "strip_debug_symbols",
+ "apple_env",
+ "apply_implicit_frameworks",
+ ],
+ tools = [
+ tool(
+ path = "wrapped_clang",
+ execution_requirements = ["requires-darwin"],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "darwin_x86_64"
+ or ctx.attr.cpu == "ios_x86_64"
+ or ctx.attr.cpu == "tvos_x86_64"
+ or ctx.attr.cpu == "watchos_x86_64"):
+ objc_executable_action = action_config(
+ action_name = "objc-executable",
+ flag_sets = [
+ flag_set(
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-Xlinker",
+ "-objc_abi_version",
+ "-Xlinker",
+ "2",
+ "-Xlinker",
+ "-rpath",
+ "-Xlinker",
+ "@executable_path/Frameworks",
+ "-fobjc-link-runtime",
+ "-ObjC",
+ ],
+ ),
+ ],
+ with_features = [with_feature_set(not_features = ["kernel_extension"])],
+ ),
+ flag_set(
+ flag_groups = [
+ flag_group(flags = ["-arch", "x86_64"]),
+ flag_group(
+ flags = ["-framework", "%{framework_names}"],
+ iterate_over = "framework_names",
+ ),
+ flag_group(
+ flags = ["-weak_framework", "%{weak_framework_names}"],
+ iterate_over = "weak_framework_names",
+ ),
+ flag_group(
+ flags = ["-l%{library_names}"],
+ iterate_over = "library_names",
+ ),
+ flag_group(flags = ["-filelist", "%{filelist}"]),
+ flag_group(flags = ["-o", "%{linked_binary}"]),
+ flag_group(
+ flags = ["-force_load", "%{force_load_exec_paths}"],
+ iterate_over = "force_load_exec_paths",
+ ),
+ flag_group(
+ flags = ["%{dep_linkopts}"],
+ iterate_over = "dep_linkopts",
+ ),
+ flag_group(
+ flags = ["-Wl,%{attr_linkopts}"],
+ iterate_over = "attr_linkopts",
+ ),
+ ],
+ ),
+ ],
+ implies = [
+ "include_system_dirs",
+ "framework_paths",
+ "version_min",
+ "strip_debug_symbols",
+ "apple_env",
+ "apply_implicit_frameworks",
+ ],
+ tools = [
+ tool(
+ path = "wrapped_clang",
+ execution_requirements = ["requires-darwin"],
+ ),
+ ],
+ )
+
+ if (ctx.attr.cpu == "tvos_arm64"
+ or ctx.attr.cpu == "tvos_x86_64"):
+ cpp_link_executable_action = action_config(
+ action_name = ACTION_NAMES.cpp_link_executable,
+ implies = [
+ "contains_objc_source",
+ "symbol_counts",
+ "linkstamps",
+ "output_execpath_flags",
+ "runtime_root_flags",
+ "input_param_flags",
+ "force_pic_flags",
+ "strip_debug_symbols",
+ "linker_param_file",
+ "version_min",
+ "apple_env",
+ "sysroot",
+ "cpp_linker_flags",
+ ],
+ tools = [
+ tool(
+ path = "cc_wrapper.sh",
+ execution_requirements = ["requires-darwin"],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "armeabi-v7a"
+ or ctx.attr.cpu == "darwin_x86_64"
+ or ctx.attr.cpu == "ios_arm64"
+ or ctx.attr.cpu == "ios_arm64e"
+ or ctx.attr.cpu == "ios_armv7"
+ or ctx.attr.cpu == "ios_i386"
+ or ctx.attr.cpu == "ios_x86_64"
+ or ctx.attr.cpu == "watchos_arm64_32"
+ or ctx.attr.cpu == "watchos_armv7k"
+ or ctx.attr.cpu == "watchos_i386"
+ or ctx.attr.cpu == "watchos_x86_64"):
+ cpp_link_executable_action = action_config(
+ action_name = ACTION_NAMES.cpp_link_executable,
+ implies = [
+ "contains_objc_source",
+ "symbol_counts",
+ "linkstamps",
+ "output_execpath_flags",
+ "runtime_root_flags",
+ "input_param_flags",
+ "force_pic_flags",
+ "strip_debug_symbols",
+ "linker_param_file",
+ "version_min",
+ "apple_env",
+ "sysroot",
+ ],
+ tools = [
+ tool(
+ path = "cc_wrapper.sh",
+ execution_requirements = ["requires-darwin"],
+ ),
+ ],
+ )
+
+ linkstamp_compile_action = action_config(
+ action_name = ACTION_NAMES.linkstamp_compile,
+ implies = [
+ "preprocessor_defines",
+ "include_system_dirs",
+ "version_min",
+ "objc_arc",
+ "no_objc_arc",
+ "apple_env",
+ "user_compile_flags",
+ "sysroot",
+ "unfiltered_compile_flags",
+ "compiler_input_flags",
+ "compiler_output_flags",
+ ],
+ tools = [
+ tool(
+ path = "wrapped_clang",
+ execution_requirements = ["requires-darwin"],
+ ),
+ ],
+ )
+
+ if (ctx.attr.cpu == "tvos_arm64"
+ or ctx.attr.cpu == "tvos_x86_64"):
+ cpp_module_compile_action = action_config(
+ action_name = ACTION_NAMES.cpp_module_compile,
+ implies = [
+ "preprocessor_defines",
+ "include_system_dirs",
+ "version_min",
+ "objc_arc",
+ "no_objc_arc",
+ "apple_env",
+ "user_compile_flags",
+ "sysroot",
+ "unfiltered_compile_flags",
+ "compiler_input_flags",
+ "compiler_output_flags",
+ "unfiltered_cxx_flags",
+ ],
+ tools = [
+ tool(
+ path = "wrapped_clang",
+ execution_requirements = ["requires-darwin"],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "armeabi-v7a"
+ or ctx.attr.cpu == "darwin_x86_64"
+ or ctx.attr.cpu == "ios_arm64"
+ or ctx.attr.cpu == "ios_arm64e"
+ or ctx.attr.cpu == "ios_armv7"
+ or ctx.attr.cpu == "ios_i386"
+ or ctx.attr.cpu == "ios_x86_64"
+ or ctx.attr.cpu == "watchos_arm64_32"
+ or ctx.attr.cpu == "watchos_armv7k"
+ or ctx.attr.cpu == "watchos_i386"
+ or ctx.attr.cpu == "watchos_x86_64"):
+ cpp_module_compile_action = action_config(
+ action_name = ACTION_NAMES.cpp_module_compile,
+ implies = [
+ "preprocessor_defines",
+ "include_system_dirs",
+ "version_min",
+ "objc_arc",
+ "no_objc_arc",
+ "apple_env",
+ "user_compile_flags",
+ "sysroot",
+ "unfiltered_compile_flags",
+ "compiler_input_flags",
+ "compiler_output_flags",
+ ],
+ tools = [
+ tool(
+ path = "wrapped_clang",
+ execution_requirements = ["requires-darwin"],
+ ),
+ ],
+ )
+
+ if (ctx.attr.cpu == "tvos_arm64"
+ or ctx.attr.cpu == "tvos_x86_64"):
+ cpp_link_nodeps_dynamic_library_action = action_config(
+ action_name = ACTION_NAMES.cpp_link_nodeps_dynamic_library,
+ implies = [
+ "contains_objc_source",
+ "has_configured_linker_path",
+ "symbol_counts",
+ "shared_flag",
+ "linkstamps",
+ "output_execpath_flags",
+ "runtime_root_flags",
+ "input_param_flags",
+ "strip_debug_symbols",
+ "linker_param_file",
+ "version_min",
+ "apple_env",
+ "sysroot",
+ "cpp_linker_flags",
+ ],
+ tools = [
+ tool(
+ path = "cc_wrapper.sh",
+ execution_requirements = ["requires-darwin"],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "armeabi-v7a"
+ or ctx.attr.cpu == "darwin_x86_64"
+ or ctx.attr.cpu == "ios_arm64"
+ or ctx.attr.cpu == "ios_arm64e"
+ or ctx.attr.cpu == "ios_armv7"
+ or ctx.attr.cpu == "ios_i386"
+ or ctx.attr.cpu == "ios_x86_64"
+ or ctx.attr.cpu == "watchos_arm64_32"
+ or ctx.attr.cpu == "watchos_armv7k"
+ or ctx.attr.cpu == "watchos_i386"
+ or ctx.attr.cpu == "watchos_x86_64"):
+ cpp_link_nodeps_dynamic_library_action = action_config(
+ action_name = ACTION_NAMES.cpp_link_nodeps_dynamic_library,
+ implies = [
+ "contains_objc_source",
+ "has_configured_linker_path",
+ "symbol_counts",
+ "shared_flag",
+ "linkstamps",
+ "output_execpath_flags",
+ "runtime_root_flags",
+ "input_param_flags",
+ "strip_debug_symbols",
+ "linker_param_file",
+ "version_min",
+ "apple_env",
+ "sysroot",
+ ],
+ tools = [
+ tool(
+ path = "cc_wrapper.sh",
+ execution_requirements = ["requires-darwin"],
+ ),
+ ],
+ )
+
+ if (ctx.attr.cpu == "armeabi-v7a"
+ or ctx.attr.cpu == "watchos_arm64_32"):
+ objc_fully_link_action = action_config(
+ action_name = "objc-fully-link",
+ flag_sets = [
+ flag_set(
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-no_warning_for_no_symbols",
+ "-static",
+ "-arch_only",
+ "<architecture>",
+ "-syslibroot",
+ "%{sdk_dir}",
+ "-o",
+ "%{fully_linked_archive_path}",
+ ],
+ ),
+ flag_group(
+ flags = ["%{objc_library_exec_paths}"],
+ iterate_over = "objc_library_exec_paths",
+ ),
+ flag_group(
+ flags = ["%{cc_library_exec_paths}"],
+ iterate_over = "cc_library_exec_paths",
+ ),
+ flag_group(
+ flags = ["%{imported_library_exec_paths}"],
+ iterate_over = "imported_library_exec_paths",
+ ),
+ ],
+ ),
+ ],
+ implies = ["apple_env"],
+ tools = [
+ tool(
+ path = "libtool",
+ execution_requirements = ["requires-darwin"],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "ios_arm64"
+ or ctx.attr.cpu == "tvos_arm64"):
+ objc_fully_link_action = action_config(
+ action_name = "objc-fully-link",
+ flag_sets = [
+ flag_set(
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-no_warning_for_no_symbols",
+ "-static",
+ "-arch_only",
+ "arm64",
+ "-syslibroot",
+ "%{sdk_dir}",
+ "-o",
+ "%{fully_linked_archive_path}",
+ ],
+ ),
+ flag_group(
+ flags = ["%{objc_library_exec_paths}"],
+ iterate_over = "objc_library_exec_paths",
+ ),
+ flag_group(
+ flags = ["%{cc_library_exec_paths}"],
+ iterate_over = "cc_library_exec_paths",
+ ),
+ flag_group(
+ flags = ["%{imported_library_exec_paths}"],
+ iterate_over = "imported_library_exec_paths",
+ ),
+ ],
+ ),
+ ],
+ implies = ["apple_env"],
+ tools = [
+ tool(
+ path = "libtool",
+ execution_requirements = ["requires-darwin"],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "ios_arm64e"):
+ objc_fully_link_action = action_config(
+ action_name = "objc-fully-link",
+ flag_sets = [
+ flag_set(
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-no_warning_for_no_symbols",
+ "-static",
+ "-arch_only",
+ "arm64e",
+ "-syslibroot",
+ "%{sdk_dir}",
+ "-o",
+ "%{fully_linked_archive_path}",
+ ],
+ ),
+ flag_group(
+ flags = ["%{objc_library_exec_paths}"],
+ iterate_over = "objc_library_exec_paths",
+ ),
+ flag_group(
+ flags = ["%{cc_library_exec_paths}"],
+ iterate_over = "cc_library_exec_paths",
+ ),
+ flag_group(
+ flags = ["%{imported_library_exec_paths}"],
+ iterate_over = "imported_library_exec_paths",
+ ),
+ ],
+ ),
+ ],
+ implies = ["apple_env"],
+ tools = [
+ tool(
+ path = "libtool",
+ execution_requirements = ["requires-darwin"],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "ios_armv7"):
+ objc_fully_link_action = action_config(
+ action_name = "objc-fully-link",
+ flag_sets = [
+ flag_set(
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-no_warning_for_no_symbols",
+ "-static",
+ "-arch_only",
+ "armv7",
+ "-syslibroot",
+ "%{sdk_dir}",
+ "-o",
+ "%{fully_linked_archive_path}",
+ ],
+ ),
+ flag_group(
+ flags = ["%{objc_library_exec_paths}"],
+ iterate_over = "objc_library_exec_paths",
+ ),
+ flag_group(
+ flags = ["%{cc_library_exec_paths}"],
+ iterate_over = "cc_library_exec_paths",
+ ),
+ flag_group(
+ flags = ["%{imported_library_exec_paths}"],
+ iterate_over = "imported_library_exec_paths",
+ ),
+ ],
+ ),
+ ],
+ implies = ["apple_env"],
+ tools = [
+ tool(
+ path = "libtool",
+ execution_requirements = ["requires-darwin"],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "watchos_armv7k"):
+ objc_fully_link_action = action_config(
+ action_name = "objc-fully-link",
+ flag_sets = [
+ flag_set(
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-no_warning_for_no_symbols",
+ "-static",
+ "-arch_only",
+ "armv7k",
+ "-syslibroot",
+ "%{sdk_dir}",
+ "-o",
+ "%{fully_linked_archive_path}",
+ ],
+ ),
+ flag_group(
+ flags = ["%{objc_library_exec_paths}"],
+ iterate_over = "objc_library_exec_paths",
+ ),
+ flag_group(
+ flags = ["%{cc_library_exec_paths}"],
+ iterate_over = "cc_library_exec_paths",
+ ),
+ flag_group(
+ flags = ["%{imported_library_exec_paths}"],
+ iterate_over = "imported_library_exec_paths",
+ ),
+ ],
+ ),
+ ],
+ implies = ["apple_env"],
+ tools = [
+ tool(
+ path = "libtool",
+ execution_requirements = ["requires-darwin"],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "ios_i386"
+ or ctx.attr.cpu == "watchos_i386"):
+ objc_fully_link_action = action_config(
+ action_name = "objc-fully-link",
+ flag_sets = [
+ flag_set(
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-no_warning_for_no_symbols",
+ "-static",
+ "-arch_only",
+ "i386",
+ "-syslibroot",
+ "%{sdk_dir}",
+ "-o",
+ "%{fully_linked_archive_path}",
+ ],
+ ),
+ flag_group(
+ flags = ["%{objc_library_exec_paths}"],
+ iterate_over = "objc_library_exec_paths",
+ ),
+ flag_group(
+ flags = ["%{cc_library_exec_paths}"],
+ iterate_over = "cc_library_exec_paths",
+ ),
+ flag_group(
+ flags = ["%{imported_library_exec_paths}"],
+ iterate_over = "imported_library_exec_paths",
+ ),
+ ],
+ ),
+ ],
+ implies = ["apple_env"],
+ tools = [
+ tool(
+ path = "libtool",
+ execution_requirements = ["requires-darwin"],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "darwin_x86_64"
+ or ctx.attr.cpu == "ios_x86_64"
+ or ctx.attr.cpu == "tvos_x86_64"
+ or ctx.attr.cpu == "watchos_x86_64"):
+ objc_fully_link_action = action_config(
+ action_name = "objc-fully-link",
+ flag_sets = [
+ flag_set(
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-no_warning_for_no_symbols",
+ "-static",
+ "-arch_only",
+ "x86_64",
+ "-syslibroot",
+ "%{sdk_dir}",
+ "-o",
+ "%{fully_linked_archive_path}",
+ ],
+ ),
+ flag_group(
+ flags = ["%{objc_library_exec_paths}"],
+ iterate_over = "objc_library_exec_paths",
+ ),
+ flag_group(
+ flags = ["%{cc_library_exec_paths}"],
+ iterate_over = "cc_library_exec_paths",
+ ),
+ flag_group(
+ flags = ["%{imported_library_exec_paths}"],
+ iterate_over = "imported_library_exec_paths",
+ ),
+ ],
+ ),
+ ],
+ implies = ["apple_env"],
+ tools = [
+ tool(
+ path = "libtool",
+ execution_requirements = ["requires-darwin"],
+ ),
+ ],
+ )
+
+ if (ctx.attr.cpu == "armeabi-v7a"):
+ objcopy_embed_data_action = action_config(
+ action_name = "objcopy_embed_data",
+ enabled = True,
+ tools = [tool(path = "/bin/false")],
+ )
+ elif (ctx.attr.cpu == "darwin_x86_64"
+ or ctx.attr.cpu == "ios_arm64"
+ or ctx.attr.cpu == "ios_arm64e"
+ or ctx.attr.cpu == "ios_armv7"
+ or ctx.attr.cpu == "ios_i386"
+ or ctx.attr.cpu == "ios_x86_64"
+ or ctx.attr.cpu == "tvos_arm64"
+ or ctx.attr.cpu == "tvos_x86_64"
+ or ctx.attr.cpu == "watchos_arm64_32"
+ or ctx.attr.cpu == "watchos_armv7k"
+ or ctx.attr.cpu == "watchos_i386"
+ or ctx.attr.cpu == "watchos_x86_64"):
+ objcopy_embed_data_action = action_config(
+ action_name = "objcopy_embed_data",
+ enabled = True,
+ tools = [tool(path = "/usr/bin/objcopy")],
+ )
+
+ action_configs = [
+ strip_action,
+ c_compile_action,
+ cpp_compile_action,
+ linkstamp_compile_action,
+ cpp_module_compile_action,
+ cpp_header_parsing_action,
+ objc_compile_action,
+ objcpp_compile_action,
+ assemble_action,
+ preprocess_assemble_action,
+ objc_archive_action,
+ objc_executable_action,
+ objcpp_executable_action,
+ cpp_link_executable_action,
+ cpp_link_dynamic_library_action,
+ cpp_link_nodeps_dynamic_library_action,
+ cpp_link_static_library_action,
+ objc_fully_link_action,
+ objcopy_embed_data_action,
+ ]
+
+ if (ctx.attr.cpu == "armeabi-v7a"
+ or ctx.attr.cpu == "ios_arm64"
+ or ctx.attr.cpu == "ios_arm64e"
+ or ctx.attr.cpu == "ios_armv7"
+ or ctx.attr.cpu == "ios_i386"
+ or ctx.attr.cpu == "ios_x86_64"
+ or ctx.attr.cpu == "watchos_arm64_32"
+ or ctx.attr.cpu == "watchos_armv7k"
+ or ctx.attr.cpu == "watchos_i386"
+ or ctx.attr.cpu == "watchos_x86_64"):
+ apply_default_compiler_flags_feature = feature(
+ name = "apply_default_compiler_flags",
+ flag_sets = [
+ flag_set(
+ actions = [ACTION_NAMES.objc_compile, ACTION_NAMES.objcpp_compile],
+ flag_groups = [flag_group(flags = ["-DOS_IOS", "-fno-autolink"])],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "darwin_x86_64"):
+ apply_default_compiler_flags_feature = feature(
+ name = "apply_default_compiler_flags",
+ flag_sets = [
+ flag_set(
+ actions = [ACTION_NAMES.objc_compile, ACTION_NAMES.objcpp_compile],
+ flag_groups = [flag_group(flags = ["-DOS_MACOSX", "-fno-autolink"])],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "tvos_arm64"
+ or ctx.attr.cpu == "tvos_x86_64"):
+ apply_default_compiler_flags_feature = feature(
+ name = "apply_default_compiler_flags",
+ flag_sets = [
+ flag_set(
+ actions = [ACTION_NAMES.objc_compile, ACTION_NAMES.objcpp_compile],
+ flag_groups = [flag_group(flags = ["-DOS_TVOS", "-fno-autolink"])],
+ ),
+ ],
+ )
+
+ dynamic_linking_mode_feature = feature(name = "dynamic_linking_mode")
+
+ compile_all_modules_feature = feature(name = "compile_all_modules")
+
+ runtime_root_flags_feature = feature(
+ name = "runtime_root_flags",
+ flag_sets = [
+ flag_set(
+ actions = all_link_actions +
+ [ACTION_NAMES.cpp_link_static_library],
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-Wl,-rpath,@loader_path/%{runtime_library_search_directories}",
+ ],
+ iterate_over = "runtime_library_search_directories",
+ expand_if_available = "runtime_library_search_directories",
+ ),
+ ],
+ ),
+ flag_set(
+ actions = all_link_actions +
+ [ACTION_NAMES.cpp_link_static_library],
+ flag_groups = [
+ flag_group(
+ flags = ["%{runtime_root_flags}"],
+ iterate_over = "runtime_root_flags",
+ expand_if_available = "runtime_root_flags",
+ ),
+ ],
+ ),
+ flag_set(
+ actions = all_link_actions +
+ [ACTION_NAMES.cpp_link_static_library],
+ flag_groups = [
+ flag_group(
+ flags = ["%{runtime_root_entries}"],
+ iterate_over = "runtime_root_entries",
+ expand_if_available = "runtime_root_entries",
+ ),
+ ],
+ ),
+ ],
+ )
+
+ use_objc_modules_feature = feature(
+ name = "use_objc_modules",
+ flag_sets = [
+ flag_set(
+ actions = [ACTION_NAMES.objc_compile, ACTION_NAMES.objcpp_compile],
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-fmodule-name=%{module_name}",
+ "-iquote",
+ "%{module_maps_dir}",
+ "-fmodules-cache-path=%{modules_cache_path}",
+ ],
+ ),
+ ],
+ ),
+ ],
+ )
+
+ objc_arc_feature = feature(
+ name = "objc_arc",
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.objc_compile,
+ ACTION_NAMES.objcpp_compile,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = ["-fobjc-arc"],
+ expand_if_available = "objc_arc",
+ ),
+ ],
+ ),
+ ],
+ )
+
+ if (ctx.attr.cpu == "tvos_arm64"
+ or ctx.attr.cpu == "tvos_x86_64"):
+ unfiltered_cxx_flags_feature = feature(
+ name = "unfiltered_cxx_flags",
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ],
+ flag_groups = [
+ flag_group(flags = ["-no-canonical-prefixes", "-pthread"]),
+ ],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "armeabi-v7a"
+ or ctx.attr.cpu == "darwin_x86_64"
+ or ctx.attr.cpu == "ios_arm64"
+ or ctx.attr.cpu == "ios_arm64e"
+ or ctx.attr.cpu == "ios_armv7"
+ or ctx.attr.cpu == "ios_i386"
+ or ctx.attr.cpu == "ios_x86_64"
+ or ctx.attr.cpu == "watchos_arm64_32"
+ or ctx.attr.cpu == "watchos_armv7k"
+ or ctx.attr.cpu == "watchos_i386"
+ or ctx.attr.cpu == "watchos_x86_64"):
+ unfiltered_cxx_flags_feature = feature(name = "unfiltered_cxx_flags")
+
+ compiler_input_flags_feature = feature(
+ name = "compiler_input_flags",
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.linkstamp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ACTION_NAMES.objc_compile,
+ ACTION_NAMES.objcpp_compile,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = ["-c", "%{source_file}"],
+ expand_if_available = "source_file",
+ ),
+ ],
+ ),
+ ],
+ )
+
+ strip_debug_symbols_feature = feature(
+ name = "strip_debug_symbols",
+ flag_sets = [
+ flag_set(
+ actions = all_link_actions +
+ ["objc-executable", "objc++-executable"],
+ flag_groups = [
+ flag_group(
+ flags = ["-Wl,-S"],
+ expand_if_available = "strip_debug_symbols",
+ ),
+ ],
+ ),
+ ],
+ )
+
+ shared_flag_feature = feature(
+ name = "shared_flag",
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.cpp_link_dynamic_library,
+ ACTION_NAMES.cpp_link_nodeps_dynamic_library,
+ ],
+ flag_groups = [flag_group(flags = ["-shared"])],
+ ),
+ ],
+ )
+
+ if (ctx.attr.cpu == "ios_i386"
+ or ctx.attr.cpu == "ios_x86_64"
+ or ctx.attr.cpu == "tvos_x86_64"
+ or ctx.attr.cpu == "watchos_i386"
+ or ctx.attr.cpu == "watchos_x86_64"):
+ apply_simulator_compiler_flags_feature = feature(
+ name = "apply_simulator_compiler_flags",
+ flag_sets = [
+ flag_set(
+ actions = [ACTION_NAMES.objc_compile, ACTION_NAMES.objcpp_compile],
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-fexceptions",
+ "-fasm-blocks",
+ "-fobjc-abi-version=2",
+ "-fobjc-legacy-dispatch",
+ ],
+ ),
+ ],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "armeabi-v7a"
+ or ctx.attr.cpu == "darwin_x86_64"
+ or ctx.attr.cpu == "ios_arm64"
+ or ctx.attr.cpu == "ios_arm64e"
+ or ctx.attr.cpu == "ios_armv7"
+ or ctx.attr.cpu == "tvos_arm64"
+ or ctx.attr.cpu == "watchos_arm64_32"
+ or ctx.attr.cpu == "watchos_armv7k"):
+ apply_simulator_compiler_flags_feature = feature(name = "apply_simulator_compiler_flags")
+
+ supports_pic_feature = feature(name = "supports_pic", enabled = True)
+
+ fastbuild_feature = feature(name = "fastbuild")
+
+ no_legacy_features_feature = feature(name = "no_legacy_features")
+
+ symbol_counts_feature = feature(
+ name = "symbol_counts",
+ flag_sets = [
+ flag_set(
+ actions = all_link_actions,
+ flag_groups = [
+ flag_group(
+ flags = ["-Wl,--print-symbol-counts=%{symbol_counts_output}"],
+ expand_if_available = "symbol_counts_output",
+ ),
+ ],
+ ),
+ ],
+ )
+
+ user_link_flags_feature = feature(
+ name = "user_link_flags",
+ enabled = True,
+ flag_sets = [
+ flag_set(
+ actions = all_link_actions +
+ ["objc-executable", "objc++-executable"],
+ flag_groups = [
+ flag_group(
+ flags = ["%{user_link_flags}"],
+ iterate_over = "user_link_flags",
+ expand_if_available = "user_link_flags",
+ ),
+ ],
+ ),
+ ],
+ )
+
+ if (ctx.attr.cpu == "armeabi-v7a"
+ or ctx.attr.cpu == "ios_arm64"
+ or ctx.attr.cpu == "ios_arm64e"
+ or ctx.attr.cpu == "ios_armv7"
+ or ctx.attr.cpu == "ios_i386"
+ or ctx.attr.cpu == "ios_x86_64"
+ or ctx.attr.cpu == "tvos_arm64"
+ or ctx.attr.cpu == "tvos_x86_64"
+ or ctx.attr.cpu == "watchos_arm64_32"
+ or ctx.attr.cpu == "watchos_armv7k"
+ or ctx.attr.cpu == "watchos_i386"
+ or ctx.attr.cpu == "watchos_x86_64"):
+ contains_objc_source_feature = feature(
+ name = "contains_objc_source",
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.cpp_link_dynamic_library,
+ ACTION_NAMES.cpp_link_nodeps_dynamic_library,
+ ACTION_NAMES.cpp_link_executable,
+ ],
+ flag_groups = [flag_group(flags = ["-fobjc-link-runtime"])],
+ ),
+ flag_set(
+ actions = [
+ ACTION_NAMES.cpp_link_dynamic_library,
+ ACTION_NAMES.cpp_link_nodeps_dynamic_library,
+ ACTION_NAMES.cpp_link_executable,
+ ],
+ flag_groups = [flag_group(flags = ["-framework", "UIKit"])],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "darwin_x86_64"):
+ contains_objc_source_feature = feature(
+ name = "contains_objc_source",
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.cpp_link_dynamic_library,
+ ACTION_NAMES.cpp_link_nodeps_dynamic_library,
+ ACTION_NAMES.cpp_link_executable,
+ ],
+ flag_groups = [flag_group(flags = ["-fobjc-link-runtime"])],
+ ),
+ ],
+ )
+
+ includes_feature = feature(
+ name = "includes",
+ enabled = True,
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.linkstamp_compile,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.objc_compile,
+ ACTION_NAMES.objcpp_compile,
+ ACTION_NAMES.clif_match,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = ["-include", "%{includes}"],
+ iterate_over = "includes",
+ expand_if_available = "includes",
+ ),
+ ],
+ ),
+ ],
+ )
+
+ gcc_coverage_map_format_feature = feature(
+ name = "gcc_coverage_map_format",
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.objc_compile,
+ ACTION_NAMES.objcpp_compile,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = ["-fprofile-arcs", "-ftest-coverage", "-g"],
+ ),
+ ],
+ ),
+ flag_set(
+ actions = [
+ ACTION_NAMES.cpp_link_dynamic_library,
+ ACTION_NAMES.cpp_link_nodeps_dynamic_library,
+ ACTION_NAMES.cpp_link_executable,
+ ],
+ flag_groups = [flag_group(flags = ["--coverage"])],
+ ),
+ ],
+ requires = [feature_set(features = ["coverage"])],
+ )
+
+ if (ctx.attr.cpu == "ios_arm64"):
+ default_link_flags_feature = feature(
+ name = "default_link_flags",
+ enabled = True,
+ flag_sets = [
+ flag_set(
+ actions = all_link_actions +
+ ["objc-executable", "objc++-executable"],
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-headerpad_max_install_names",
+ "-no-canonical-prefixes",
+ "-target",
+ "arm64-apple-ios",
+ ],
+ ),
+ ],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "tvos_arm64"):
+ default_link_flags_feature = feature(
+ name = "default_link_flags",
+ enabled = True,
+ flag_sets = [
+ flag_set(
+ actions = all_link_actions +
+ ["objc-executable", "objc++-executable"],
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-headerpad_max_install_names",
+ "-no-canonical-prefixes",
+ "-target",
+ "arm64-apple-tvos",
+ ],
+ ),
+ ],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "ios_arm64e"):
+ default_link_flags_feature = feature(
+ name = "default_link_flags",
+ enabled = True,
+ flag_sets = [
+ flag_set(
+ actions = all_link_actions +
+ ["objc-executable", "objc++-executable"],
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-headerpad_max_install_names",
+ "-no-canonical-prefixes",
+ "-target",
+ "arm64e-apple-ios",
+ ],
+ ),
+ ],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "ios_armv7"):
+ default_link_flags_feature = feature(
+ name = "default_link_flags",
+ enabled = True,
+ flag_sets = [
+ flag_set(
+ actions = all_link_actions +
+ ["objc-executable", "objc++-executable"],
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-headerpad_max_install_names",
+ "-no-canonical-prefixes",
+ "-target",
+ "armv7-apple-ios",
+ ],
+ ),
+ ],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "watchos_armv7k"):
+ default_link_flags_feature = feature(
+ name = "default_link_flags",
+ enabled = True,
+ flag_sets = [
+ flag_set(
+ actions = all_link_actions +
+ ["objc-executable", "objc++-executable"],
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-headerpad_max_install_names",
+ "-no-canonical-prefixes",
+ "-target",
+ "armv7-apple-watchos",
+ ],
+ ),
+ ],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "ios_i386"):
+ default_link_flags_feature = feature(
+ name = "default_link_flags",
+ enabled = True,
+ flag_sets = [
+ flag_set(
+ actions = all_link_actions +
+ ["objc-executable", "objc++-executable"],
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-headerpad_max_install_names",
+ "-no-canonical-prefixes",
+ "-target",
+ "i386-apple-ios",
+ ],
+ ),
+ ],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "watchos_i386"):
+ default_link_flags_feature = feature(
+ name = "default_link_flags",
+ enabled = True,
+ flag_sets = [
+ flag_set(
+ actions = all_link_actions +
+ ["objc-executable", "objc++-executable"],
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-headerpad_max_install_names",
+ "-no-canonical-prefixes",
+ "-target",
+ "i386-apple-watchos",
+ ],
+ ),
+ ],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "ios_x86_64"):
+ default_link_flags_feature = feature(
+ name = "default_link_flags",
+ enabled = True,
+ flag_sets = [
+ flag_set(
+ actions = all_link_actions +
+ ["objc-executable", "objc++-executable"],
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-headerpad_max_install_names",
+ "-no-canonical-prefixes",
+ "-target",
+ "x86_64-apple-ios",
+ ],
+ ),
+ ],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "tvos_x86_64"):
+ default_link_flags_feature = feature(
+ name = "default_link_flags",
+ enabled = True,
+ flag_sets = [
+ flag_set(
+ actions = all_link_actions +
+ ["objc-executable", "objc++-executable"],
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-headerpad_max_install_names",
+ "-no-canonical-prefixes",
+ "-target",
+ "x86_64-apple-tvos",
+ ],
+ ),
+ ],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "darwin_x86_64"):
+ default_link_flags_feature = feature(
+ name = "default_link_flags",
+ enabled = True,
+ flag_sets = [
+ flag_set(
+ actions = all_link_actions +
+ ["objc-executable", "objc++-executable"],
+ flag_groups = [
+ flag_group(
+ flags = ["-headerpad_max_install_names", "-no-canonical-prefixes"],
+ ),
+ ],
+ ),
+ flag_set(
+ actions = [ACTION_NAMES.cpp_link_nodeps_dynamic_library],
+ flag_groups = [flag_group(flags = ["-undefined", "dynamic_lookup"])],
+ ),
+ flag_set(
+ actions = [
+ ACTION_NAMES.cpp_link_executable,
+ ACTION_NAMES.cpp_link_dynamic_library,
+ "objc-executable",
+ "objc++-executable",
+ ],
+ flag_groups = [flag_group(flags = ["-undefined", "dynamic_lookup"])],
+ with_features = [with_feature_set(features = ["dynamic_linking_mode"])],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "armeabi-v7a"
+ or ctx.attr.cpu == "watchos_arm64_32"
+ or ctx.attr.cpu == "watchos_x86_64"):
+ default_link_flags_feature = feature(
+ name = "default_link_flags",
+ enabled = True,
+ flag_sets = [
+ flag_set(
+ actions = all_link_actions +
+ ["objc-executable", "objc++-executable"],
+ flag_groups = [
+ flag_group(
+ flags = ["-headerpad_max_install_names", "-no-canonical-prefixes"],
+ ),
+ ],
+ ),
+ ],
+ )
+
+ output_execpath_flags_feature = feature(
+ name = "output_execpath_flags",
+ flag_sets = [
+ flag_set(
+ actions = all_link_actions,
+ flag_groups = [
+ flag_group(
+ flags = ["-o", "%{output_execpath}"],
+ expand_if_available = "output_execpath",
+ ),
+ ],
+ ),
+ ],
+ )
+
+ no_enable_modules_feature = feature(
+ name = "no_enable_modules",
+ flag_sets = [
+ flag_set(
+ actions = [ACTION_NAMES.objc_compile, ACTION_NAMES.objcpp_compile],
+ flag_groups = [flag_group(flags = ["-fmodule-maps"])],
+ ),
+ ],
+ requires = [feature_set(features = ["use_objc_modules"])],
+ )
+
+ pic_feature = feature(
+ name = "pic",
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.linkstamp_compile,
+ ACTION_NAMES.preprocess_assemble,
+ ],
+ flag_groups = [
+ flag_group(flags = ["-fPIC"], expand_if_available = "pic"),
+ ],
+ ),
+ ],
+ )
+
+ framework_paths_feature = feature(
+ name = "framework_paths",
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.objc_compile,
+ ACTION_NAMES.objcpp_compile,
+ "objc-executable",
+ "objc++-executable",
+ ],
+ flag_groups = [
+ flag_group(
+ flags = ["-F%{framework_paths}"],
+ iterate_over = "framework_paths",
+ ),
+ ],
+ ),
+ ],
+ )
+
+ if (ctx.attr.cpu == "armeabi-v7a"
+ or ctx.attr.cpu == "watchos_arm64_32"
+ or ctx.attr.cpu == "watchos_x86_64"):
+ version_min_feature = feature(
+ name = "version_min",
+ flag_sets = [
+ flag_set(
+ actions = [
+ "objc-executable",
+ "objc++-executable",
+ ACTION_NAMES.cpp_link_executable,
+ ACTION_NAMES.cpp_link_dynamic_library,
+ ACTION_NAMES.cpp_link_nodeps_dynamic_library,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.objc_compile,
+ ACTION_NAMES.objcpp_compile,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = ["-m<platform_for_version_min>-version-min=%{version_min}"],
+ ),
+ ],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "ios_i386"
+ or ctx.attr.cpu == "ios_x86_64"):
+ version_min_feature = feature(
+ name = "version_min",
+ flag_sets = [
+ flag_set(
+ actions = [
+ "objc-executable",
+ "objc++-executable",
+ ACTION_NAMES.cpp_link_executable,
+ ACTION_NAMES.cpp_link_dynamic_library,
+ ACTION_NAMES.cpp_link_nodeps_dynamic_library,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.objc_compile,
+ ACTION_NAMES.objcpp_compile,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = ["-mios-simulator-version-min=%{version_min}"],
+ ),
+ ],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "ios_arm64"
+ or ctx.attr.cpu == "ios_arm64e"
+ or ctx.attr.cpu == "ios_armv7"):
+ version_min_feature = feature(
+ name = "version_min",
+ flag_sets = [
+ flag_set(
+ actions = [
+ "objc-executable",
+ "objc++-executable",
+ ACTION_NAMES.cpp_link_executable,
+ ACTION_NAMES.cpp_link_dynamic_library,
+ ACTION_NAMES.cpp_link_nodeps_dynamic_library,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.objc_compile,
+ ACTION_NAMES.objcpp_compile,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = ["-miphoneos-version-min=%{version_min}"],
+ ),
+ ],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "tvos_x86_64"):
+ version_min_feature = feature(
+ name = "version_min",
+ flag_sets = [
+ flag_set(
+ actions = [
+ "objc-executable",
+ "objc++-executable",
+ ACTION_NAMES.cpp_link_executable,
+ ACTION_NAMES.cpp_link_dynamic_library,
+ ACTION_NAMES.cpp_link_nodeps_dynamic_library,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.objc_compile,
+ ACTION_NAMES.objcpp_compile,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = ["-mtvos-simulator-version-min=%{version_min}"],
+ ),
+ ],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "watchos_i386"):
+ version_min_feature = feature(
+ name = "version_min",
+ flag_sets = [
+ flag_set(
+ actions = [
+ "objc-executable",
+ "objc++-executable",
+ ACTION_NAMES.cpp_link_executable,
+ ACTION_NAMES.cpp_link_dynamic_library,
+ ACTION_NAMES.cpp_link_nodeps_dynamic_library,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.objc_compile,
+ ACTION_NAMES.objcpp_compile,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = ["-mwatchos-simulator-version-min=%{version_min}"],
+ ),
+ ],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "watchos_armv7k"):
+ version_min_feature = feature(
+ name = "version_min",
+ flag_sets = [
+ flag_set(
+ actions = [
+ "objc-executable",
+ "objc++-executable",
+ ACTION_NAMES.cpp_link_executable,
+ ACTION_NAMES.cpp_link_dynamic_library,
+ ACTION_NAMES.cpp_link_nodeps_dynamic_library,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.objc_compile,
+ ACTION_NAMES.objcpp_compile,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = ["-mwatchos-version-min=%{version_min}"],
+ ),
+ ],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "darwin_x86_64"):
+ version_min_feature = feature(
+ name = "version_min",
+ flag_sets = [
+ flag_set(
+ actions = [
+ "objc-executable",
+ "objc++-executable",
+ ACTION_NAMES.cpp_link_executable,
+ ACTION_NAMES.cpp_link_dynamic_library,
+ ACTION_NAMES.cpp_link_nodeps_dynamic_library,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.objc_compile,
+ ACTION_NAMES.objcpp_compile,
+ ],
+ flag_groups = [
+ flag_group(flags = ["-mmacosx-version-min=%{version_min}"]),
+ ],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "tvos_arm64"):
+ version_min_feature = feature(
+ name = "version_min",
+ flag_sets = [
+ flag_set(
+ actions = [
+ "objc-executable",
+ "objc++-executable",
+ ACTION_NAMES.cpp_link_executable,
+ ACTION_NAMES.cpp_link_dynamic_library,
+ ACTION_NAMES.cpp_link_nodeps_dynamic_library,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.objc_compile,
+ ACTION_NAMES.objcpp_compile,
+ ],
+ flag_groups = [flag_group(flags = ["-mtvos-version-min=%{version_min}"])],
+ ),
+ ],
+ )
+
+ compiler_output_flags_feature = feature(
+ name = "compiler_output_flags",
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.linkstamp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ACTION_NAMES.objc_compile,
+ ACTION_NAMES.objcpp_compile,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = ["-S"],
+ expand_if_available = "output_assembly_file",
+ ),
+ flag_group(
+ flags = ["-E"],
+ expand_if_available = "output_preprocess_file",
+ ),
+ flag_group(
+ flags = ["-o", "%{output_file}"],
+ expand_if_available = "output_file",
+ ),
+ ],
+ ),
+ ],
+ )
+
+ opt_feature = feature(name = "opt")
+
+ pch_feature = feature(
+ name = "pch",
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.objc_compile,
+ ACTION_NAMES.objcpp_compile,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ],
+ flag_groups = [flag_group(flags = ["-include", "%{pch_file}"])],
+ ),
+ ],
+ )
+
+ coverage_feature = feature(name = "coverage")
+
+ if (ctx.attr.cpu == "watchos_arm64_32"
+ or ctx.attr.cpu == "watchos_armv7k"
+ or ctx.attr.cpu == "watchos_i386"
+ or ctx.attr.cpu == "watchos_x86_64"):
+ include_system_dirs_feature = feature(
+ name = "include_system_dirs",
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.objc_compile,
+ ACTION_NAMES.objcpp_compile,
+ "objc-executable",
+ "objc++-executable",
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-isysroot",
+ "%{sdk_dir}",
+ "-F%{sdk_framework_dir}",
+ "-F%{platform_developer_framework_dir}",
+ ],
+ ),
+ ],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "armeabi-v7a"
+ or ctx.attr.cpu == "darwin_x86_64"
+ or ctx.attr.cpu == "ios_arm64"
+ or ctx.attr.cpu == "ios_arm64e"
+ or ctx.attr.cpu == "ios_armv7"
+ or ctx.attr.cpu == "ios_i386"
+ or ctx.attr.cpu == "ios_x86_64"
+ or ctx.attr.cpu == "tvos_arm64"
+ or ctx.attr.cpu == "tvos_x86_64"):
+ include_system_dirs_feature = feature(
+ name = "include_system_dirs",
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.objc_compile,
+ ACTION_NAMES.objcpp_compile,
+ "objc-executable",
+ "objc++-executable",
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ],
+ flag_groups = [flag_group(flags = ["-isysroot", "%{sdk_dir}"])],
+ ),
+ ],
+ )
+
+ input_param_flags_feature = feature(
+ name = "input_param_flags",
+ flag_sets = [
+ flag_set(
+ actions = all_link_actions +
+ [ACTION_NAMES.cpp_link_static_library],
+ flag_groups = [
+ flag_group(
+ flags = ["-L%{library_search_directories}"],
+ iterate_over = "library_search_directories",
+ expand_if_available = "library_search_directories",
+ ),
+ ],
+ ),
+ flag_set(
+ actions = all_link_actions +
+ [ACTION_NAMES.cpp_link_static_library],
+ flag_groups = [
+ flag_group(
+ flags = ["%{libopts}"],
+ iterate_over = "libopts",
+ expand_if_available = "libopts",
+ ),
+ ],
+ ),
+ flag_set(
+ actions = all_link_actions +
+ [ACTION_NAMES.cpp_link_static_library],
+ flag_groups = [
+ flag_group(
+ flags = ["-Wl,-force_load,%{whole_archive_linker_params}"],
+ iterate_over = "whole_archive_linker_params",
+ expand_if_available = "whole_archive_linker_params",
+ ),
+ ],
+ ),
+ flag_set(
+ actions = all_link_actions +
+ [ACTION_NAMES.cpp_link_static_library],
+ flag_groups = [
+ flag_group(
+ flags = ["%{linker_input_params}"],
+ iterate_over = "linker_input_params",
+ expand_if_available = "linker_input_params",
+ ),
+ ],
+ ),
+ flag_set(
+ actions = all_link_actions +
+ [ACTION_NAMES.cpp_link_static_library],
+ flag_groups = [
+ flag_group(
+ iterate_over = "libraries_to_link",
+ flag_groups = [
+ flag_group(
+ flags = ["-Wl,--start-lib"],
+ expand_if_equal = variable_with_value(
+ name = "libraries_to_link.type",
+ value = "object_file_group",
+ ),
+ ),
+ flag_group(
+ iterate_over = "libraries_to_link.object_files",
+ flag_groups = [
+ flag_group(
+ flags = ["%{libraries_to_link.object_files}"],
+ expand_if_false = "libraries_to_link.is_whole_archive",
+ ),
+ flag_group(
+ flags = ["-Wl,-force_load,%{libraries_to_link.object_files}"],
+ expand_if_true = "libraries_to_link.is_whole_archive",
+ ),
+ ],
+ expand_if_equal = variable_with_value(
+ name = "libraries_to_link.type",
+ value = "object_file_group",
+ ),
+ ),
+ flag_group(
+ flags = ["-Wl,--end-lib"],
+ expand_if_equal = variable_with_value(
+ name = "libraries_to_link.type",
+ value = "object_file_group",
+ ),
+ ),
+ flag_group(
+ flag_groups = [
+ flag_group(
+ flags = ["%{libraries_to_link.name}"],
+ expand_if_false = "libraries_to_link.is_whole_archive",
+ ),
+ flag_group(
+ flags = ["-Wl,-force_load,%{libraries_to_link.name}"],
+ expand_if_true = "libraries_to_link.is_whole_archive",
+ ),
+ ],
+ expand_if_equal = variable_with_value(
+ name = "libraries_to_link.type",
+ value = "object_file",
+ ),
+ ),
+ flag_group(
+ flag_groups = [
+ flag_group(
+ flags = ["%{libraries_to_link.name}"],
+ expand_if_false = "libraries_to_link.is_whole_archive",
+ ),
+ flag_group(
+ flags = ["-Wl,-force_load,%{libraries_to_link.name}"],
+ expand_if_true = "libraries_to_link.is_whole_archive",
+ ),
+ ],
+ expand_if_equal = variable_with_value(
+ name = "libraries_to_link.type",
+ value = "interface_library",
+ ),
+ ),
+ flag_group(
+ flag_groups = [
+ flag_group(
+ flags = ["%{libraries_to_link.name}"],
+ expand_if_false = "libraries_to_link.is_whole_archive",
+ ),
+ flag_group(
+ flags = ["-Wl,-force_load,%{libraries_to_link.name}"],
+ expand_if_true = "libraries_to_link.is_whole_archive",
+ ),
+ ],
+ expand_if_equal = variable_with_value(
+ name = "libraries_to_link.type",
+ value = "static_library",
+ ),
+ ),
+ flag_group(
+ flag_groups = [
+ flag_group(
+ flags = ["-l%{libraries_to_link.name}"],
+ expand_if_false = "libraries_to_link.is_whole_archive",
+ ),
+ flag_group(
+ flags = ["-Wl,-force_load,-l%{libraries_to_link.name}"],
+ expand_if_true = "libraries_to_link.is_whole_archive",
+ ),
+ ],
+ expand_if_equal = variable_with_value(
+ name = "libraries_to_link.type",
+ value = "dynamic_library",
+ ),
+ ),
+ flag_group(
+ flag_groups = [
+ flag_group(
+ flags = ["-l:%{libraries_to_link.name}"],
+ expand_if_false = "libraries_to_link.is_whole_archive",
+ ),
+ flag_group(
+ flags = ["-Wl,-force_load,-l:%{libraries_to_link.name}"],
+ expand_if_true = "libraries_to_link.is_whole_archive",
+ ),
+ ],
+ expand_if_equal = variable_with_value(
+ name = "libraries_to_link.type",
+ value = "versioned_dynamic_library",
+ ),
+ ),
+ ],
+ expand_if_available = "libraries_to_link",
+ ),
+ ],
+ ),
+ ],
+ )
+
+ per_object_debug_info_feature = feature(
+ name = "per_object_debug_info",
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = ["-gsplit-dwarf"],
+ expand_if_available = "per_object_debug_info_file",
+ ),
+ ],
+ ),
+ ],
+ )
+
+ lipo_feature = feature(
+ name = "lipo",
+ flag_sets = [
+ flag_set(
+ actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile],
+ flag_groups = [flag_group(flags = ["-fripa"])],
+ ),
+ ],
+ requires = [
+ feature_set(features = ["autofdo"]),
+ feature_set(features = ["fdo_optimize"]),
+ feature_set(features = ["fdo_instrument"]),
+ ],
+ )
+
+ apple_env_feature = feature(
+ name = "apple_env",
+ env_sets = [
+ env_set(
+ actions = [
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.objc_compile,
+ ACTION_NAMES.objcpp_compile,
+ "objc-archive",
+ "objc-fully-link",
+ ACTION_NAMES.cpp_link_executable,
+ ACTION_NAMES.cpp_link_dynamic_library,
+ ACTION_NAMES.cpp_link_nodeps_dynamic_library,
+ ACTION_NAMES.cpp_link_static_library,
+ "objc-executable",
+ "objc++-executable",
+ ACTION_NAMES.linkstamp_compile,
+ ],
+ env_entries = [
+ env_entry(
+ key = "XCODE_VERSION_OVERRIDE",
+ value = "%{xcode_version_override_value}",
+ ),
+ env_entry(
+ key = "APPLE_SDK_VERSION_OVERRIDE",
+ value = "%{apple_sdk_version_override_value}",
+ ),
+ env_entry(
+ key = "APPLE_SDK_PLATFORM",
+ value = "%{apple_sdk_platform_value}",
+ ),
+ ],
+ ),
+ ],
+ )
+
+ if (ctx.attr.cpu == "armeabi-v7a"
+ or ctx.attr.cpu == "ios_arm64"
+ or ctx.attr.cpu == "ios_arm64e"
+ or ctx.attr.cpu == "ios_armv7"
+ or ctx.attr.cpu == "ios_i386"
+ or ctx.attr.cpu == "ios_x86_64"
+ or ctx.attr.cpu == "tvos_arm64"
+ or ctx.attr.cpu == "tvos_x86_64"
+ or ctx.attr.cpu == "watchos_arm64_32"
+ or ctx.attr.cpu == "watchos_armv7k"
+ or ctx.attr.cpu == "watchos_i386"
+ or ctx.attr.cpu == "watchos_x86_64"):
+ apply_implicit_frameworks_feature = feature(
+ name = "apply_implicit_frameworks",
+ flag_sets = [
+ flag_set(
+ actions = ["objc-executable", "objc++-executable"],
+ flag_groups = [
+ flag_group(
+ flags = ["-framework", "Foundation", "-framework", "UIKit"],
+ ),
+ ],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "darwin_x86_64"):
+ apply_implicit_frameworks_feature = feature(
+ name = "apply_implicit_frameworks",
+ flag_sets = [
+ flag_set(
+ actions = ["objc-executable", "objc++-executable"],
+ flag_groups = [flag_group(flags = ["-framework", "Foundation"])],
+ with_features = [with_feature_set(not_features = ["kernel_extension"])],
+ ),
+ ],
+ )
+
+ dbg_feature = feature(name = "dbg")
+
+ has_configured_linker_path_feature = feature(name = "has_configured_linker_path")
+
+ random_seed_feature = feature(
+ name = "random_seed",
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ACTION_NAMES.cpp_module_compile,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = ["-frandom-seed=%{output_file}"],
+ expand_if_available = "output_file",
+ ),
+ ],
+ ),
+ ],
+ )
+
+ llvm_coverage_map_format_feature = feature(
+ name = "llvm_coverage_map_format",
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.objc_compile,
+ ACTION_NAMES.objcpp_compile,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = ["-fprofile-instr-generate", "-fcoverage-mapping", "-g"],
+ ),
+ ],
+ ),
+ flag_set(
+ actions = [
+ ACTION_NAMES.cpp_link_dynamic_library,
+ ACTION_NAMES.cpp_link_nodeps_dynamic_library,
+ ACTION_NAMES.cpp_link_executable,
+ "objc-executable",
+ "objc++-executable",
+ ],
+ flag_groups = [flag_group(flags = ["-fprofile-instr-generate"])],
+ ),
+ ],
+ requires = [feature_set(features = ["coverage"])],
+ )
+
+ force_pic_flags_feature = feature(
+ name = "force_pic_flags",
+ flag_sets = [
+ flag_set(
+ actions = [ACTION_NAMES.cpp_link_executable],
+ flag_groups = [
+ flag_group(
+ flags = ["-Wl,-pie"],
+ expand_if_available = "force_pic",
+ ),
+ ],
+ ),
+ ],
+ )
+
+ sysroot_feature = feature(
+ name = "sysroot",
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.objc_compile,
+ ACTION_NAMES.objcpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_link_executable,
+ ACTION_NAMES.cpp_link_dynamic_library,
+ ACTION_NAMES.cpp_link_nodeps_dynamic_library,
+ ACTION_NAMES.linkstamp_compile,
+ ACTION_NAMES.clif_match,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = ["--sysroot=%{sysroot}"],
+ expand_if_available = "sysroot",
+ ),
+ ],
+ ),
+ ],
+ )
+
+ autofdo_feature = feature(
+ name = "autofdo",
+ flag_sets = [
+ flag_set(
+ actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile],
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-fauto-profile=%{fdo_profile_path}",
+ "-fprofile-correction",
+ ],
+ expand_if_available = "fdo_profile_path",
+ ),
+ ],
+ ),
+ ],
+ provides = ["profile"],
+ )
+
+ bitcode_embedded_feature = feature(name = "bitcode_embedded")
+
+ link_libcpp_feature = feature(
+ name = "link_libc++",
+ enabled = True,
+ flag_sets = [
+ flag_set(
+ actions = all_link_actions +
+ ["objc-executable", "objc++-executable"],
+ flag_groups = [flag_group(flags = ["-lc++"])],
+ with_features = [with_feature_set(not_features = ["kernel_extension"])],
+ ),
+ ],
+ )
+
+ supports_dynamic_linker_feature = feature(name = "supports_dynamic_linker", enabled = True)
+
+ objc_actions_feature = feature(
+ name = "objc_actions",
+ implies = [
+ "objc-compile",
+ "objc++-compile",
+ "objc-fully-link",
+ "objc-archive",
+ "objc-executable",
+ "objc++-executable",
+ "assemble",
+ "preprocess-assemble",
+ "c-compile",
+ "c++-compile",
+ "c++-link-static-library",
+ "c++-link-dynamic-library",
+ "c++-link-nodeps-dynamic-library",
+ "c++-link-executable",
+ ],
+ )
+
+ module_maps_feature = feature(name = "module_maps")
+
+ if (ctx.attr.cpu == "ios_arm64"):
+ unfiltered_compile_flags_feature = feature(
+ name = "unfiltered_compile_flags",
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ACTION_NAMES.linkstamp_compile,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-no-canonical-prefixes",
+ "-Wno-builtin-macro-redefined",
+ "-D__DATE__=\"redacted\"",
+ "-D__TIMESTAMP__=\"redacted\"",
+ "-D__TIME__=\"redacted\"",
+ "-target",
+ "arm64-apple-ios",
+ ],
+ ),
+ ],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "tvos_arm64"):
+ unfiltered_compile_flags_feature = feature(
+ name = "unfiltered_compile_flags",
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ACTION_NAMES.linkstamp_compile,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-no-canonical-prefixes",
+ "-Wno-builtin-macro-redefined",
+ "-D__DATE__=\"redacted\"",
+ "-D__TIMESTAMP__=\"redacted\"",
+ "-D__TIME__=\"redacted\"",
+ "-target",
+ "arm64-apple-tvos",
+ ],
+ ),
+ ],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "ios_arm64e"):
+ unfiltered_compile_flags_feature = feature(
+ name = "unfiltered_compile_flags",
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ACTION_NAMES.linkstamp_compile,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-no-canonical-prefixes",
+ "-Wno-builtin-macro-redefined",
+ "-D__DATE__=\"redacted\"",
+ "-D__TIMESTAMP__=\"redacted\"",
+ "-D__TIME__=\"redacted\"",
+ "-target",
+ "arm64e-apple-ios",
+ ],
+ ),
+ ],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "ios_armv7"):
+ unfiltered_compile_flags_feature = feature(
+ name = "unfiltered_compile_flags",
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ACTION_NAMES.linkstamp_compile,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-no-canonical-prefixes",
+ "-Wno-builtin-macro-redefined",
+ "-D__DATE__=\"redacted\"",
+ "-D__TIMESTAMP__=\"redacted\"",
+ "-D__TIME__=\"redacted\"",
+ "-target",
+ "armv7-apple-ios",
+ ],
+ ),
+ ],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "watchos_armv7k"):
+ unfiltered_compile_flags_feature = feature(
+ name = "unfiltered_compile_flags",
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ACTION_NAMES.linkstamp_compile,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-no-canonical-prefixes",
+ "-Wno-builtin-macro-redefined",
+ "-D__DATE__=\"redacted\"",
+ "-D__TIMESTAMP__=\"redacted\"",
+ "-D__TIME__=\"redacted\"",
+ "-target",
+ "armv7k-apple-watchos",
+ ],
+ ),
+ ],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "ios_i386"):
+ unfiltered_compile_flags_feature = feature(
+ name = "unfiltered_compile_flags",
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ACTION_NAMES.linkstamp_compile,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-no-canonical-prefixes",
+ "-Wno-builtin-macro-redefined",
+ "-D__DATE__=\"redacted\"",
+ "-D__TIMESTAMP__=\"redacted\"",
+ "-D__TIME__=\"redacted\"",
+ "-target",
+ "i386-apple-ios",
+ ],
+ ),
+ ],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "watchos_i386"):
+ unfiltered_compile_flags_feature = feature(
+ name = "unfiltered_compile_flags",
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ACTION_NAMES.linkstamp_compile,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-no-canonical-prefixes",
+ "-Wno-builtin-macro-redefined",
+ "-D__DATE__=\"redacted\"",
+ "-D__TIMESTAMP__=\"redacted\"",
+ "-D__TIME__=\"redacted\"",
+ "-target",
+ "i386-apple-watchos",
+ ],
+ ),
+ ],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "ios_x86_64"):
+ unfiltered_compile_flags_feature = feature(
+ name = "unfiltered_compile_flags",
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ACTION_NAMES.linkstamp_compile,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-no-canonical-prefixes",
+ "-Wno-builtin-macro-redefined",
+ "-D__DATE__=\"redacted\"",
+ "-D__TIMESTAMP__=\"redacted\"",
+ "-D__TIME__=\"redacted\"",
+ "-target",
+ "x86_64-apple-ios",
+ ],
+ ),
+ ],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "tvos_x86_64"):
+ unfiltered_compile_flags_feature = feature(
+ name = "unfiltered_compile_flags",
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ACTION_NAMES.linkstamp_compile,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-no-canonical-prefixes",
+ "-Wno-builtin-macro-redefined",
+ "-D__DATE__=\"redacted\"",
+ "-D__TIMESTAMP__=\"redacted\"",
+ "-D__TIME__=\"redacted\"",
+ "-target",
+ "x86_64-apple-tvos",
+ ],
+ ),
+ ],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "armeabi-v7a"
+ or ctx.attr.cpu == "darwin_x86_64"
+ or ctx.attr.cpu == "watchos_arm64_32"
+ or ctx.attr.cpu == "watchos_x86_64"):
+ unfiltered_compile_flags_feature = feature(
+ name = "unfiltered_compile_flags",
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ACTION_NAMES.linkstamp_compile,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-no-canonical-prefixes",
+ "-Wno-builtin-macro-redefined",
+ "-D__DATE__=\"redacted\"",
+ "-D__TIMESTAMP__=\"redacted\"",
+ "-D__TIME__=\"redacted\"",
+ ],
+ ),
+ ],
+ ),
+ ],
+ )
+
+ linker_param_file_feature = feature(
+ name = "linker_param_file",
+ flag_sets = [
+ flag_set(
+ actions = all_link_actions,
+ flag_groups = [
+ flag_group(
+ flags = ["-Wl,@%{linker_param_file}"],
+ expand_if_available = "linker_param_file",
+ ),
+ ],
+ ),
+ flag_set(
+ actions = [ACTION_NAMES.cpp_link_static_library],
+ flag_groups = [
+ flag_group(
+ flags = ["@%{linker_param_file}"],
+ expand_if_available = "linker_param_file",
+ ),
+ ],
+ ),
+ ],
+ )
+
+ archiver_flags_feature = feature(
+ name = "archiver_flags",
+ flag_sets = [
+ flag_set(
+ actions = [ACTION_NAMES.cpp_link_static_library],
+ flag_groups = [
+ flag_group(
+ flags = ["rcS", "%{output_execpath}"],
+ expand_if_available = "output_execpath",
+ ),
+ ],
+ ),
+ ],
+ )
+
+ fdo_optimize_feature = feature(
+ name = "fdo_optimize",
+ flag_sets = [
+ flag_set(
+ actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile],
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-fprofile-use=%{fdo_profile_path}",
+ "-Xclang-only=-Wno-profile-instr-unprofiled",
+ "-Xclang-only=-Wno-profile-instr-out-of-date",
+ "-fprofile-correction",
+ ],
+ expand_if_available = "fdo_profile_path",
+ ),
+ ],
+ ),
+ ],
+ provides = ["profile"],
+ )
+
+ no_objc_arc_feature = feature(
+ name = "no_objc_arc",
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.objc_compile,
+ ACTION_NAMES.objcpp_compile,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = ["-fno-objc-arc"],
+ expand_if_available = "no_objc_arc",
+ ),
+ ],
+ ),
+ ],
+ )
+
+ if (ctx.attr.cpu == "tvos_arm64"):
+ cpp_linker_flags_feature = feature(
+ name = "cpp_linker_flags",
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.cpp_link_executable,
+ ACTION_NAMES.cpp_link_dynamic_library,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = ["-lc++", "-target", "arm64-apple-tvos"],
+ ),
+ ],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "tvos_x86_64"):
+ cpp_linker_flags_feature = feature(
+ name = "cpp_linker_flags",
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.cpp_link_executable,
+ ACTION_NAMES.cpp_link_dynamic_library,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = ["-lc++", "-target", "x86_64-apple-tvos"],
+ ),
+ ],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "armeabi-v7a"
+ or ctx.attr.cpu == "darwin_x86_64"
+ or ctx.attr.cpu == "ios_arm64"
+ or ctx.attr.cpu == "ios_arm64e"
+ or ctx.attr.cpu == "ios_armv7"
+ or ctx.attr.cpu == "ios_i386"
+ or ctx.attr.cpu == "ios_x86_64"
+ or ctx.attr.cpu == "watchos_arm64_32"
+ or ctx.attr.cpu == "watchos_armv7k"
+ or ctx.attr.cpu == "watchos_i386"
+ or ctx.attr.cpu == "watchos_x86_64"):
+ cpp_linker_flags_feature = feature(name = "cpp_linker_flags")
+
+ exclude_private_headers_in_module_maps_feature = feature(name = "exclude_private_headers_in_module_maps")
+
+ debug_prefix_map_pwd_is_dot_feature = feature(
+ name = "debug_prefix_map_pwd_is_dot",
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ACTION_NAMES.linkstamp_compile,
+ ACTION_NAMES.objc_compile,
+ ACTION_NAMES.objcpp_compile,
+ ],
+ flag_groups = [flag_group(flags = ["DEBUG_PREFIX_MAP_PWD=."])],
+ ),
+ ],
+ )
+
+ linkstamps_feature = feature(
+ name = "linkstamps",
+ flag_sets = [
+ flag_set(
+ actions = all_link_actions,
+ flag_groups = [
+ flag_group(
+ flags = ["%{linkstamp_paths}"],
+ iterate_over = "linkstamp_paths",
+ expand_if_available = "linkstamp_paths",
+ ),
+ ],
+ ),
+ ],
+ )
+
+ include_paths_feature = feature(
+ name = "include_paths",
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.linkstamp_compile,
+ ACTION_NAMES.clif_match,
+ ACTION_NAMES.objc_compile,
+ ACTION_NAMES.objcpp_compile,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = ["-iquote", "%{quote_include_paths}"],
+ iterate_over = "quote_include_paths",
+ ),
+ flag_group(
+ flags = ["-I%{include_paths}"],
+ iterate_over = "include_paths",
+ ),
+ flag_group(
+ flags = ["-isystem", "%{system_include_paths}"],
+ iterate_over = "system_include_paths",
+ ),
+ ],
+ ),
+ ],
+ )
+
+ only_doth_headers_in_module_maps_feature = feature(name = "only_doth_headers_in_module_maps")
+
+ if (ctx.attr.cpu == "armeabi-v7a"
+ or ctx.attr.cpu == "ios_arm64e"
+ or ctx.attr.cpu == "tvos_arm64"
+ or ctx.attr.cpu == "tvos_x86_64"
+ or ctx.attr.cpu == "watchos_arm64_32"
+ or ctx.attr.cpu == "watchos_x86_64"):
+ default_compile_flags_feature = feature(
+ name = "default_compile_flags",
+ enabled = True,
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.linkstamp_compile,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ACTION_NAMES.lto_backend,
+ ACTION_NAMES.clif_match,
+ ACTION_NAMES.objc_compile,
+ ACTION_NAMES.objcpp_compile,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-D_FORTIFY_SOURCE=1",
+ "-fstack-protector",
+ "-fcolor-diagnostics",
+ "-Wall",
+ "-Wthread-safety",
+ "-Wself-assign",
+ "-fno-omit-frame-pointer",
+ ],
+ ),
+ ],
+ ),
+ flag_set(
+ actions = [
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.linkstamp_compile,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ACTION_NAMES.lto_backend,
+ ACTION_NAMES.clif_match,
+ ACTION_NAMES.objc_compile,
+ ACTION_NAMES.objcpp_compile,
+ ],
+ flag_groups = [flag_group(flags = ["-O0", "-DDEBUG"])],
+ with_features = [with_feature_set(features = ["fastbuild"])],
+ ),
+ flag_set(
+ actions = [
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.linkstamp_compile,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ACTION_NAMES.lto_backend,
+ ACTION_NAMES.clif_match,
+ ACTION_NAMES.objc_compile,
+ ACTION_NAMES.objcpp_compile,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-g0",
+ "-O2",
+ "-D_FORTIFY_SOURCE=1",
+ "-DNDEBUG",
+ "-ffunction-sections",
+ "-fdata-sections",
+ "-DNS_BLOCK_ASSERTIONS=1",
+ ],
+ ),
+ ],
+ with_features = [with_feature_set(features = ["opt"])],
+ ),
+ flag_set(
+ actions = [
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.linkstamp_compile,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ACTION_NAMES.lto_backend,
+ ACTION_NAMES.clif_match,
+ ACTION_NAMES.objc_compile,
+ ACTION_NAMES.objcpp_compile,
+ ],
+ flag_groups = [flag_group(flags = ["-g"])],
+ with_features = [with_feature_set(features = ["dbg"])],
+ ),
+ flag_set(
+ actions = [
+ ACTION_NAMES.linkstamp_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ACTION_NAMES.lto_backend,
+ ACTION_NAMES.clif_match,
+ ],
+ flag_groups = [flag_group(flags = ["-std=c++11"])],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "darwin_x86_64"
+ or ctx.attr.cpu == "ios_arm64"
+ or ctx.attr.cpu == "ios_armv7"
+ or ctx.attr.cpu == "ios_i386"
+ or ctx.attr.cpu == "ios_x86_64"
+ or ctx.attr.cpu == "watchos_armv7k"
+ or ctx.attr.cpu == "watchos_i386"):
+ default_compile_flags_feature = feature(
+ name = "default_compile_flags",
+ enabled = True,
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.linkstamp_compile,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ACTION_NAMES.lto_backend,
+ ACTION_NAMES.clif_match,
+ ACTION_NAMES.objc_compile,
+ ACTION_NAMES.objcpp_compile,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-D_FORTIFY_SOURCE=1",
+ "-fstack-protector",
+ "-fcolor-diagnostics",
+ "-Wall",
+ "-Wthread-safety",
+ "-Wself-assign",
+ "-fno-omit-frame-pointer",
+ ],
+ ),
+ ],
+ ),
+ flag_set(
+ actions = [
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.linkstamp_compile,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ACTION_NAMES.lto_backend,
+ ACTION_NAMES.clif_match,
+ ACTION_NAMES.objc_compile,
+ ACTION_NAMES.objcpp_compile,
+ ],
+ flag_groups = [flag_group(flags = ["-O0", "-DDEBUG"])],
+ with_features = [with_feature_set(features = ["fastbuild"])],
+ ),
+ flag_set(
+ actions = [
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.linkstamp_compile,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ACTION_NAMES.lto_backend,
+ ACTION_NAMES.clif_match,
+ ACTION_NAMES.objc_compile,
+ ACTION_NAMES.objcpp_compile,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-g0",
+ "-O2",
+ "-D_FORTIFY_SOURCE=1",
+ "-DNDEBUG",
+ "-ffunction-sections",
+ "-fdata-sections",
+ ],
+ ),
+ ],
+ with_features = [with_feature_set(features = ["opt"])],
+ ),
+ flag_set(
+ actions = [
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.linkstamp_compile,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ACTION_NAMES.lto_backend,
+ ACTION_NAMES.clif_match,
+ ACTION_NAMES.objc_compile,
+ ACTION_NAMES.objcpp_compile,
+ ],
+ flag_groups = [flag_group(flags = ["-g"])],
+ with_features = [with_feature_set(features = ["dbg"])],
+ ),
+ flag_set(
+ actions = [
+ ACTION_NAMES.linkstamp_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ACTION_NAMES.lto_backend,
+ ACTION_NAMES.clif_match,
+ ],
+ flag_groups = [flag_group(flags = ["-std=c++11"])],
+ ),
+ ],
+ )
+
+ objcopy_embed_flags_feature = feature(
+ name = "objcopy_embed_flags",
+ enabled = True,
+ flag_sets = [
+ flag_set(
+ actions = ["objcopy_embed_data"],
+ flag_groups = [flag_group(flags = ["-I", "binary"])],
+ ),
+ ],
+ )
+
+ bitcode_embedded_markers_feature = feature(name = "bitcode_embedded_markers")
+
+ dead_strip_feature = feature(
+ name = "dead_strip",
+ flag_sets = [
+ flag_set(
+ actions = all_link_actions +
+ ["objc-executable", "objc++-executable"],
+ flag_groups = [
+ flag_group(
+ flags = ["-dead_strip", "-no_dead_strip_inits_and_terms"],
+ ),
+ ],
+ ),
+ ],
+ requires = [feature_set(features = ["opt"])],
+ )
+
+ generate_dsym_file_feature = feature(
+ name = "generate_dsym_file",
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.objc_compile,
+ ACTION_NAMES.objcpp_compile,
+ "objc-executable",
+ "objc++-executable",
+ ],
+ flag_groups = [flag_group(flags = ["-g"])],
+ ),
+ flag_set(
+ actions = ["objc-executable", "objc++-executable"],
+ flag_groups = [
+ flag_group(
+ flags = [
+ "DSYM_HINT_LINKED_BINARY=%{linked_binary}",
+ "DSYM_HINT_DSYM_PATH=%{dsym_path}",
+ ],
+ ),
+ ],
+ ),
+ ],
+ )
+
+ if (ctx.attr.cpu == "darwin_x86_64"):
+ kernel_extension_feature = feature(
+ name = "kernel_extension",
+ flag_sets = [
+ flag_set(
+ actions = ["objc-executable", "objc++-executable"],
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-nostdlib",
+ "-lkmod",
+ "-lkmodc++",
+ "-lcc_kext",
+ "-Xlinker",
+ "-kext",
+ ],
+ ),
+ ],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "armeabi-v7a"
+ or ctx.attr.cpu == "ios_arm64"
+ or ctx.attr.cpu == "ios_arm64e"
+ or ctx.attr.cpu == "ios_armv7"
+ or ctx.attr.cpu == "ios_i386"
+ or ctx.attr.cpu == "ios_x86_64"
+ or ctx.attr.cpu == "tvos_arm64"
+ or ctx.attr.cpu == "tvos_x86_64"
+ or ctx.attr.cpu == "watchos_arm64_32"
+ or ctx.attr.cpu == "watchos_armv7k"
+ or ctx.attr.cpu == "watchos_i386"
+ or ctx.attr.cpu == "watchos_x86_64"):
+ kernel_extension_feature = feature(name = "kernel_extension")
+
+ apply_default_warnings_feature = feature(
+ name = "apply_default_warnings",
+ flag_sets = [
+ flag_set(
+ actions = [ACTION_NAMES.objc_compile, ACTION_NAMES.objcpp_compile],
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-Wshorten-64-to-32",
+ "-Wbool-conversion",
+ "-Wconstant-conversion",
+ "-Wduplicate-method-match",
+ "-Wempty-body",
+ "-Wenum-conversion",
+ "-Wint-conversion",
+ "-Wunreachable-code",
+ "-Wmismatched-return-types",
+ "-Wundeclared-selector",
+ "-Wuninitialized",
+ "-Wunused-function",
+ "-Wunused-variable",
+ ],
+ ),
+ ],
+ ),
+ ],
+ )
+
+ dependency_file_feature = feature(
+ name = "dependency_file",
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.objc_compile,
+ ACTION_NAMES.objcpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = ["-MD", "-MF", "%{dependency_file}"],
+ expand_if_available = "dependency_file",
+ ),
+ ],
+ ),
+ ],
+ )
+
+ preprocessor_defines_feature = feature(
+ name = "preprocessor_defines",
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.linkstamp_compile,
+ ACTION_NAMES.objc_compile,
+ ACTION_NAMES.objcpp_compile,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = ["-D%{preprocessor_defines}"],
+ iterate_over = "preprocessor_defines",
+ ),
+ ],
+ ),
+ ],
+ )
+
+ fdo_instrument_feature = feature(
+ name = "fdo_instrument",
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_link_dynamic_library,
+ ACTION_NAMES.cpp_link_nodeps_dynamic_library,
+ ACTION_NAMES.cpp_link_executable,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-fprofile-generate=%{fdo_instrument_path}",
+ "-fno-data-sections",
+ ],
+ expand_if_available = "fdo_instrument_path",
+ ),
+ ],
+ ),
+ ],
+ provides = ["profile"],
+ )
+
+ if (ctx.attr.cpu == "darwin_x86_64"):
+ link_cocoa_feature = feature(
+ name = "link_cocoa",
+ flag_sets = [
+ flag_set(
+ actions = ["objc-executable", "objc++-executable"],
+ flag_groups = [flag_group(flags = ["-framework", "Cocoa"])],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "armeabi-v7a"
+ or ctx.attr.cpu == "ios_arm64"
+ or ctx.attr.cpu == "ios_arm64e"
+ or ctx.attr.cpu == "ios_armv7"
+ or ctx.attr.cpu == "ios_i386"
+ or ctx.attr.cpu == "ios_x86_64"
+ or ctx.attr.cpu == "tvos_arm64"
+ or ctx.attr.cpu == "tvos_x86_64"
+ or ctx.attr.cpu == "watchos_arm64_32"
+ or ctx.attr.cpu == "watchos_armv7k"
+ or ctx.attr.cpu == "watchos_i386"
+ or ctx.attr.cpu == "watchos_x86_64"):
+ link_cocoa_feature = feature(name = "link_cocoa")
+
+ user_compile_flags_feature = feature(
+ name = "user_compile_flags",
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ACTION_NAMES.linkstamp_compile,
+ ACTION_NAMES.objc_compile,
+ ACTION_NAMES.objcpp_compile,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = ["%{user_compile_flags}"],
+ iterate_over = "user_compile_flags",
+ expand_if_available = "user_compile_flags",
+ ),
+ ],
+ ),
+ ],
+ )
+
+ if (ctx.attr.cpu == "ios_arm64"
+ or ctx.attr.cpu == "ios_arm64e"
+ or ctx.attr.cpu == "ios_armv7"
+ or ctx.attr.cpu == "ios_i386"
+ or ctx.attr.cpu == "ios_x86_64"
+ or ctx.attr.cpu == "tvos_arm64"
+ or ctx.attr.cpu == "tvos_x86_64"
+ or ctx.attr.cpu == "watchos_arm64_32"
+ or ctx.attr.cpu == "watchos_armv7k"
+ or ctx.attr.cpu == "watchos_i386"
+ or ctx.attr.cpu == "watchos_x86_64"):
+ features = [
+ fastbuild_feature,
+ no_legacy_features_feature,
+ opt_feature,
+ dbg_feature,
+ link_libcpp_feature,
+ compile_all_modules_feature,
+ exclude_private_headers_in_module_maps_feature,
+ has_configured_linker_path_feature,
+ only_doth_headers_in_module_maps_feature,
+ default_compile_flags_feature,
+ debug_prefix_map_pwd_is_dot_feature,
+ generate_dsym_file_feature,
+ contains_objc_source_feature,
+ objc_actions_feature,
+ strip_debug_symbols_feature,
+ symbol_counts_feature,
+ shared_flag_feature,
+ kernel_extension_feature,
+ linkstamps_feature,
+ output_execpath_flags_feature,
+ archiver_flags_feature,
+ runtime_root_flags_feature,
+ input_param_flags_feature,
+ force_pic_flags_feature,
+ pch_feature,
+ module_maps_feature,
+ use_objc_modules_feature,
+ no_enable_modules_feature,
+ apply_default_warnings_feature,
+ includes_feature,
+ include_paths_feature,
+ sysroot_feature,
+ dependency_file_feature,
+ pic_feature,
+ per_object_debug_info_feature,
+ preprocessor_defines_feature,
+ framework_paths_feature,
+ random_seed_feature,
+ fdo_instrument_feature,
+ fdo_optimize_feature,
+ autofdo_feature,
+ lipo_feature,
+ coverage_feature,
+ llvm_coverage_map_format_feature,
+ gcc_coverage_map_format_feature,
+ apply_default_compiler_flags_feature,
+ include_system_dirs_feature,
+ bitcode_embedded_feature,
+ bitcode_embedded_markers_feature,
+ objc_arc_feature,
+ no_objc_arc_feature,
+ apple_env_feature,
+ user_link_flags_feature,
+ default_link_flags_feature,
+ version_min_feature,
+ dead_strip_feature,
+ cpp_linker_flags_feature,
+ apply_implicit_frameworks_feature,
+ link_cocoa_feature,
+ apply_simulator_compiler_flags_feature,
+ unfiltered_cxx_flags_feature,
+ user_compile_flags_feature,
+ unfiltered_compile_flags_feature,
+ linker_param_file_feature,
+ compiler_input_flags_feature,
+ compiler_output_flags_feature,
+ objcopy_embed_flags_feature,
+ ]
+ elif (ctx.attr.cpu == "darwin_x86_64"):
+ features = [
+ fastbuild_feature,
+ no_legacy_features_feature,
+ opt_feature,
+ dbg_feature,
+ link_libcpp_feature,
+ compile_all_modules_feature,
+ exclude_private_headers_in_module_maps_feature,
+ has_configured_linker_path_feature,
+ only_doth_headers_in_module_maps_feature,
+ default_compile_flags_feature,
+ debug_prefix_map_pwd_is_dot_feature,
+ generate_dsym_file_feature,
+ contains_objc_source_feature,
+ objc_actions_feature,
+ strip_debug_symbols_feature,
+ symbol_counts_feature,
+ shared_flag_feature,
+ kernel_extension_feature,
+ linkstamps_feature,
+ output_execpath_flags_feature,
+ archiver_flags_feature,
+ runtime_root_flags_feature,
+ input_param_flags_feature,
+ force_pic_flags_feature,
+ pch_feature,
+ module_maps_feature,
+ use_objc_modules_feature,
+ no_enable_modules_feature,
+ apply_default_warnings_feature,
+ includes_feature,
+ include_paths_feature,
+ sysroot_feature,
+ dependency_file_feature,
+ pic_feature,
+ per_object_debug_info_feature,
+ preprocessor_defines_feature,
+ framework_paths_feature,
+ random_seed_feature,
+ fdo_instrument_feature,
+ fdo_optimize_feature,
+ autofdo_feature,
+ lipo_feature,
+ coverage_feature,
+ llvm_coverage_map_format_feature,
+ gcc_coverage_map_format_feature,
+ apply_default_compiler_flags_feature,
+ include_system_dirs_feature,
+ bitcode_embedded_feature,
+ bitcode_embedded_markers_feature,
+ objc_arc_feature,
+ no_objc_arc_feature,
+ apple_env_feature,
+ user_link_flags_feature,
+ default_link_flags_feature,
+ version_min_feature,
+ dead_strip_feature,
+ cpp_linker_flags_feature,
+ apply_implicit_frameworks_feature,
+ link_cocoa_feature,
+ apply_simulator_compiler_flags_feature,
+ unfiltered_cxx_flags_feature,
+ user_compile_flags_feature,
+ unfiltered_compile_flags_feature,
+ linker_param_file_feature,
+ compiler_input_flags_feature,
+ compiler_output_flags_feature,
+ supports_dynamic_linker_feature,
+ objcopy_embed_flags_feature,
+ dynamic_linking_mode_feature,
+ ]
+ elif (ctx.attr.cpu == "armeabi-v7a"):
+ features = [
+ fastbuild_feature,
+ no_legacy_features_feature,
+ opt_feature,
+ dbg_feature,
+ link_libcpp_feature,
+ compile_all_modules_feature,
+ exclude_private_headers_in_module_maps_feature,
+ has_configured_linker_path_feature,
+ only_doth_headers_in_module_maps_feature,
+ default_compile_flags_feature,
+ debug_prefix_map_pwd_is_dot_feature,
+ generate_dsym_file_feature,
+ contains_objc_source_feature,
+ objc_actions_feature,
+ strip_debug_symbols_feature,
+ symbol_counts_feature,
+ shared_flag_feature,
+ kernel_extension_feature,
+ linkstamps_feature,
+ output_execpath_flags_feature,
+ archiver_flags_feature,
+ runtime_root_flags_feature,
+ input_param_flags_feature,
+ force_pic_flags_feature,
+ pch_feature,
+ module_maps_feature,
+ use_objc_modules_feature,
+ no_enable_modules_feature,
+ apply_default_warnings_feature,
+ includes_feature,
+ include_paths_feature,
+ sysroot_feature,
+ dependency_file_feature,
+ pic_feature,
+ per_object_debug_info_feature,
+ preprocessor_defines_feature,
+ framework_paths_feature,
+ random_seed_feature,
+ fdo_instrument_feature,
+ fdo_optimize_feature,
+ autofdo_feature,
+ lipo_feature,
+ coverage_feature,
+ llvm_coverage_map_format_feature,
+ gcc_coverage_map_format_feature,
+ apply_default_compiler_flags_feature,
+ include_system_dirs_feature,
+ bitcode_embedded_feature,
+ bitcode_embedded_markers_feature,
+ objc_arc_feature,
+ no_objc_arc_feature,
+ apple_env_feature,
+ user_link_flags_feature,
+ default_link_flags_feature,
+ version_min_feature,
+ dead_strip_feature,
+ cpp_linker_flags_feature,
+ apply_implicit_frameworks_feature,
+ link_cocoa_feature,
+ apply_simulator_compiler_flags_feature,
+ unfiltered_cxx_flags_feature,
+ user_compile_flags_feature,
+ unfiltered_compile_flags_feature,
+ linker_param_file_feature,
+ compiler_input_flags_feature,
+ compiler_output_flags_feature,
+ supports_pic_feature,
+ objcopy_embed_flags_feature,
+ ]
+ else:
+ fail("Unreachable")
+
+ cxx_builtin_include_directories = [
+%{cxx_builtin_include_directories}
+ ]
+
+ artifact_name_patterns = []
+
+ make_variables = [
+ make_variable(
+ name = "STACK_FRAME_UNLIMITED",
+ value = "-Wframe-larger-than=100000000 -Wno-vla",
+ ),
+ ]
+
+ if (ctx.attr.cpu == "armeabi-v7a"):
+ tool_paths = [
+ tool_path(name = "ar", path = "/bin/false"),
+ tool_path(name = "compat-ld", path = "/bin/false"),
+ tool_path(name = "cpp", path = "/bin/false"),
+ tool_path(name = "dwp", path = "/bin/false"),
+ tool_path(name = "gcc", path = "/bin/false"),
+ tool_path(name = "gcov", path = "/bin/false"),
+ tool_path(name = "ld", path = "/bin/false"),
+ tool_path(name = "nm", path = "/bin/false"),
+ tool_path(name = "objcopy", path = "/bin/false"),
+ tool_path(name = "objdump", path = "/bin/false"),
+ tool_path(name = "strip", path = "/bin/false"),
+ ]
+ elif (ctx.attr.cpu == "darwin_x86_64"
+ or ctx.attr.cpu == "ios_arm64"
+ or ctx.attr.cpu == "ios_arm64e"
+ or ctx.attr.cpu == "ios_armv7"
+ or ctx.attr.cpu == "ios_i386"
+ or ctx.attr.cpu == "ios_x86_64"
+ or ctx.attr.cpu == "tvos_arm64"
+ or ctx.attr.cpu == "tvos_x86_64"
+ or ctx.attr.cpu == "watchos_arm64_32"
+ or ctx.attr.cpu == "watchos_armv7k"
+ or ctx.attr.cpu == "watchos_i386"
+ or ctx.attr.cpu == "watchos_x86_64"):
+ tool_paths = [
+ tool_path(name = "ar", path = "wrapped_ar"),
+ tool_path(name = "compat-ld", path = "/usr/bin/ld"),
+ tool_path(name = "cpp", path = "/usr/bin/cpp"),
+ tool_path(name = "dwp", path = "/usr/bin/dwp"),
+ tool_path(name = "gcc", path = "cc_wrapper.sh"),
+ tool_path(name = "gcov", path = "/usr/bin/gcov"),
+ tool_path(name = "ld", path = "/usr/bin/ld"),
+ tool_path(name = "nm", path = "/usr/bin/nm"),
+ tool_path(name = "objcopy", path = "/usr/bin/objcopy"),
+ tool_path(name = "objdump", path = "/usr/bin/objdump"),
+ tool_path(name = "strip", path = "/usr/bin/strip"),
+ ]
+ else:
+ fail("Unreachable")
+
+
+ out = ctx.actions.declare_file(ctx.label.name)
+ ctx.actions.write(out, "Fake executable")
+ return [
+ cc_common.create_cc_toolchain_config_info(
+ ctx = ctx,
+ features = features,
+ action_configs = action_configs,
+ artifact_name_patterns = artifact_name_patterns,
+ cxx_builtin_include_directories = cxx_builtin_include_directories,
+ toolchain_identifier = toolchain_identifier,
+ host_system_name = host_system_name,
+ target_system_name = target_system_name,
+ target_cpu = target_cpu,
+ target_libc = target_libc,
+ compiler = compiler,
+ abi_version = abi_version,
+ abi_libc_version = abi_libc_version,
+ tool_paths = tool_paths,
+ make_variables = make_variables,
+ builtin_sysroot = builtin_sysroot,
+ cc_target_os = cc_target_os
+ ),
+ DefaultInfo(
+ executable = out,
+ ),
+ ]
+
+cc_toolchain_config = rule(
+ implementation = _impl,
+ attrs = {
+ "cpu": attr.string(mandatory=True),
+ "compiler": attr.string(),
+ },
+ provides = [CcToolchainConfigInfo],
+ executable = True,
+)
\ No newline at end of file