Skip to content

Commit

Permalink
* Bumped version to 0.5.3.rc.2
Browse files Browse the repository at this point in the history
* Removed use of the --with-psych switch since we now include the complete Ruby 1.9 stdlib by default
* Changed how we omit psych tests on jruby-jars 1.5.6 to avoid stack overflow.
  • Loading branch information
donv committed Jan 11, 2012
1 parent a9745cc commit b236fa7
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 68 deletions.
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ namespace :platform do
task :project => PLATFORM_PROJECT

file PLATFORM_PROJECT do
sh "ruby -rubygems -I#{File.expand_path('lib', File.dirname(__FILE__))} bin/ruboto gen app --package org.ruboto.core --name RubotoCore --with-jruby #{'--with-psych' unless ON_JRUBY_JARS_1_5_6} --path #{PLATFORM_PROJECT}"
sh "ruby -rubygems -I#{File.expand_path('lib', File.dirname(__FILE__))} bin/ruboto gen app --package org.ruboto.core --name RubotoCore --with-jruby --path #{PLATFORM_PROJECT}"
Dir.chdir(PLATFORM_PROJECT) do
manifest = REXML::Document.new(File.read(MANIFEST_FILE))
manifest.root.attributes['android:versionCode'] = '408'
Expand Down
22 changes: 4 additions & 18 deletions lib/ruboto/commands/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,6 @@ def self.main
description "Generate the JRuby jars jar"
cast :boolean
}
option("with-psych") {
description "Generate the Psych YAML parser jar"
cast :boolean
}

def run
package = params['package'].value
Expand Down Expand Up @@ -94,7 +90,7 @@ def run
update_ruboto true
update_icons true
update_classes true
update_jruby true, params['with-psych'].value if params['with-jruby'].value || params['with-psych'].value
update_jruby true if params['with-jruby'].value
# update_build_xml
update_manifest min_sdk[/\d+/], target[/\d+/], true
update_core_classes "exclude"
Expand All @@ -114,14 +110,9 @@ def run
include Ruboto::Util::Update
include Ruboto::Util::Verify

option("with-psych") {
description "Generate the Psych YAML parser jar"
cast :boolean
}

def run
Dir.chdir root do
update_jruby true, params['with-psych'].value
update_jruby true
end
end
end
Expand Down Expand Up @@ -332,11 +323,6 @@ def run
description "force and update even if the version hasn't changed"
}

option("with-psych") {
description "Generate the Psych YAML parser jar"
cast :boolean
}

def run
case params['what'].value
when "app" then
Expand All @@ -347,12 +333,12 @@ def run
update_ruboto force
update_icons force
update_classes force
update_jruby force, params['with-psych'].value
update_jruby force
update_manifest nil, nil, force
update_core_classes "exclude"
update_bundle
when "jruby" then
update_jruby(params['force'].value, params['with-psych'].value) || abort
update_jruby(params['force'].value) || abort
when "ruboto" then
update_ruboto(params['force'].value) || abort
end
Expand Down
11 changes: 5 additions & 6 deletions lib/ruboto/util/update.rb
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def update_test(force = nil)
end
end

def update_jruby(force=nil, with_psych=nil)
def update_jruby(force=nil)
jruby_core = Dir.glob("libs/jruby-core-*.jar")[0]
jruby_stdlib = Dir.glob("libs/jruby-stdlib-*.jar")[0]
new_jruby_version = JRubyJars::VERSION
Expand All @@ -158,7 +158,7 @@ def update_jruby(force=nil, with_psych=nil)
log_action("Copying #{JRubyJars::core_jar_path} to libs") {copier.copy_from_absolute_path JRubyJars::core_jar_path, "libs"}
log_action("Copying #{JRubyJars::stdlib_jar_path} to libs") {copier.copy_from_absolute_path JRubyJars::stdlib_jar_path, "libs"}

reconfigure_jruby_libs(new_jruby_version, with_psych)
reconfigure_jruby_libs(new_jruby_version)

