bin/calabash-android-build.rb in calabash-android-0.4.4 vs bin/calabash-android-build.rb in calabash-android-0.4.5.pre1
- old
+ new
@@ -9,11 +9,12 @@
test_server_file_name = test_server_path(app)
FileUtils.mkdir_p File.dirname(test_server_file_name) unless File.exist? File.dirname(test_server_file_name)
unsigned_test_apk = File.join(File.dirname(__FILE__), '..', 'lib/calabash-android/lib/TestServer.apk')
- android_platform = Dir["#{ENV["ANDROID_HOME"].gsub("\\", "/")}/platforms/android-*"].last
+ platforms = Dir["#{android_home_path}/platforms/android-*"].sort_by! { |item| '%08s' % item.split('-').last }
+ android_platform = platforms.last
raise "No Android SDK found in #{ENV["ANDROID_HOME"].gsub("\\", "/")}/platforms/" unless android_platform
Dir.mktmpdir do |workspace_dir|
Dir.chdir(workspace_dir) do
FileUtils.cp(unsigned_test_apk, "TestServer.apk")
FileUtils.cp(File.join(File.dirname(__FILE__), '..', 'test-server/AndroidManifest.xml'), "AndroidManifest.xml")
@@ -24,11 +25,11 @@
unless system %Q{"#{RbConfig.ruby}" -pi.bak -e "gsub(/#testPackage#/, '#{package_name(app)}.test')" AndroidManifest.xml}
raise "Could not replace test package name in manifest"
end
- unless system %Q{"#{ENV["ANDROID_HOME"]}/platform-tools/aapt" package -M AndroidManifest.xml -I "#{android_platform}/android.jar" -F dummy.apk}
+ unless system %Q{"#{tools_dir}/aapt" package -M AndroidManifest.xml -I "#{android_platform}/android.jar" -F dummy.apk}
raise "Could not create dummy.apk"
end
Zip::ZipFile.new("dummy.apk").extract("AndroidManifest.xml","customAndroidManifest.xml")
Zip::ZipFile.open("TestServer.apk") do |zip_file|
@@ -42,6 +43,6 @@
log e
raise "Could not sign test server"
end
end
puts "Done signing the test server. Moved it to #{test_server_file_name}"
-end
\ No newline at end of file
+end