From 3e6d3b9a4af9a8f42bc4be75088800541d82ea0c Mon Sep 17 00:00:00 2001 From: Marcel Hlopko Date: Tue, 14 May 2019 15:51:00 +0200 Subject: [PATCH] Update rules_cc for --incompatible_enable_cc_toolchain_resolution https://github.com/bazelbuild/bazel/issues/7260 --- examples/my_c_archive/my_c_archive.bzl | 4 +--- examples/my_c_compile/my_c_compile.bzl | 5 ++--- examples/write_cc_toolchain_cpu/write_cc_toolchain_cpu.bzl | 1 + 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/examples/my_c_archive/my_c_archive.bzl b/examples/my_c_archive/my_c_archive.bzl index 30b313e..eba8af0 100644 --- a/examples/my_c_archive/my_c_archive.bzl +++ b/examples/my_c_archive/my_c_archive.bzl @@ -71,9 +71,7 @@ def _my_c_archive_impl(ctx): inputs = depset( direct = [object_file], transitive = [ - # TODO: Use CcToolchainInfo getters when available - # See https://github.com/bazelbuild/bazel/issues/7427. - ctx.attr._cc_toolchain.files, + cc_toolchain.all_files, ], ), outputs = [output_file], diff --git a/examples/my_c_compile/my_c_compile.bzl b/examples/my_c_compile/my_c_compile.bzl index 6e35b39..fe58db8 100644 --- a/examples/my_c_compile/my_c_compile.bzl +++ b/examples/my_c_compile/my_c_compile.bzl @@ -61,9 +61,7 @@ def _my_c_compile_impl(ctx): env = env, inputs = depset( items = [source_file], - # TODO: Use CcToolchainInfo getters when available - # See https://github.com/bazelbuild/bazel/issues/7427. - transitive = [ctx.attr._cc_toolchain.files], + transitive = [cc_toolchain.all_files], ), outputs = [output_file], ) @@ -78,5 +76,6 @@ my_c_compile = rule( "src": attr.label(mandatory = True, allow_single_file = True), "_cc_toolchain": attr.label(default = Label("@bazel_tools//tools/cpp:current_cc_toolchain")), }, + toolchains = ["@bazel_tools//tools/cpp:toolchain_type"], fragments = ["cpp"], ) diff --git a/examples/write_cc_toolchain_cpu/write_cc_toolchain_cpu.bzl b/examples/write_cc_toolchain_cpu/write_cc_toolchain_cpu.bzl index 549c8b2..e1d253f 100644 --- a/examples/write_cc_toolchain_cpu/write_cc_toolchain_cpu.bzl +++ b/examples/write_cc_toolchain_cpu/write_cc_toolchain_cpu.bzl @@ -28,4 +28,5 @@ write_cc_toolchain_cpu = rule( attrs = { "_cc_toolchain": attr.label(default = Label("@bazel_tools//tools/cpp:current_cc_toolchain")), }, + toolchains = ["@bazel_tools//tools/cpp:toolchain_type"], )