-
Notifications
You must be signed in to change notification settings - Fork 232
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #587 from travis-ci/gc-add-oraclejdk9
Add support for (upcoming) Oracle JDK 9 and refactor similar recipes to reduce duplications
- Loading branch information
Showing
10 changed files
with
105 additions
and
160 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
|
||
module TravisJava | ||
module OracleJdk | ||
def install_oraclejdk(version) | ||
attribute_key = "oraclejdk#{version}" | ||
pkg_prefix = "oracle-java#{version}" | ||
pkg_installer = "#{pkg_prefix}-installer" | ||
deb_installer = File.join(Chef::Config[:file_cache_path], "#{pkg_installer}.deb") | ||
installer_cache_path = "/var/cache/oracle-jdk#{version}-installer" | ||
java_home = File.join(node['travis_java']['jvm_base_dir'], node['travis_java'][attribute_key]['jvm_name']) | ||
|
||
include_recipe 'travis_java::webupd8' | ||
|
||
# accept Oracle License v1.1, otherwise the package won't install | ||
bash "accept oracle license v1.1 for #{attribute_key}" do | ||
code <<-EOBASH.gsub(/^\s+>\s/, '') | ||
> /bin/echo -e #{pkg_installer} shared/accepted-oracle-license-v1-1 select true | \\ | ||
> debconf-set-selections | ||
EOBASH | ||
end | ||
|
||
if node['travis_java'][attribute_key]['pinned_release'] | ||
remote_file deb_installer do | ||
source "http://ppa.launchpad.net/webupd8team/java/ubuntu/pool/main/o/#{pkg_installer}/#{pkg_installer}_#{node['travis_java'][attribute_key]['pinned_release']}.deb" | ||
not_if "test -f #{deb_installer}" | ||
end | ||
|
||
dpkg_package deb_installer | ||
else | ||
package pkg_installer | ||
end | ||
|
||
package "#{pkg_prefix}-unlimited-jce-policy" | ||
|
||
link "#{java_home}/jre/lib/security/cacerts" do | ||
to '/etc/ssl/certs/java/cacerts' | ||
not_if { version > 8 } | ||
# TODO: This "skip condition" must be removed when the Oracle JDK 9 package will provide the 'jre' subdirectory | ||
end | ||
|
||
directory installer_cache_path do | ||
action :delete | ||
recursive true | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
maintainer_email '[email protected]' | ||
license 'Apache 2.0' | ||
description 'Installs different Java Development Kits (JDK)' | ||
version '2.1.0' | ||
version '2.2.0' | ||
|
||
supports 'ubuntu', '>= 12.04' | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,3 @@ | ||
# | ||
# Cookbook Name:: travis_java | ||
# Recipe:: oraclejdk7 | ||
# | ||
# Copyright 2012-2015, Michael S. Klishin & Travis CI Development Team | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
Chef::Recipe.send(:include, TravisJava::OracleJdk) | ||
|
||
include_recipe 'travis_java::webupd8' | ||
|
||
# accept Oracle License v1.1, otherwise the package won't install | ||
bash 'accept oracle license v1.1' do | ||
code <<-EOBASH.gsub(/^\s+>\s/, '') | ||
> /bin/echo -e oracle-java7-installer shared/accepted-oracle-license-v1-1 select true | \\ | ||
> debconf-set-selections | ||
EOBASH | ||
end | ||
|
||
installer = File.join(Chef::Config[:file_cache_path], 'oracle-java7-installer.deb') | ||
|
||
remote_file installer do | ||
source "http://ppa.launchpad.net/webupd8team/java/ubuntu/pool/main/o/oracle-java7-installer/oracle-java7-installer_#{node['travis_java']['oraclejdk7']['pinned_release']}.deb" | ||
not_if "test -f #{installer}" | ||
only_if { node['travis_java']['oraclejdk7']['pinned_release'] } | ||
end | ||
|
||
dpkg_package installer do | ||
action :install | ||
only_if { node['travis_java']['oraclejdk7']['pinned_release'] } | ||
end | ||
|
||
package 'oracle-java7-installer' do | ||
not_if { node['travis_java']['oraclejdk7']['pinned_release'] } | ||
end | ||
|
||
oraclejdk7_home = File.join( | ||
node['travis_java']['jvm_base_dir'], | ||
node['travis_java']['oraclejdk7']['jvm_name'] | ||
) | ||
|
||
link "#{oraclejdk7_home}/jre/lib/security/cacerts" do | ||
to '/etc/ssl/certs/java/cacerts' | ||
end | ||
|
||
bash 'install jce unlimited' do | ||
code <<-EOBASH.gsub(/^\s+>\s/, '') | ||
> curl -L --cookie 'oraclelicense=accept-securebackup-cookie;' \\ | ||
> -o /tmp/policy.zip \\ | ||
> http://download.oracle.com/otn-pub/java/jce/7/UnlimitedJCEPolicyJDK7.zip && \\ | ||
> sudo unzip -j -o /tmp/policy.zip *.jar -d #{oraclejdk7_home}/jre/lib/security && \\ | ||
> rm /tmp/policy.zip | ||
EOBASH | ||
only_if { node['travis_java']['oraclejdk7']['install_jce_unlimited'] } | ||
end | ||
install_oraclejdk 7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,71 +1,3 @@ | ||
# | ||
# Cookbook Name:: travis_java | ||
# Recipe:: oraclejdk8 | ||
# | ||
# Copyright 2012, Michael S. Klishin & Travis CI Development Team | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
Chef::Recipe.send(:include, TravisJava::OracleJdk) | ||
|
||
include_recipe 'travis_java::webupd8' | ||
|
||
# accept Oracle License v1.1, otherwise the package won't install | ||
bash 'accept oracle license v1.1' do | ||
code <<-EOBASH.gsub(/^\s+>\s/, '') | ||
> /bin/echo -e oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | \\ | ||
> debconf-set-selections | ||
EOBASH | ||
end | ||
|
||
installer = File.join(Chef::Config[:file_cache_path], 'oracle-java8-installer.deb') | ||
|
||
remote_file installer do | ||
source "http://ppa.launchpad.net/webupd8team/java/ubuntu/pool/main/o/oracle-java8-installer/oracle-java8-installer_#{node['travis_java']['oraclejdk8']['pinned_release']}.deb" | ||
not_if "test -f #{installer}" | ||
only_if { node['travis_java']['oraclejdk8']['pinned_release'] } | ||
end | ||
|
||
dpkg_package installer do | ||
action :install | ||
only_if { node['travis_java']['oraclejdk8']['pinned_release'] } | ||
end | ||
|
||
package 'oracle-java8-installer' do | ||
not_if { node['travis_java']['oraclejdk8']['pinned_release'] } | ||
end | ||
|
||
oraclejdk8_home = File.join( | ||
node['travis_java']['jvm_base_dir'], | ||
node['travis_java']['oraclejdk8']['jvm_name'] | ||
) | ||
|
||
link "#{oraclejdk8_home}/jre/lib/security/cacerts" do | ||
to '/etc/ssl/certs/java/cacerts' | ||
end | ||
|
||
directory '/var/cache/oracle-jdk8-installer' do | ||
action :delete | ||
recursive true | ||
ignore_failure true | ||
end | ||
|
||
bash 'install jce unlimited' do | ||
code <<-EOBASH.gsub(/^\s+>\s/, '') | ||
> curl -L --cookie 'oraclelicense=accept-securebackup-cookie;' \\ | ||
> -o /tmp/policy.zip \\ | ||
> http://download.oracle.com/otn-pub/java/jce/8/jce_policy-8.zip && \\ | ||
> sudo unzip -j -o /tmp/policy.zip *.jar -d #{oraclejdk8_home}/jre/lib/security && \\ | ||
> rm /tmp/policy.zip | ||
EOBASH | ||
only_if { node['travis_java']['oraclejdk8']['install_jce_unlimited'] } | ||
end | ||
install_oraclejdk 8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Chef::Recipe.send(:include, TravisJava::OracleJdk) | ||
|
||
install_oraclejdk 9 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters