2012-02-03 17:01:35 +01:00
|
|
|
|
|
|
|
sdk_loc = node[:settings][:sdk_loc]
|
|
|
|
user = node[:settings][:user]
|
|
|
|
|
|
|
|
script "setup-android-sdk" do
|
2013-05-23 11:53:27 +02:00
|
|
|
timeout 14400
|
2012-02-03 17:01:35 +01:00
|
|
|
interpreter "bash"
|
|
|
|
user user
|
|
|
|
cwd "/tmp"
|
|
|
|
code "
|
2013-05-25 14:55:16 +02:00
|
|
|
tar zxvf /vagrant/cache/android-sdk_r21.0.1-linux.tgz
|
2012-02-03 17:01:35 +01:00
|
|
|
mv android-sdk-linux #{sdk_loc}
|
|
|
|
#{sdk_loc}/tools/android update sdk --no-ui -t platform-tool
|
2012-08-31 15:48:50 +02:00
|
|
|
#{sdk_loc}/tools/android update sdk --no-ui -t tool
|
2012-02-03 17:01:35 +01:00
|
|
|
"
|
2012-09-04 19:51:53 +02:00
|
|
|
not_if "test -d #{sdk_loc}"
|
2012-02-03 17:01:35 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
execute "add-android-sdk-path" do
|
|
|
|
user user
|
|
|
|
path = "#{sdk_loc}/tools:#{sdk_loc}/platform-tools"
|
2013-08-29 22:05:25 +02:00
|
|
|
command "echo \"export PATH=\\$PATH:#{path} #PATH-SDK\" >> /home/#{user}/.bsenv"
|
|
|
|
not_if "grep PATH-SDK /home/#{user}/.bsenv"
|
2013-08-29 19:25:26 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
execute "add-android-home" do
|
|
|
|
user user
|
2013-08-29 22:05:25 +02:00
|
|
|
command "echo \"export ANDROID_HOME=#{sdk_loc}\" >> /home/#{user}/.bsenv"
|
|
|
|
not_if "grep ANDROID_HOME /home/#{user}/.bsenv"
|
2012-02-03 17:01:35 +01:00
|
|
|
end
|
|
|
|
|
2013-08-08 12:43:15 +02:00
|
|
|
%w{17.0.0 18.0.1}.each do |ver|
|
|
|
|
|
|
|
|
script "add_build_tools_#{ver}" do
|
|
|
|
interpreter "bash"
|
|
|
|
user user
|
|
|
|
cwd "/tmp"
|
|
|
|
code "
|
|
|
|
if [ -f /vagrant/cache/build-tools/#{ver}.tar.gz ] ; then
|
|
|
|
echo Installing from cache
|
|
|
|
mkdir #{sdk_loc}/build-tools
|
|
|
|
tar -C #{sdk_loc}/build-tools -z -x -f /vagrant/cache/build-tools/#{ver}.tar.gz
|
|
|
|
else
|
|
|
|
#{sdk_loc}/tools/android update sdk --no-ui -a -t build-tools-#{ver} <<X
|
2013-07-31 18:46:31 +02:00
|
|
|
y
|
|
|
|
|
|
|
|
X
|
2013-08-08 12:43:15 +02:00
|
|
|
fi
|
|
|
|
"
|
|
|
|
not_if "test -d #{sdk_loc}/build-tools/#{ver}"
|
|
|
|
end
|
2013-06-04 23:39:46 +02:00
|
|
|
end
|
|
|
|
|
2012-09-20 11:27:33 +02:00
|
|
|
%w{android-3 android-4 android-7 android-8 android-10 android-11
|
2013-08-08 12:11:48 +02:00
|
|
|
android-12 android-13 android-14 android-15 android-16 android-17 android-18
|
2013-08-22 10:54:01 +02:00
|
|
|
extra-android-support extra-android-m2repository}.each do |sdk|
|
2012-09-04 19:51:53 +02:00
|
|
|
|
|
|
|
script "add_sdk_#{sdk}" do
|
|
|
|
interpreter "bash"
|
|
|
|
user user
|
|
|
|
cwd "/tmp"
|
|
|
|
code "
|
2013-05-31 08:48:39 +02:00
|
|
|
if [ -f /vagrant/cache/platforms/#{sdk}.tar.gz ] ; then
|
|
|
|
echo Installing from cache
|
|
|
|
tar -C #{sdk_loc}/platforms -z -x -f /vagrant/cache/platforms/#{sdk}.tar.gz
|
|
|
|
else
|
|
|
|
echo Installing via 'android'
|
|
|
|
#{sdk_loc}/tools/android update sdk --no-ui -a -t #{sdk} <<X
|
2013-05-25 15:00:31 +02:00
|
|
|
y
|
|
|
|
|
|
|
|
X
|
2013-05-31 08:48:39 +02:00
|
|
|
fi
|
2012-09-04 19:51:53 +02:00
|
|
|
"
|
|
|
|
not_if "test -d #{sdk_loc}/platforms/#{sdk}"
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
2013-05-22 15:55:14 +02:00
|
|
|
%w{addon-google_apis-google-7 addon-google_apis-google-10 addon-google_apis-google-15 addon-google_apis-google-16 addon-google_apis-google-17}.each do |sdk|
|
2012-09-04 19:51:53 +02:00
|
|
|
|
|
|
|
script "add_addon_#{sdk}" do
|
|
|
|
interpreter "bash"
|
|
|
|
user user
|
|
|
|
cwd "/tmp"
|
|
|
|
code "
|
2013-05-31 08:48:39 +02:00
|
|
|
if [ -f /vagrant/cache/add-ons/#{sdk}.tar.gz ] ; then
|
|
|
|
echo Installing from cache
|
|
|
|
tar -C #{sdk_loc}/add-ons -z -x -f /vagrant/cache/add-ons/#{sdk}.tar.gz
|
|
|
|
else
|
|
|
|
echo Installing via 'android'
|
|
|
|
#{sdk_loc}/tools/android update sdk --no-ui -a -t #{sdk} <<X
|
2013-05-25 15:00:31 +02:00
|
|
|
y
|
|
|
|
|
|
|
|
X
|
2013-05-31 08:48:39 +02:00
|
|
|
fi
|
2012-09-04 19:51:53 +02:00
|
|
|
"
|
|
|
|
|
|
|
|
not_if "test -d #{sdk_loc}/add-ons/#{sdk}"
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|