Skip to content

Commit 6c06fde

Browse files
authored
Use same jacoco_core that bazel 6.4.0 uses (#20)
1 parent b266b03 commit 6c06fde

File tree

2 files changed

+28
-8
lines changed

2 files changed

+28
-8
lines changed

WORKSPACE

+20-7
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ workspace(name = "rules_jdt")
22

33
# --------------------------------------------------------------------------
44
# Load http_archive
5-
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
5+
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file")
66

77
# Load Bazel Skylib
88
http_archive(
@@ -117,12 +117,25 @@ jvm_maven_import_external(
117117
server_urls = _DEFAULT_REPOSITORIES,
118118
)
119119

120-
jvm_maven_import_external(
121-
name = "rules_jdt_jacoco_core",
122-
artifact = "org.jacoco:org.jacoco.core:0.8.7",
123-
artifact_sha256 = "ad7739b5fb5969aa1a8aead3d74ed54dc82ed012f1f10f336bd1b96e71c1a13c",
124-
licenses = ["notice"],
125-
server_urls = _DEFAULT_REPOSITORIES,
120+
# here we need to use the same jacoco version/jars that bazel adds to the runtime classpath
121+
# if the jars are out of sync this error will be reported: NoClassDefFoundError: org/jacoco/agent/rt/internal_{commit-hash}/Offline
122+
# get the latest bazel jacoco jars from https://github.com/bazelbuild/bazel/tree/master/third_party/java/jacoco
123+
http_file(
124+
name = "bazel_org_jacoco_core_jar",
125+
downloaded_file_path = "org.jacoco.core-0.8.9-SNAPSHOT.jar",
126+
urls = [
127+
"https://github.com/bazelbuild/bazel/raw/master/third_party/java/jacoco/org.jacoco.core-0.8.9-SNAPSHOT.jar"
128+
],
129+
sha256 = "434d2b652afbf48904172d3f078ed126220997f247d66d5ed93a8f5f107783b3",
130+
)
131+
132+
http_file(
133+
name = "bazel_org_jacoco_core_srcjar",
134+
downloaded_file_path = "org.jacoco.core-0.8.9-SNAPSHOT-sources.jar",
135+
urls = [
136+
"https://github.com/bazelbuild/bazel/raw/master/third_party/java/jacoco/org.jacoco.core-0.8.9-SNAPSHOT-sources.jar"
137+
],
138+
sha256 = "0d40cf9f67cc790727554d5474f8e2a9262aa2c99c6bada2defa97644eacf01d",
126139
)
127140

128141
jvm_maven_import_external(

compiler/BUILD

+8-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ java_library(
1313
)
1414

1515
# Bazel's BuildJar
16+
17+
java_import(
18+
name = "bazel_org_jacoco_core",
19+
jars = ["@bazel_org_jacoco_core_jar//file"],
20+
srcjar = "@bazel_org_jacoco_core_srcjar//file",
21+
)
22+
1623
java_library(
1724
name = "buildjar",
1825
srcs = glob(["src/main/buildjar/**/*.java"]),
@@ -33,6 +40,7 @@ java_library(
3340
"@rules_jdt_org_ow2_asm_asm_util",
3441
],
3542
deps = [
43+
":bazel_org_jacoco_core",
3644
":ecj",
3745
":work_request_handlers",
3846
"//compiler/src/main/protobuf:deps_java_proto",
@@ -42,7 +50,6 @@ java_library(
4250
"@com_google_protobuf//:protobuf_java",
4351
"@rules_jdt_caffeine",
4452
"@rules_jdt_guava",
45-
"@rules_jdt_jacoco_core",
4653
"@rules_jdt_jsr305",
4754
],
4855
)

0 commit comments

Comments
 (0)