-
Notifications
You must be signed in to change notification settings - Fork 278
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extract
dev_deps_repositories()
from WORKSPACE and remove `//privat…
…e` (#1656) * Extract dev_deps_repositories() from WORKSPACE `dev_deps_repositories()` encapsulates the instantiation of repositories used only for `rules_scala` development. Also removes the unused `//private` package and its `WORKSPACE` statements. Part of #1482. Both `WORKSPACE` and Bzlmod builds can use this macro, though how Bzlmod will use it will depend on whether we continue building with Bazel 6. `@bazel_tools//tools/build_defs/repo:local.bzl` isn't available under Bazel 6. To continue building with Bazel 6 under Bzlmod, we will need to call `dev_deps_repositories()` from `WORKSPACE.bzlmod` to continue using `native.{,new_}local_repository()`. If we switch to Bazel 7, we can load `local.bzl` and strip the `native.` prefix from the `{,new_}local_repository()` calls. Then we can call `dev_deps_repositories()` from a module extension instead of from `WORKSPACE.bzlmod`. Another alternative would be updating the local repositories to become proper nested repositories. Then we can call `local_repository()` from `WORKSPACE` and call `bazel_dep()` and `local_path_override()` from `MODULE.bazel`. In that case, we'd remove the `{,new_}local_repository` calls from `dev_deps_dependencies()`, and remove `proto_cross_repo_boundary_repository()` entirely. * 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 #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()`.)
- Loading branch information
Showing
11 changed files
with
103 additions
and
165 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
"""Repositories for testing rules_scala itself""" | ||
|
||
load("//scala:scala_cross_version.bzl", "default_maven_server_urls") | ||
load("//scala:scala_maven_import_external.bzl", "java_import_external") | ||
load("//test/toolchains:jdk.bzl", "remote_jdk21_repositories") | ||
load("//third_party/repositories:repositories.bzl", "repositories") | ||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") | ||
load("@rules_java//java:repositories.bzl", "remote_jdk8_repos") | ||
|
||
_BUILD_TOOLS_RELEASE = "5.1.0" | ||
|
||
def dev_deps_repositories( | ||
name = "unused_dev_deps_name", | ||
maven_servers = default_maven_server_urls(), | ||
fetch_sources = False): | ||
"""Instantiates internal only repos for development and testing | ||
Args: | ||
name: unused macro parameter to satisfy Buildifier lint rules | ||
maven_servers: servers to use when resolving Maven artifacts | ||
fetch_sources: retrieve Maven artifact sources when True | ||
""" | ||
http_archive( | ||
name = "com_github_bazelbuild_buildtools", | ||
sha256 = "e3bb0dc8b0274ea1aca75f1f8c0c835adbe589708ea89bf698069d0790701ea3", | ||
strip_prefix = "buildtools-%s" % _BUILD_TOOLS_RELEASE, | ||
url = ( | ||
"https://github.com/bazelbuild/buildtools/archive/%s.tar.gz" % | ||
_BUILD_TOOLS_RELEASE | ||
), | ||
) | ||
|
||
# bazel's java_import_external has been altered in rules_scala to be a macro | ||
# based on jvm_import_external in order to allow for other jvm-language | ||
# imports (e.g. scala_import) the 3rd-party dependency below is using the | ||
# java_import_external macro in order to make sure no regression with the | ||
# original java_import_external | ||
java_import_external( | ||
name = "org_apache_commons_commons_lang_3_5_without_file", | ||
generated_linkable_rule_name = "linkable_org_apache_commons_commons_lang_3_5_without_file", | ||
jar_sha256 = "8ac96fc686512d777fca85e144f196cd7cfe0c0aec23127229497d1a38ff651c", | ||
jar_urls = ["https://repo.maven.apache.org/maven2/org/apache/commons/commons-lang3/3.5/commons-lang3-3.5.jar"], | ||
licenses = ["notice"], # Apache 2.0 | ||
neverlink = True, | ||
testonly_ = True, | ||
) | ||
|
||
# We need to select based on platform when we use these | ||
# https://github.com/bazelbuild/bazel/issues/11655 | ||
remote_jdk8_repos() | ||
|
||
repositories( | ||
fetch_sources = fetch_sources, | ||
for_artifact_ids = [ | ||
# test adding a scala jar: | ||
"com_twitter__scalding_date", | ||
# test of strict deps (scalac plugin UT + E2E) | ||
"com_google_guava_guava_21_0_with_file", | ||
"com_github_jnr_jffi_native", | ||
"org_apache_commons_commons_lang_3_5", | ||
"com_google_guava_guava_21_0", | ||
# test of import external | ||
# scala maven import external decodes maven artifacts to its parts | ||
# (group id, artifact id, packaging, version and classifier). To make sure | ||
# the decoding and then the download url composition are working the artifact example | ||
# must contain all the different parts and sha256s so the downloaded content will be | ||
# validated against it | ||
"org_springframework_spring_core", | ||
"org_springframework_spring_tx", | ||
"org_typelevel_kind_projector", | ||
# For testing that we don't include sources jars to the classpath | ||
"org_typelevel__cats_core", | ||
], | ||
maven_servers = maven_servers, | ||
) | ||
|
||
remote_jdk21_repositories() |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
6.5.0 |
File renamed without changes.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
6.5.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
filegroup( | ||
name = "data", | ||
srcs = glob(["**/*.txt"]), | ||
visibility = ["//visibility:public"], | ||
) |
Empty file.