Install Java 1.8 alongside 1.7 for retrolambda

Fixes #103.
This commit is contained in:
Daniel Martí 2015-09-03 21:44:59 -07:00
parent 6812390e39
commit a4d1fa22f7
4 changed files with 26 additions and 2 deletions

View file

@ -3,3 +3,7 @@ ndk_paths = {
'r9b': "/home/vagrant/android-ndk/r9b", 'r9b': "/home/vagrant/android-ndk/r9b",
'r10e': "/home/vagrant/android-ndk/r10e", 'r10e': "/home/vagrant/android-ndk/r10e",
} }
java_paths = {
'1.7': "/usr/lib/jvm/java-7-openjdk",
'1.8': "/usr/lib/jvm/java-8-openjdk",
}

View file

@ -10,7 +10,7 @@ execute "apt-get-update" do
command "apt-get update" command "apt-get update"
end end
%w{ant ant-contrib autoconf autoconf2.13 automake1.11 autopoint bison bzr cmake curl expect faketime flex gettext git-core git-svn gperf graphviz imagemagick inkscape javacc libarchive-zip-perl liblzma-dev librsvg2-bin libsaxonb-java libssl-dev libssl1.0.0 libtool make maven mercurial nasm openjdk-7-jdk optipng pandoc perlmagick pkg-config python python-yaml python-gnupg python-magic python-setuptools python3-gnupg quilt realpath scons subversion swig texinfo transfig unzip vorbis-tools xsltproc yasm zip}.each do |pkg| %w{ant ant-contrib autoconf autoconf2.13 automake1.11 autopoint bison bzr cmake curl expect faketime flex gettext git-core git-svn gperf graphviz imagemagick inkscape javacc libarchive-zip-perl liblzma-dev librsvg2-bin libsaxonb-java libssl-dev libssl1.0.0 libtool make maven mercurial nasm openjdk-7-jdk openjdk-8-jdk optipng pandoc perlmagick pkg-config python python-yaml python-gnupg python-magic python-setuptools python3-gnupg quilt realpath scons subversion swig texinfo transfig unzip vorbis-tools xsltproc yasm zip}.each do |pkg|
package pkg do package pkg do
action :install action :install
end end
@ -35,4 +35,8 @@ execute "add-bsenv" do
not_if "grep bsenv /home/#{user}/.bashrc" not_if "grep bsenv /home/#{user}/.bashrc"
end end
execute "set-default-java" do
user user
command "update-java-alternatives --set java-7-openjdk"
end

View file

@ -15,6 +15,13 @@
# 'r10e': "$ANDROID_NDK", # 'r10e': "$ANDROID_NDK",
# } # }
# If you want to build apps that use retrolambda and Java 1.8, you'll need to
# have both 1.7 and 1.8 installed.
# java_paths = {
# '1.7': "/usr/lib/jvm/java-7-openjdk",
# '1.8': None,
# }
# Build tools version to be used # Build tools version to be used
# build_tools = "23.0.1" # build_tools = "23.0.1"

View file

@ -57,6 +57,10 @@ default_config = {
'r10e': "$ANDROID_NDK", 'r10e': "$ANDROID_NDK",
}, },
'build_tools': "23.0.1", 'build_tools': "23.0.1",
'java_paths': {
'1.7': "/usr/lib/jvm/java-7-openjdk",
'1.8': None,
},
'ant': "ant", 'ant': "ant",
'mvn3': "mvn", 'mvn3': "mvn",
'gradle': 'gradle', 'gradle': 'gradle',
@ -122,7 +126,7 @@ def fill_config_defaults(thisconfig):
thisconfig[k] = exp thisconfig[k] = exp
thisconfig[k + '_orig'] = v thisconfig[k + '_orig'] = v
for k in ['ndk_paths']: for k in ['ndk_paths', 'java_paths']:
d = thisconfig[k] d = thisconfig[k]
for k2 in d.copy(): for k2 in d.copy():
v = d[k2] v = d[k2]
@ -185,6 +189,11 @@ def read_config(opts, config_file='config.py'):
for n in ['ANDROID_HOME', 'ANDROID_SDK']: for n in ['ANDROID_HOME', 'ANDROID_SDK']:
env[n] = config['sdk_path'] env[n] = config['sdk_path']
for v in ['7', '8']:
cpath = config['java_paths']['1.%s' % v]
if cpath:
env['JAVA%s_HOME' % v] = cpath
for k in ["keystorepass", "keypass"]: for k in ["keystorepass", "keypass"]:
if k in config: if k in config:
write_password_file(k) write_password_file(k)