-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix for sdk25 #2
Changes from 1 commit
5ddec19
47d08e1
04ac4ea
5ef234b
23aae55
586bb82
69ec362
a27931a
e877e10
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,57 +8,57 @@ provisioner: | |
require_chef_omnibus: latest | ||
|
||
platforms: | ||
|
||
- name: ubuntu-12.04 | ||
driver: | ||
customize: | ||
memory: 384 | ||
- name: ubuntu-12.04 | ||
driver: | ||
customize: | ||
memory: 384 | ||
run_list: | ||
- recipe[apt] | ||
|
||
- name: ubuntu-14.04 | ||
driver: | ||
customize: | ||
memory: 384 | ||
- name: ubuntu-14.04 | ||
driver: | ||
customize: | ||
memory: 384 | ||
run_list: | ||
- recipe[apt] | ||
|
||
- name: centos-7.1 | ||
driver: | ||
customize: | ||
memory: 512 | ||
- name: centos-7.1 | ||
driver: | ||
customize: | ||
memory: 512 | ||
run_list: | ||
- recipe[yum] | ||
- recipe[yum-centos] | ||
|
||
- name: mac_el_capitan | ||
os_type: mac_os_x | ||
driver: | ||
box: jhcook/osx-elcapitan-10.11 | ||
boot_timeout: 1800 | ||
customize: | ||
cpuexecutioncap: 80 # % max of total cpu power | ||
- name: mac_el_capitan | ||
os_type: mac_os_x | ||
driver: | ||
box: jhcook/osx-elcapitan-10.11 | ||
boot_timeout: 1800 | ||
customize: | ||
cpuexecutioncap: 80 # % max of total cpu power | ||
|
||
- name: windows-2012R2 | ||
os_type: windows | ||
driver: | ||
box: mwrock/Windows2012R2 | ||
boot_timeout: 1800 | ||
attributes: | ||
seven_zip: | ||
home: 'C:\7-zip' | ||
java: | ||
oracle: | ||
accept_oracle_download_terms: true | ||
windows: | ||
url: 'http://download.oracle.com/otn-pub/java/jdk/7u79-b15/jdk-7u79-windows-x64.exe' | ||
package_name: 'Java SE Development Kit 7 Update 79 (64-bit)' | ||
java_home: 'C:\\Program Files\\Java\\jdk1.7.0_79' | ||
android-sdk: | ||
owner: vagrant | ||
group: vagrant | ||
setup_root: 'C:/Users/vagrant/google' | ||
license: | ||
default_answer: y | ||
- name: windows-2012R2 | ||
os_type: windows | ||
driver: | ||
box: mwrock/Windows2012R2 | ||
boot_timeout: 1800 | ||
attributes: | ||
seven_zip: | ||
home: 'C:\7-zip' | ||
java: | ||
oracle: | ||
accept_oracle_download_terms: true | ||
windows: | ||
url: 'http://download.oracle.com/otn-pub/java/jdk/7u79-b15/jdk-7u79-windows-x64.exe' | ||
package_name: 'Java SE Development Kit 7 Update 79 (64-bit)' | ||
java_home: 'C:\\Program Files\\Java\\jdk1.7.0_79' | ||
android-sdk: | ||
owner: vagrant | ||
group: vagrant | ||
setup_root: 'C:/Users/vagrant/google' | ||
license: | ||
default_answer: y | ||
|
||
suites: | ||
|
||
|
@@ -81,15 +81,24 @@ suites: | |
java: | ||
jdk_version: 7 | ||
|
||
- name: default | ||
- name: legacy | ||
run_list: | ||
- recipe[android-sdk] | ||
attributes: | ||
java: | ||
jdk_version: 7 | ||
android-sdk: | ||
version: '24.4' | ||
checksum: | ||
linux: f2bb546534d16e2004665257ee530060338c684adad14a49cd4bbde08098d8a4 | ||
mac_os_x: a1cb0c9b2036d597e18986de1bd43918b6113373ff3bf6fdb81b6cce4ec3efd7 | ||
windows: 1f9f22271fe55bf0bf10b60556ed1a5fa2f2ca672fc20d35478325104941cb05 | ||
components: | ||
- platform-tools | ||
- build-tools-22.0.1 | ||
- android-22 | ||
- sys-img-armeabi-v7a-android-22 | ||
|
||
- name: default | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suite to check the latest SDK and default recipe without modification attributes |
||
run_list: | ||
- recipe[android-sdk] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ AllCops: | |
- 'vendor/**/*' | ||
|
||
Metrics/LineLength: | ||
Max: 150 | ||
Max: 155 | ||
|
||
Metrics/BlockLength: | ||
Max: 30 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,13 @@ | ||
source 'https://rubygems.org' | ||
|
||
gem 'berkshelf', '~> 4.3' | ||
gem 'chef', '~> 12.11' | ||
gem 'chefspec', '~> 4.7' | ||
gem 'foodcritic', '>= 5.0.0' | ||
gem 'rake' | ||
gem 'rubocop' | ||
gem 'tailor' | ||
gem 'berkshelf', '~> 5.6' | ||
gem 'chef', '~> 12.18' | ||
gem 'chefspec', '~> 6.0' | ||
gem 'foodcritic', '~> 9.0' | ||
gem 'rake', '~> 12.0' | ||
gem 'rubocop', '~> 0.47.1' | ||
|
||
group :integration do | ||
gem 'kitchen-vagrant', '~> 0.20.0' | ||
gem 'test-kitchen', '~> 1.10' | ||
gem 'kitchen-vagrant', '~> 1.0' | ||
gem 'test-kitchen', '~> 1.15' | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,40 +2,13 @@ | |
|
||
require 'foodcritic' | ||
require 'rake/testtask' | ||
require 'tailor/rake_task' | ||
require 'rubocop/rake_task' | ||
require 'rspec/core/rake_task' | ||
|
||
# TODO: add chefspec | ||
task default: [:tailor, :rubocop, :foodcritic, :knife, :serverspec] | ||
task default: [:rubocop, :foodcritic, :knife, :serverspec] | ||
|
||
desc 'Lint Ruby code' | ||
task :tailor do | ||
Tailor::RakeTask.new do |task| | ||
task.file_set('attributes/**/*.rb', 'attributes') do |style| | ||
style.max_line_length 160, level: :warn | ||
end | ||
# task.file_set('definitions/**/*.rb', "definitions") | ||
# task.file_set('libraries/**/*.rb', "libraries") | ||
task.file_set('metadata.rb', 'metadata') do |style| | ||
style.max_line_length 80, level: :warn | ||
end | ||
# task.file_set('providers/**/*.rb', "providers") | ||
task.file_set('recipes/**/*.rb', 'recipes') do |style| | ||
style.max_line_length 160, level: :warn | ||
end | ||
# task.file_set('resources/**/*.rb', "resources") | ||
|
||
# Template analysis is currently disabled, | ||
# because I have no idea how 'ruby -c' could support ERB markers like '<%' | ||
# task.file_set('templates/**/*.erb', "templates") | ||
|
||
task.file_set('spec/**/*.rb', 'chefspec') do |style| | ||
style.max_line_length 160, level: :warn | ||
end | ||
end | ||
end | ||
|
||
RuboCop::RakeTask.new | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why removal? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rubocop checks the the same and even more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. and also we execute foodcritic ;) |
||
FoodCritic::Rake::LintTask.new do |t| | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,27 @@ | ||
default['android-sdk']['name'] = 'android-sdk' | ||
default['android-sdk']['owner'] = 'root' | ||
default['android-sdk']['group'] = platform_family?('mac_os_x') ? 'wheel' : 'root' | ||
default['android-sdk']['backup_archive'] = false # The number of backups to be kept in /var/chef/backup. To prevent backups set to false. | ||
default['android-sdk']['setup_root'] = nil # ark defaults (/usr/local) is used if this attribute is not defined | ||
default['android-sdk']['with_symlink'] = true # use ark's :install action when true; use ark's :put action when false | ||
default['android-sdk']['set_environment_variables'] = true | ||
default['android-sdk']['name'] = 'android-sdk' | ||
default['android-sdk']['owner'] = 'root' | ||
default['android-sdk']['group'] = platform_family?('mac_os_x') ? 'wheel' : 'root' | ||
default['android-sdk']['backup_archive'] = false # The number of backups to be kept in /var/chef/backup. To prevent backups set to false. | ||
default['android-sdk']['setup_root'] = nil # ark defaults (/usr/local) is used if this attribute is not defined | ||
default['android-sdk']['with_symlink'] = true # use ark's :install action when true; use ark's :put action when false | ||
default['android-sdk']['set_environment_variables'] = true | ||
|
||
default['android-sdk']['version'] = '24.4' | ||
default['android-sdk']['checksum']['linux'] = 'f2bb546534d16e2004665257ee530060338c684adad14a49cd4bbde08098d8a4' | ||
default['android-sdk']['checksum']['mac_os_x'] = 'a1cb0c9b2036d597e18986de1bd43918b6113373ff3bf6fdb81b6cce4ec3efd7' | ||
default['android-sdk']['checksum']['windows'] = '1f9f22271fe55bf0bf10b60556ed1a5fa2f2ca672fc20d35478325104941cb05' | ||
default['android-sdk']['download_url']['linux'] = "http://dl.google.com/android/android-sdk_r#{node['android-sdk']['version']}-linux.tgz" | ||
default['android-sdk']['download_url']['mac_os_x'] = "https://dl.google.com/android/android-sdk_r#{node['android-sdk']['version']}-macosx.zip" | ||
default['android-sdk']['download_url']['windows'] = "https://dl.google.com/android/android-sdk_r#{node['android-sdk']['version']}-windows.zip" | ||
default['android-sdk']['version'] = '25.2.3' | ||
default['android-sdk']['checksum']['linux'] = '1b35bcb94e9a686dff6460c8bca903aa0281c6696001067f34ec00093145b560' | ||
default['android-sdk']['checksum']['mac_os_x'] = '593544d4ca7ab162705d0032fb0c0c88e75bd0f42412d09a1e8daa3394681dc6' | ||
default['android-sdk']['checksum']['windows'] = '23d5686ffe489e5a1af95253b153ce9d6f933e5dbabe14c494631234697a0e08' | ||
|
||
if ::Gem::Version.new(node['android-sdk']['version']) < ::Gem::Version.new('25') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We check the SDK version and set |
||
automatic['android-sdk']['legacy_sdk'] = true | ||
default['android-sdk']['download_url']['linux'] = "https://dl.google.com/android/android-sdk_r#{node['android-sdk']['version']}-linux.tgz" | ||
default['android-sdk']['download_url']['mac_os_x'] = "https://dl.google.com/android/android-sdk_r#{node['android-sdk']['version']}-macosx.zip" | ||
default['android-sdk']['download_url']['windows'] = "https://dl.google.com/android/android-sdk_r#{node['android-sdk']['version']}-windows.zip" | ||
else | ||
automatic['android-sdk']['legacy_sdk'] = false | ||
default['android-sdk']['download_url']['linux'] = "https://dl.google.com/android/repository/tools_r#{node['android-sdk']['version']}-linux.zip" | ||
default['android-sdk']['download_url']['mac_os_x'] = "https://dl.google.com/android/repository/tools_r#{node['android-sdk']['version']}-macosx.zip" | ||
default['android-sdk']['download_url']['windows'] = "https://dl.google.com/android/repository/tools_r#{node['android-sdk']['version']}-windows.zip" | ||
end | ||
|
||
# | ||
# List of Android SDK components to preinstall: | ||
|
@@ -25,24 +34,22 @@ | |
# without having to adapt 'version' and 'checksum' attributes of this cookbook. | ||
# Note that it will require (waste) some extra download effort. | ||
# | ||
default['android-sdk']['components'] = %w( platform-tools | ||
build-tools-24.0.1 | ||
android-24 | ||
sys-img-armeabi-v7a-android-24 | ||
sys-img-armeabi-v7a-android-tv-24 | ||
extra-android-support | ||
extra-google-google_play_services | ||
extra-google-m2repository | ||
extra-android-m2repository ) | ||
default['android-sdk']['components'] = %w( platform-tools | ||
build-tools-25.0.2 | ||
android-25 | ||
extra-android-support | ||
extra-google-google_play_services | ||
extra-google-m2repository | ||
extra-android-m2repository ) | ||
|
||
default['android-sdk']['license']['white_list'] = %w(.+) | ||
default['android-sdk']['license']['black_list'] = [] # e.g. ['intel-.+', 'mips-.+', 'android-wear-sdk-license-.+'] | ||
default['android-sdk']['license']['default_answer'] = 'n' # 'y' or 'n' ('yes' or 'no') | ||
default['android-sdk']['license']['white_list'] = %w(.+) | ||
default['android-sdk']['license']['black_list'] = [] # e.g. ['intel-.+', 'mips-.+', 'android-wear-sdk-license-.+'] | ||
default['android-sdk']['license']['default_answer'] = 'n' # 'y' or 'n' ('yes' or 'no') | ||
|
||
default['android-sdk']['scripts']['path'] = '/usr/local/bin' | ||
default['android-sdk']['scripts']['owner'] = node['android-sdk']['owner'] | ||
default['android-sdk']['scripts']['group'] = node['android-sdk']['group'] | ||
default['android-sdk']['scripts']['path'] = '/usr/local/bin' | ||
default['android-sdk']['scripts']['owner'] = node['android-sdk']['owner'] | ||
default['android-sdk']['scripts']['group'] = node['android-sdk']['group'] | ||
|
||
default['android-sdk']['java_from_system'] = false | ||
default['android-sdk']['java_from_system'] = false | ||
|
||
default['android-sdk']['maven-rescue'] = false | ||
default['android-sdk']['maven-rescue'] = false |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,8 @@ | |
# | ||
# Install required libraries | ||
# | ||
package 'unzip' | ||
|
||
if node['platform'] == 'ubuntu' | ||
package 'libgl1-mesa-dev' | ||
|
||
|
@@ -71,6 +73,7 @@ | |
owner node['android-sdk']['owner'] | ||
group node['android-sdk']['group'] | ||
backup node['android-sdk']['backup_archive'] | ||
strip_components node['android-sdk']['legacy_sdk'] ? 1 : 0 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Major fix for unix system is just simply extract archive to |
||
action node['android-sdk']['with_symlink'] ? :install : :put | ||
end | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,9 +43,15 @@ | |
|
||
ruby_block 'Rename directory' do | ||
block do | ||
::File.rename "#{setup_root}/android-sdk-windows", "#{setup_root}/#{node['android-sdk']['name']}" | ||
if node['android-sdk']['legacy_sdk'] | ||
::File.rename "#{setup_root}/android-sdk-windows", "#{setup_root}/#{node['android-sdk']['name']}" | ||
else | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Major fix for windows system |
||
require 'fileutils' | ||
::FileUtils.mkdir "#{setup_root}/#{node['android-sdk']['name']}" | ||
::FileUtils.mv "#{setup_root}/tools", "#{setup_root}/#{node['android-sdk']['name']}/tools" | ||
end | ||
end | ||
only_if { ::Dir.exist? "#{setup_root}\\android-sdk-windows" } | ||
only_if { ::Dir.exist?("#{setup_root}\\android-sdk-windows") || ::Dir.exist?("#{setup_root}\\tools") } | ||
end | ||
|
||
env 'ANDROID_HOME' do | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,10 @@ | ||
require_relative 'spec_helper' | ||
# Workaround for load spec_helper on Travis | ||
libdir = File.expand_path(File.join(File.dirname(__FILE__), '../../helpers/serverspec')) | ||
$LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir) || $LOAD_PATH.include?(libdir) | ||
# | ||
|
||
# Windows | ||
describe file('C:\\Users\\vagrant\\google\\android-sdk'), if: os[:family] == 'windows' do | ||
it { should be_directory } | ||
end | ||
|
||
describe file('C:\\Users\\vagrant\\google\\android-sdk\\platform-tools\\adb.exe'), if: os[:family] == 'windows' do | ||
it { should exist } | ||
end | ||
|
||
describe command('adb kill-server'), if: os[:family] == 'windows' do | ||
its(:stderr) { should contain('server not running') } | ||
end | ||
|
||
# Unix | ||
describe command('adb kill-server'), if: os[:family] != 'windows' do | ||
its(:exit_status) { should eq 0 } | ||
end | ||
require 'spec_helper' | ||
|
||
# All platform | ||
describe command('android -h') do | ||
its(:stdout) { should contain('android') } | ||
describe 'Android SDK' do | ||
include_examples 'basic suite' | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suite to check the backward compatibility