Permalink
Browse files

Android SDK: Bug fixes and Version Updates

- store helper scripts out of android sdk directory
  (fix travis-ci/travis-ci#2279)

- change license pattern in android-update-sdk helper script
  (fix travis-ci/travis-ci#2466)

- upgrade to Android SDK 23 and use new system images identifiers

- ship android-wait-for-emulator helper script
  (usage to be described in docs.travis-ci.com)

Note: maven-rescue recipe is still a work in progress, and for this
reason it is disabled for now.
  • Loading branch information...
1 parent 763fcf5 commit a167d0cebe4bb2ce1b1a5721bf6dc635966239df @gildegoma gildegoma committed Jun 27, 2014
@@ -4,6 +4,9 @@ CHANGELOG for Android-SDK cookbook
v0.2.0 (upcoming)
-------------------
+- Integrate by default with Android SDK 23.0.0
+- WIP: Optionally install Maven Android SDK Deployer [GH-14]
+- Deploy scripts for waiting on Emulator startup [GH-16]
- Deploy scripts for non-interactive SDK setup/updates [GH-13]
v0.1.1 (2014-04-01)
@@ -5,8 +5,8 @@
default['android-sdk']['group'] = node['travis_build_environment']['group']
default['android-sdk']['setup_root'] = nil # ark defaults (/usr/local) is used if this attribute is not defined
-default['android-sdk']['version'] = '22.6.2'
-default['android-sdk']['checksum'] = 'f87e1bb207783a8b7d59775dcd3a8a2828034787860e44c99a9aefebdf7cb28f'
+default['android-sdk']['version'] = '23'
+default['android-sdk']['checksum'] = '2eaab06852ac21b6c79df73c07a667c5da5be57f7ffcbd4f17aef7efeea22ac1'
default['android-sdk']['download_url'] = "http://dl.google.com/android/android-sdk_r#{node['android-sdk']['version']}-linux.tgz"
#
@@ -20,16 +20,18 @@
# 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
+ android-20
+ sys-img-armeabi-v7a-android-wear-20
android-19
- sysimg-19
+ sys-img-armeabi-v7a-android-19
android-18
- sysimg-18
+ sys-img-armeabi-v7a-android-18
android-17
- sysimg-17
+ sys-img-armeabi-v7a-android-17
android-16
- sysimg-16
+ sys-img-armeabi-v7a-android-16
android-15
- sysimg-15
+ sys-img-armeabi-v7a-android-15
android-10
extra-android-support
extra-google-google_play_services
@@ -39,3 +41,9 @@
default['android-sdk']['license']['white_list'] = %w(android-sdk-license-.+)
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']['maven-rescue'] = false
@@ -0,0 +1,9 @@
+include_attribute 'travis_build_environment'
+
+default['android-sdk']['maven-android-sdk-deployer']['name'] = "maven-android-sdk-deployer"
+default['android-sdk']['maven-android-sdk-deployer']['version'] = "881915c628650cbc275eaa111ce8e715016f43b2"
+default['android-sdk']['maven-android-sdk-deployer']['git_repository'] = "https://github.com/mosabua/maven-android-sdk-deployer.git"
+
+# TODO explain/verify why I don't want to be depending on
+# Maven cookbook attributes (e.g. use node['maven']['mavenrc']['opts'])
+default['android-sdk']['maven-local-repository'] = File.join(node['travis_build_environment']['home'], %w(.m2 repository))
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+# Originally written by Ralf Kistner <ralf@embarkmobile.com>, but placed in the public domain
+
+set +e
+
+bootanim=""
+failcounter=0
+until [[ "$bootanim" =~ "stopped" ]]; do
+ bootanim=`adb -e shell getprop init.svc.bootanim 2>&1`
+ echo "$bootanim"
+ if [[ "$bootanim" =~ "not found" ]]; then
+ let "failcounter += 1"
+ if [[ $failcounter -gt 15 ]]; then
+ echo "Failed to start emulator"
+ exit 1
+ fi
+ fi
+ sleep 1
+done
+echo "Done"
@@ -3,14 +3,18 @@
maintainer_email "foss@gilles.cornu.name"
license "Apache 2.0"
description "Installs Google Android SDK"
-version "0.1.0"
+version "0.2.0" # not released
%w{ java ark }.each do |dep|
depends dep
end
+# TODO: maybe put maven into depends section
+recommends 'maven' # Maven 3.1.1+ is required by android-sdk::maven-rescue recipe
+
supports 'ubuntu', '>= 12.04'
-# Support for more platforms is on the road (e.g. Debian, CentOS,...).
-# Watch https://github.com/gildegoma/chef-android-sdk/issues/5
+# Support for more platforms is on the road (e.g. Debian, CentOS,...).
+# Please watch or help on https://github.com/gildegoma/chef-android-sdk/issues/5
-recipe "android-sdk", "Install and update Google Android SDK"
+recipe "android-sdk::default", "Install and update Google Android SDK"
+recipe "android-sdk::maven-rescue", "Install missing dependencies with Maven Android SDK Deployer"
@@ -103,7 +103,7 @@
#
# KISS: use a basic idempotent guard, waiting for https://github.com/gildegoma/chef-android-sdk/issues/12
-unless File.exist?("#{setup_root}/#{node['android-sdk']['name']}-#{node['android-sdk']['version']}/build-tools")
+unless File.exist?("#{setup_root}/#{node['android-sdk']['name']}-#{node['android-sdk']['version']}/temp")
# With "--filter node['android-sdk']['components'].join(,)" pattern,
# some system-images were not installed as expected.
@@ -142,13 +142,27 @@
#
-# Deploy additional scripts into Android-SDK tools directory
+# Deploy additional scripts, preferably outside Android-SDK own directories to
+# avoid unwanted removal when updating android sdk components later.
#
-%w(android-update-sdk android-accept-licenses).each do |android_helper_script|
- cookbook_file File.join(android_home, 'tools', android_helper_script) do
+%w(android-accept-licenses android-wait-for-emulator).each do |android_helper_script|
+ cookbook_file File.join(node['android-sdk']['scripts']['path'], android_helper_script) do
source android_helper_script
- owner node['android-sdk']['owner']
- group node['android-sdk']['group']
- mode 0775
+ owner node['android-sdk']['scripts']['owner']
+ group node['android-sdk']['scripts']['group']
+ mode 0755
end
end
+%w(android-update-sdk).each do |android_helper_script|
+ template File.join(node['android-sdk']['scripts']['path'], android_helper_script) do
+ source "#{android_helper_script}.erb"
+ owner node['android-sdk']['scripts']['owner']
+ group node['android-sdk']['scripts']['group']
+ mode 0755
+ end
+end
+
+#
+# Install Maven Android SDK Deployer toolkit to populate local Maven repository
+#
+include_recipe('android-sdk::maven-rescue') if node['android-sdk']['maven-rescue']
@@ -0,0 +1,46 @@
+# TODO: decide which way we depend on maven (weak dependency, conditional include_recipe or always include_recipe?)
+# include_recipe "maven"
+
+maven_android_sdk_deployer_root = node['android-sdk']['setup_root'].to_s.empty? ? node['ark']['prefix_home'] : node['android-sdk']['setup_root']
+maven_android_sdk_deployer_home = File.join(maven_android_sdk_deployer_root, node['android-sdk']['maven-android-sdk-deployer']['name'])
+
+#
+# Install Maven Android SDK Deployer from git repository
+#
+directory maven_android_sdk_deployer_home do
+ user node['android-sdk']['owner']
+ group node['android-sdk']['group']
+ mode 00755
+ action :create
+end
+git maven_android_sdk_deployer_home do
+ repository node['android-sdk']['maven-android-sdk-deployer']['git_repository']
+ revision node['android-sdk']['maven-android-sdk-deployer']['version']
+ checkout_branch "deploy_#{node['android-sdk']['maven-android-sdk-deployer']['version']}"
+ action :sync
+ user node['android-sdk']['owner']
+ group node['android-sdk']['group']
+end
+
+#
+# Deploy Android SDK jar files to a Maven local repository
+# TODO: improve the messy management of the maven repository location
+#
+# The following is a KISS approach that should generally work pretty well, but
+# it could be nicer/safer to loop over node['android-sdk']['components'] and
+# generate a more precise `mvn -pl component1,component2,... install` command.
+#
+# The problem: target names do not match 100% of the time (e.g. "extras/google-play-services" vs "extra-google-google_play_services")
+#
+execute 'Execute maven-android-sdk-deployer' do
+ command "mvn clean install -Dmaven.repo.local=#{node['android-sdk']['maven-local-repository']} --fail-never -B"
+ user node['android-sdk']['owner']
+ group node['android-sdk']['group']
+ cwd maven_android_sdk_deployer_home
+
+ # FIXME: setting HOME might be required (if $HOME used in node['android-sdk']['maven-local-repository'],
+ # or if -Dmaven.repo.local is unset (default to ~/.m2/repository)
+ # environment ({ 'HOME' => '/home/vagrant' })
+
+ # Note: There is no idempotent guard for now. Pending on https://github.com/gildegoma/chef-android-sdk/issues/12.
+end
@@ -6,7 +6,7 @@
set +e
# Defaults
-LICENSES="android-sdk-license-bcbbd656"
+LICENSES="<%= node['android-sdk']['license']['white_list'].join('|') %>"
for i in "$@"
do

0 comments on commit a167d0c

Please sign in to comment.