bin/calabash-android-build.rb in calabash-android-0.3.0.pre6 vs bin/calabash-android-build.rb in calabash-android-0.3.0.pre7
- old
+ new
@@ -10,21 +10,27 @@
FileUtils.cp(unsigned_test_apk, "TestServer.apk")
FileUtils.cp(File.join(File.dirname(__FILE__), '..', 'test-server/AndroidManifest.xml'), "AndroidManifest.xml")
unless system %Q{ruby -pi.bak -e "gsub(/#targetPackage#/, '#{package_name(app)}')" AndroidManifest.xml}
raise "Could not replace package name in manifest"
- end
-
+ end
+
unless system("#{ENV["ANDROID_HOME"]}/platform-tools/aapt package -M AndroidManifest.xml -I #{android_platform}/android.jar -F dummy.apk")
raise "Could not create dummy.apk"
- end
-
+ end
+
Zip::ZipFile.new("dummy.apk").extract("AndroidManifest.xml","customAndroidManifest.xml")
Zip::ZipFile.open("TestServer.apk") do |zip_file|
zip_file.add("AndroidManifest.xml", "customAndroidManifest.xml")
end
end
- cmd = "jarsigner -sigalg MD5withRSA -digestalg SHA1 -signedjar #{test_server_file_name} -storepass #{keystore["keystore_password"]} -keystore \"#{File.expand_path keystore["keystore_location"]}\" #{workspace_dir}/TestServer.apk #{keystore["keystore_alias"]}"
+ if is_windows?
+ jarsigner_path = "#{ENV["JAVA_HOME"]}/bin/jarsigner.exe"
+ else
+ jarsigner_path = "jarsigner"
+ end
+
+ cmd = "#{jarsigner_path} -sigalg MD5withRSA -digestalg SHA1 -signedjar #{test_server_file_name} -storepass #{keystore["keystore_password"]} -keystore \"#{File.expand_path keystore["keystore_location"]}\" #{workspace_dir}/TestServer.apk #{keystore["keystore_alias"]}"
unless system(cmd)
raise "Could not sign test server"
end
end
puts "Done signing the test server. Moved it to #{test_server_file_name}"
\ No newline at end of file