sdk_loc = node[:settings][:sdk_loc]
user = node[:settings][:user]
script "setup-android-sdk" do
timeout 14400
interpreter "bash"
user user
cwd "/tmp"
code "
tar zxvf /vagrant/cache/android-sdk_r21.0.1-linux.tgz
mv android-sdk-linux #{sdk_loc}
#{sdk_loc}/tools/android update sdk --no-ui -t platform-tool
#{sdk_loc}/tools/android update sdk --no-ui -t tool
"
not_if "test -d #{sdk_loc}"
end
execute "add-android-sdk-path" do
user user
path = "#{sdk_loc}/tools:#{sdk_loc}/platform-tools"
command "echo \"export PATH=\\$PATH:#{path} #PATH-SDK\" >> /home/#{user}/.bsenv"
not_if "grep PATH-SDK /home/#{user}/.bsenv"
end
execute "add-android-home" do
user user
command "echo \"export ANDROID_HOME=#{sdk_loc}\" >> /home/#{user}/.bsenv"
not_if "grep ANDROID_HOME /home/#{user}/.bsenv"
end
execute "add-maven-support-repo" do
user user
command "echo \"
android
androidandroid-support-repository
file:///opt/android/sdk/extras/android/m2repository/
\" > /home/#{user}/.m2/settings.xml"
not_if "grep m2repository /home/#{user}/.m2/settings.xml"
end
%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} <