Skip to content

Commit

Permalink
deploy: Verify that jazzer.jar is a valid Jazzer jar
Browse files Browse the repository at this point in the history
Release v0.20.0 failed because the zip containing the Jazzer jar was
passed in instead of the Jazzer jar itself.
  • Loading branch information
fmeum committed Aug 31, 2023
1 parent d23bea7 commit 4ee7d7a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
4 changes: 4 additions & 0 deletions deploy/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ sh_binary(
name = "deploy",
srcs = ["deploy.sh"],
args = [JAZZER_COORDINATES],
data = ["@bazel_tools//tools/jdk:current_host_java_runtime"],
env = {"JAVA_EXECPATH": "$(JAVA)"},
toolchains = ["@bazel_tools//tools/jdk:current_host_java_runtime"],
deps = ["@bazel_tools//tools/bash/runfiles"],
)

java_export(
Expand Down
20 changes: 19 additions & 1 deletion deploy/deploy.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env sh
#!/usr/bin/env bash
# Copyright 2022 Code Intelligence GmbH
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -33,6 +33,24 @@ JAZZER_COORDINATES=$1
[ ! -f "${JAZZER_JAR_PATH}" ] && \
fail "JAZZER_JAR_PATH does not exist at '$JAZZER_JAR_PATH'"

# --- begin runfiles.bash initialization v3 ---
# Copy-pasted from the Bazel Bash runfiles library v3.
set -uo pipefail; set +e; f=bazel_tools/tools/bash/runfiles/runfiles.bash
source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null || \
source "$(grep -sm1 "^$f " "${RUNFILES_MANIFEST_FILE:-/dev/null}" | cut -f2- -d' ')" 2>/dev/null || \
source "$0.runfiles/$f" 2>/dev/null || \
source "$(grep -sm1 "^$f " "$0.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
source "$(grep -sm1 "^$f " "$0.exe.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
{ echo>&2 "ERROR: cannot find $f"; exit 1; }; f=; set -e
# --- end runfiles.bash initialization v3 ---

# JAZZER_EXECPATH is a path of the form "external/remotejdk_17/bin/java". We need to strip of the
# leading external to get a path we can pass to rlocation.
java_rlocationpath=$(echo "$JAVA_EXECPATH" | cut -d/ -f2-)
java=$(rlocation "$java_rlocationpath")
"$java" -jar "${JAZZER_JAR_PATH}" --version 2>&1 | grep '^Jazzer v' || \
fail "JAZZER_JAR_PATH is not a valid jazzer.jar"

MAVEN_REPO=https://oss.sonatype.org/service/local/staging/deploy/maven2

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

0 comments on commit 4ee7d7a

Please sign in to comment.