From 09222fac7c8851d26e44e087a6beb4ce2ed5dc39 Mon Sep 17 00:00:00 2001 From: Googler Date: Thu, 14 Jun 2018 08:06:32 -0700 Subject: Introduces a BAZEL_JAVAC_OPTS environment variable to the bootstrap build with empty default value to keep the script behavior unchanged. javac is not given a large enough max heap on Raspberry Pi 3. This change but allows the user to override the setting. RELNOTES: The BAZEL_JAVAC_OPTS environment variable allows arguments, e.g., "-J-Xmx2g", may be passed to the javac compiler during bootstrap build. This is helpful if your system chooses too small of a max heap size for the Java compiler during the bootstrap build. PiperOrigin-RevId: 200557606 --- scripts/bootstrap/compile.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/bootstrap/compile.sh b/scripts/bootstrap/compile.sh index 1c22e03b49..b8e98cba5b 100755 --- a/scripts/bootstrap/compile.sh +++ b/scripts/bootstrap/compile.sh @@ -114,9 +114,14 @@ function java_compilation() { cat "$paramfile" >&2 fi + # Use BAZEL_JAVAC_OPTS to pass additional arguments to javac, e.g., + # export BAZEL_JAVAC_OPTS="-J-Xmx2g -J-Xms200m" + # Useful if your system chooses too small of a max heap for javac. + # We intentionally rely on shell word splitting to allow multiple + # additional arguments to be passed to javac. run "${JAVAC}" -classpath "${classpath}" -sourcepath "${sourcepath}" \ -d "${output}/classes" -source "$JAVA_VERSION" -target "$JAVA_VERSION" \ - -encoding UTF-8 "@${paramfile}" + -encoding UTF-8 ${BAZEL_JAVAC_OPTS} "@${paramfile}" log "Extracting helper classes for $name..." for f in ${library_jars} ; do -- cgit v1.2.3