Skip to content
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

Merged
merged 9 commits into from
Mar 4, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
132 changes: 71 additions & 61 deletions .kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,88 +8,98 @@ 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
cache_directory: false
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:
## WIP
#- name: wip # be prepared to work on https://github.com/gildegoma/chef-android-sdk/issues/14 (maven-android-sdk-deployer)
# excludes:
# - windows-2012R2
# - mac_el_capitan
# run_list:
# - recipe[git]
# - recipe[maven]
# - recipe[android-sdk]
# attributes:
# android-sdk:
# owner: vagrant
# group: vagrant
# components:
# - build-tools-22.1.0
# - android-22
# - sysimg-22
# java:
# jdk_version: 7

- name: wip # be prepared to work on https://github.com/gildegoma/chef-android-sdk/issues/14 (maven-android-sdk-deployer)
excludes:
- windows-2012R2
- mac_el_capitan
run_list:
- recipe[git]
- recipe[maven]
- recipe[android-sdk]
attributes:
android-sdk:
owner: vagrant
group: vagrant
components:
- build-tools-22.1.0
- android-22
- sysimg-22
java:
jdk_version: 7

- name: default
- name: legacy
Copy link
Owner Author

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

run_list:
- recipe[android-sdk]
attributes:
java:
jdk_version: 7
android-sdk:
version: '24.4'
checksum:
linux: 47b0462b9935b0b9685857eeea407434ee2a47bcdee6bda64b7026f2c22ab341
mac_os_x: 78efef51598cbbdd417b50e00864a86a1f50c63b50599ecf40d20b179be66a71
windows: 12cb4a05e518ec4b816645d8571af3637ba63241c47b15eea7feba5b6804da28
components:
- platform-tools
- build-tools-22.0.1
- android-22
- sys-img-armeabi-v7a-android-22

- name: default
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suite to check the latest SDK and default recipe without modification attributes android-sdk

run_list:
- recipe[android-sdk]
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ AllCops:
- 'vendor/**/*'

Metrics/LineLength:
Max: 150
Max: 155

Metrics/BlockLength:
Max: 30
10 changes: 8 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@ os:
- linux
- osx
language: ruby
dist: trusty
rvm:
- 2.2.2
- 2.3
env:
- BERKSHELF_PATH=/tmp/
before_install:
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get update; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; fi
- curl -L https://www.chef.io/chef/install.sh | sudo bash
- rvm use ruby-2.3@my_project_gemset --create
- gem install bundler
install:
- bundle install --without integration
Expand All @@ -19,5 +23,7 @@ script:
- rvm reset # To use the embedded ruby in chef-client
- sudo chef-client -z -c /tmp/client.rb -j /tmp/dna.json # Run chef in zero mode
- '[ -f ~/.bash_profile ] && source ~/.bash_profile || source ~/.profile && source /etc/profile' # Apply new env vars
- rvm use ruby-2.2.2 # To use the rvm ruby and custom gems
- rvm use ruby-2.3@my_project_gemset # To use the rvm ruby and custom gems
- bundle exec rake # Test all
after_script:
- rvm --force gemset delete my_project_gemset
3 changes: 3 additions & 0 deletions Berksfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@ source 'https://supermarket.chef.io'
metadata

group :integration do
cookbook 'apt'
cookbook 'yum'
cookbook 'yum-centos'
cookbook 'android-sdk', path: './'
end
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
CHANGELOG for Android-SDK cookbook
==================================

v0.2.1 (2017-03-??)
-------------------

- Add support for Android SDK 25 (but without integration of the `sdkmanager` command) [GH-34]
- Download **all** the SDK Tools packages from the new HTTPS-based repository.
Note that the packages are now .zip files (and no longer available as .tgz).
- Chef 12.5+ is now required to run this cookbook and its dependencies


v0.2.0 (2015-10-17)
-------------------

Expand Down
17 changes: 8 additions & 9 deletions Gemfile
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', '>= 5.6.3'
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Requirements
------------

* Depends on **ark**, **java**, **homebrew**, **chef-sugar**, **expect** and **bash** cookbooks
* This cookbook currently supports Ubuntu 12.04+ and CentOS 7+, Mac OS X, Windows
* This cookbook currently supports Ubuntu 12.04+ and CentOS 6.6+, but more Linux distributions are welcome (depending on community interests). Support for MacOS and Windows is also on the [roadmap](https://github.com/gildegoma/chef-android-sdk/pull/33) thanks to @rjaros87.

Attributes
----------
Expand Down
29 changes: 1 addition & 28 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why removal?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rubocop checks the the same and even more.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and also we execute foodcritic ;)

FoodCritic::Rake::LintTask.new do |t|
Expand Down
61 changes: 30 additions & 31 deletions attributes/default.rb
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
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'

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"

#
# List of Android SDK components to preinstall:
Expand All @@ -25,24 +26,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
11 changes: 3 additions & 8 deletions recipes/unix.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
#
# Install required libraries
#
include_recipe 'ark::default'

if node['platform'] == 'ubuntu'
package 'libgl1-mesa-dev'

Expand Down Expand Up @@ -71,17 +73,10 @@
owner node['android-sdk']['owner']
group node['android-sdk']['group']
backup node['android-sdk']['backup_archive']
strip_components 0
action node['android-sdk']['with_symlink'] ? :install : :put
end

#
# Fix non-friendly 0750 permissions in order to make android-sdk available to all system users
#
%w(add-ons platforms tools).each do |subfolder|
directory File.join(android_home, subfolder) do
mode '0755'
end
end
# TODO: find a way to handle 'chmod stuff' below with own chef resource (idempotence stuff...)
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't need this anymore :) by default in archive tools has 755

execute 'Grant all users to read android files' do
command "chmod -R a+r #{android_home}/*"
Expand Down
Loading