From 0048c3a8ceb0801a5cc33f6ad7ad177dea67c445 Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Mon, 22 Jan 2024 14:21:48 -0800 Subject: [PATCH 1/3] Force bzlmod in shell tests This avoids the need for us to support multiple paths for these tests --- BUILD | 5 +-- test/BUILD | 16 ------- test/apple_shell_testutils.sh | 4 +- test/bazel_testrunner.sh | 85 ++--------------------------------- test/test_rules.bzl | 3 -- 5 files changed, 6 insertions(+), 107 deletions(-) diff --git a/BUILD b/BUILD index 9a60231e80..dc7e1eab6e 100644 --- a/BUILD +++ b/BUILD @@ -27,12 +27,9 @@ filegroup( "WORKSPACE", "//apple:for_bazel_tests", "//tools:for_bazel_tests", - "@build_bazel_apple_support//:for_bazel_tests", - "@build_bazel_rules_swift//:for_bazel_tests", - "@xctestrunner//:for_bazel_tests", ], visibility = [ - "//:__subpackages__", + "//test:__subpackages__", ], ) diff --git a/test/BUILD b/test/BUILD index a1255a7a32..657a6d4d82 100644 --- a/test/BUILD +++ b/test/BUILD @@ -45,22 +45,6 @@ filegroup( visibility = ["//visibility:public"], ) -# Gather external dependencies into a target that can be injected into the -# integration tests. The test script will then mock out the files required -# to make these proper WORKSPACES that can be used in tests. -# This enables us to: -# 1. Reuse the download of the external dependencies across all tests. -# 2. Remove the need to update dependency versions in the repo's -# WORKSPACE and the test WORKSPACE. -filegroup( - name = "external_deps", - testonly = 1, - srcs = [ - "@bazel_skylib//:test_deps", - "@xctestrunner//:ios_test_runner", - ], -) - # ---------------------------------------------------------------------------- # Ballpark number for shared_count: diff --git a/test/apple_shell_testutils.sh b/test/apple_shell_testutils.sh index 9a7eb011ed..d7d3cc49ec 100755 --- a/test/apple_shell_testutils.sh +++ b/test/apple_shell_testutils.sh @@ -469,9 +469,7 @@ function do_action() { # Used so that if there's a single configuration transition, its output # directory gets mapped into the bazel-bin symlink. "--use_top_level_targets_for_symlinks" - "--apple_crosstool_top=@local_config_apple_cc//:toolchain" - "--crosstool_top=@local_config_apple_cc//:toolchain" - "--host_crosstool_top=@local_config_apple_cc//:toolchain" + "--enable_bzlmod" ) if [[ -n "${XCODE_VERSION_FOR_TESTS-}" ]]; then diff --git a/test/bazel_testrunner.sh b/test/bazel_testrunner.sh index 9841d1d797..e3b3ba9fa7 100755 --- a/test/bazel_testrunner.sh +++ b/test/bazel_testrunner.sh @@ -69,104 +69,27 @@ function create_new_workspace() { mkdir -p "${new_workspace_dir}" cd "${new_workspace_dir}" - # Make a modifiable copy of external, so that we can mock out missing - # test resources. This should only be needed for mocking the xctestrunner - # BUILD file below; if we can workaround this, we don't need to make this - # copy and we should reference it from the original location. - cp -rf "$EXTERNAL_DIR" ../external - - apple_support_path=$(resolve_external_repository build_bazel_apple_support) rules_apple_path=$(resolve_external_repository build_bazel_rules_apple) - rules_swift_path=$(resolve_external_repository build_bazel_rules_swift) touch MODULE.bazel cat > MODULE.bazel < WORKSPACE < Date: Mon, 22 Jan 2024 15:23:57 -0800 Subject: [PATCH 2/3] fixes --- test/bazel_testrunner.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/bazel_testrunner.sh b/test/bazel_testrunner.sh index e3b3ba9fa7..6023672b40 100755 --- a/test/bazel_testrunner.sh +++ b/test/bazel_testrunner.sh @@ -89,8 +89,7 @@ local_path_override( ) EOF - touch WORKSPACE WORKSPACE.bzlmod - cp "$(rlocation build_bazel_rules_apple/platform_mappings)" platform_mappings + touch WORKSPACE } # Set-up a clean default workspace. From 2943d4b1f234bebef0e32be29f3f986a18dcd92f Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Mon, 22 Jan 2024 15:33:47 -0800 Subject: [PATCH 3/3] fxies --- test/apple_shell_testutils.sh | 3 +++ test/bazel_testrunner.sh | 3 +++ 2 files changed, 6 insertions(+) diff --git a/test/apple_shell_testutils.sh b/test/apple_shell_testutils.sh index d7d3cc49ec..2744b2d10b 100755 --- a/test/apple_shell_testutils.sh +++ b/test/apple_shell_testutils.sh @@ -469,6 +469,9 @@ function do_action() { # Used so that if there's a single configuration transition, its output # directory gets mapped into the bazel-bin symlink. "--use_top_level_targets_for_symlinks" + "--apple_crosstool_top=@local_config_apple_cc//:toolchain" + "--crosstool_top=@local_config_apple_cc//:toolchain" + "--host_crosstool_top=@local_config_apple_cc//:toolchain" "--enable_bzlmod" ) diff --git a/test/bazel_testrunner.sh b/test/bazel_testrunner.sh index 6023672b40..3eb2cd8361 100755 --- a/test/bazel_testrunner.sh +++ b/test/bazel_testrunner.sh @@ -83,6 +83,9 @@ bazel_dep(name = "rules_apple", version = "0", repo_name = "build_bazel_rules_ap xcode_configure = use_extension("@bazel_tools//tools/osx:xcode_configure.bzl", "xcode_configure_extension") use_repo(xcode_configure, "local_config_xcode") +apple_cc_configure = use_extension("@build_bazel_apple_support//crosstool:setup.bzl", "apple_cc_configure_extension") +use_repo(apple_cc_configure, "local_config_apple_cc") + local_path_override( module_name = "rules_apple", path = "$rules_apple_path",