ruboto 0.10.1 → 0.10.2.rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. data/Gemfile +1 -1
  2. data/Gemfile.lock +1 -1
  3. data/Rakefile +110 -34
  4. data/assets/rakelib/ruboto.rake +181 -76
  5. data/assets/src/org/ruboto/JRubyAdapter.java +7 -3
  6. data/assets/src/org/ruboto/ScriptLoader.java +12 -4
  7. data/assets/src/ruboto/widget.rb +43 -34
  8. data/bin/ruboto +9 -4
  9. data/lib/ruboto/sdk_versions.rb +11 -2
  10. data/lib/ruboto/util/build.rb +1 -1
  11. data/lib/ruboto/util/update.rb +104 -32
  12. data/lib/ruboto/version.rb +1 -1
  13. data/test/activity/call_super_activity.rb +2 -3
  14. data/test/activity/dir_and_file_activity.rb +18 -0
  15. data/test/activity/dir_and_file_activity_test.rb +20 -0
  16. data/test/activity/image_button_and_button_activity.rb +4 -5
  17. data/test/activity/json_activity.rb +21 -0
  18. data/test/activity/json_activity_test.rb +17 -0
  19. data/test/activity/location_activity.rb +30 -0
  20. data/test/activity/location_activity_test.rb +17 -0
  21. data/test/activity/margins_activity.rb +0 -1
  22. data/test/activity/option_menu_activity.rb +0 -1
  23. data/test/activity/psych_activity.rb +8 -2
  24. data/test/activity/ssl_activity.rb +31 -0
  25. data/test/activity/ssl_activity_test.rb +22 -0
  26. data/test/activity/stack_activity.rb +0 -1
  27. data/test/activity/stack_activity_test.rb +4 -5
  28. data/test/activity/subclass_activity.rb +0 -1
  29. data/test/activity/view_constants_activity.rb +0 -1
  30. data/test/app_test_methods.rb +19 -6
  31. data/test/minimal_app_test.rb +10 -10
  32. data/test/rake_test.rb +8 -8
  33. data/test/ruboto_gen_test.rb +18 -12
  34. data/test/ruboto_update_test.rb +16 -10
  35. data/test/test_helper.rb +16 -35
  36. metadata +21 -9
@@ -49,14 +49,18 @@ class RubotoGenTest < Test::Unit::TestCase
49
49
  end
50
50
  end
51
51
 
52
- # APK was smaller than 277.2KB: 61.9KB. PLATFORM: CURRENT, ANDROID_TARGET: 10.
53
- # APK was smaller than 278.1KB: 67.2KB. PLATFORM: CURRENT, ANDROID_TARGET: 15.
54
- # APK was larger than 5800.0KB: 5879.2KB. PLATFORM: STANDALONE, ANDROID_TARGET: 15, JRuby: 1.6.7.
55
- # APK was larger than 7100.0KB: 7341.1KB. PLATFORM: STANDALONE, ANDROID_TARGET: 10, JRuby: 1.7.0.preview2.
56
- # APK was larger than 7308.0KB: 7558.3KB. PLATFORM: STANDALONE, ANDROID_TARGET: 15, JRuby: 1.7.0.preview2.
57
- # APK was larger than 4200.0KB: 7380.0KB. PLATFORM: STANDALONE, ANDROID_TARGET: 15, JRuby: 1.7.0.
58
- # APK was larger than 7600.0KB: 9962.1KB. PLATFORM: STANDALONE, ANDROID_TARGET: 10, JRuby: 1.7.2.dev.
59
-
52
+ # APK was 56.4KB. PLATFORM: CURRENT, ANDROID_TARGET: 7
53
+ # APK was 61.9KB. PLATFORM: CURRENT, ANDROID_TARGET: 10
54
+ # APK was 67.2KB. PLATFORM: CURRENT, ANDROID_TARGET: 15
55
+ # APK was 72.9KB. PLATFORM: CURRENT ANDROID_TARGET: 16
56
+ # APK was 5879.2KB. PLATFORM: STANDALONE, ANDROID_TARGET: 15, JRuby: 1.6.7
57
+ # APK was 7380.0KB. PLATFORM: STANDALONE, ANDROID_TARGET: 15, JRuby: 1.7.0
58
+ # APK was 7310.1KB. PLATFORM: STANDALONE, ANDROID_TARGET: 10, JRuby: 1.7.2
59
+ # APK was 7337.0KB. PLATFORM: STANDALONE, ANDROID_TARGET: 15, JRuby: 1.7.2.
60
+ # APK was 7317.4KB. PLATFORM: STANDALONE, ANDROID_TARGET: 15, JRuby: 1.7.3
61
+ # APK was 7332.1KB. PLATFORM: STANDALONE, ANDROID_TARGET: 16, JRuby: 1.7.3
62
+ # APK was 7405.8KB. PLATFORM: STANDALONE, ANDROID_TARGET: 15, JRuby: 1.7.4.dev
63
+ # APK was 7420.9KB. PLATFORM: STANDALONE, ANDROID_TARGET: 16, JRuby: 1.7.4.dev
60
64
  def test_new_apk_size_is_within_limits
