Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1064)

Unified Diff: build/install-build-deps-android.sh

Issue 2666783004: Android: Update docs to say Java 8 is required (Closed)
Patch Set: Android: Update docs and install-build-deps-android.sh to require java8 Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | docs/android_build_instructions.md » ('j') | docs/android_build_instructions.md » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/install-build-deps-android.sh
diff --git a/build/install-build-deps-android.sh b/build/install-build-deps-android.sh
index 37f4244b90d801e72bc34d674db77eda6597d8f5..f623be36ebee30e2c9adf5123beae69c49f984d0 100755
--- a/build/install-build-deps-android.sh
+++ b/build/install-build-deps-android.sh
@@ -19,33 +19,17 @@ if ! uname -m | egrep -q "i686|x86_64"; then
exit
fi
-lsb_release=$(lsb_release --codename --short)
+function IsJava8() {
+ # Arg is either java or javac
+ $1 -version 2>&1 | grep '1\.8' > /dev/null
jbudorick 2017/01/31 21:51:35 grep -q ?
agrieve 2017/02/01 02:39:20 Done.
+}
-case $lsb_release in
- xenial|yakkety)
- java_alternative="java-1.8.0-openjdk-amd64"
- java_pkgs="openjdk-8-jre openjdk-8-jdk"
- ;;
- *)
- java_alternative="java-1.7.0-openjdk-amd64"
- java_pkgs="openjdk-7-jre openjdk-7-jdk"
- ;;
-esac
+lsb_release=$(lsb_release --codename --short)
# Install first the default Linux build deps.
"$(dirname "${BASH_SOURCE[0]}")/install-build-deps.sh" \
--no-syms --lib32 --no-arm --no-chromeos-fonts --no-nacl --no-prompt "${args}"
-# The temporary directory used to store output of update-java-alternatives
-TEMPDIR=$(mktemp -d)
-cleanup() {
- local status=${?}
- trap - EXIT
- rm -rf "${TEMPDIR}"
- exit ${status}
-}
-trap cleanup EXIT
-
# Fix deps
sudo apt-get -f install
@@ -65,36 +49,23 @@ else
sudo apt-get -y install libncurses5:i386 libstdc++6:i386 zlib1g:i386
fi
+# Required by //components/cronet/tools/generate_javadoc.py
+# TODO(375324): Stop requiring ANT.
sudo apt-get -y install ant
-# Install openjdk and openjre stuff
-sudo apt-get -y install $java_pkgs
-
-# Switch version of Java to openjdk 7.
-# Some Java plugins (e.g. for firefox, mozilla) are not required to build, and
-# thus are treated only as warnings. Any errors in updating java alternatives
-# which are not '*-javaplugin.so' will cause errors and stop the script from
-# completing successfully.
-if ! sudo update-java-alternatives -s $java_alternative \
- >& "${TEMPDIR}"/update-java-alternatives.out
-then
- # Check that there are the expected javaplugin.so errors for the update
- if grep 'javaplugin.so' "${TEMPDIR}"/update-java-alternatives.out >& \
- /dev/null
- then
- # Print as warnings all the javaplugin.so errors
- echo 'WARNING: java-6-sun has no alternatives for the following plugins:'
- grep 'javaplugin.so' "${TEMPDIR}"/update-java-alternatives.out
- fi
- # Check if there are any errors that are not javaplugin.so
- if grep -v 'javaplugin.so' "${TEMPDIR}"/update-java-alternatives.out \
- >& /dev/null
- then
- # If there are non-javaplugin.so errors, treat as errors and exit
- echo 'ERRORS: Failed to update alternatives for java-6-sun:'
- grep -v 'javaplugin.so' "${TEMPDIR}"/update-java-alternatives.out
- exit 1
- fi
+if ! (IsJava8 java && IsJava8 javac); then
+ sudo apt-get -y install openjdk-8-jre openjdk-8-jdk
jbudorick 2017/01/31 21:51:34 This will just fail on 14.04 or earlier.
agrieve 2017/02/01 02:39:21 Expanded the error message. This also made me rea
+fi
+
+# Assume java8 still not reporting being there means update-java-alternatives
jbudorick 2017/01/31 21:51:35 Doing this before any of the bots switch & when su
agrieve 2017/02/01 02:39:21 Folded into an error message. Given that this isn'
jbudorick 2017/02/01 16:30:39 It isn't run on the bots, but I'd prefer that we u
+# needs to be run.
+if ! IsJava8 javac; then
+ sudo update-java-alternatives -s java-1.8.0-openjdk-amd64
fi
+if ! IsJava8 javac; then
+ echo "Failed to install javac 1.8. javac -version reports:"
+ javac -version
+ exit 1
+fi
echo "install-build-deps-android.sh complete."
« no previous file with comments | « no previous file | docs/android_build_instructions.md » ('j') | docs/android_build_instructions.md » ('J')

Powered by Google App Engine
This is Rietveld 408576698