diff --git a/.bazelignore b/.bazelignore new file mode 100644 index 00000000..2b29f276 --- /dev/null +++ b/.bazelignore @@ -0,0 +1 @@ +tests diff --git a/tests/.bazelrc b/tests/.bazelrc index cbbcfb85..e3a15497 100644 --- a/tests/.bazelrc +++ b/tests/.bazelrc @@ -1,2 +1,3 @@ common --incompatible_disallow_empty_glob +common --nolegacy_external_runfiles build --features=layering_check diff --git a/tests/BUILD.bazel b/tests/BUILD.bazel index 02ab2032..1c953b21 100644 --- a/tests/BUILD.bazel +++ b/tests/BUILD.bazel @@ -120,7 +120,7 @@ sh_test( name = "file_dependency_test", srcs = ["file_dependency_test.sh"], args = [ - "$(execpath @llvm_toolchain_llvm//:bin/clang-format)", + "$(rootpath @llvm_toolchain_llvm//:bin/clang-format)", "$(rootpaths @llvm_toolchain_llvm//:lib)", ], data = [ @@ -136,7 +136,7 @@ toolchain( "@platforms//cpu:arm64", "@platforms//os:macos", ], - toolchain = "@@rules_foreign_cc~~tools~ninja_1.11.1_mac//:ninja_tool", + toolchain = "@ninja_mac//:ninja_tool", toolchain_type = "@rules_foreign_cc//toolchains:ninja_toolchain", ) diff --git a/tests/MODULE.bazel b/tests/MODULE.bazel index 5d4bfa8c..b37c838f 100644 --- a/tests/MODULE.bazel +++ b/tests/MODULE.bazel @@ -29,6 +29,8 @@ bazel_dep(name = "rules_foreign_cc", version = "0.12.0") bazel_dep(name = "abseil-cpp", version = "20240722.0", repo_name = "com_google_absl") # As a workaround for https://github.com/bazelbuild/rules_foreign_cc/issues/1018. +rules_foreign_cc_tools = use_extension("@rules_foreign_cc//foreign_cc:extensions.bzl", "tools") +use_repo(rules_foreign_cc_tools, ninja_mac = "ninja_1.12.1_mac") register_toolchains( "//:ninja_mac_arm64_toolchain", ) @@ -162,7 +164,7 @@ llvm.toolchain_root( llvm.sysroot( name = "llvm_toolchain_with_sysroot", targets = ["linux-x86_64"], - label = "@@org_chromium_sysroot_linux_x64//:sysroot", + label = "@org_chromium_sysroot_linux_x64//:sysroot", ) use_repo(llvm, "llvm_toolchain_with_sysroot") @@ -216,3 +218,18 @@ wasi_sdk_sysroots(name = "wasi_sdk_sysroots") libclang_rt_wasm32 = use_repo_rule("//wasm:wasi_sdk.bzl", "libclang_rt_wasm32") libclang_rt_wasm32(name = "libclang_rt_wasm32") + +http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") +# This sysroot is used by github.com/vsco/bazel-toolchains. +http_archive( + name = "org_chromium_sysroot_linux_x64", + build_file_content = """ +filegroup( + name = "sysroot", + srcs = glob(["*/**"]), + visibility = ["//visibility:public"], +) +""", + sha256 = "84656a6df544ecef62169cfe3ab6e41bb4346a62d3ba2a045dc5a0a2ecea94a3", + urls = ["https://commondatastorage.googleapis.com/chrome-linux-sysroot/toolchain/2202c161310ffde63729f29d27fe7bb24a0bc540/debian_stretch_amd64_sysroot.tar.xz"], +) diff --git a/tests/WORKSPACE.bzlmod b/tests/WORKSPACE.bzlmod index 7e848f7c..7aae8c4f 100644 --- a/tests/WORKSPACE.bzlmod +++ b/tests/WORKSPACE.bzlmod @@ -2,20 +2,6 @@ workspace(name = "toolchains_llvm_tests") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -# This sysroot is used by github.com/vsco/bazel-toolchains. -http_archive( - name = "org_chromium_sysroot_linux_x64", - build_file_content = """ -filegroup( - name = "sysroot", - srcs = glob(["*/**"]), - visibility = ["//visibility:public"], -) -""", - sha256 = "84656a6df544ecef62169cfe3ab6e41bb4346a62d3ba2a045dc5a0a2ecea94a3", - urls = ["https://commondatastorage.googleapis.com/chrome-linux-sysroot/toolchain/2202c161310ffde63729f29d27fe7bb24a0bc540/debian_stretch_amd64_sysroot.tar.xz"], -) - # Well known repos; present here only for testing. http_archive( diff --git a/tests/file_dependency_test.sh b/tests/file_dependency_test.sh index 37f2f1df..bf60e2bd 100755 --- a/tests/file_dependency_test.sh +++ b/tests/file_dependency_test.sh @@ -21,10 +21,10 @@ fail() { clang_format_path=$1 libcpp_path=$2 -[[ -e ${clang_format_path} ]] || fail "bin/clang-format not found" +[[ -e ${clang_format_path} ]] || fail "bin/clang-format not found at ${clang_format_path}" [[ -e ${libcpp_path} ]] || compgen -G "${libcpp_path}" >/dev/null || - fail "libc++.a not found" + fail "libc++.a not found at ${libcpp_path}" echo "SUCCESS!"