bin/calabash-android-build.rb in calabash-android-0.3.6 vs bin/calabash-android-build.rb in calabash-android-0.3.7
- old
+ new
@@ -1,6 +1,5 @@
-require 'zip/zip'
def calabash_build(app)
keystore = read_keystore_info()
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)
@@ -21,36 +20,18 @@
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|
- zip_file.add("AndroidManifest.xml", "customAndroidManifest.xml")
+ zip_file.add("AndroidManifest.xml", "customAndroidManifest.xml")
end
end
- if is_windows?
- jarsigner_path = "\"#{ENV["JAVA_HOME"]}/bin/jarsigner.exe\""
- else
- jarsigner_path = "jarsigner"
- end
+ sign_apk("#{workspace_dir}/TestServer.apk", test_server_file_name)
+ begin
- 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)
- puts "jarsigner command: #{cmd}"
+ rescue Exception => e
+ log e
raise "Could not sign test server"
end
end
puts "Done signing the test server. Moved it to #{test_server_file_name}"
-end
-
-
-def read_keystore_info
- if File.exist? ".calabash_settings"
- JSON.parse(IO.read(".calabash_settings"))
- else
- {
- "keystore_location" => "#{ENV["HOME"]}/.android/debug.keystore",
- "keystore_password" => "android",
- "keystore_alias" => "androiddebugkey",
- "keystore_alias_password" => "android"
- }
- end
end
\ No newline at end of file