puts "JRuby version is now: #{new_jruby_version}"
true
Expand Down Expand Up @@ -293,9 +293,9 @@ def update_ruboto(force=nil)
end
end

def reconfigure_jruby_libs(jruby_core_version, with_psych=nil)
def reconfigure_jruby_libs(jruby_core_version)
reconfigure_jruby_core(jruby_core_version)
reconfigure_jruby_stdlib(with_psych)
reconfigure_jruby_stdlib
end

# - Removes unneeded code from jruby-core
Expand Down Expand Up @@ -360,8 +360,7 @@ def reconfigure_jruby_core(jruby_core_version)
end

# - Moves ruby stdlib to the root of the jruby-stdlib jar
# FIXME(uwe): Place stdlib and psych source in lib/ruby/site_ruby/1.8 since that is first in the load path generated by JRuby.
def reconfigure_jruby_stdlib(with_psych=nil)
def reconfigure_jruby_stdlib
excluded_stdlibs = [*verify_ruboto_config[:excluded_stdlibs]].compact
Dir.chdir 'libs' do
jruby_stdlib = JRubyJars::stdlib_jar_path.split('/')[-1]
Expand Down
2 changes: 1 addition & 1 deletion lib/ruboto/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Ruboto
VERSION = '0.5.3.rc.1'
VERSION = '0.5.3.rc.2'
end
36 changes: 16 additions & 20 deletions test/activity/psych_activity.rb
Original file line number Diff line number Diff line change
@@ -1,29 +1,25 @@
# TODO(uwe): Remove check when we stop supporting jruby-jars 1.5.6
if JRUBY_VERSION != '1.5.6'
require 'jruby'
require 'rbconfig'
org.jruby.ext.psych.PsychLibrary.new.load(JRuby.runtime, false)
$LOADED_FEATURES << 'psych.so'
$LOAD_PATH << File.join(Config::CONFIG['libdir'], 'ruby/1.9')
require 'psych.rb'
require 'jruby'
require 'rbconfig'
org.jruby.ext.psych.PsychLibrary.new.load(JRuby.runtime, false)
$LOADED_FEATURES << 'psych.so'
$LOAD_PATH << File.join(Config::CONFIG['libdir'], 'ruby/1.9')
require 'psych.rb'

Psych::Parser
Psych::Handler
Psych::Parser
Psych::Handler

require 'ruboto'
require 'ruboto'

ruboto_import_widgets :Button, :LinearLayout, :TextView
ruboto_import_widgets :Button, :LinearLayout, :TextView

$activity.handle_create do |bundle|
setTitle File.basename(__FILE__).chomp('_activity.rb').split('_').map { |s| "#{s[0..0].upcase}#{s[1..-1]}" }.join(' ')
$activity.handle_create do |bundle|
setTitle File.basename(__FILE__).chomp('_activity.rb').split('_').map { |s| "#{s[0..0].upcase}#{s[1..-1]}" }.join(' ')

setup_content do
linear_layout :orientation => LinearLayout::VERTICAL do
@decoded_view = text_view :id => 42, :text => Psych.load('--- foo')
# @encoded_view = text_view :id => 43, :text => Psych.dump("foo")
end
setup_content do
linear_layout :orientation => LinearLayout::VERTICAL do
@decoded_view = text_view :id => 42, :text => Psych.load('--- foo')
# @encoded_view = text_view :id => 43, :text => Psych.dump("foo")
end

end

end
27 changes: 12 additions & 15 deletions test/activity/psych_activity_test.rb
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
# TODO(uwe): Remove check when we stop supporting jruby-jars 1.5.6
if JRUBY_VERSION != '1.5.6'
activity org.ruboto.test_app.PsychActivity
activity org.ruboto.test_app.PsychActivity

setup do |activity|
start = Time.now
loop do
@text_view = activity.findViewById(42)
break if @text_view || (Time.now - start > 60)
sleep 1
end
assert @text_view
setup do |activity|
start = Time.now
loop do
@text_view = activity.findViewById(42)
break if @text_view || (Time.now - start > 60)
sleep 1
end
assert @text_view
end

