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

Side by Side 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, 10 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') | docs/android_build_instructions.md » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/bin/bash -e 1 #!/bin/bash -e
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 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 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. 13 # past the curses-based dialog press TAB <ret> TAB <ret> to agree.
14 14
15 args="$@" 15 args="$@"
16 16
17 if ! uname -m | egrep -q "i686|x86_64"; then 17 if ! uname -m | egrep -q "i686|x86_64"; then
18 echo "Only x86 architectures are currently supported" >&2 18 echo "Only x86 architectures are currently supported" >&2
19 exit 19 exit
20 fi 20 fi
21 21
22 function IsJava8() {
23 # Arg is either java or javac
24 $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.
25 }
26
22 lsb_release=$(lsb_release --codename --short) 27 lsb_release=$(lsb_release --codename --short)
23 28
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. 29 # Install first the default Linux build deps.
36 "$(dirname "${BASH_SOURCE[0]}")/install-build-deps.sh" \ 30 "$(dirname "${BASH_SOURCE[0]}")/install-build-deps.sh" \
37 --no-syms --lib32 --no-arm --no-chromeos-fonts --no-nacl --no-prompt "${args}" 31 --no-syms --lib32 --no-arm --no-chromeos-fonts --no-nacl --no-prompt "${args}"
38 32
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 33 # Fix deps
50 sudo apt-get -f install 34 sudo apt-get -f install
51 35
52 # Install deps 36 # Install deps
53 # This step differs depending on what Ubuntu release we are running 37 # This step differs depending on what Ubuntu release we are running
54 # on since the package names are different, and Sun's Java must 38 # on since the package names are different, and Sun's Java must
55 # be installed manually on late-model versions. 39 # be installed manually on late-model versions.
56 40
57 # common 41 # common
58 sudo apt-get -y install lib32z1 lighttpd python-pexpect xvfb x11-utils 42 sudo apt-get -y install lib32z1 lighttpd python-pexpect xvfb x11-utils
59 43
60 # Some binaries in the Android SDK require 32-bit libraries on the host. 44 # 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 45 # See https://developer.android.com/sdk/installing/index.html?pkg=tools
62 if [[ $lsb_release == "precise" ]]; then 46 if [[ $lsb_release == "precise" ]]; then
63 sudo apt-get -y install ia32-libs 47 sudo apt-get -y install ia32-libs
64 else 48 else
65 sudo apt-get -y install libncurses5:i386 libstdc++6:i386 zlib1g:i386 49 sudo apt-get -y install libncurses5:i386 libstdc++6:i386 zlib1g:i386
66 fi 50 fi
67 51
52 # Required by //components/cronet/tools/generate_javadoc.py
53 # TODO(375324): Stop requiring ANT.
68 sudo apt-get -y install ant 54 sudo apt-get -y install ant
69 55
70 # Install openjdk and openjre stuff 56 if ! (IsJava8 java && IsJava8 javac); then
71 sudo apt-get -y install $java_pkgs 57 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
72
73 # Switch version of Java to openjdk 7.
74 # Some Java plugins (e.g. for firefox, mozilla) are not required to build, and
75 # thus are treated only as warnings. Any errors in updating java alternatives
76 # which are not '*-javaplugin.so' will cause errors and stop the script from
77 # completing successfully.
78 if ! sudo update-java-alternatives -s $java_alternative \
79 >& "${TEMPDIR}"/update-java-alternatives.out
80 then
81 # Check that there are the expected javaplugin.so errors for the update
82 if grep 'javaplugin.so' "${TEMPDIR}"/update-java-alternatives.out >& \
83 /dev/null
84 then
85 # Print as warnings all the javaplugin.so errors
86 echo 'WARNING: java-6-sun has no alternatives for the following plugins:'
87 grep 'javaplugin.so' "${TEMPDIR}"/update-java-alternatives.out
88 fi
89 # Check if there are any errors that are not javaplugin.so
90 if grep -v 'javaplugin.so' "${TEMPDIR}"/update-java-alternatives.out \
91 >& /dev/null
92 then
93 # If there are non-javaplugin.so errors, treat as errors and exit
94 echo 'ERRORS: Failed to update alternatives for java-6-sun:'
95 grep -v 'javaplugin.so' "${TEMPDIR}"/update-java-alternatives.out
96 exit 1
97 fi
98 fi 58 fi
99 59
60 # 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
61 # needs to be run.
62 if ! IsJava8 javac; then
63 sudo update-java-alternatives -s java-1.8.0-openjdk-amd64
64 fi
65
66 if ! IsJava8 javac; then
67 echo "Failed to install javac 1.8. javac -version reports:"
68 javac -version
69 exit 1
70 fi
100 echo "install-build-deps-android.sh complete." 71 echo "install-build-deps-android.sh complete."
OLDNEW
« 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