Skip to content

Commit 0bbf8c6

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 8115f88 commit 0bbf8c6

File tree

9 files changed

+23
-54
lines changed

9 files changed

+23
-54
lines changed

WORKSPACE

+16
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,22 @@ scalafmt_default_config()
8383

8484
scalafmt_repositories()
8585

86+
# needed for the cross repo proto test
87+
local_repository(
88+
name = "proto_cross_repo_boundary",
89+
path = "test/proto_cross_repo_boundary/repo",
90+
)
91+
92+
local_repository(
93+
name = "test_new_local_repo",
94+
path = "third_party/test/new_local_repo",
95+
)
96+
97+
local_repository(
98+
name = "example_external_workspace",
99+
path = "third_party/test/example_external_workspace",
100+
)
101+
86102
http_archive(
87103
name = "io_bazel_rules_go",
88104
sha256 = "6dc2da7ab4cf5d7bfc7c949776b1b7c733f05e56edc4bcd9022bb249d2e2a996",

scala/private/extensions/dev_deps.bzl

-40
Original file line numberDiff line numberDiff line change
@@ -2,22 +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("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
12-
13-
# Once we switch to Bazel 7, uncomment this `load` statement remove the
14-
# `native.` prefix from `local_repository` and `new_local_repository`.
15-
# Update //test/proto_cross_repo_boundary:repo.bzl in the same way.
16-
#load(
17-
# "@bazel_tools//tools/build_defs/repo:local.bzl",
18-
# "local_repository",
19-
# "new_local_repository",
20-
#)
218
load("@rules_java//java:repositories.bzl", "remote_jdk8_repos")
229

2310
_BUILD_TOOLS_RELEASE = "5.1.0"
@@ -28,13 +15,6 @@ def dev_deps_repositories(
2815
fetch_sources = False):
2916
"""Instantiates internal only repos for development and testing
3017
31-
Once we're using Bazel 7, uncomment the `load()` statement for `local.bzl`
32-
in this file and remove `native.` from the `native.{,new_}local_repository`
33-
calls.
34-
35-
Until then, `dev_deps_repositories()` must be called from `WORKSPACE` or
36-
`WORKSPACE.bzlmod`, as module extensions won't be able to use it.
37-
3818
Args:
3919
name: unused macro parameter to satisfy Buildifier lint rules
4020
maven_servers: servers to use when resolving Maven artifacts
@@ -50,26 +30,6 @@ def dev_deps_repositories(
5030
),
5131
)
5232

53-
# needed for the cross repo proto test
54-
proto_cross_repo_boundary_repository()
55-
56-
native.local_repository(
57-
name = "example_external_workspace",
58-
path = "third_party/test/example_external_workspace",
59-
)
60-
61-
native.new_local_repository(
62-
name = "test_new_local_repo",
63-
build_file_content = """
64-
filegroup(
65-
name = "data",
66-
srcs = glob(["**/*.txt"]),
67-
visibility = ["//visibility:public"],
68-
)
69-
""",
70-
path = "third_party/test/new_local_repo",
71-
)
72-
7333
# bazel's java_import_external has been altered in rules_scala to be a macro
7434
# based on jvm_import_external in order to allow for other jvm-language
7535
# imports (e.g. scala_import) the 3rd-party dependency below is using the

test/proto_cross_repo_boundary/repo.bzl

-14
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
6.5.0

test/proto_cross_repo_boundary/repo/WORKSPACE

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
6.5.0

third_party/test/new_local_repo/BUILD

+5
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)