61
65
  apk_size = BigDecimal(File.size("#{APP_DIR}/bin/RubotoTestApp-debug.apk").to_s) / 1024
62
66
  version = " PLATFORM: #{RUBOTO_PLATFORM}"
@@ -66,15 +70,17 @@ class RubotoGenTest < Test::Unit::TestCase
66
70
  '1.6.7' => 5900.0,
67
71
  '1.6.8' => 5900.0,
68
72
  '1.7.0' => ANDROID_TARGET < 15 ? 7400.0 : 7600.0,
69
- '1.7.1.dev' => ANDROID_TARGET < 15 ? 7400.0 : 7600.0,
70
- '1.7.2.dev' => 9970.0,
71
- }[JRUBY_JARS_VERSION.to_s] || 7600.0
73
+ '1.7.1' => ANDROID_TARGET < 15 ? 7400.0 : 7600.0,
74
+ '1.7.2' => 7400.0,
75
+ '1.7.3' => 7400.0,
76
+ }[JRUBY_JARS_VERSION.to_s] || 7500.0
72
77
  version << ", JRuby: #{JRUBY_JARS_VERSION.to_s}"
73
78
  else
74
79
  upper_limit = {
80
+ 7 => 62.0,
75
81
  10 => 62.0,
76
82
  15 => 63.0,
77
- }[ANDROID_TARGET] || 64.0
83
+ }[ANDROID_TARGET] || 73.0
78
84
  end
79
85
  lower_limit = upper_limit * 0.9
80
86
  assert apk_size <= upper_limit, "APK was larger than #{'%.1f' % upper_limit}KB: #{'%.1f' % apk_size.ceil(1)}KB.#{version}"
@@ -1,17 +1,24 @@
1
1
  if ENV['SKIP_RUBOTO_UPDATE_TEST']
2
2
  puts 'Detected SKIP_RUBOTO_UPDATE_TEST environment variable. Skipping Ruboto update test.'
3
- else
4
- require File.expand_path('updated_example_test_methods', File.dirname(__FILE__))
5
- require File.expand_path('update_test_methods', File.dirname(__FILE__))
3
+ example_limit = 0
4
+ elsif ENV['RUBOTO_UPDATE_EXAMPLES']
5
+ example_limit = ENV['RUBOTO_UPDATE_EXAMPLES'].to_i
6
+ puts "Detected RUBOTO_UPDATE_EXAMPLES environment variable. Limiting to #{example_limit} examples."
7
+ end
8
+ require File.expand_path('updated_example_test_methods', File.dirname(__FILE__))
9
+ require File.expand_path('update_test_methods', File.dirname(__FILE__))
6
10
 
7
11
  # TODO(uwe): Delete obsolete examples when we stop supporting updating from them.
8
12
 
9
- Dir.chdir "#{RubotoTest::PROJECT_DIR}/examples/" do
10
- Dir["#{RubotoTest::APP_NAME}_*_tools_r*.tgz"].each do |f|
11
- next unless f =~ /^#{RubotoTest::APP_NAME}_(.*)_tools_r(.*)\.tgz$/
12
- ruboto_version = $1
13
- tools_version = $2
14
- self.class.class_eval <<EOF
13
+ Dir.chdir "#{RubotoTest::PROJECT_DIR}/examples/" do
14
+ example_archives = Dir["#{RubotoTest::APP_NAME}_*_tools_r*.tgz"]
15
+ example_archives = example_archives.sort_by{|a| Gem::Version.new a[RubotoTest::APP_NAME.size + 1..-1].slice(/(.*)(?=_tools_)/)}
16
+ example_archives = example_archives.last(example_limit) if example_limit
17
+ example_archives.each do |f|
18
+ next unless f =~ /^#{RubotoTest::APP_NAME}_(.*)_tools_r(.*)\.tgz$/
19
+ ruboto_version = $1
20
+ tools_version = $2
21
+ self.class.class_eval <<EOF
15
22
  class RubotoUpdatedExample#{ruboto_version.gsub('.', '_')}Tools#{tools_version}Test < Test::Unit::TestCase
