Skip to content

Commit

Permalink
Add some missing dependencies to the built-in module bazel_tools
Browse files Browse the repository at this point in the history
This includes `@remote_coverage_tools` (used by `@bazel_tools//tools/test`) and various Java-related repos provided by `@rules_java` (used by `@bazel_tools//tools/jdk`).

Fixes #15478.

PiperOrigin-RevId: 449458403
  • Loading branch information
Wyverald authored and copybara-github committed May 18, 2022
1 parent a54a1a7 commit ee3637c
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 1 deletion.
13 changes: 13 additions & 0 deletions src/MODULE.tools
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,18 @@ bazel_dep(name = "protobuf", version = "3.19.0", repo_name = "com_google_protobu
cc_configure = use_extension("@rules_cc//bzlmod:extensions.bzl", "cc_configure")
use_repo(cc_configure, "local_config_cc", "local_config_xcode")

java_toolchains = use_extension("@rules_java//java:extensions.bzl", "toolchains")
use_repo(
java_toolchains,
"local_jdk",
"remote_java_tools",
"remote_java_tools_linux",
"remote_java_tools_windows",
"remote_java_tools_darwin",
)

sh_configure_extension = use_extension("//tools/sh:sh_configure.bzl", "sh_configure_extension")
use_repo(sh_configure_extension, "local_config_sh")

remote_coverage_tools_extension = use_extension("//tools/test:extensions.bzl", "remote_coverage_tools_extension")
use_repo(remote_coverage_tools_extension, "remote_coverage_tools")
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ genrule(
# 1. bazel build tools/test/CoverageOutputGenerator/java/com/google/devtools/coverageoutputgenerator:coverage_output_generator_zip
# 2. Copy and rename the zip file with a new version locally.
# 3. Upload the file under https://mirror.bazel.build/bazel_coverage_output_generator/releases.
# 4. Update //distdir_deps.bzl to point to the new release.
# 4. Update //distdir_deps.bzl and //tools/test/extensions.bzl to point to the new release.
gen_workspace_stanza(
name = "workspace_with_coverage_output_generator",
out = "coverage.WORKSPACE",
Expand Down
1 change: 1 addition & 0 deletions tools/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ filegroup(
"//tools/osx:bzl_srcs",
"//tools/python:bzl_srcs",
"//tools/sh:bzl_srcs",
"//tools/test:bzl_srcs",
"//tools/windows:bzl_srcs",
],
)
Expand Down
6 changes: 6 additions & 0 deletions tools/test/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ filegroup(
"generate-xml.sh",
"collect_coverage.sh",
"collect_cc_coverage.sh",
"extensions.bzl",
] + select({
"@bazel_tools//src/conditions:windows": [
"tw",
Expand All @@ -126,3 +127,8 @@ filegroup(
}),
visibility = ["//tools:__pkg__"],
)

filegroup(
name = "bzl_srcs",
srcs = ["extensions.bzl"],
)
5 changes: 5 additions & 0 deletions tools/test/BUILD.tools
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,8 @@ filegroup(
"//conditions:default": ["dummy.sh"],
}),
)

filegroup(
name = "bzl_srcs",
srcs = ["extensions.bzl"],
)
30 changes: 30 additions & 0 deletions tools/test/extensions.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright 2022 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""A module extension to bring in the remote coverage tools under
@remote_coverage_tools."""

load("//tools/build_defs/repo:http.bzl", "http_archive")

def _remote_coverage_tools_extension_impl(ctx):
http_archive(
name = "remote_coverage_tools",
sha256 = "7006375f6756819b7013ca875eab70a541cf7d89142d9c511ed78ea4fefa38af",
urls = [
"https://mirror.bazel.build/bazel_coverage_output_generator/releases/coverage_output_generator-v2.6.zip",
],
)

remote_coverage_tools_extension = module_extension(
implementation = _remote_coverage_tools_extension_impl,
)

0 comments on commit ee3637c

Please sign in to comment.