Skip to content

Commit aa18181

Browse files
committed
Add test local_repository calls to WORKSPACE
Removes `native.{,new_}local_repository()` calls in macros in favor of `local_repository` calls from `WORKSPACE`. Part of bazel-contrib#1482. `native.{,new_}local_repository()` isn't available under Bzlmod, `@bazel_tools//tools/build_defs/repo:local.bzl` with the Starlarkified definitions isn't available under Bazel 6, and Bazel 8 compatibility work is imminent. Redefining the repositories in this way will be compatible with Bazel 6, 7, and 8, both under `WORKSPACE` and Bzlmod. (`MODULE.bazel` will use a combination of `bazel_dep()` and `local_path_override()`.)
1 parent c329176 commit aa18181

7 files changed

Lines changed: 21 additions & 46 deletions

File tree

WORKSPACE

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,22 @@ load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
7272

7373
protobuf_deps()
7474

75+
# needed for the cross repo proto test
76+
local_repository(
77+
name = "proto_cross_repo_boundary",
78+
path = "test/proto_cross_repo_boundary/repo",
79+
)
80+
81+
local_repository(
82+
name = "test_new_local_repo",
83+
path = "third_party/test/new_local_repo",
84+
)
85+
86+
local_repository(
87+
name = "example_external_workspace",
88+
path = "third_party/test/example_external_workspace",
89+
)
90+
7591
http_archive(
7692
name = "io_bazel_rules_go",
7793
sha256 = "6dc2da7ab4cf5d7bfc7c949776b1b7c733f05e56edc4bcd9022bb249d2e2a996",

scala/private/extensions/dev_deps.bzl

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,9 @@
22

33
load("//scala:scala_cross_version.bzl", "default_maven_server_urls")
44
load("//scala:scala_maven_import_external.bzl", "java_import_external")
5-
load(
6-
"//test/proto_cross_repo_boundary:repo.bzl",
7-
"proto_cross_repo_boundary_repository",
8-
)
95
load("//test/toolchains:jdk.bzl", "remote_jdk21_repositories")
106
load("//third_party/repositories:repositories.bzl", "repositories")
117
load("@rules_java//java:repositories.bzl", "remote_jdk8_repos")
12-
# Once we switch to Bazel 7, uncomment this `load` statement remove the
13-
# `native.` prefix from `local_repository` and `new_local_repository`.
14-
# Update //test/proto_cross_repo_boundary:repo.bzl in the same way.
15-
#load(
16-
# "@bazel_tools//tools/build_defs/repo:local.bzl",
17-
# "local_repository",
18-
# "new_local_repository",
19-
#)
208

219
def dev_deps_repositories(
2210
name = "unused_dev_deps_name",
@@ -66,26 +54,6 @@ def dev_deps_repositories(
6654
remote_jdk8_repos()
6755
remote_jdk21_repositories()
6856

69-
# needed for the cross repo proto test
70-
proto_cross_repo_boundary_repository()
71-
72-
native.local_repository(
73-
name = "example_external_workspace",
74-
path = "third_party/test/example_external_workspace",
75-
)
76-
77-
native.new_local_repository(
78-
name = "test_new_local_repo",
79-
build_file_content = """
80-
filegroup(
81-
name = "data",
82-
srcs = glob(["**/*.txt"]),
83-
visibility = ["//visibility:public"],
84-
)
85-
""",
86-
path = "third_party/test/new_local_repo",
87-
)
88-
8957
# bazel's java_import_external has been altered in rules_scala to be a macro
9058
# based on jvm_import_external in order to allow for other jvm-language
9159
# imports (e.g. scala_import) the 3rd-party dependency below is using the

test/proto_cross_repo_boundary/repo.bzl

Lines changed: 0 additions & 14 deletions
This file was deleted.
File renamed without changes.

test/proto_cross_repo_boundary/repo/WORKSPACE

Whitespace-only changes.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
filegroup(
2+
name = "data",
3+
srcs = glob(["**/*.txt"]),
4+
visibility = ["//visibility:public"],
5+
)

third_party/test/new_local_repo/WORKSPACE

Whitespace-only changes.

0 commit comments

Comments
 (0)