16
23
  include UpdatedExampleTestMethods
17
24
  def setup
@@ -26,6 +33,5 @@ class RubotoUpdate#{ruboto_version.gsub('.', '_')}Tools#{tools_version}Test < Te
26
33
  end
27
34
  end
28
35
  EOF
29
- end
30
36
  end
31
37
  end
data/test/test_helper.rb CHANGED
@@ -20,7 +20,7 @@ module RubotoTest
20
20
  Gem.paths = GEM_PATH
21
21
  Gem.refresh
22
22
  `gem query -i -n bundler`
23
- system 'gem install bundler --no-ri --no-rdoc' unless $? == 0
23
+ system 'gem install bundler -v "!=1.3.1" --no-ri --no-rdoc' unless $? == 0
24
24
  `bundle check`
25
25
  system 'bundle --system' unless $? == 0
26
26
  lib_path = File.expand_path('lib', File.dirname(File.dirname(__FILE__)))
@@ -39,13 +39,13 @@ module RubotoTest
39
39
  '2.3.3' => 'android-10', '2.3.4' => 'android-10',
40
40
  '3.0' => 'android-11', '3.1' => 'android-12', '3.2' => 'android-13',
41
41
  '4.0.1' => 'android-14', '4.0.3' => 'android-15', '4.0.4' => 'android-15',
42
- '4.1' => 'android-16', '4.1.1' => 'android-16',
42
+ '4.1' => 'android-16', '4.1.1' => 'android-16', '4.1.2' => 'android-16',
43
43
  '4.2' => 'android-17',
44
44
  }
45
45
 
46
46
  def self.version_from_device
47
- puts "Reading OS version from device/emulator"
48
- system "adb wait-for-device"
47
+ puts 'Reading OS version from device/emulator'
48
+ system 'adb wait-for-device'
49
49
  IO.popen('adb bugreport').each_line do |line|
50
50
  if line =~ /sdk-eng (.*?) .*? .*? test-keys/
51
51
  version = $1
@@ -57,7 +57,7 @@ module RubotoTest
57
57
  return $1
58
58
  end
59
59
  end
60
- raise "Unable to read device/emulator apilevel"
60
+ raise 'Unable to read device/emulator apilevel'
61
61
  end
62
62
 
63
63
  def self.install_jruby_jars_gem
@@ -117,10 +117,10 @@ module RubotoTest
117
117
  RUBOTO_PLATFORM = ENV['RUBOTO_PLATFORM'] || 'CURRENT'
118
118
  puts "RUBOTO_PLATFORM: #{RUBOTO_PLATFORM}"
119
119
 
120
- install_jruby_jars_gem
120
+ install_jruby_jars_gem unless RUBOTO_PLATFORM == 'CURRENT'
121
121
 
122
122
  if RUBOTO_PLATFORM == 'CURRENT'
123
- JRUBY_JARS_VERSION = Gem::Version.new('1.7.1.dev')
123
+ JRUBY_JARS_VERSION = Gem::Version.new('1.7.1')
124
124
  else
125
125
  # FIXME(uwe): Simplify when we stop supporting rubygems < 1.8.0
126
126
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.8.0')
@@ -263,30 +263,7 @@ class Test::Unit::TestCase
263
263
  end
264
264
  check_platform_installation
265
265
  Dir.chdir APP_DIR do
266
- # FIXME(uwe): Simplify when we stop supporting JRuby < 1.7.0 which causes the ArrayIndexOutOfBoundsException
267
- # FIXME(uwe): Simplify if we find a cause for the system crashes.
268
- # system 'rake test:quick' # This line should replace all those below.
269
-
270
- retries = 0
271
- loop do
272
- output = `rake test:quick`
273
- puts output
274
- break if $? == 0
275
- retries += 1
276
- # FIXME(uwe): The cause of the system crash is unnown. We should investigate.
277
- if output =~ /INSTRUMENTATION_ABORTED: System has crashed./
278
- puts "System crash detected."
279
- elsif (RUBOTO_PLATFORM == 'CURRENT' || JRUBY_JARS_VERSION < Gem::Version.new('1.7.0')) &&
280
- output =~ /INSTRUMENTATION_RESULT: longMsg=java.lang.ArrayIndexOutOfBoundsException/
281
- puts "Known ArrayIndexOutOfBoundsException failure detected. Retrying (#{retries})."
282
- else
283
- break
284
- end
285
- break if retries >= 3
286
- puts "Retrying (#{retries})."
287
- end
288
- # EMXIF
289
-
266
+ system 'rake test:quick'
290
267
  assert_equal 0, $?, "tests failed with return code #$?"
