Skip to content

Commit 134315e

Browse files
committed
chore: use zipper to list jar file content
Java tools are tricky to find in a sh_test with bazel 8.
1 parent c365a0b commit 134315e

File tree

6 files changed

+24
-26
lines changed

6 files changed

+24
-26
lines changed

deploy/BUILD.bazel

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -144,21 +144,18 @@ sh_test(
144144
srcs = [artifact + "_artifact_test.sh"],
145145
args = [
146146
"$(rootpath :%s)" % artifact,
147-
"$(JAVABASE)",
147+
"$(location @bazel_tools//tools/zip:zipper)",
148148
],
149149
data = [
150150
":" + artifact,
151-
"@bazel_tools//tools/jdk:current_java_runtime",
151+
"@bazel_tools//tools/zip:zipper",
152152
],
153153
tags = [
154154
# Coverage instrumentation necessarily adds files to the jar that we
155155
# wouldn't want to release and thus causes this test to fail.
156156
"no-coverage",
157157
],
158158
target_compatible_with = SKIP_ON_WINDOWS,
159-
toolchains = [
160-
"@bazel_tools//tools/jdk:current_java_runtime",
161-
],
162159
)
163160
for artifact in [
164161
"jazzer-api",

deploy/jazzer-api_artifact_test.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env sh
1+
#!/usr/bin/env bash
22
#
33
# Copyright 2024 Code Intelligence GmbH
44
#
@@ -16,12 +16,13 @@
1616
#
1717

1818
[ -f "$1" ] || exit 1
19-
JAR="$2/bin/jar"
20-
[ -e "$JAR" ] || exit 1
19+
ZIPPER="$2"
20+
[[ -x "$ZIPPER" ]] || exit 1
21+
2122
# List all files in the jar and exclude an allowed list of files.
2223
# Since grep fails if there is no match, ! ... | grep ... fails if there is a
2324
# match.
24-
! "$JAR" tf "$1" | \
25+
! "$ZIPPER" v "$1" | awk '{print $3}' | \
2526
grep -v \
2627
-e '^com/$' \
2728
-e '^com/code_intelligence/$' \

deploy/jazzer-junit_artifact_test.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env sh
1+
#!/usr/bin/env bash
22
#
33
# Copyright 2024 Code Intelligence GmbH
44
#
@@ -16,12 +16,13 @@
1616
#
1717

1818
[ -f "$1" ] || exit 1
19-
JAR="$2/bin/jar"
20-
[ -e "$JAR" ] || exit 1
19+
ZIPPER="$2"
20+
[[ -x "$ZIPPER" ]] || exit 1
21+
2122
# List all files in the jar and exclude an allowed list of files.
2223
# Since grep fails if there is no match, ! ... | grep ... fails if there is a
2324
# match.
24-
! "$JAR" tf "$1" | \
25+
! "$ZIPPER" v "$1" | awk '{print $3}' | \
2526
grep -v \
2627
-e '^com/$' \
2728
-e '^com/code_intelligence/$' \

deploy/jazzer_artifact_test.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env sh
1+
#!/usr/bin/env bash
22
#
33
# Copyright 2024 Code Intelligence GmbH
44
#
@@ -16,12 +16,13 @@
1616
#
1717

1818
[ -f "$1" ] || exit 1
19-
JAR="$2/bin/jar"
20-
[ -e "$JAR" ] || exit 1
19+
ZIPPER="$2"
20+
[[ -x "$ZIPPER" ]] || exit 1
21+
2122
# List all files in the jar and exclude an allowed list of files.
2223
# Since grep fails if there is no match, ! ... | grep ... fails if there is a
2324
# match.
24-
! "$JAR" tf "$1" | \
25+
! "$ZIPPER" v "$1" | awk '{print $3}' | \
2526
grep -v \
2627
-e '^com/$' \
2728
-e '^com/code_intelligence/$' \

src/main/java/com/code_intelligence/jazzer/runtime/BUILD.bazel

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,21 +65,18 @@ sh_test(
6565
srcs = ["verify_shading.sh"],
6666
args = [
6767
"$(rootpath jazzer_bootstrap.jar)",
68-
"$(JAVABASE)",
68+
"$(location @bazel_tools//tools/zip:zipper)",
6969
],
7070
data = [
7171
"jazzer_bootstrap.jar",
72-
"@bazel_tools//tools/jdk:current_java_runtime",
72+
"@bazel_tools//tools/zip:zipper",
7373
],
7474
tags = [
7575
# Coverage instrumentation necessarily adds files to the jar that we
7676
# wouldn't want to release and thus causes this test to fail.
7777
"no-coverage",
7878
],
7979
target_compatible_with = SKIP_ON_WINDOWS,
80-
toolchains = [
81-
"@bazel_tools//tools/jdk:current_java_runtime",
82-
],
8380
)
8481

8582
# At runtime, the AgentInstaller appends jazzer_bootstrap.jar to the bootstrap

src/main/java/com/code_intelligence/jazzer/runtime/verify_shading.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env sh
1+
#!/usr/bin/env bash
22
#
33
# Copyright 2024 Code Intelligence GmbH
44
#
@@ -16,12 +16,13 @@
1616
#
1717

1818
[ -f "$1" ] || exit 1
19-
JAR="$2/bin/jar"
20-
[ -e "$JAR" ] || exit 1
19+
ZIPPER="$2"
20+
[[ -x "$ZIPPER" ]] || exit 1
21+
2122
# List all files in the jar and exclude an allowed list of files.
2223
# Since grep fails if there is no match, ! ... | grep ... fails if there is a
2324
# match.
24-
! "$JAR" tf "$1" | \
25+
! "$ZIPPER" v "$1" | awk '{print $3}' | \
2526
grep -v \
2627
-e '^com/$' \
2728
-e '^com/code_intelligence/$' \

0 commit comments

Comments
 (0)