Skip to content

Commit e28b6a9

Browse files
committed
Consume JaCoCo via jvm_import_external
1 parent fd9967a commit e28b6a9

File tree

2 files changed

+9
-20
lines changed

2 files changed

+9
-20
lines changed

MODULE.bazel

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -58,22 +58,17 @@ use_repo(maven, "maven")
5858
#
5959
# Get the matching bazel jacoco jars from https://github.com/bazelbuild/bazel/tree/master/third_party/java/jacoco
6060
#
61-
http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_file")
61+
jvm_import_external = use_repo_rule("@bazel_tools//tools/build_defs/repo:jvm.bzl", "jvm_import_external")
6262

63-
http_archive(
64-
name = "bazel_org_jacoco_core_jar",
65-
downloaded_file_path = "org.jacoco.core.jar",
66-
sha256 = "fcd188c688473fc8dcc0c6caaf355e7b389502243527c33b9597a3ec28791f47",
67-
urls = [
63+
jvm_import_external(
64+
name = "bazel_org_jacoco_core",
65+
rule_name = "java_import",
66+
artifact_sha256 = "fcd188c688473fc8dcc0c6caaf355e7b389502243527c33b9597a3ec28791f47",
67+
artifact_urls = [
6868
"https://github.com/bazelbuild/bazel/raw/ad8ea5aed2c97c4dbbe577fb69adbd51746f6a51/third_party/java/jacoco/org.jacoco.core-0.8.11.jar",
6969
],
70-
)
71-
72-
http_archive(
73-
name = "bazel_org_jacoco_core_srcjar",
74-
downloaded_file_path = "org.jacoco.core-sources.jar",
75-
sha256 = "6856d98a837c669f33284df0104130000b12eaf38f04374c6d753eb03c65d93a",
76-
urls = [
70+
srcjar_sha256 = "6856d98a837c669f33284df0104130000b12eaf38f04374c6d753eb03c65d93a",
71+
srcjar_urls = [
7772
"https://github.com/bazelbuild/bazel/raw/ad8ea5aed2c97c4dbbe577fb69adbd51746f6a51/third_party/java/jacoco/org.jacoco.core-0.8.11-sources.jar",
7873
],
7974
)

compiler/BUILD

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,6 @@ java_library(
1515

1616
# Bazel's BuildJar
1717

18-
java_import(
19-
name = "bazel_org_jacoco_core",
20-
jars = ["@bazel_org_jacoco_core_jar//file"],
21-
srcjar = "@bazel_org_jacoco_core_srcjar//file",
22-
)
23-
2418
java_library(
2519
name = "buildjar",
2620
srcs = glob(["src/main/buildjar/**/*.java"]),
@@ -41,7 +35,7 @@ java_library(
4135
"@maven//:org_ow2_asm_asm_util",
4236
],
4337
deps = [
44-
":bazel_org_jacoco_core",
38+
"@bazel_org_jacoco_core//jar",
4539
":ecj",
4640
":work_request_handlers",
4741
"//compiler/src/main/protobuf:deps_java_proto",

0 commit comments

Comments
 (0)