Android: Update docs and install-build-deps-android.sh to require java8
We don't strictly require java8 yet, but will soon. BUG=662467 Review-Url: https://codereview.chromium.org/2666783004 Cr-Original-Commit-Position: refs/heads/master@{#455459} Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src Cr-Mirrored-Commit: 8638ef810c10cee09e467b2ecd678341e12fc892
This commit is contained in:
Родитель
5ace2f33c9
Коммит
b7b3669fbd
|
@ -1,4 +1,4 @@
|
|||
#!/bin/bash -e
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
|
@ -8,10 +8,6 @@
|
|||
# items requiring sudo privileges.
|
||||
# See https://www.chromium.org/developers/how-tos/android-build-instructions
|
||||
|
||||
# This script installs the sun-java6 packages (bin, jre and jdk). Sun requires
|
||||
# a license agreement, so upon installation it will prompt the user. To get
|
||||
# past the curses-based dialog press TAB <ret> TAB <ret> to agree.
|
||||
|
||||
args="$@"
|
||||
|
||||
if ! uname -m | egrep -q "i686|x86_64"; then
|
||||
|
@ -19,41 +15,18 @@ if ! uname -m | egrep -q "i686|x86_64"; then
|
|||
exit
|
||||
fi
|
||||
|
||||
lsb_release=$(lsb_release --codename --short)
|
||||
# Exit if any commands fail.
|
||||
set -e
|
||||
|
||||
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
|
||||
|
||||
# Install deps
|
||||
# This step differs depending on what Ubuntu release we are running
|
||||
# on since the package names are different, and Sun's Java must
|
||||
# be installed manually on late-model versions.
|
||||
|
||||
# common
|
||||
sudo apt-get -y install lib32z1 lighttpd python-pexpect xvfb x11-utils
|
||||
|
||||
|
@ -65,39 +38,45 @@ 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
|
||||
|
||||
# Required for apk-patch-size-estimator
|
||||
sudo apt-get -y install bsdiff
|
||||
|
||||
# Install openjdk and openjre stuff
|
||||
sudo apt-get -y install $java_pkgs
|
||||
# Do our own error handling for java.
|
||||
set +e
|
||||
|
||||
# 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
|
||||
function IsJava8() {
|
||||
# Arg is either "java" or "javac"
|
||||
$1 -version 2>&1 | grep -q '1\.8'
|
||||
}
|
||||
|
||||
if ! (IsJava8 java && IsJava8 javac); then
|
||||
sudo apt-get -y install openjdk-8-jre openjdk-8-jdk
|
||||
fi
|
||||
|
||||
# There can be several reasons why java8 is not default despite being installed.
|
||||
# Just show an error and exit.
|
||||
if ! (IsJava8 java && IsJava8 javac); then
|
||||
echo
|
||||
echo "Automatic java installation failed."
|
||||
echo '`java -version` reports:'
|
||||
java -version
|
||||
echo
|
||||
echo '`javac -version` reports:'
|
||||
javac -version
|
||||
echo
|
||||
echo "Please ensure that JDK 8 is installed and resolves first in your PATH."
|
||||
echo -n '`which java` reports: '
|
||||
which java
|
||||
echo -n '`which javac` reports: '
|
||||
which javac
|
||||
echo
|
||||
echo "You might also try running:"
|
||||
echo " sudo update-java-alternatives -s java-1.8.0-openjdk-amd64"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "install-build-deps-android.sh complete."
|
||||
|
|
Загрузка…
Ссылка в новой задаче