Update rules_cc for --incompatible_enable_cc_toolchain_resolution

https://github.com/bazelbuild/bazel/issues/7260
This commit is contained in:
Marcel Hlopko 2019-05-14 15:51:00 +02:00
parent b308aae57f
commit 3e6d3b9a4a
3 changed files with 4 additions and 6 deletions

View File

@ -71,9 +71,7 @@ def _my_c_archive_impl(ctx):
inputs = depset( inputs = depset(
direct = [object_file], direct = [object_file],
transitive = [ transitive = [
# TODO: Use CcToolchainInfo getters when available cc_toolchain.all_files,
# See https://github.com/bazelbuild/bazel/issues/7427.
ctx.attr._cc_toolchain.files,
], ],
), ),
outputs = [output_file], outputs = [output_file],

View File

@ -61,9 +61,7 @@ def _my_c_compile_impl(ctx):
env = env, env = env,
inputs = depset( inputs = depset(
items = [source_file], items = [source_file],
# TODO: Use CcToolchainInfo getters when available transitive = [cc_toolchain.all_files],
# See https://github.com/bazelbuild/bazel/issues/7427.
transitive = [ctx.attr._cc_toolchain.files],
), ),
outputs = [output_file], outputs = [output_file],
) )
@ -78,5 +76,6 @@ my_c_compile = rule(
"src": attr.label(mandatory = True, allow_single_file = True), "src": attr.label(mandatory = True, allow_single_file = True),
"_cc_toolchain": attr.label(default = Label("@bazel_tools//tools/cpp:current_cc_toolchain")), "_cc_toolchain": attr.label(default = Label("@bazel_tools//tools/cpp:current_cc_toolchain")),
}, },
toolchains = ["@bazel_tools//tools/cpp:toolchain_type"],
fragments = ["cpp"], fragments = ["cpp"],
) )

View File

@ -28,4 +28,5 @@ write_cc_toolchain_cpu = rule(
attrs = { attrs = {
"_cc_toolchain": attr.label(default = Label("@bazel_tools//tools/cpp:current_cc_toolchain")), "_cc_toolchain": attr.label(default = Label("@bazel_tools//tools/cpp:current_cc_toolchain")),
}, },
toolchains = ["@bazel_tools//tools/cpp:toolchain_type"],
) )