Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

* Changed icon

* Separated 'build apk' (debug) and 'install' tasks in Rakefile
* Started looking at pushing test scripts to speed up test rerun
* Leave app icon alone on 'ruboto update app'
* Bumped to version 0.2.2.dev
  • Loading branch information...
commit 17036d3fc5b9ff47a7229f1724453953329aff43 1 parent 791e7c9
@donv donv authored
View
1  Rakefile
@@ -9,6 +9,7 @@ task :release do
end
task :test do
+ FileUtils.rm_rf Dir['tmp/RubotoTestApp_template*']
Dir['test/*_test.rb'].each do |f|
require f.chomp('.rb')
end
View
55 assets/Rakefile
@@ -16,6 +16,7 @@ stdlib = jars.grep(/stdlib/).first #libs/jruby-stdlib-VERSION.jar
jruby_jar = jars.grep(/core/).first #libs/jruby-core-VERSION.jar
MANIFEST_FILE = 'AndroidManifest.xml'
APK_FILE = "bin/#{build_project_name}-debug.apk"
+TEST_APK_FILE = "test/bin/#{build_project_name}Test-debug.apk"
CLEAN.include('tmp', 'bin')
@@ -27,8 +28,8 @@ task :debug => [BUNDLE_JAR, :mark_update] do
end
desc "build package and install it on the emulator or device"
-task :install => [BUNDLE_JAR, :mark_update] do
- sh 'ant install'
+task :install => [APK_FILE, BUNDLE_JAR, :mark_update] do
+ sh 'ant ruboto-install-debug' unless package_installed?
end
task :tag => :release do
@@ -92,25 +93,31 @@ file MANIFEST_FILE
file APK_FILE => MANIFEST_FILE do
puts "#{MANIFEST_FILE} changed. Forcing rebuild of #{APK_FILE}."
- Rake::Task['install:clean'].invoke
+ Rake::Task['debug'].invoke
end
desc 'Copy scripts to emulator or device'
task :update_scripts => [BUNDLE_JAR, APK_FILE] do
sdcard_path = "/mnt/sdcard/Android/data/#{package}/files"
app_files_path = "/data/data/#{package}/files"
- if package_installed? && device_path_exists?(sdcard_path)
- puts 'Pushing files to apk public file area.'
- data_dir = sdcard_path
- elsif package_installed? && device_path_exists?(app_files_path)
- puts 'Pushing files to apk private file area.'
- data_dir = app_files_path
+ if package_installed?
+ if device_path_exists?(sdcard_path)
+ puts 'Pushing files to apk public file area.'
+ data_dir = sdcard_path
+ elsif device_path_exists?(app_files_path)
+ puts 'Pushing files to apk private file area.'
+ data_dir = app_files_path
+ else
+ puts 'Cannot find the scripts directory on the device.'
+ puts 'If you have a non-rooted device, you need to add'
+ puts %q{ <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />}
+ puts 'to the AndroidManifest.xml file to enable the update_scripts rake task.'
+ puts "Reverting to uninstalling and re-installing the apk."
+ Rake::Task['install:clean'].invoke
+ next
+ end
else
- puts 'Cannot find the scripts directory on the device.'
- puts 'If you have a non-rooted device, you need to add'
- puts %q{ <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />}
- puts 'to the AndroidManifest.xml file to enable the update_scripts rake task.'
- puts "Reverting to uninstalling and re-installing the apk."
+ puts 'Cannot find the app on the device. Installing it.'
Rake::Task['install:clean'].invoke
next
end
@@ -136,7 +143,7 @@ end
task :update_test_scripts do
test_scripts_path = "/data/data/#{package}.tests/files/scripts"
# TODO(uwe): Investigate if we can just push the scripts instead of building and installing the instrumentation APK
- if false && package_installed?(true) && device_path_exists?(test_scripts_path)
+ if package_installed?(true) && device_path_exists?(test_scripts_path)
Dir['test/assets/scripts/*.rb'].each do |script|
print "#{script}: " ; $stdout.flush
`adb push #{script} #{test_scripts_path}`
@@ -252,12 +259,18 @@ end
def package_installed? test = false
package_name = "#{package}#{'.tests' if test}"
- app_paths = ['', '-0', '-1', '-2'].map{|i| "/data/app/#{package_name}#{i}.apk"}
- path_outputs = app_paths.map{|p| `adb shell ls #{p}`.chomp}
- path_outputs.each_with_index do |o, i|
- if o == app_paths[i]
- puts "Found package #{app_paths[i]}"
- return true
+ ['', '-0', '-1', '-2'].each do |i|
+ p = "/data/app/#{package_name}#{i}.apk"
+ o = `adb shell ls -l #{p}`.chomp
+ if o =~ /^-rw-r--r-- system\s+system\s+(\d+) \d{4}-\d{2}-\d{2} \d{2}:\d{2} #{File.basename(p)}$/
+ apk_file = test ? TEST_APK_FILE : APK_FILE
+ if !File.exists?(apk_file) || $1.to_i == File.size(apk_file)
+ puts "Found package #{p}"
+ return true
+ else
+ puts "Package #{p} installed, but of wrong size."
+ return false
+ end
end
end
puts "Package not found: #{package_name}"
View
BIN  assets/res/drawable-hdpi/icon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  assets/res/drawable-ldpi/icon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  assets/res/drawable-mdpi/icon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
15 assets/src/org/ruboto/Script.java
@@ -58,8 +58,10 @@ public static synchronized ScriptingContainer setUpJRuby(Context appContext) {
public static synchronized ScriptingContainer setUpJRuby(Context appContext, PrintStream out) {
if (ruby == null) {
Log.d(TAG, "Setting up JRuby runtime");
- System.setProperty("jruby.interfaces.useProxy", "true");
System.setProperty("jruby.bytecode.version", "1.5");
+ System.setProperty("jruby.interfaces.useProxy", "true");
+ System.setProperty("jruby.management.enabled", "false");
+
// ruby = new ScriptingContainer(LocalContextScope.THREADSAFE);
ruby = new ScriptingContainer();
RubyInstanceConfig config = ruby.getProvider().getRubyInstanceConfig();
@@ -210,10 +212,10 @@ private static boolean isDebugBuild(Context context) {
}
- private static void copyScriptsIfNeeded(Context context) {
+ private static String scriptsDirName(Context context) {
File toFile = null;
if (isDebugBuild(context)) {
-
+
// FIXME(uwe): Simplify this as soon as we drop support for android-7 or JRuby 1.5.6 or JRuby 1.6.2
Log.i(TAG, "JRuby VERSION: " + org.jruby.runtime.Constants.VERSION);
if (!org.jruby.runtime.Constants.VERSION.equals("1.5.6") && !org.jruby.runtime.Constants.VERSION.equals("1.6.2") && android.os.Build.VERSION.SDK_INT >= 8) {
@@ -224,7 +226,7 @@ private static void copyScriptsIfNeeded(Context context) {
Log.e(TAG, "Calculated path to sdcard the old way: " + toFile);
}
// FIXME end
-
+
if (toFile == null || (!toFile.exists() && !toFile.mkdirs())) {
Log.e(TAG,
"Development mode active, but sdcard is not available. Make sure you have added\n<uses-permission android:name='android.permission.WRITE_EXTERNAL_STORAGE' />\nto your AndroidManifest.xml file.");
@@ -234,6 +236,11 @@ private static void copyScriptsIfNeeded(Context context) {
toFile = context.getFilesDir();
}
String to = toFile.getAbsolutePath() + "/scripts";
+ return to;
+ }
+
+ private static void copyScriptsIfNeeded(Context context) {
+ String to = scriptsDirName(context);
Log.i(TAG, "Checking scripts in " + to);
/* the if makes sure we only do this the first time */
if (configDir(to)) {
View
12 assets/src/org/ruboto/test/InstrumentationTestRunner.java
@@ -4,6 +4,7 @@
import android.util.Log;
import java.io.BufferedReader;
import java.io.File;
+import java.io.FileInputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.IOException;
@@ -41,7 +42,15 @@ public TestSuite getAllTests() {
Script.defineGlobalVariable("$runner", this);
Script.defineGlobalVariable("$test", this);
Script.defineGlobalVariable("$suite", suite);
+
+ // TODO(uwe): Why doesn't this work?
+ // Script.copyScriptsIfNeeded(getContext());
+
loadScript("test_helper.rb");
+
+ // TODO(uwe): Why doesn't this work?
+ // String[] scripts = new File(Script.scriptsDirName(getContext())).list();
+
String[] scripts = getContext().getResources().getAssets().list("scripts");
for (String f : scripts) {
if (f.equals("test_helper.rb")) continue;
@@ -83,6 +92,9 @@ public void runTest() throws java.lang.Throwable {
}
private void loadScript(String f) throws IOException {
+ // TODO(uwe): Why doesn't this work?
+ // InputStream is = new FileInputStream(Script.scriptsDirName(getContext()) + "/" + f);
+
InputStream is = getContext().getResources().getAssets().open("scripts/" + f);
BufferedReader buffer = new BufferedReader(new InputStreamReader(is));
StringBuilder source = new StringBuilder();
View
0  icons/drawable-hdpi/icon.png → icons/drawable-hdpi/icon1.png
File renamed without changes
View
BIN  icons/drawable-hdpi/icon2.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
0  icons/drawable-ldpi/icon.png → icons/drawable-ldpi/icon1.png
File renamed without changes
View
BIN  icons/drawable-ldpi/icon2.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
0  icons/drawable-mdpi/icon.png → icons/drawable-mdpi/icon1.png
File renamed without changes
View
BIN  icons/drawable-mdpi/icon2.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
8 lib/ruboto/commands/base.rb
@@ -79,9 +79,11 @@ def run
Dir.chdir root do
update_test true
- update_assets true
+ update_assets
+ update_icons true
update_classes true
update_jruby true, params['with-psych'].value
+ update_build_xml
update_manifest min_sdk[/\d+/], target[/\d+/], true
update_core_classes "exclude"
@@ -310,9 +312,11 @@ def run
when "app" then
force = params['force'].value
update_test force
- update_assets force
+ update_assets
+ update_icons force
update_classes force
update_jruby force, params['with-psych'].value
+ update_build_xml
update_manifest nil, nil, force
update_core_classes "exclude"
when "ruboto" then
View
13 lib/ruboto/util/asset_copier.rb
@@ -1,14 +1,21 @@
module Ruboto
module Util
class AssetCopier
- def initialize(from, to)
+ def initialize(from, to, force = true)
@from = from
@to = to
+ @force = force
end
def copy(from, to='')
- FileUtils.mkdir_p(File.join(@to, to))
- FileUtils.cp_r(Dir[File.join(@from, from)], File.join(@to, to))
+ target_dir = File.join(@to, to)
+ file_pattern = File.directory?(File.join(@from, from)) ? File.join(from, '**/*') : from
+ existing_files = @force ? [] : Dir.chdir(target_dir){Dir[file_pattern].select{|f| !File.directory?(f)}}
+ files_to_copy = Dir.chdir(@from){Dir[file_pattern].select{|f| !File.directory?(f)}} - existing_files
+ files_to_copy.each do |f|
+ FileUtils.mkdir_p(File.join(target_dir, File.dirname(f)))
+ FileUtils.cp(File.join(@from, f), File.join(target_dir, f))
+ end
end
def copy_from_absolute_path(from, to='')
View
69 lib/ruboto/util/update.rb
@@ -15,12 +15,28 @@ def update_test(force = nil)
FileUtils.rm_rf File.join(root, 'test', 'src', verify_package.split('.'))
puts "Done"
else
+ # TODO(uwe): Run "android update test"
puts "Test project already exists. Use --force to overwrite."
end
Dir.chdir File.join(root, 'test') do
test_manifest = REXML::Document.new(File.read('AndroidManifest.xml')).root
test_manifest.elements['instrumentation'].attributes['android:name'] = 'org.ruboto.test.InstrumentationTestRunner'
+
+ # TODO(uwe): Trying to push test scripts for faster test cycle, by failing...
+ # if test_manifest.elements["uses-permission[@android:name='android.permission.WRITE_INTERNAL_STORAGE']"]
+ # puts 'Found permission tag'
+ # else
+ # test_manifest.add_element 'uses-permission', {"android:name" => "android.permission.WRITE_INTERNAL_STORAGE"}
+ # puts 'Added permission tag'
+ # end
+ # if test_manifest.elements["uses-permission[@android:name='android.permission.WRITE_EXTERNAL_STORAGE']"]
+ # puts 'Found external permission tag'
+ # else
+ # test_manifest.add_element 'uses-permission', {"android:name" => "android.permission.WRITE_EXTERNAL_STORAGE"}
+ # puts 'Added external permission tag'
+ # end
+
File.open("AndroidManifest.xml", 'w'){|f| test_manifest.document.write(f, 4)}
instrumentation_property = "test.runner=org.ruboto.test.InstrumentationTestRunner\n"
prop_lines = File.readlines('build.properties')
@@ -111,19 +127,28 @@ def update_jruby(force=nil, with_psych=nil)
true
end
- def update_assets(force = nil)
+ def update_assets
puts "\nCopying files:"
copier = Ruboto::Util::AssetCopier.new Ruboto::ASSETS, '.'
- %w{Rakefile .gitignore assets res test}.each do |f|
+ %w{Rakefile .gitignore assets test}.each do |f|
log_action(f) {copier.copy f}
end
end
+ def update_icons(force = nil)
+ copier = Ruboto::Util::AssetCopier.new Ruboto::ASSETS, '.', force
+ log_action('icons') do
+ copier.copy 'res/drawable*/icon.png'
+ # TODO(uwe): The icon for the test project is not displayed on the emulator/device. Why not?
+ # copier.copy 'res/drawable*/icon.png', 'test'
+ end
+ end
+
def update_classes(force = nil)
copier = Ruboto::Util::AssetCopier.new Ruboto::ASSETS, '.'
- log_action("Ruboto java classes"){copier.copy "src/org/ruboto/*.java", "src/org/ruboto"}
- log_action("Ruboto java test classes"){copier.copy "src/org/ruboto/test/*.java", "test/src/org/ruboto/test"}
+ log_action("Ruboto java classes"){copier.copy "src/org/ruboto/*.java"}
+ log_action("Ruboto java test classes"){copier.copy "src/org/ruboto/test/*.java", "test"}
end
def update_manifest(min_sdk, target, force = false)
@@ -206,21 +231,24 @@ def reconfigure_jruby_core(jruby_core_version)
`jar -xf #{jruby_core}`
File.delete jruby_core
invalid_libs = [
- 'META-INF' ,'cext', 'com/martiansoftware', 'ext', 'jline', 'jni', 'jnr',
- 'org/apache', 'org/jruby/ant', 'org/jruby/compiler/ir',
- 'org/jruby/demo', 'org/jruby/embed/bsf', 'org/jruby/embed/osgi',
- 'org/jruby/embed/jsr223', 'org/jruby/ext/ffi','org/jruby/javasupport/bsf',
+ 'META-INF', 'cext', 'com/martiansoftware', 'ext', 'jline', 'jni', 'jnr',
+ 'org/apache', 'org/jruby/ant', 'org/jruby/compiler/ir', 'org/jruby/demo', 'org/jruby/embed/bsf',
+ 'org/jruby/embed/jsr223', 'org/jruby/embed/osgi', 'org/jruby/ext/ffi','org/jruby/javasupport/bsf',
]
+
+ # TODO(uwe): Remove when we stop supporting jruby-jars-1.6.2
if jruby_core_version == '1.6.2'
puts 'Retaining FFI for JRuby 1.6.2'
invalid_libs.delete('org/jruby/ext/ffi')
end
+ # TODO end
+
invalid_libs.each {|i| FileUtils.remove_dir i, true}
- Dir['**/*'].select{|f| !File.directory?(f)}.map{|f| File.dirname(f)}.uniq.sort.reverse.each do |dir|
- `jar -cf ../jruby-core-#{dir.gsub('/', '.')}-#{jruby_core_version}.jar #{dir}`
- FileUtils.rm_rf dir
- end
+ #Dir['**/*'].select{|f| !File.directory?(f)}.map{|f| File.dirname(f)}.uniq.sort.reverse.each do |dir|
+ # `jar -cf ../jruby-core-#{dir.gsub('/', '.')}-#{jruby_core_version}.jar #{dir}`
+ # FileUtils.rm_rf dir
+ #end
`jar -cf ../#{jruby_core} .`
end
@@ -283,6 +311,23 @@ def reconfigure_jruby_stdlib(with_psych=nil)
FileUtils.remove_dir "1.8", true
end
end
+
+ def update_build_xml
+ ant_setup_line = /^(\s*<setup\s*\/>)/
+ patch = <<-EOF
+ <!-- BEGIN added by ruboto-core -->
+ <target name="ruboto-install-debug" description="Installs the already built debug package">
+ <install-helper />
+ </target>
+ <!-- END added by ruboto-core -->
+
+ EOF
+ ant_script = File.read('build.xml')
+ ant_script.gsub!(/\s*<!-- BEGIN added by ruboto-core -->.*?<!-- END added by ruboto-core -->\s*\n*/m, '')
+ ant_script.gsub!(ant_setup_line, "\\1\n\n#{patch}")
+ File.open('build.xml', 'w'){|f| f << ant_script}
+ end
+
end
end
end
View
14 performance.txt
@@ -0,0 +1,14 @@
+ServiceTest
+
+ruby test/service_test.rb
+
+0.2.2.dev Uwe's laptop:
+ Tot(tst)
+ 185 191(25) 195(24) 203(26) 160(24)
+1 161
+1-2 165( 24) 192
+1-2-3 165( 24)
+1-2-3-4 184( 25)
+1-2-3-4-6-7-8-9 232(1:23)
+1-2-3-4-6-7-8 190( 24) 158(24)
+1-2-3-4-5-6-7-8 183( 24) 180(24) 160(24)
View
2  ruboto-core.gemspec
@@ -2,7 +2,7 @@ require 'rake'
Gem::Specification.new do |s|
s.name = %q{ruboto-core}
- s.version = "0.2.1"
+ s.version = "0.2.2.dev"
s.date = Date.today.strftime '%Y-%m-%d'
s.authors = ["Daniel Jackoway", "Charles Nutter", "Scott Moyer", 'Uwe Kubosch']
s.email = %q{ruboto@googlegroups.com}
View
7 test/activity/image_button_and_button.rb
@@ -21,11 +21,4 @@
end
end
-# handle_image_click do |view|
-# if view.id == 43
-# @text_view.text = 'Image button pressed'
-# elsif view.id == 44
-# @text_view.text = 'Button pressed'
-# end
-# end
end
View
14 test/rake_test.rb
@@ -1,8 +1,6 @@
require File.expand_path("test_helper", File.dirname(__FILE__))
require 'fileutils'
-$stdout.sync = true
-
class RakeTest < Test::Unit::TestCase
def setup
generate_app
@@ -38,16 +36,4 @@ def test_that_update_scripts_task_copies_files_to_app_directory_when_permissions
end
end
- private
-
- def wait_for_dir(dir)
- puts "Waiting for app to generate script directory: #{dir}"
- start = Time.now
- loop do
- break if `adb shell ls -d #{dir}`.chomp =~ %r{^#{dir}$}
- flunk 'Timeout waiting for scripts directory to appear' if Time.now > start + 60
- sleep 1
- end
- end
-
end
View
15 test/ruboto_gen_test.rb
@@ -12,20 +12,21 @@ def setup
def teardown
cleanup_app
end
+
+ def test_icons_are_updated
+ Dir.chdir APP_DIR do
+ assert_equal 4032, File.size('res/drawable-hdpi/icon.png')
+ end
+ end
+
end
if not RubotoTest::ON_JRUBY_JARS_1_5_6
- class RubotoGenWithPsychTest < Test::Unit::TestCase
- include AppTestMethods
-
+ class RubotoGenWithPsychTest < RubotoGenTest
def setup
generate_app :with_psych => true
end
- def teardown
- cleanup_app
- end
-
def test_psych_jar_exists
assert File.exists?("#{APP_DIR}/libs/psych.jar"), "Failed to generate psych jar"
end
View
25 test/ruboto_update_test.rb
@@ -6,23 +6,7 @@ module UpdateTestMethods
include RubotoTest
def setup(with_psych = false)
- Dir.mkdir TMP_DIR unless File.exists? TMP_DIR
- FileUtils.rm_rf APP_DIR if File.exists? APP_DIR
- Dir.chdir TMP_DIR do
- system "tar xzf #{PROJECT_DIR}/examples/RubotoTestApp_0.1.0_jruby_1.6.3.dev.tgz"
- end
- if ENV['ANDROID_HOME']
- android_home = ENV['ANDROID_HOME']
- else
- android_home = File.dirname(File.dirname(`which adb`))
- end
- File.open("#{APP_DIR}/local.properties", 'w'){|f| f.puts "sdk.dir=#{android_home}"}
- File.open("#{APP_DIR}/test/local.properties", 'w'){|f| f.puts "sdk.dir=#{android_home}"}
- Dir.chdir APP_DIR do
- FileUtils.touch "libs/psych.jar" if with_psych
- system "#{RUBOTO_CMD} update app"
- assert_equal 0, $?, "update app failed with return code #$?"
- end
+ generate_app(:with_psych => with_psych, :update => true)
end
def teardown
@@ -35,6 +19,13 @@ def test_properties_and_ant_file_has_no_duplicates
assert_equal 1, File.readlines('test/build.xml').grep(/<macrodef name="run-tests-helper">/).size, 'Duplicate macro in build.xml'
end
end
+
+ def test_icons_are_untouched
+ Dir.chdir APP_DIR do
+ assert_equal 4100, File.size('res/drawable-hdpi/icon.png')
+ end
+ end
+
end
class RubotoUpdateTest < Test::Unit::TestCase
View
6 test/service_test.rb
@@ -2,8 +2,6 @@
require 'fileutils'
class ServiceTest < Test::Unit::TestCase
- include RubotoTest
-
def setup
generate_app
end
@@ -44,6 +42,6 @@ def test_service_startup
File.open(activity_filename, 'w') { |f| f << s }
end
run_app_tests
- end
+ end
-end
+ end
View
41 test/test_helper.rb
@@ -77,19 +77,38 @@ def log(message = '')
def generate_app(options = {})
with_psych = options.delete(:with_psych) || false
+ update = options.delete(:update) || false
raise "Unknown options: #{options.inspect}" unless options.empty?
Dir.mkdir TMP_DIR unless File.exists? TMP_DIR
FileUtils.rm_rf APP_DIR if File.exists? APP_DIR
- template_dir = "#{APP_DIR}_template_#{$$}#{'_with_psych' if with_psych}"
+ template_dir = "#{APP_DIR}_template_#{$$}#{'_with_psych' if with_psych}#{'_updated' if update}"
if File.exists?(template_dir)
puts "Copying app from template #{template_dir}"
FileUtils.cp_r template_dir, APP_DIR, :preserve => true
else
- puts "Generating app #{APP_DIR}"
- system "#{RUBOTO_CMD} gen app --package #{PACKAGE} --path #{APP_DIR} --name #{APP_NAME} --min_sdk #{ANDROID_TARGET} #{'--with-psych' if with_psych}"
- if $? != 0
- FileUtils.rm_rf template_dir
- raise "gen app failed with return code #$?"
+ if update
+ Dir.chdir TMP_DIR do
+ system "tar xzf #{PROJECT_DIR}/examples/RubotoTestApp_0.1.0_jruby_1.6.3.dev.tgz"
+ end
+ if ENV['ANDROID_HOME']
+ android_home = ENV['ANDROID_HOME']
+ else
+ android_home = File.dirname(File.dirname(`which adb`))
+ end
+ File.open("#{APP_DIR}/local.properties", 'w'){|f| f.puts "sdk.dir=#{android_home}"}
+ File.open("#{APP_DIR}/test/local.properties", 'w'){|f| f.puts "sdk.dir=#{android_home}"}
+ Dir.chdir APP_DIR do
+ FileUtils.touch "libs/psych.jar" if with_psych
+ system "#{RUBOTO_CMD} update app"
+ assert_equal 0, $?, "update app failed with return code #$?"
+ end
+ else
+ puts "Generating app #{APP_DIR}"
+ system "#{RUBOTO_CMD} gen app --package #{PACKAGE} --path #{APP_DIR} --name #{APP_NAME} --min_sdk #{ANDROID_TARGET} #{'--with-psych' if with_psych}"
+ if $? != 0
+ FileUtils.rm_rf APP_DIR
+ raise "gen app failed with return code #$?"
+ end
end
Dir.chdir APP_DIR do
system 'rake debug'
@@ -111,4 +130,14 @@ def run_app_tests
end
end
+ def wait_for_dir(dir)
+ puts "Waiting for app to generate script directory: #{dir}"
+ start = Time.now
+ loop do
+ break if `adb shell ls -d #{dir}`.chomp =~ %r{^#{dir}$}
+ flunk 'Timeout waiting for scripts directory to appear' if Time.now > start + 120
+ sleep 1
+ end
+ end
+
end
Please sign in to comment.
Something went wrong with that request. Please try again.