diff --git a/go/tools/bazel_testing/bazel_testing.go b/go/tools/bazel_testing/bazel_testing.go index 4c8f8d3f9..30bc8f058 100644 --- a/go/tools/bazel_testing/bazel_testing.go +++ b/go/tools/bazel_testing/bazel_testing.go @@ -466,15 +466,6 @@ func setupWorkspace(args Args, files []string) (dir string, cleanup func() error if err := defaultModuleBazelTpl.Execute(w, info); err != nil { return "", cleanup, err } - - // Enable Bzlmod. - bazelrcPath := filepath.Join(mainDir, ".bazelrc") - if _, err = os.Stat(bazelrcPath); os.IsNotExist(err) { - err = os.WriteFile(bazelrcPath, []byte("common --enable_bzlmod"), 0666) - if err != nil { - return "", cleanup, err - } - } } return mainDir, cleanup, nil diff --git a/tests/core/cross/proto_test.go b/tests/core/cross/proto_test.go index 45c4410f9..c8372ffb8 100644 --- a/tests/core/cross/proto_test.go +++ b/tests/core/cross/proto_test.go @@ -24,6 +24,52 @@ var testArgs = bazel_testing.Args{ ModuleFileSuffix: ` bazel_dep(name = "rules_proto", version = "6.0.0") bazel_dep(name = "toolchains_protoc", version = "0.2.4") +`, + WorkspacePrefix: ` +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") + +# The non-polyfill version of this is needed by rules_proto below. +http_archive( + name = "bazel_features", + sha256 = "d7787da289a7fb497352211ad200ec9f698822a9e0757a4976fd9f713ff372b3", + strip_prefix = "bazel_features-1.9.1", + url = "https://github.com/bazel-contrib/bazel_features/releases/download/v1.9.1/bazel_features-v1.9.1.tar.gz", +) + +load("@bazel_features//:deps.bzl", "bazel_features_deps") + +bazel_features_deps() +`, + WorkspaceSuffix: ` +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") + +http_archive( + name = "com_google_protobuf", + sha256 = "75be42bd736f4df6d702a0e4e4d30de9ee40eac024c4b845d17ae4cc831fe4ae", + strip_prefix = "protobuf-21.7", + # latest available in BCR, as of 2022-09-30 + urls = [ + "https://github.com/protocolbuffers/protobuf/archive/v21.7.tar.gz", + "https://mirror.bazel.build/github.com/protocolbuffers/protobuf/archive/v21.7.tar.gz", + ], +) + +load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") + +protobuf_deps() + +http_archive( + name = "rules_proto", + sha256 = "303e86e722a520f6f326a50b41cfc16b98fe6d1955ce46642a5b7a67c11c0f5d", + strip_prefix = "rules_proto-6.0.0", + url = "https://github.com/bazelbuild/rules_proto/releases/download/6.0.0/rules_proto-6.0.0.tar.gz", +) + +load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies") +rules_proto_dependencies() + +load("@rules_proto//proto:toolchains.bzl", "rules_proto_toolchains") +rules_proto_toolchains() `, Main: ` -- BUILD.bazel -- diff --git a/tests/core/transition/hermeticity_test.go b/tests/core/transition/hermeticity_test.go index b4194e37c..a121f9003 100644 --- a/tests/core/transition/hermeticity_test.go +++ b/tests/core/transition/hermeticity_test.go @@ -125,6 +125,52 @@ message Foo { bazel_dep(name = "protobuf", version = "21.7", repo_name = "com_google_protobuf") bazel_dep(name = "rules_proto", version = "6.0.0") bazel_dep(name = "toolchains_protoc", version = "0.2.4") +`, + WorkspacePrefix: ` +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") + +# The non-polyfill version of this is needed by rules_proto below. +http_archive( + name = "bazel_features", + sha256 = "d7787da289a7fb497352211ad200ec9f698822a9e0757a4976fd9f713ff372b3", + strip_prefix = "bazel_features-1.9.1", + url = "https://github.com/bazel-contrib/bazel_features/releases/download/v1.9.1/bazel_features-v1.9.1.tar.gz", +) + +load("@bazel_features//:deps.bzl", "bazel_features_deps") + +bazel_features_deps() +`, + WorkspaceSuffix: ` +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") + +http_archive( + name = "com_google_protobuf", + sha256 = "75be42bd736f4df6d702a0e4e4d30de9ee40eac024c4b845d17ae4cc831fe4ae", + strip_prefix = "protobuf-21.7", + # latest available in BCR, as of 2022-09-30 + urls = [ + "https://github.com/protocolbuffers/protobuf/archive/v21.7.tar.gz", + "https://mirror.bazel.build/github.com/protocolbuffers/protobuf/archive/v21.7.tar.gz", + ], +) + +load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") + +protobuf_deps() + +http_archive( + name = "rules_proto", + sha256 = "303e86e722a520f6f326a50b41cfc16b98fe6d1955ce46642a5b7a67c11c0f5d", + strip_prefix = "rules_proto-6.0.0", + url = "https://github.com/bazelbuild/rules_proto/releases/download/6.0.0/rules_proto-6.0.0.tar.gz", +) + +load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies") +rules_proto_dependencies() + +load("@rules_proto//proto:toolchains.bzl", "rules_proto_toolchains") +rules_proto_toolchains() `, }) }