291
268
  end
292
269
  end
@@ -295,9 +272,9 @@ class Test::Unit::TestCase
295
272
  if RUBOTO_PLATFORM == 'STANDALONE'
296
273
  system 'rake platform:uninstall'
297
274
  elsif RUBOTO_PLATFORM == 'CURRENT'
298
- system "rake platform:current platform:install"
275
+ system 'rake platform:current'
299
276
  elsif RUBOTO_PLATFORM == 'FROM_GEM'
300
- system "rake platform:debug platform:install"
277
+ system 'rake platform:install'
301
278
  else
302
279
  fail "Unknown Ruboto platform: #{RUBOTO_PLATFORM.inspect}"
303
280
  end
@@ -313,8 +290,12 @@ class Test::Unit::TestCase
313
290
  end
314
291
 
315
292
  def write_gemfile(bundle)
316
- puts "Adding Gemfile.apk: #{[*bundle].join(' ')}"
317
- File.open('Gemfile.apk', 'w') { |f| f << "source :rubygems\n\ngem 'sqldroid'\n" }
293
+ gems = [*bundle]
294
+ puts "Adding Gemfile.apk: #{gems.join(' ')}"
295
+ File.open('Gemfile.apk', 'w') do |f|
296
+ f << "source :rubygems\n\n"
297
+ gems.each{|g| f << "gem '#{g}'\n"}
298
+ end
318
299
  end
319
300
 
320
301
  end
metadata CHANGED
@@ -1,13 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruboto
3
3
  version: !ruby/object:Gem::Version
4
- hash: 53
5
- prerelease:
4
+ hash: -3617997014
5
+ prerelease: 7
6
6
  segments:
7
7
  - 0
8
8
  - 10
9
- - 1
10
- version: 0.10.1
9
+ - 2
10
+ - rc
11
+ - 0
12
+ version: 0.10.2.rc.0
11
13
  platform: ruby
12
14
  authors:
13
15
  - Daniel Jackoway
@@ -18,7 +20,7 @@ autorequire:
18
20
  bindir: bin
19
21
  cert_chain: []
20
22
 
21
- date: 2013-01-01 00:00:00 Z
23
+ date: 2013-03-05 00:00:00 Z
22
24
  dependencies:
23
25
  - !ruby/object:Gem::Dependency
24
26
  name: main
@@ -134,10 +136,16 @@ files:
134
136
  - lib/ruboto.rb
135
137
  - test/activity/call_super_activity.rb
136
138
  - test/activity/call_super_activity_test.rb
139
+ - test/activity/dir_and_file_activity.rb
140
+ - test/activity/dir_and_file_activity_test.rb
137
141
  - test/activity/image_button_activity.rb
138
142
  - test/activity/image_button_activity_test.rb
139
143
  - test/activity/image_button_and_button_activity.rb
140
144
  - test/activity/image_button_and_button_activity_test.rb
145
+ - test/activity/json_activity.rb
146
+ - test/activity/json_activity_test.rb
147
+ - test/activity/location_activity.rb
148
+ - test/activity/location_activity_test.rb
141
149
  - test/activity/margins_activity.rb
142
150
  - test/activity/margins_activity_test.rb
143
151
  - test/activity/navigation_activity.rb
@@ -149,6 +157,8 @@ files:
149
157
  - test/activity/psych_activity.rb
150
158
  - test/activity/psych_activity_test.rb
151
159
  - test/activity/ruby_file_activity.rb
160
+ - test/activity/ssl_activity.rb
161
+ - test/activity/ssl_activity_test.rb
152
162
  - test/activity/stack_activity.rb
153
163
  - test/activity/stack_activity_test.rb
154
164
  - test/activity/subclass_activity.rb
@@ -187,12 +197,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
187
197
  required_rubygems_version: !ruby/object:Gem::Requirement
188
198
  none: false
189
199
  requirements:
190
- - - ">="
200
+ - - ">"
191
201
  - !ruby/object:Gem::Version
192
- hash: 3
202
+ hash: 25
193
203
  segments:
194
- - 0
195
- version: "0"
204
+ - 1
205
+ - 3
206
+ - 1
207
+ version: 1.3.1
196
208
  requirements: []
197
209
 
198
210
  rubyforge_project: ruboto/ruboto