Damien Martin-Guillerez | d47a8ef | 2015-06-10 11:54:50 +0000 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
Damien Martin-Guillerez | f88f4d8 | 2015-09-25 13:56:55 +0000 | [diff] [blame] | 3 | # Copyright 2015 The Bazel Authors. All rights reserved. |
Damien Martin-Guillerez | d47a8ef | 2015-06-10 11:54:50 +0000 | [diff] [blame] | 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | |
| 17 | # Script for building bazel from scratch without bazel |
| 18 | |
Klaus Aehlig | f009901 | 2016-09-28 12:13:17 +0000 | [diff] [blame] | 19 | PROTO_FILES=$(ls src/main/protobuf/*.proto src/main/java/com/google/devtools/build/lib/buildeventstream/proto/*.proto) |
Liam Miller-Cushon | acd0d0c | 2016-12-08 05:26:45 +0000 | [diff] [blame] | 20 | LIBRARY_JARS=$(find third_party -name '*.jar' | grep -Fv /javac-9-dev-r3297-1.jar | grep -Fv /javac7.jar | grep -Fv JavaBuilder | grep -ve third_party/grpc/grpc.*jar | tr "\n" " ") |
dapengzhang0 | 3abcec1 | 2016-07-22 20:54:44 +0000 | [diff] [blame] | 21 | GRPC_JAVA_VERSION=0.15.0 |
| 22 | GRPC_LIBRARY_JARS=$(find third_party/grpc -name '*.jar' | grep -e .*${GRPC_JAVA_VERSION}.*jar | tr "\n" " ") |
| 23 | LIBRARY_JARS="${LIBRARY_JARS} ${GRPC_LIBRARY_JARS}" |
Nathan Harmata | 8a47590 | 2016-11-23 19:08:12 +0000 | [diff] [blame] | 24 | |
| 25 | # tl;dr - error_prone_core contains a copy of an older version of guava, so we |
| 26 | # need to make sure the newer version of guava always appears first on the |
| 27 | # classpath. |
| 28 | # |
| 29 | # Please read the comment in third_party/BUILD for more details. |
| 30 | LIBRARY_JARS_ARRAY=($LIBRARY_JARS) |
| 31 | for i in $(seq 0 $((${#LIBRARY_JARS_ARRAY[@]} - 1))) |
| 32 | do |
Damien Martin-Guillerez | b46631b | 2017-01-20 13:27:26 +0000 | [diff] [blame] | 33 | [[ "${LIBRARY_JARS_ARRAY[$i]}" =~ ^"third_party/error_prone/error_prone_core-".*\.jar$ ]] && ERROR_PRONE_INDEX=$i |
| 34 | [[ "${LIBRARY_JARS_ARRAY[$i]}" =~ ^"third_party/guava/guava-".*\.jar$ ]] && GUAVA_INDEX=$i |
Nathan Harmata | 8a47590 | 2016-11-23 19:08:12 +0000 | [diff] [blame] | 35 | done |
| 36 | [ "${ERROR_PRONE_INDEX:+present}" = "present" ] || { echo "no error prone jar"; echo "${LIBRARY_JARS_ARRAY[@]}"; exit 1; } |
| 37 | [ "${GUAVA_INDEX:+present}" = "present" ] || { echo "no guava jar"; exit 1; } |
| 38 | if [ "$ERROR_PRONE_INDEX" -lt "$GUAVA_INDEX" ]; then |
| 39 | TEMP_FOR_SWAP="${LIBRARY_JARS_ARRAY[$ERROR_PRONE_INDEX]}" |
| 40 | LIBRARY_JARS_ARRAY[$ERROR_PRONE_INDEX]="${LIBRARY_JARS_ARRAY[$GUAVA_INDEX]}" |
| 41 | LIBRARY_JARS_ARRAY[$GUAVA_INDEX]="$TEMP_FOR_SWAP" |
| 42 | LIBRARY_JARS="${LIBRARY_JARS_ARRAY[@]}" |
| 43 | fi |
| 44 | |
Damien Martin-Guillerez | e700e72 | 2016-06-30 15:06:39 +0200 | [diff] [blame] | 45 | DIRS=$(echo src/{java_tools/singlejar/java/com/google/devtools/build/zip,main/java,tools/xcode-common/java/com/google/devtools/build/xcode/{common,util}} third_party/java/dd_plist/java ${OUTPUT_DIR}/src) |
Lukacs Berki | 8b3b918 | 2016-04-14 08:29:05 +0000 | [diff] [blame] | 46 | EXCLUDE_FILES=src/main/java/com/google/devtools/build/lib/server/GrpcServerImpl.java |
Damien Martin-Guillerez | d47a8ef | 2015-06-10 11:54:50 +0000 | [diff] [blame] | 47 | |
Alexander Chung | fc07142 | 2017-02-07 12:48:26 +0000 | [diff] [blame] | 48 | mkdir -p "${OUTPUT_DIR}/classes" |
| 49 | mkdir -p "${OUTPUT_DIR}/src" |
Damien Martin-Guillerez | d47a8ef | 2015-06-10 11:54:50 +0000 | [diff] [blame] | 50 | |
| 51 | # May be passed in from outside. |
Damien Martin-Guillerez | d47a8ef | 2015-06-10 11:54:50 +0000 | [diff] [blame] | 52 | ZIPOPTS="$ZIPOPTS" |
| 53 | |
Damien Martin-Guillerez | d47a8ef | 2015-06-10 11:54:50 +0000 | [diff] [blame] | 54 | unset JAVA_TOOL_OPTIONS |
| 55 | unset _JAVA_OPTIONS |
| 56 | |
| 57 | LDFLAGS=${LDFLAGS:-""} |
| 58 | |
Damien Martin-Guillerez | d47a8ef | 2015-06-10 11:54:50 +0000 | [diff] [blame] | 59 | MSYS_DLLS="" |
Damien Martin-Guillerez | d47a8ef | 2015-06-10 11:54:50 +0000 | [diff] [blame] | 60 | |
Damien Martin-Guillerez | d47a8ef | 2015-06-10 11:54:50 +0000 | [diff] [blame] | 61 | # Check that javac -version returns a upper version than $JAVA_VERSION. |
Damien Martin-Guillerez | 338dc56 | 2015-06-23 17:15:12 +0000 | [diff] [blame] | 62 | get_java_version |
| 63 | [ ${JAVA_VERSION#*.} -le ${JAVAC_VERSION#*.} ] || \ |
| 64 | fail "JDK version (${JAVAC_VERSION}) is lower than ${JAVA_VERSION}, please set \$JAVA_HOME." |
Damien Martin-Guillerez | d47a8ef | 2015-06-10 11:54:50 +0000 | [diff] [blame] | 65 | |
| 66 | JAR="${JAVA_HOME}/bin/jar" |
| 67 | |
| 68 | # Compiles java classes. |
| 69 | function java_compilation() { |
| 70 | local name=$1 |
| 71 | local directories=$2 |
Lukacs Berki | e21e592 | 2016-04-12 12:22:20 +0000 | [diff] [blame] | 72 | local excludes=$3 |
| 73 | local library_jars=$4 |
| 74 | local output=$5 |
Damien Martin-Guillerez | d47a8ef | 2015-06-10 11:54:50 +0000 | [diff] [blame] | 75 | |
Laszlo Csomor | 5402993 | 2016-12-19 15:43:31 +0000 | [diff] [blame] | 76 | local classpath=${library_jars// /$PATHSEP}${PATHSEP}$5 |
Damien Martin-Guillerez | d47a8ef | 2015-06-10 11:54:50 +0000 | [diff] [blame] | 77 | local sourcepath=${directories// /$PATHSEP} |
| 78 | |
| 79 | tempdir |
| 80 | local tmp="${NEW_TMPDIR}" |
| 81 | local paramfile="${tmp}/param" |
Lukacs Berki | e21e592 | 2016-04-12 12:22:20 +0000 | [diff] [blame] | 82 | local filelist="${tmp}/filelist" |
| 83 | local excludefile="${tmp}/excludefile" |
Damien Martin-Guillerez | d47a8ef | 2015-06-10 11:54:50 +0000 | [diff] [blame] | 84 | touch $paramfile |
| 85 | |
| 86 | mkdir -p "${output}/classes" |
| 87 | |
| 88 | # Compile .java files (incl. generated ones) using javac |
| 89 | log "Compiling $name code..." |
Lukacs Berki | e21e592 | 2016-04-12 12:22:20 +0000 | [diff] [blame] | 90 | find ${directories} -name "*.java" | sort > "$filelist" |
| 91 | # Quotes around $excludes intentionally omitted in the for statement so that |
| 92 | # it's split on spaces |
| 93 | (for i in $excludes; do |
| 94 | echo $i |
| 95 | done) | sort > "$excludefile" |
| 96 | |
| 97 | comm -23 "$filelist" "$excludefile" > "$paramfile" |
Damien Martin-Guillerez | d47a8ef | 2015-06-10 11:54:50 +0000 | [diff] [blame] | 98 | |
| 99 | if [ ! -z "$BAZEL_DEBUG_JAVA_COMPILATION" ]; then |
| 100 | echo "directories=${directories}" >&2 |
| 101 | echo "classpath=${classpath}" >&2 |
| 102 | echo "sourcepath=${sourcepath}" >&2 |
| 103 | echo "libraries=${library_jars}" >&2 |
| 104 | echo "output=${output}/classes" >&2 |
| 105 | echo "List of compiled files:" >&2 |
| 106 | cat "$paramfile" >&2 |
| 107 | fi |
| 108 | |
Julio Merino | 5909d9d | 2016-02-25 21:44:31 +0000 | [diff] [blame] | 109 | run "${JAVAC}" -classpath "${classpath}" -sourcepath "${sourcepath}" \ |
Damien Martin-Guillerez | d47a8ef | 2015-06-10 11:54:50 +0000 | [diff] [blame] | 110 | -d "${output}/classes" -source "$JAVA_VERSION" -target "$JAVA_VERSION" \ |
Damien Martin-Guillerez | 45d18d4 | 2015-09-21 11:45:10 +0000 | [diff] [blame] | 111 | -encoding UTF-8 "@${paramfile}" |
Damien Martin-Guillerez | d47a8ef | 2015-06-10 11:54:50 +0000 | [diff] [blame] | 112 | |
| 113 | log "Extracting helper classes for $name..." |
| 114 | for f in ${library_jars} ; do |
Julio Merino | 5909d9d | 2016-02-25 21:44:31 +0000 | [diff] [blame] | 115 | run unzip -qn ${f} -d "${output}/classes" |
Damien Martin-Guillerez | d47a8ef | 2015-06-10 11:54:50 +0000 | [diff] [blame] | 116 | done |
| 117 | } |
| 118 | |
| 119 | # Create the deploy JAR |
| 120 | function create_deploy_jar() { |
| 121 | local name=$1 |
| 122 | local mainClass=$2 |
| 123 | local output=$3 |
| 124 | shift 3 |
| 125 | local packages="" |
| 126 | for i in $output/classes/*; do |
| 127 | local package=$(basename $i) |
| 128 | if [[ "$package" != "META-INF" ]]; then |
| 129 | packages="$packages -C $output/classes $package" |
| 130 | fi |
| 131 | done |
| 132 | |
| 133 | log "Creating $name.jar..." |
| 134 | echo "Main-Class: $mainClass" > $output/MANIFEST.MF |
Julio Merino | 5909d9d | 2016-02-25 21:44:31 +0000 | [diff] [blame] | 135 | run "$JAR" cmf $output/MANIFEST.MF $output/$name.jar $packages "$@" |
Damien Martin-Guillerez | d47a8ef | 2015-06-10 11:54:50 +0000 | [diff] [blame] | 136 | } |
| 137 | |
Klaus Aehlig | 967a0a3 | 2016-12-02 15:08:25 +0000 | [diff] [blame] | 138 | HOW_TO_BOOTSTRAP=' |
| 139 | |
| 140 | -------------------------------------------------------------------------------- |
| 141 | NOTE: This failure is likely occuring if you are trying to bootstrap bazel from |
| 142 | a developer checkout. Those checkouts do not include the generated output of |
| 143 | the protoc compiler (as we prefer not to version generated files). |
| 144 | |
| 145 | * To build a developer version of bazel, do |
| 146 | |
| 147 | bazel build //src:bazel |
| 148 | |
| 149 | * To bootstrap your first bazel binary, please download a dist archive from our |
| 150 | release page at https://github.com/bazelbuild/bazel/releases and run |
| 151 | compile.sh on the unpacked archive. |
| 152 | |
| 153 | The full install instructions to install a release version of bazel can be found |
| 154 | at https://bazel.build/versions/master/docs/install.html#compiling-from-source |
| 155 | For a rationale, why the bootstrap process is organized in this way, see |
| 156 | https://bazel.build/designs/2016/10/11/distribution-artifact.html |
| 157 | -------------------------------------------------------------------------------- |
| 158 | |
| 159 | ' |
| 160 | |
Damien Martin-Guillerez | d47a8ef | 2015-06-10 11:54:50 +0000 | [diff] [blame] | 161 | if [ -z "${BAZEL_SKIP_JAVA_COMPILATION}" ]; then |
Klaus Aehlig | d700dff5 | 2016-11-23 16:53:22 +0000 | [diff] [blame] | 162 | |
| 163 | if [ -d derived/src/java ] |
| 164 | then |
| 165 | log "Using pre-generated java proto files" |
| 166 | mkdir -p "${OUTPUT_DIR}/src" |
| 167 | cp -r derived/src/java/* "${OUTPUT_DIR}/src" |
| 168 | else |
| 169 | |
| 170 | [ -n "${PROTOC}" ] \ |
Klaus Aehlig | 967a0a3 | 2016-12-02 15:08:25 +0000 | [diff] [blame] | 171 | || fail "Must specify PROTOC if not bootstrapping from the distribution artifact${HOW_TO_BOOTSTRAP}" |
Klaus Aehlig | d700dff5 | 2016-11-23 16:53:22 +0000 | [diff] [blame] | 172 | |
| 173 | [ -n "${GRPC_JAVA_PLUGIN}" ] \ |
Klaus Aehlig | 967a0a3 | 2016-12-02 15:08:25 +0000 | [diff] [blame] | 174 | || fail "Must specify GRPC_JAVA_PLUGIN if not bootstrapping from the distribution artifact${HOW_TO_BOOTSTRAP}" |
Klaus Aehlig | d700dff5 | 2016-11-23 16:53:22 +0000 | [diff] [blame] | 175 | |
| 176 | [[ -x "${PROTOC-}" ]] \ |
| 177 | || fail "Protobuf compiler not found in ${PROTOC-}" |
| 178 | |
| 179 | [[ -x "${GRPC_JAVA_PLUGIN-}" ]] \ |
| 180 | || fail "gRPC Java plugin not found in ${GRPC_JAVA_PLUGIN-}" |
| 181 | |
| 182 | log "Compiling Java stubs for protocol buffers..." |
| 183 | for f in $PROTO_FILES ; do |
| 184 | run "${PROTOC}" -Isrc/main/protobuf/ \ |
| 185 | -Isrc/main/java/com/google/devtools/build/lib/buildeventstream/proto/ \ |
| 186 | --java_out=${OUTPUT_DIR}/src \ |
| 187 | --plugin=protoc-gen-grpc="${GRPC_JAVA_PLUGIN-}" \ |
| 188 | --grpc_out=${OUTPUT_DIR}/src "$f" |
| 189 | done |
| 190 | fi |
Damien Martin-Guillerez | d47a8ef | 2015-06-10 11:54:50 +0000 | [diff] [blame] | 191 | |
Lukacs Berki | e21e592 | 2016-04-12 12:22:20 +0000 | [diff] [blame] | 192 | java_compilation "Bazel Java" "$DIRS" "$EXCLUDE_FILES" "$LIBRARY_JARS" "${OUTPUT_DIR}" |
Damien Martin-Guillerez | d47a8ef | 2015-06-10 11:54:50 +0000 | [diff] [blame] | 193 | |
| 194 | # help files: all non java and BUILD files in src/main/java. |
| 195 | for i in $(find src/main/java -type f -a \! -name '*.java' -a \! -name 'BUILD' | sed 's|src/main/java/||'); do |
| 196 | mkdir -p $(dirname ${OUTPUT_DIR}/classes/$i) |
| 197 | cp src/main/java/$i ${OUTPUT_DIR}/classes/$i |
| 198 | done |
| 199 | |
Damien Martin-Guillerez | 12c68aa | 2016-01-15 13:18:11 +0000 | [diff] [blame] | 200 | # Overwrite tools.WORKSPACE, this is only for the bootstrap binary |
Klaus Aehlig | 286cfdd | 2016-10-17 16:47:55 +0000 | [diff] [blame] | 201 | chmod u+w "${OUTPUT_DIR}/classes/com/google/devtools/build/lib/bazel/rules/tools.WORKSPACE" |
Damien Martin-Guillerez | be5b2eb | 2016-03-02 16:08:07 +0000 | [diff] [blame] | 202 | cat <<EOF >${OUTPUT_DIR}/classes/com/google/devtools/build/lib/bazel/rules/tools.WORKSPACE |
| 203 | local_repository(name = 'bazel_tools', path = __workspace_dir__) |
| 204 | bind(name = "cc_toolchain", actual = "@bazel_tools//tools/cpp:default-toolchain") |
| 205 | EOF |
Damien Martin-Guillerez | 12c68aa | 2016-01-15 13:18:11 +0000 | [diff] [blame] | 206 | |
Damien Martin-Guillerez | d47a8ef | 2015-06-10 11:54:50 +0000 | [diff] [blame] | 207 | create_deploy_jar "libblaze" "com.google.devtools.build.lib.bazel.BazelMain" \ |
Han-Wen Nienhuys | a4b6182 | 2015-11-09 13:55:44 +0000 | [diff] [blame] | 208 | ${OUTPUT_DIR} |
Damien Martin-Guillerez | d47a8ef | 2015-06-10 11:54:50 +0000 | [diff] [blame] | 209 | fi |
| 210 | |
Damien Martin-Guillerez | daffc35 | 2016-01-18 15:20:32 +0000 | [diff] [blame] | 211 | log "Creating Bazel install base..." |
| 212 | ARCHIVE_DIR=${OUTPUT_DIR}/archive |
| 213 | mkdir -p ${ARCHIVE_DIR}/_embedded_binaries |
Damien Martin-Guillerez | d47a8ef | 2015-06-10 11:54:50 +0000 | [diff] [blame] | 214 | |
Damien Martin-Guillerez | dceee0e | 2016-01-18 11:57:26 +0000 | [diff] [blame] | 215 | # Dummy build-runfiles |
Damien Martin-Guillerez | daffc35 | 2016-01-18 15:20:32 +0000 | [diff] [blame] | 216 | cat <<'EOF' >${ARCHIVE_DIR}/_embedded_binaries/build-runfiles${EXE_EXT} |
Klaus Aehlig | 6992e68 | 2016-08-05 12:27:21 +0000 | [diff] [blame] | 217 | #!/bin/sh |
Lukacs Berki | 25f3569 | 2016-08-04 10:38:36 +0000 | [diff] [blame] | 218 | mkdir -p $2 |
Damien Martin-Guillerez | dceee0e | 2016-01-18 11:57:26 +0000 | [diff] [blame] | 219 | cp $1 $2/MANIFEST |
| 220 | EOF |
Damien Martin-Guillerez | daffc35 | 2016-01-18 15:20:32 +0000 | [diff] [blame] | 221 | chmod 0755 ${ARCHIVE_DIR}/_embedded_binaries/build-runfiles${EXE_EXT} |
Damien Martin-Guillerez | d47a8ef | 2015-06-10 11:54:50 +0000 | [diff] [blame] | 222 | |
Damien Martin-Guillerez | 8c04e9e | 2016-01-18 12:53:39 +0000 | [diff] [blame] | 223 | log "Creating process-wrapper..." |
Damien Martin-Guillerez | daffc35 | 2016-01-18 15:20:32 +0000 | [diff] [blame] | 224 | cat <<'EOF' >${ARCHIVE_DIR}/_embedded_binaries/process-wrapper${EXE_EXT} |
Klaus Aehlig | 6dbcc2d | 2016-05-11 12:46:42 +0000 | [diff] [blame] | 225 | #!/bin/sh |
Damien Martin-Guillerez | ec758db | 2016-01-18 12:14:28 +0000 | [diff] [blame] | 226 | # Dummy process wrapper, does not support timeout |
| 227 | shift 2 |
Dmitry Lomov | 9bf3f6a | 2016-07-07 13:50:06 +0000 | [diff] [blame] | 228 | stdout="$1" |
| 229 | stderr="$2" |
| 230 | shift 2 |
| 231 | |
| 232 | if [ "$stdout" = "-" ] |
| 233 | then |
| 234 | if [ "$stderr" = "-" ] |
| 235 | then |
| 236 | "$@" |
| 237 | exit $? |
| 238 | else |
| 239 | "$@" 2>"$stderr" |
| 240 | exit $? |
| 241 | fi |
| 242 | else |
| 243 | if [ "$stderr" = "-" ] |
| 244 | then |
| 245 | "$@" >"$stdout" |
| 246 | exit $? |
| 247 | else |
| 248 | "$@" 2>"$stderr" >"$stdout" |
| 249 | exit $? |
| 250 | fi |
| 251 | fi |
| 252 | |
Klaus Aehlig | b297341 | 2016-03-16 13:55:40 +0000 | [diff] [blame] | 253 | |
| 254 | "$@" |
Damien Martin-Guillerez | ec758db | 2016-01-18 12:14:28 +0000 | [diff] [blame] | 255 | exit $? |
| 256 | EOF |
Damien Martin-Guillerez | daffc35 | 2016-01-18 15:20:32 +0000 | [diff] [blame] | 257 | chmod 0755 ${ARCHIVE_DIR}/_embedded_binaries/process-wrapper${EXE_EXT} |
Philipp Wollermann | 43c4a1a | 2015-08-25 12:52:57 +0000 | [diff] [blame] | 258 | |
Laszlo Csomor | d40c78a | 2016-12-20 10:22:17 +0000 | [diff] [blame] | 259 | function build_jni() { |
| 260 | local -r output_dir=$1 |
| 261 | |
| 262 | case "${PLATFORM}" in |
| 263 | msys*|mingw*) |
| 264 | # We need JNI on Windows because some filesystem operations are not (and |
| 265 | # cannot be) implemented in native Java. |
| 266 | log "Building Windows JNI library..." |
| 267 | |
| 268 | local -r jni_lib_name="windows_jni.dll" |
| 269 | local -r output="${output_dir}/${jni_lib_name}" |
| 270 | local -r tmp_output="${NEW_TMPDIR}/jni/${jni_lib_name}" |
| 271 | mkdir -p "$(dirname "$tmp_output")" |
| 272 | mkdir -p "$(dirname "$output")" |
| 273 | |
| 274 | # Keep this `find` command in sync with the `srcs` of |
| 275 | # //src/main/native:windows_jni |
| 276 | local srcs=$(find src/main/native \ |
| 277 | -name 'windows_*.cc' -o -name 'windows_*.h') |
| 278 | [ -n "$srcs" ] || fail "Could not find sources for Windows JNI library" |
| 279 | |
| 280 | # do not quote $srcs because we need to expand it to multiple args |
| 281 | src/main/native/build_windows_jni.sh "$tmp_output" ${srcs} |
| 282 | |
| 283 | cp "$tmp_output" "$output" |
| 284 | chmod 0555 "$output" |
| 285 | |
| 286 | JNI_FLAGS="-Dio.bazel.EnableJni=1 -Djava.library.path=${output_dir}" |
| 287 | ;; |
| 288 | |
| 289 | *) |
| 290 | # We don't need JNI on other platforms. |
| 291 | JNI_FLAGS="-Dio.bazel.EnableJni=0" |
| 292 | ;; |
| 293 | esac |
| 294 | } |
| 295 | |
| 296 | build_jni "${ARCHIVE_DIR}/_embedded_binaries" |
| 297 | |
Damien Martin-Guillerez | daffc35 | 2016-01-18 15:20:32 +0000 | [diff] [blame] | 298 | cp src/main/tools/build_interface_so ${ARCHIVE_DIR}/_embedded_binaries/build_interface_so |
| 299 | cp src/main/tools/jdk.BUILD ${ARCHIVE_DIR}/_embedded_binaries/jdk.BUILD |
| 300 | cp $OUTPUT_DIR/libblaze.jar ${ARCHIVE_DIR} |
Chris Parsons | 381850e | 2016-08-31 17:04:17 +0000 | [diff] [blame] | 301 | |
| 302 | # TODO(b/28965185): Remove when xcode-locator is no longer required in embedded_binaries. |
| 303 | log "Compiling xcode-locator..." |
| 304 | if [[ $PLATFORM == "darwin" ]]; then |
| 305 | run /usr/bin/xcrun clang -fobjc-arc -framework CoreServices -framework Foundation -o ${ARCHIVE_DIR}/_embedded_binaries/xcode-locator tools/osx/xcode_locator.m |
| 306 | else |
| 307 | cp tools/osx/xcode_locator_stub.sh ${ARCHIVE_DIR}/_embedded_binaries/xcode-locator |
| 308 | fi |
Chris Parsons | f488818 | 2016-01-08 00:42:14 +0000 | [diff] [blame] | 309 | |
Laszlo Csomor | 9f7180f | 2016-09-27 13:07:43 +0000 | [diff] [blame] | 310 | function run_bazel_jar() { |
| 311 | local command=$1 |
| 312 | shift |
Dmitry Lomov | f9f2e10 | 2016-01-29 14:26:46 +0000 | [diff] [blame] | 313 | "${JAVA_HOME}/bin/java" \ |
Philipp Wollermann | 74cb8c7 | 2016-07-15 14:01:37 +0000 | [diff] [blame] | 314 | -XX:+HeapDumpOnOutOfMemoryError -Xverify:none -Dfile.encoding=ISO-8859-1 \ |
Carmi Grushko | 4068a1d | 2016-06-22 18:43:13 +0000 | [diff] [blame] | 315 | -XX:HeapDumpPath=${OUTPUT_DIR} \ |
Damien Martin-Guillerez | daffc35 | 2016-01-18 15:20:32 +0000 | [diff] [blame] | 316 | -Djava.util.logging.config.file=${OUTPUT_DIR}/javalog.properties \ |
Laszlo Csomor | d40c78a | 2016-12-20 10:22:17 +0000 | [diff] [blame] | 317 | ${JNI_FLAGS} \ |
Damien Martin-Guillerez | daffc35 | 2016-01-18 15:20:32 +0000 | [diff] [blame] | 318 | -jar ${ARCHIVE_DIR}/libblaze.jar \ |
| 319 | --batch \ |
| 320 | --install_base=${ARCHIVE_DIR} \ |
| 321 | --output_base=${OUTPUT_DIR}/out \ |
| 322 | --install_md5= \ |
| 323 | --workspace_directory=${PWD} \ |
Kristina Chodorow | 4873e56 | 2016-06-20 14:17:50 +0000 | [diff] [blame] | 324 | --nofatal_event_bus_exceptions \ |
Klaus Aehlig | 276a8cd | 2016-07-11 12:06:07 +0000 | [diff] [blame] | 325 | ${BAZEL_DIR_STARTUP_OPTIONS} \ |
Laszlo Csomor | 50f6bba | 2016-09-26 14:10:25 +0000 | [diff] [blame] | 326 | ${BAZEL_BOOTSTRAP_STARTUP_OPTIONS:-} \ |
Laszlo Csomor | 9f7180f | 2016-09-27 13:07:43 +0000 | [diff] [blame] | 327 | $command \ |
Damien Martin-Guillerez | 51a204a | 2016-02-08 14:59:59 +0000 | [diff] [blame] | 328 | --ignore_unsupported_sandboxing \ |
Damien Martin-Guillerez | daffc35 | 2016-01-18 15:20:32 +0000 | [diff] [blame] | 329 | --startup_time=329 --extract_data_time=523 \ |
Klaus Aehlig | 7038d3f | 2016-03-16 15:41:22 +0000 | [diff] [blame] | 330 | --rc_source=/dev/null --isatty=1 \ |
Damien Martin-Guillerez | daffc35 | 2016-01-18 15:20:32 +0000 | [diff] [blame] | 331 | --ignore_client_env \ |
| 332 | --client_cwd=${PWD} \ |
Damien Martin-Guillerez | daffc35 | 2016-01-18 15:20:32 +0000 | [diff] [blame] | 333 | "${@}" |
| 334 | } |