test('psych_encode_decode') do |activity|
assert_equal 'foo', activity.find_view_by_id(42).text.to_s
#assert_equal "--- foo\n...\n", activity.find_view_by_id(43).text.to_s
end
test('psych_encode_decode') do |activity|
assert_equal 'foo', activity.find_view_by_id(42).text.to_s
#assert_equal "--- foo\n...\n", activity.find_view_by_id(43).text.to_s
end
4 changes: 4 additions & 0 deletions test/app_test_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module AppTestMethods
include RubotoTest

def test_activity_tests
# TODO(uwe): Remove check when we stop supporting jruby-jars 1.5.6
if not ON_JRUBY_JARS_1_5_6
assert_code 'YamlLoads', "with_large_stack{require 'yaml'}"
else
Expand All @@ -14,6 +15,9 @@ def test_activity_tests
assert_code 'DirListsFilesInApk', 'Dir["#{File.dirname(__FILE__)}/*"].each{|f| raise "File #{f.inspect} not found" unless File.exists?(f)}'

Dir[File.expand_path('activity/*_test.rb', File.dirname(__FILE__))].each do |test_src|
# TODO(uwe): Remove check when we stop supporting jruby-jars 1.5.6
next if ON_JRUBY_JARS_1_5_6 && test_src == 'psych_activity_test.rb'

snake_name = test_src.chomp('_test.rb')
activity_name = File.basename(snake_name).split('_').map { |s| "#{s[0..0].upcase}#{s[1..-1]}" }.join
Dir.chdir APP_DIR do
Expand Down
8 changes: 3 additions & 5 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,12 @@ def log(message = '')
end

def generate_app(options = {})
with_psych = options.delete(:with_psych) || false
update = options.delete(:update) || false
excluded_stdlibs = options.delete(:excluded_stdlibs)
raise "Unknown options: #{options.inspect}" unless options.empty?
Dir.mkdir TMP_DIR unless File.exists? TMP_DIR

if with_psych || excluded_stdlibs
if excluded_stdlibs
system 'rake platform:uninstall'
else
system 'rake platform:install'
Expand All @@ -108,7 +107,7 @@ def generate_app(options = {})
end

FileUtils.rm_rf APP_DIR if File.exists? APP_DIR
template_dir = "#{APP_DIR}_template_#{$$}#{'_with_psych' if with_psych}#{'_updated' if update}#{"_without_#{excluded_stdlibs.map{|ed| ed.gsub(/[.\/]/, '_')}.join('_')}" if excluded_stdlibs}"
template_dir = "#{APP_DIR}_template_#{$$}#{'_updated' if update}#{"_without_#{excluded_stdlibs.map{|ed| ed.gsub(/[.\/]/, '_')}.join('_')}" if excluded_stdlibs}"
if File.exists?(template_dir)
puts "Copying app from template #{template_dir}"
FileUtils.cp_r template_dir, APP_DIR, :preserve => true
Expand All @@ -125,14 +124,13 @@ def generate_app(options = {})
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}" }
FileUtils.touch "libs/psych.jar" if with_psych
exclude_stdlibs(excluded_stdlibs) if excluded_stdlibs
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} --target #{ANDROID_TARGET} #{'--with-psych' if with_psych}"
system "#{RUBOTO_CMD} gen app --package #{PACKAGE} --path #{APP_DIR} --name #{APP_NAME} --target #{ANDROID_TARGET}"
if $? != 0
FileUtils.rm_rf APP_DIR
raise "gen app failed with return code #$?"
Expand Down
4 changes: 2 additions & 2 deletions test/update_test_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ module UpdateTestMethods
include RubotoTest
include AppTestMethods

def setup(with_psych = false)
generate_app(:with_psych => with_psych, :update => true)
def setup
generate_app :update => true
end

def teardown
Expand Down

0 comments on commit b236fa7

Please sign in to comment.