|
@@ -259,6 +259,47 @@ filegroup_with_stage = rule(
|
|
|
""",
|
|
""",
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
|
|
+def _exec_filegroup_impl(ctx):
|
|
|
|
|
+ return [DefaultInfo(files = depset(ctx.files.srcs))]
|
|
|
|
|
+
|
|
|
|
|
+_exec_filegroup = rule(
|
|
|
|
|
+ implementation = _exec_filegroup_impl,
|
|
|
|
|
+ attrs = {
|
|
|
|
|
+ "srcs": attr.label_list(cfg = "exec"),
|
|
|
|
|
+ },
|
|
|
|
|
+)
|
|
|
|
|
+
|
|
|
|
|
+def filegroup_with_stage_and_exec(name, srcs, stage, tags = []):
|
|
|
|
|
+ """Wraps `filegroup_with_stage` with a conditional `exec` config transition.
|
|
|
|
|
+
|
|
|
|
|
+ When `//:bootstrap_exec_config` is disabled, this works exactly like
|
|
|
|
|
+ `filegroup_with_stage`. But when it is _enabled_, it also adds an `exec`
|
|
|
|
|
+ config transition. This allows bootstrapping for a target that is not exec
|
|
|
|
|
+ compatible with the host, and in general makes bootstrapping more robust at
|
|
|
|
|
+ the expense of a likely duplicate build of the entire toolchain.
|
|
|
|
|
+ """
|
|
|
|
|
+ filegroup_with_stage(
|
|
|
|
|
+ name = name + "_stage_only",
|
|
|
|
|
+ srcs = srcs,
|
|
|
|
|
+ stage = stage,
|
|
|
|
|
+ tags = tags,
|
|
|
|
|
+ )
|
|
|
|
|
+
|
|
|
|
|
+ _exec_filegroup(
|
|
|
|
|
+ name = name + "_with_exec",
|
|
|
|
|
+ srcs = [":" + name + "_stage_only"],
|
|
|
|
|
+ tags = tags,
|
|
|
|
|
+ )
|
|
|
|
|
+
|
|
|
|
|
+ native.alias(
|
|
|
|
|
+ name = name,
|
|
|
|
|
+ actual = select({
|
|
|
|
|
+ "//:bootstrap_with_exec_config": ":" + name + "_with_exec",
|
|
|
|
|
+ "//conditions:default": ":" + name + "_stage_only",
|
|
|
|
|
+ }),
|
|
|
|
|
+ tags = tags,
|
|
|
|
|
+ )
|
|
|
|
|
+
|
|
|
def _gen_cc_toolchain_paths_impl(ctx):
|
|
def _gen_cc_toolchain_paths_impl(ctx):
|
|
|
cc_toolchain = find_cpp_toolchain(ctx)
|
|
cc_toolchain = find_cpp_toolchain(ctx)
|
|
|
|
|
|
|
@@ -332,21 +373,21 @@ def carbon_cc_toolchain_suite(
|
|
|
# and not in the runtimes build. These allow us to form the inputs to both
|
|
# and not in the runtimes build. These allow us to form the inputs to both
|
|
|
# the runtimes toolchain and the main toolchain of this stage that are built
|
|
# the runtimes toolchain and the main toolchain of this stage that are built
|
|
|
# entirely by the base stage toolchain.
|
|
# entirely by the base stage toolchain.
|
|
|
- filegroup_with_stage(
|
|
|
|
|
|
|
+ filegroup_with_stage_and_exec(
|
|
|
name = "{}_clang_hdrs".format(name),
|
|
name = "{}_clang_hdrs".format(name),
|
|
|
srcs = clang_hdrs,
|
|
srcs = clang_hdrs,
|
|
|
stage = base_stage,
|
|
stage = base_stage,
|
|
|
tags = tags,
|
|
tags = tags,
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
- filegroup_with_stage(
|
|
|
|
|
|
|
+ filegroup_with_stage_and_exec(
|
|
|
name = "{}_base_files".format(name),
|
|
name = "{}_base_files".format(name),
|
|
|
srcs = base_files,
|
|
srcs = base_files,
|
|
|
stage = base_stage,
|
|
stage = base_stage,
|
|
|
tags = tags,
|
|
tags = tags,
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
- filegroup_with_stage(
|
|
|
|
|
|
|
+ filegroup_with_stage_and_exec(
|
|
|
name = "{}_runtimes_compile_files".format(name),
|
|
name = "{}_runtimes_compile_files".format(name),
|
|
|
srcs = [
|
|
srcs = [
|
|
|
":{}_base_files".format(name),
|
|
":{}_base_files".format(name),
|
|
@@ -356,7 +397,7 @@ def carbon_cc_toolchain_suite(
|
|
|
tags = tags,
|
|
tags = tags,
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
- filegroup_with_stage(
|
|
|
|
|
|
|
+ filegroup_with_stage_and_exec(
|
|
|
name = "{}_compile_files".format(name),
|
|
name = "{}_compile_files".format(name),
|
|
|
srcs = [":{}_base_files".format(name)] + all_hdrs,
|
|
srcs = [":{}_base_files".format(name)] + all_hdrs,
|
|
|
stage = base_stage,
|
|
stage = base_stage,
|