test/test_helper.rb in ruboto-1.0.2 vs test/test_helper.rb in ruboto-1.0.3

- old
+ new

@@ -44,11 +44,11 @@ IO.popen('adb bugreport').each_line do |line| if line =~ /sdk-eng (.*?) .*? .*? test-keys/ version = $1 api_level = VERSION_TO_API_LEVEL[version] raise "Unknown version: #{version}" if api_level.nil? - return api_level + return "android-#{api_level}" end if line =~ /\[ro\.build\.version\.sdk\]: \[(\d+)\]/ return $1 end end @@ -157,20 +157,22 @@ heap_alloc = options.delete(:heap_alloc) included_stdlibs = options.delete(:included_stdlibs) package = options.delete(:package) || PACKAGE standalone = options.delete(:standalone) || !!included_stdlibs || !!excluded_stdlibs || ENV['RUBOTO_PLATFORM'] == 'STANDALONE' update = options.delete(:update) || false + ruby_version = options.delete(:ruby_version) || (JRUBY_JARS_VERSION.to_s[0..0] == "9" ? 2.1 : 1.9) raise "Unknown options: #{options.inspect}" unless options.empty? raise 'Inclusion/exclusion of libs requires standalone mode.' if (included_stdlibs || excluded_stdlibs) && !standalone Dir.mkdir TMP_DIR unless File.exists? TMP_DIR FileUtils.rm_rf APP_DIR if File.exists? APP_DIR template_dir = "#{APP_DIR}_template_#{$$}" template_dir << "_package_#{package}" if package != PACKAGE template_dir << "_heap_alloc_#{heap_alloc}" if heap_alloc +# template_dir << "_ruby_version_#{ruby_version.to_s.gsub('.', '_')}" if ruby_version template_dir << "_example_#{example}" if example template_dir << "_bundle_#{[*bundle].join('_')}" if bundle template_dir << '_updated' if update template_dir << '_standalone' if standalone template_dir << "_without_#{excluded_stdlibs.map { |ed| ed.gsub(/[.\/]/, '_') }.join('_')}" if excluded_stdlibs @@ -185,11 +187,11 @@ end Dir.chdir APP_DIR do File.open('local.properties', 'w') { |f| f.puts "sdk.dir=#{ANDROID_HOME}" } File.open('test/local.properties', 'w') { |f| f.puts "sdk.dir=#{ANDROID_HOME}" } if standalone - write_ruboto_yml(included_stdlibs, excluded_stdlibs, heap_alloc) if included_stdlibs || excluded_stdlibs || heap_alloc + write_ruboto_yml(included_stdlibs, excluded_stdlibs, heap_alloc, ruby_version) if included_stdlibs || excluded_stdlibs || heap_alloc || ruby_version FileUtils.touch 'libs/jruby-core-x.x.x.jar' FileUtils.touch 'libs/jruby-stdlib-x.x.x.jar' install_jruby_jars_gem else FileUtils.rm(Dir['libs/{jruby-*.jar,dx.jar}']) @@ -207,11 +209,11 @@ FileUtils.rm_rf APP_DIR raise "gen app failed with return code #$?" end Dir.chdir APP_DIR do write_gemfile(bundle) if bundle - write_ruboto_yml(included_stdlibs, excluded_stdlibs, heap_alloc) if included_stdlibs || excluded_stdlibs || heap_alloc + write_ruboto_yml(included_stdlibs, excluded_stdlibs, heap_alloc, ruby_version) if included_stdlibs || excluded_stdlibs || heap_alloc || ruby_version if standalone system "#{RUBOTO_CMD} gen jruby" raise "update jruby failed with return code #$?" if $? != 0 end end @@ -285,17 +287,16 @@ FileUtils.rm_rf 'tmp/RubotoCore' fail 'Error (un)installing RubotoCore' end end - def write_ruboto_yml(included_stdlibs, excluded_stdlibs, heap_alloc) + def write_ruboto_yml(included_stdlibs, excluded_stdlibs, heap_alloc, ruby_version) yml = YAML.dump({'included_stdlibs' => included_stdlibs, 'excluded_stdlibs' => excluded_stdlibs, + # 'ruby_version' => ruby_version, 'heap_alloc' => heap_alloc}) puts "Adding ruboto.yml:\n#{yml}" - File.open('ruboto.yml', 'w') do |f| - f << yml - end + File.open('ruboto.yml', 'w') { |f| f << yml } end def write_gemfile(bundle) gems = [*bundle] puts "Adding Gemfile.apk: #{gems.join(' ')}"