Skip to content

Commit

Permalink
Build: Fix building, copy AndroidManifest along testserver.apk
Browse files Browse the repository at this point in the history
  • Loading branch information
TobiasRoikjer committed Dec 14, 2015
1 parent 4c8acb3 commit 6c6a11b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ instrumentation_backend/assets/foo.bar
**/.DS_STORE
ruby-gem/pkg
ruby-gem/lib/calabash-android/lib/TestServer.apk
ruby-gem/lib/calabash-android/lib/AndroidManifest.xml
ruby-gem/test-server/out
calabash-android-*.gem
.idea
Expand Down
8 changes: 8 additions & 0 deletions ruby-gem/Rakefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
require 'bundler'
load 'lib/calabash-android/env.rb'

# Monkey patch 'log' for env
class Env
def self.log(message, error = false)
$stdout.puts "#{Time.now.strftime("%Y-%m-%d %H:%M:%S")} - #{message}"
end
end

def build
test_server_template_dir = find_server_repo_or_raise

Expand Down Expand Up @@ -31,6 +38,7 @@ def build
FileUtils.mkdir_p "test_servers" unless File.exist? "test_servers"

FileUtils.cp(File.join(@test_server_dir, "bin", "Test_unsigned.apk"), File.join(File.dirname(__FILE__), 'lib/calabash-android/lib/TestServer.apk'))
FileUtils.cp(File.join(@test_server_dir, "AndroidManifest.xml"), File.join(File.dirname(__FILE__), 'lib/calabash-android/lib/AndroidManifest.xml'))
end
end

Expand Down
3 changes: 2 additions & 1 deletion ruby-gem/bin/calabash-android-build.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,13 @@ def calabash_build(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')
test_server_manifest = File.join(File.dirname(__FILE__), '..', 'lib', 'calabash-android', 'lib', 'AndroidManifest.xml')

android_platform = Env.android_platform_path
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")
FileUtils.cp(test_server_manifest, "AndroidManifest.xml")

unless system %Q{"#{RbConfig.ruby}" -pi.bak -e "gsub(/#targetPackage#/, '#{package_name(app)}')" AndroidManifest.xml}
raise "Could not replace package name in manifest"
Expand Down

0 comments on commit 6c6a11b

Please sign in to comment.