Requires JDK 8
This change deprecate JDK 7 as JavaBuilder follow changes in Java 9
and might use Java 8 features. We will maintain a build with the
JDK 7 as long as possible but this build won't include updates
in JavaBuilder.
RELNOTES[INC]: Bazel requires JDK 8 to run.
--
MOS_MIGRATED_REVID=103069207
diff --git a/scripts/bootstrap/buildenv.sh b/scripts/bootstrap/buildenv.sh
index 5731507..02d97a2 100755
--- a/scripts/bootstrap/buildenv.sh
+++ b/scripts/bootstrap/buildenv.sh
@@ -21,7 +21,7 @@
DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
WORKSPACE_DIR="$(dirname $(dirname ${DIR}))"
-JAVA_VERSION=${JAVA_VERSION:-1.7}
+JAVA_VERSION=${JAVA_VERSION:-1.8}
BAZELRC=${BAZELRC:-"/dev/null"}
PLATFORM="$(uname -s | tr 'A-Z' 'a-z')"
diff --git a/scripts/ci/build.sh b/scripts/ci/build.sh
index 8e766d5..4711287 100755
--- a/scripts/ci/build.sh
+++ b/scripts/ci/build.sh
@@ -97,6 +97,23 @@
fi
fi
}
+
+# Set the various arguments when JDK 7 is required (deprecated).
+# This method is here to continue to build binary release of Bazel
+# for JDK 7. We will drop this method and JDK 7 support when our
+# ci system turn red on this one.
+function setup_jdk7() {
+ # This is a JDK 7 JavaBuilder from release 0.1.0.
+ local javabuilder_url="https://storage.googleapis.com/bazel/0.1.0/JavaBuilder_deploy.jar"
+ sed -i.bak 's/_version = "8"/_version = "7"/' tools/jdk/BUILD
+ rm -f tools/jdk/BUILD.bak
+ curl -s -o tools/jdk/JavaBuilder_deploy.jar "${javabuilder_url}"
+ export BAZEL_ARGS="--singlejar_top=//src/java_tools/singlejar:bootstrap_deploy.jar \
+ --genclass_top=//src/java_tools/buildjar:bootstrap_genclass_deploy.jar \
+ --ijar_top=//third_party/ijar"
+ export BAZEL_SKIP_TOOL_COMPILATION=tools/jdk/JavaBuilder_deploy.jar
+}
+
# Main entry point for building bazel.
# It sets the embed label to the release name if any, calls the whole
# test suite, compile the various packages, then copy the artifacts
@@ -104,10 +121,17 @@
function bazel_build() {
local release_label="$(get_full_release_name)"
local embed_label_opts=
- setup_android_repositories
+
if [ -n "${release_label}" ]; then
export EMBED_LABEL="${release_label}"
fi
+
+ if [[ "${JAVA_VERSION-}" =~ ^(1\.)?7$ ]]; then
+ setup_jdk7
+ release_label="${release_label}-jdk7"
+ fi
+
+ setup_android_repositories
${BUILD_SCRIPT_PATH} ${BAZEL_COMPILE_TARGET:-all} || exit $?
# Build the packages
diff --git a/site/contributing.md b/site/contributing.md
index 214b007..b32a4a3 100644
--- a/site/contributing.md
+++ b/site/contributing.md
@@ -49,8 +49,6 @@
## Setting up your coding environment
-_Note that some of our tests target Java 8 so you must test using a JDK 8._
-
For now we have partial support for the Eclipse and IntelliJ IDEs for Java. We
don't have IDE support for other languages in Bazel right now.
diff --git a/site/docs/install.md b/site/docs/install.md
index 2ded214..5652ed8 100644
--- a/site/docs/install.md
+++ b/site/docs/install.md
@@ -13,16 +13,28 @@
Java:
-* Java JDK 7 or later
+* Java JDK 8 or later ([JDK 7](#jdk7) is still supported
+ but deprecated).
## Install dependencies
### Ubuntu
-#### 1. Install OpenJDK 7
+#### 1. Install JDK 8
+
+**Ubuntu Trusty (14.04 LTS).** OpenJDK 8 is not available on Trusty. To
+install Oracle JDK 8:
```
-$ sudo apt-get install openjdk-7-jdk openjdk-7-source
+$ sudo add-apt-repository ppa:webupd8team/java
+$ sudo apt-get update
+$ sudo apt-get install oracle-java8-installer
+```
+
+**Ubuntu Utopic (14.10).** To install OpenJDK 8:
+
+```
+$ sudo apt-get install openjdk-8-jdk openjdk-8-source
```
#### 2. Install required packages
@@ -33,10 +45,10 @@
### Mac OS X
-#### 1. Install JDK 7
+#### 1. Install JDK 8
-JDK 7 can be downloaded from
-[Oracle's JDK Page](http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html).
+JDK 8 can be downloaded from
+[Oracle's JDK Page](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html).
Look for "Mac OS X x64" under "Java SE Development Kit". This will download a
DMG image with an install wizard.
@@ -86,6 +98,14 @@
You can also add this command to your `~/.bashrc` file.
+## <a name="jdk7"></a>Using Bazel with JDK 7 (deprecated)
+
+Bazel version _0.1.0_ runs without any change with JDK 7. However, future
+version will stop supporting JDK 7 when our CI cannot build for it anymore.
+The installer for JDK 7 for Bazel versions after _0.1.0_ is labeled
+`./install-<em>version</em>-<em>os</em>-<b>jdk7</b>.sh`. If you wish to use JDK
+7, follow the same steps as for JDK 8 but with the _jdk7_ installer.
+
### Getting bash completion
Bazel comes with a bash completion script. To install it:
diff --git a/src/BUILD b/src/BUILD
index 3d672ad..a07be09 100644
--- a/src/BUILD
+++ b/src/BUILD
@@ -52,7 +52,7 @@
VERSION_LINE=$$(cat $< | grep target_version);
JAVA_VERSION=$$(echo $${VERSION_LINE} | sed -E 's/.*value="([^"])".*/\\1/');
if [ -z "$${JAVA_VERSION}" ]; then
- echo "1.7" >$@ # Java 7 is the default
+ echo "1.8" >$@ # Java 8 is the default
elif [[ "$${JAVA_VERSION}" =~ ^[0-9]+$$ ]]; then
echo "1.$${JAVA_VERSION}" >$@ # Add 1. before 7 or 8
else
diff --git a/tools/jdk/BUILD b/tools/jdk/BUILD
index 2ee3d68..3326081 100644
--- a/tools/jdk/BUILD
+++ b/tools/jdk/BUILD
@@ -90,8 +90,8 @@
name = "toolchain",
encoding = "UTF-8",
jvm_opts = ["-client"],
- source_version = "7",
- target_version = "7",
+ source_version = "8",
+ target_version = "8",
)
exports_files([