Skip to content

Commit d48529b

Browse files
committed
deploy: Verify that jazzer.jar is a valid Jazzer jar
Release v0.20.0 failed because the zip containing the Jazzer jar was passed in instead of the Jazzer jar itself.
1 parent abead07 commit d48529b

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

deploy/BUILD.bazel

+4
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ sh_binary(
2020
name = "deploy",
2121
srcs = ["deploy.sh"],
2222
args = [JAZZER_COORDINATES],
23+
data = ["@bazel_tools//tools/jdk:current_host_java_runtime"],
24+
env = {"JAVA_EXECPATH": "$(JAVA)"},
25+
toolchains = ["@bazel_tools//tools/jdk:current_host_java_runtime"],
26+
deps = ["@bazel_tools//tools/bash/runfiles"],
2327
)
2428

2529
java_export(

deploy/deploy.sh

+19-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env sh
1+
#!/usr/bin/env bash
22
# Copyright 2022 Code Intelligence GmbH
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -33,6 +33,24 @@ JAZZER_COORDINATES=$1
3333
[ ! -f "${JAZZER_JAR_PATH}" ] && \
3434
fail "JAZZER_JAR_PATH does not exist at '$JAZZER_JAR_PATH'"
3535

36+
# --- begin runfiles.bash initialization v3 ---
37+
# Copy-pasted from the Bazel Bash runfiles library v3.
38+
set -uo pipefail; set +e; f=bazel_tools/tools/bash/runfiles/runfiles.bash
39+
source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null || \
40+
source "$(grep -sm1 "^$f " "${RUNFILES_MANIFEST_FILE:-/dev/null}" | cut -f2- -d' ')" 2>/dev/null || \
41+
source "$0.runfiles/$f" 2>/dev/null || \
42+
source "$(grep -sm1 "^$f " "$0.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
43+
source "$(grep -sm1 "^$f " "$0.exe.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
44+
{ echo>&2 "ERROR: cannot find $f"; exit 1; }; f=; set -e
45+
# --- end runfiles.bash initialization v3 ---
46+
47+
# JAZZER_EXECPATH is a path of the form "external/remotejdk_17/bin/java". We need to strip of the
48+
# leading external to get a path we can pass to rlocation.
49+
java_rlocationpath=$(echo "$JAVA_EXECPATH" | cut -d/ -f2-)
50+
java=$(rlocation "$java_rlocationpath")
51+
"$java" -jar "${JAZZER_JAR_PATH}" --version 2>&1 | grep '^Jazzer v' || \
52+
fail "JAZZER_JAR_PATH is not a valid jazzer.jar"
53+
3654
MAVEN_REPO=https://oss.sonatype.org/service/local/staging/deploy/maven2
3755

3856
# The Jazzer jar itself bundles native libraries for multiple architectures and thus can't be built

0 commit comments

Comments
 (0)