summaryrefslogtreecommitdiffstats
path: root/envsetup.sh
diff options
context:
space:
mode:
authorNeil Fuller <nfuller@google.com>2015-11-19 15:51:47 +0000
committerMichael Bestas <mikeioannina@cyanogenmod.org>2016-09-30 17:06:07 +0300
commitba31c2695aa7c81a930059976f2dacffb84f1cb0 (patch)
tree07357104d1f633d19c782b14dc87b49c4ed35696 /envsetup.sh
parent9f360cd1250cf36633efd4fc88ddf4b5fdbdc4a6 (diff)
downloadbuild-ba31c2695aa7c81a930059976f2dacffb84f1cb0.zip
build-ba31c2695aa7c81a930059976f2dacffb84f1cb0.tar.gz
build-ba31c2695aa7c81a930059976f2dacffb84f1cb0.tar.bz2
Use sensible default locations for Java
Use sensible default locations for Java based on the EXPERIMENTAL_USE_JAVA8 flag. Bug: 25786468 Change-Id: I7ec035b5329785efc41b3f971d5e3ae202293576
Diffstat (limited to 'envsetup.sh')
-rw-r--r--envsetup.sh33
1 files changed, 20 insertions, 13 deletions
diff --git a/envsetup.sh b/envsetup.sh
index c93db03..3efd683 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -2384,11 +2384,7 @@ function fixup_common_out_dir() {
fi
}
-# Force JAVA_HOME to point to java 1.7 if it isn't already set.
-#
-# Note that the MacOS path for java 1.7 includes a minor revision number (sigh).
-# For some reason, installing the JDK doesn't make it show up in the
-# JavaVM.framework/Versions/1.7/ folder.
+# Force JAVA_HOME to point to java 1.7/1.8 if it isn't already set.
function set_java_home() {
# Clear the existing JAVA_HOME value if we set it ourselves, so that
# we can reset it later, depending on the version of java the build
@@ -2401,14 +2397,25 @@ function set_java_home() {
fi
if [ ! "$JAVA_HOME" ]; then
- case `uname -s` in
- Darwin)
- export JAVA_HOME=$(/usr/libexec/java_home -v 1.7)
- ;;
- *)
- export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
- ;;
- esac
+ if [ ! "$EXPERIMENTAL_USE_JAVA8" ]; then
+ case `uname -s` in
+ Darwin)
+ export JAVA_HOME=$(/usr/libexec/java_home -v 1.7)
+ ;;
+ *)
+ export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
+ ;;
+ esac
+ else
+ case `uname -s` in
+ Darwin)
+ export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)
+ ;;
+ *)
+ export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
+ ;;
+ esac
+ fi
# Keep track of the fact that we set JAVA_HOME ourselves, so that
# we can change it on the next envsetup.sh, if required.