diff --git a/examples/rule_based_toolchain/MODULE.bazel b/examples/rule_based_toolchain/MODULE.bazel index 8e91dfd..9f89760 100644 --- a/examples/rule_based_toolchain/MODULE.bazel +++ b/examples/rule_based_toolchain/MODULE.bazel @@ -6,9 +6,11 @@ module( bazel_dep(name = "platforms", version = "0.0.10") bazel_dep(name = "googletest", version = "1.15.2") bazel_dep(name = "bazel_skylib", version = "1.7.1") - bazel_dep(name = "rules_cc") -local_path_override(module_name = "rules_cc", path = "../..") +local_path_override( + module_name = "rules_cc", + path = "../..", +) http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") diff --git a/examples/rule_based_toolchain/dynamic_answer/BUILD b/examples/rule_based_toolchain/dynamic_answer/BUILD index 5894da0..08b8cb5 100644 --- a/examples/rule_based_toolchain/dynamic_answer/BUILD +++ b/examples/rule_based_toolchain/dynamic_answer/BUILD @@ -20,28 +20,27 @@ licenses(["notice"]) # Apache 2.0 cc_library( name = "headers", - includes = ["public"], hdrs = ["public/dynamic_answer.h"], + includes = ["public"], visibility = ["//visibility:private"], ) cc_library( name = "answer", srcs = ["dynamic_answer.c"], - deps = [":headers"], visibility = ["//visibility:private"], + deps = [":headers"], ) - cc_shared_library( name = "shared_library", - deps = [":answer"], visibility = ["//visibility:private"], + deps = [":answer"], ) # Forces linkage as a shared library. cc_library( name = "dynamic_answer", - deps = [":headers"], srcs = [":shared_library"], + deps = [":headers"], ) diff --git a/examples/rule_based_toolchain/static_answer/BUILD b/examples/rule_based_toolchain/static_answer/BUILD index beb1546..0d597d1 100644 --- a/examples/rule_based_toolchain/static_answer/BUILD +++ b/examples/rule_based_toolchain/static_answer/BUILD @@ -20,9 +20,9 @@ licenses(["notice"]) # Apache 2.0 cc_library( name = "answer", - includes = ["public"], - hdrs = ["public/static_answer.h"], srcs = ["static_answer.cc"], + hdrs = ["public/static_answer.h"], + includes = ["public"], linkstatic = True, visibility = ["//visibility:private"], ) diff --git a/examples/rule_based_toolchain/toolchain/BUILD b/examples/rule_based_toolchain/toolchain/BUILD index f58aab7..5c65067 100644 --- a/examples/rule_based_toolchain/toolchain/BUILD +++ b/examples/rule_based_toolchain/toolchain/BUILD @@ -59,10 +59,10 @@ cc_args( ":no_canonical_prefixes", ":warnings", ], - tool_map = "@clang-{}//:all_tools".format(platform_name), - known_features = ["@rules_cc//cc/toolchains/args:experimental_replace_legacy_action_config_features"], enabled_features = ["@rules_cc//cc/toolchains/args:experimental_replace_legacy_action_config_features"], + known_features = ["@rules_cc//cc/toolchains/args:experimental_replace_legacy_action_config_features"], target_compatible_with = constraints, + tool_map = "@clang-{}//:all_tools".format(platform_name), ) for platform_name, constraints in PLATFORMS.items() ] diff --git a/examples/rule_based_toolchain/toolchain/clang.BUILD b/examples/rule_based_toolchain/toolchain/clang.BUILD index 3e27772..5ab31b9 100644 --- a/examples/rule_based_toolchain/toolchain/clang.BUILD +++ b/examples/rule_based_toolchain/toolchain/clang.BUILD @@ -12,11 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -load("@rules_cc//cc/toolchains:tool.bzl", "cc_tool") -load("@rules_cc//cc/toolchains:tool_map.bzl", "cc_tool_map") load("@bazel_skylib//rules/directory:directory.bzl", "directory") load("@bazel_skylib//rules/directory:subdirectory.bzl", "subdirectory") -load("@bazel_skylib//lib:selects.bzl", "selects") +load("@rules_cc//cc/toolchains:tool.bzl", "cc_tool") +load("@rules_cc//cc/toolchains:tool_map.bzl", "cc_tool_map") package(default_visibility = ["//visibility:public"]) @@ -41,7 +40,7 @@ alias( actual = select({ "@platforms//os:macos": ":macos_tools", "//conditions:default": ":default_tools", - }) + }), ) COMMON_TOOLS = { @@ -56,7 +55,7 @@ COMMON_TOOLS = { cc_tool_map( name = "default_tools", tools = COMMON_TOOLS | { - "@rules_cc//cc/toolchains/actions:ar_actions": ":llvm-ar" + "@rules_cc//cc/toolchains/actions:ar_actions": ":llvm-ar", }, visibility = ["//visibility:private"], ) @@ -64,7 +63,7 @@ cc_tool_map( cc_tool_map( name = "macos_tools", tools = COMMON_TOOLS | { - "@rules_cc//cc/toolchains/actions:ar_actions": ":llvm-libtool-darwin" + "@rules_cc//cc/toolchains/actions:ar_actions": ":llvm-libtool-darwin", }, visibility = ["//visibility:private"], ) @@ -82,14 +81,14 @@ cc_tool( "@platforms//os:windows": "//:bin/clang.exe", "//conditions:default": "//:bin/clang", }), + allowlist_include_directories = [ + ":lib-clang-include", + ], data = glob([ "bin/llvm", "include/**", "lib/clang/**/include/**", ]), - allowlist_include_directories = [ - ":lib-clang-include", - ], ) cc_tool( @@ -98,16 +97,16 @@ cc_tool( "@platforms//os:windows": "//:bin/clang++.exe", "//conditions:default": "//:bin/clang++", }), - data = glob([ - "bin/llvm", - "include/**", - "lib/clang/**/include/**", - ]), allowlist_include_directories = [ ":include-x86_64-unknown-linux-gnu-c++-v1", ":include-c++-v1", ":lib-clang-include", ], + data = glob([ + "bin/llvm", + "include/**", + "lib/clang/**/include/**", + ]), ) cc_tool( diff --git a/examples/rule_based_toolchain/toolchain/linux_sysroot.BUILD b/examples/rule_based_toolchain/toolchain/linux_sysroot.BUILD index aa00dcb..c151082 100644 --- a/examples/rule_based_toolchain/toolchain/linux_sysroot.BUILD +++ b/examples/rule_based_toolchain/toolchain/linux_sysroot.BUILD @@ -20,12 +20,12 @@ package(default_visibility = ["//visibility:public"]) cc_sysroot( name = "sysroot", - sysroot = ":root", - data = [":root"], allowlist_include_directories = [ ":usr-include-x86_64-linux-gnu", ":usr-include", ], + data = [":root"], + sysroot = ":root", ) directory( @@ -35,12 +35,12 @@ directory( subdirectory( name = "usr-include-x86_64-linux-gnu", - path = "usr/include/x86_64-linux-gnu", parent = ":root", + path = "usr/include/x86_64-linux-gnu", ) subdirectory( name = "usr-include", - path = "usr/include", parent = ":root", + path = "usr/include", )