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

Side by Side Diff: build/install-build-deps-android.sh

Issue 2666783004: Android: Update docs to say Java 8 is required (Closed)
Patch Set: rebase Created 3 years, 9 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 unified diff | Download patch
« no previous file with comments | « no previous file | docs/android_build_instructions.md » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/bin/bash -e 1 #!/bin/bash
2 2
3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 # Script to install everything needed to build chromium on android, including 7 # Script to install everything needed to build chromium on android, including
8 # items requiring sudo privileges. 8 # items requiring sudo privileges.
9 # See https://www.chromium.org/developers/how-tos/android-build-instructions 9 # See https://www.chromium.org/developers/how-tos/android-build-instructions
10 10
11 # This script installs the sun-java6 packages (bin, jre and jdk). Sun requires
12 # a license agreement, so upon installation it will prompt the user. To get
13 # past the curses-based dialog press TAB <ret> TAB <ret> to agree.
14
15 args="$@" 11 args="$@"
16 12
17 if ! uname -m | egrep -q "i686|x86_64"; then 13 if ! uname -m | egrep -q "i686|x86_64"; then
18 echo "Only x86 architectures are currently supported" >&2 14 echo "Only x86 architectures are currently supported" >&2
19 exit 15 exit
20 fi 16 fi
21 17
18 # Exit if any commands fail.
19 set -e
20
22 lsb_release=$(lsb_release --codename --short) 21 lsb_release=$(lsb_release --codename --short)
23 22
24 case $lsb_release in
25 xenial|yakkety)
26 java_alternative="java-1.8.0-openjdk-amd64"
27 java_pkgs="openjdk-8-jre openjdk-8-jdk"
28 ;;
29 *)
30 java_alternative="java-1.7.0-openjdk-amd64"
31 java_pkgs="openjdk-7-jre openjdk-7-jdk"
32 ;;
33 esac
34
35 # Install first the default Linux build deps. 23 # Install first the default Linux build deps.
36 "$(dirname "${BASH_SOURCE[0]}")/install-build-deps.sh" \ 24 "$(dirname "${BASH_SOURCE[0]}")/install-build-deps.sh" \
37 --no-syms --lib32 --no-arm --no-chromeos-fonts --no-nacl --no-prompt "${args}" 25 --no-syms --lib32 --no-arm --no-chromeos-fonts --no-nacl --no-prompt "${args}"
38 26
39 # The temporary directory used to store output of update-java-alternatives
40 TEMPDIR=$(mktemp -d)
41 cleanup() {
42 local status=${?}
43 trap - EXIT
44 rm -rf "${TEMPDIR}"
45 exit ${status}
46 }
47 trap cleanup EXIT
48
49 # Fix deps 27 # Fix deps
50 sudo apt-get -f install 28 sudo apt-get -f install
51 29
52 # Install deps
53 # This step differs depending on what Ubuntu release we are running
54 # on since the package names are different, and Sun's Java must
55 # be installed manually on late-model versions.
56
57 # common 30 # common
58 sudo apt-get -y install lib32z1 lighttpd python-pexpect xvfb x11-utils 31 sudo apt-get -y install lib32z1 lighttpd python-pexpect xvfb x11-utils
59 32
60 # Some binaries in the Android SDK require 32-bit libraries on the host. 33 # Some binaries in the Android SDK require 32-bit libraries on the host.
61 # See https://developer.android.com/sdk/installing/index.html?pkg=tools 34 # See https://developer.android.com/sdk/installing/index.html?pkg=tools
62 if [[ $lsb_release == "precise" ]]; then 35 if [[ $lsb_release == "precise" ]]; then
63 sudo apt-get -y install ia32-libs 36 sudo apt-get -y install ia32-libs
64 else 37 else
65 sudo apt-get -y install libncurses5:i386 libstdc++6:i386 zlib1g:i386 38 sudo apt-get -y install libncurses5:i386 libstdc++6:i386 zlib1g:i386
66 fi 39 fi
67 40
41 # Required by //components/cronet/tools/generate_javadoc.py
42 # TODO(375324): Stop requiring ANT.
68 sudo apt-get -y install ant 43 sudo apt-get -y install ant
69 44
70 # Required for apk-patch-size-estimator 45 # Required for apk-patch-size-estimator
71 sudo apt-get -y install bsdiff 46 sudo apt-get -y install bsdiff
72 47
73 # Install openjdk and openjre stuff 48 # Do our own error handling for java.
74 sudo apt-get -y install $java_pkgs 49 set +e
75 50
76 # Switch version of Java to openjdk 7. 51 function IsJava8() {
77 # Some Java plugins (e.g. for firefox, mozilla) are not required to build, and 52 # Arg is either "java" or "javac"
78 # thus are treated only as warnings. Any errors in updating java alternatives 53 $1 -version 2>&1 | grep -q '1\.8'
79 # which are not '*-javaplugin.so' will cause errors and stop the script from 54 }
80 # completing successfully. 55
81 if ! sudo update-java-alternatives -s $java_alternative \ 56 if ! (IsJava8 java && IsJava8 javac); then
82 >& "${TEMPDIR}"/update-java-alternatives.out 57 sudo apt-get -y install openjdk-8-jre openjdk-8-jdk
friedman1 2017/03/14 20:29:01 You can't do this on Trusty... java8 doesn't exist
83 then 58 fi
84 # Check that there are the expected javaplugin.so errors for the update 59
85 if grep 'javaplugin.so' "${TEMPDIR}"/update-java-alternatives.out >& \ 60 # There can be several reasons why java8 is not default despite being installed.
86 /dev/null 61 # Just show an error and exit.
87 then 62 if ! (IsJava8 java && IsJava8 javac); then
88 # Print as warnings all the javaplugin.so errors 63 echo
89 echo 'WARNING: java-6-sun has no alternatives for the following plugins:' 64 echo "Automatic java installation failed."
90 grep 'javaplugin.so' "${TEMPDIR}"/update-java-alternatives.out 65 echo '`java -version` reports:'
91 fi 66 java -version
92 # Check if there are any errors that are not javaplugin.so 67 echo
93 if grep -v 'javaplugin.so' "${TEMPDIR}"/update-java-alternatives.out \ 68 echo '`javac -version` reports:'
94 >& /dev/null 69 javac -version
95 then 70 echo
96 # If there are non-javaplugin.so errors, treat as errors and exit 71 echo "Please ensure that JDK 8 is installed and resolves first in your PATH."
97 echo 'ERRORS: Failed to update alternatives for java-6-sun:' 72 echo -n '`which java` reports: '
98 grep -v 'javaplugin.so' "${TEMPDIR}"/update-java-alternatives.out 73 which java
99 exit 1 74 echo -n '`which javac` reports: '
100 fi 75 which javac
76 echo
77 echo "You might also try running:"
78 echo " sudo update-java-alternatives -s java-1.8.0-openjdk-amd64"
79 exit 1
101 fi 80 fi
102 81
103 echo "install-build-deps-android.sh complete." 82 echo "install-build-deps-android.sh complete."
OLDNEW
« no previous file with comments | « no previous file | docs/android_build_instructions.md » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698