Skip to content

Commit

Permalink
Remove Bazel 5.0.0 coverage workarounds
Browse files Browse the repository at this point in the history
  • Loading branch information
fmeum committed Apr 27, 2024
1 parent 9ca5b03 commit 393c2c6
Show file tree
Hide file tree
Showing 11 changed files with 9 additions and 501 deletions.
10 changes: 4 additions & 6 deletions .github/workflows/run-tests-externally.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,17 @@ jobs:
strategy:
fail-fast: false
matrix:
bazel: [5.0.0, latest, last_green]
bazel: [6.0.0, 7.x, last_green]
bazel_mode: [workspace, module]
os: [ubuntu-latest, macos-13, macos-latest, windows-2019]
jdk: [8, 11, 17, 21]
exclude:
- bazel: 5.0.0
- bazel: 6.0.0
jdk: 11
- bazel: 5.0.0
- bazel: 6.0.0
jdk: 17
- bazel: 5.0.0
- bazel: 6.0.0
jdk: 21
- bazel: 5.0.0
bazel_mode: module
- bazel: last_green
jdk: 8
- bazel: last_green
Expand Down
24 changes: 1 addition & 23 deletions jni/internal/cc_jni_library.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

load(":coverage.bzl", "cc_jni_coverage_helper_library", "java_jni_coverage_helper_library")
load(":jni_headers.bzl", "jni_headers")
load(":os_cpu_utils.bzl", "SELECT_TARGET_CPU", "SELECT_TARGET_OS")
load(":transitions.bzl", "multi_platform_transition")
Expand Down Expand Up @@ -188,26 +187,9 @@ def cc_jni_library(
# Arguments to be set on all targets.
testonly = cc_binary_args.pop("testonly", default = None)

java_coverage_helper_name = "%s_java_coverage_helper" % name
java_jni_coverage_helper_library(
name = java_coverage_helper_name,
library_name = basename,
)

cc_coverage_helper_name = "%s_cc_coverage_helper" % name
cc_jni_coverage_helper_library(
name = cc_coverage_helper_name,
library_name = basename,
)

# Simple concatenation is compatible with select, append is not.
cc_binary_args.setdefault("deps", [])
cc_binary_args["deps"] += [
Label("//jni"),
] + select({
str(Label("//jni/internal:collect_coverage")): [":" + cc_coverage_helper_name],
"//conditions:default": [],
})
cc_binary_args["deps"] += [Label("//jni")]

native.cc_binary(
name = macos_library_name,
Expand Down Expand Up @@ -267,10 +249,6 @@ def cc_jni_library(
name = name,
resources = [":" + multi_platform_artifact_name],
resource_strip_prefix = _maven_resource_prefix_if_present(),
runtime_deps = select({
str(Label("//jni/internal:collect_coverage")): [":" + java_coverage_helper_name],
"//conditions:default": [],
}),
tags = tags,
testonly = testonly,
visibility = visibility,
Expand Down
124 changes: 0 additions & 124 deletions jni/internal/coverage.bzl

This file was deleted.

4 changes: 0 additions & 4 deletions jni/internal/templates/BUILD.bazel

This file was deleted.

33 changes: 0 additions & 33 deletions jni/internal/templates/native_library_coverage.tmpl.c

This file was deleted.

20 changes: 0 additions & 20 deletions jni/internal/templates/native_library_coverage.tmpl.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,4 @@ java_library(
"RulesJni.java",
],
visibility = ["//jni/tools/native_loader:__pkg__"],
deps = select({
"//jni/internal:collect_coverage": [":coverage_helper"],
"//conditions:default": [":noop_coverage_helper"],
}) + [
"//jni/tools/native_loader/src/main/java/com/github/fmeum/rules_jni:native_library_info",
],
)

java_library(
name = "coverage_helper",
srcs = [
"CoverageHelper.java",
],
resource_strip_prefix = "external",
resources = [
"@bazel_tools//tools/test:collect_cc_coverage.sh",
],
deps = [
":native_library_info",
],
)

java_library(
name = "noop_coverage_helper",
srcs = [
"NoopCoverageHelper.java",
],
deps = [
":native_library_info",
],
)

java_library(
name = "native_library_info",
srcs = ["NativeLibraryInfo.java"],
)
Loading

0 comments on commit 393c2c6

Please sign in to comment.