1#!/bin/bash -eux 2# Copyright 2021 Google LLC 3# 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at 7# 8# http://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15# 16################################################################################ 17 18# Install OpenJDK 15 and trim its size by removing unused components. 19cd /tmp 20curl -L -O https://download.java.net/java/GA/jdk15.0.2/0d1cfde4252546c6931946de8db48ee2/7/GPL/openjdk-15.0.2_linux-x64_bin.tar.gz && \ 21mkdir -p $JAVA_HOME 22tar -xzv --strip-components=1 -f openjdk-15.0.2_linux-x64_bin.tar.gz --directory $JAVA_HOME && \ 23rm -f openjdk-15.0.2_linux-x64_bin.tar.gz 24rm -rf $JAVA_HOME/jmods $JAVA_HOME/lib/src.zip 25 26# Install the latest Jazzer in $OUT. 27# jazzer_api_deploy.jar is required only at build-time, the agent and the 28# drivers are copied to $OUT as they need to be present on the runners. 29cd $SRC/ 30git clone --depth=1 https://github.com/CodeIntelligenceTesting/jazzer && \ 31cd jazzer 32bazel build --java_runtime_version=localjdk_15 -c opt --cxxopt="-stdlib=libc++" --linkopt=-lc++ \ 33 //agent:jazzer_agent_deploy.jar //driver:jazzer_driver //driver:jazzer_driver_asan //driver:jazzer_driver_ubsan //agent:jazzer_api_deploy.jar 34cp bazel-bin/agent/jazzer_agent_deploy.jar bazel-bin/driver/jazzer_driver bazel-bin/driver/jazzer_driver_asan bazel-bin/driver/jazzer_driver_ubsan /usr/local/bin/ 35cp bazel-bin/agent/jazzer_api_deploy.jar $JAZZER_API_PATH 36rm -rf ~/.cache/bazel ~/.cache/bazelisk 37rm -rf $SRC/jazzer 38