ruboto 1.2.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +5 -3
  3. data/README.md +1 -1
  4. data/RELEASE_CANDICATE_DOC.md +22 -5
  5. data/RELEASE_DOC.md +58 -26
  6. data/Rakefile +68 -163
  7. data/Vagrantfile +46 -0
  8. data/assets/rakelib/ruboto.device.rb +170 -0
  9. data/assets/rakelib/ruboto.rake +121 -239
  10. data/assets/rakelib/ruboto.stdlib.rake +1 -1
  11. data/assets/src/org/ruboto/JRubyAdapter.java +1 -0
  12. data/lib/ruboto/sdk_versions.rb +5 -4
  13. data/lib/ruboto/util/emulator.rb +6 -4
  14. data/lib/ruboto/util/setup.rb +40 -23
  15. data/lib/ruboto/util/update.rb +61 -13
  16. data/lib/ruboto/version.rb +1 -1
  17. data/test/activity/dir_and_file_activity_test.rb +3 -3
  18. data/test/activity/json_activity.rb +11 -0
  19. data/test/activity/navigation_activity_test.rb +2 -1
  20. data/test/activity/stack_activity_test.rb +16 -12
  21. data/test/app_test_methods.rb +4 -4
  22. data/test/arjdbc_test.rb +18 -7
  23. data/test/broadcast_receiver_test.rb +1 -1
  24. data/test/gem_test.rb +1 -1
  25. data/test/git_based_gem_test.rb +1 -1
  26. data/test/minimal_app_test.rb +7 -5
  27. data/test/rake_test.rb +3 -3
  28. data/test/ruboto_activity_test.rb +1 -1
  29. data/test/ruboto_gen_test.rb +25 -11
  30. data/test/ruboto_setup_test.rb +1 -1
  31. data/test/ruboto_update_test.rb +3 -3
  32. data/test/sample_broadcast_receiver_test.rb +1 -1
  33. data/test/service_block_test.rb +1 -1
  34. data/test/service_gen_class_test.rb +1 -1
  35. data/test/service_infile_class_test.rb +1 -1
  36. data/test/splash_test.rb +1 -1
  37. data/test/sqldroid_test.rb +1 -1
  38. data/test/test_helper.rb +22 -18
  39. data/test/update_test_methods.rb +1 -1
  40. data/test/updated_example_test_methods.rb +1 -1
  41. data/test/uppercase_package_name_test.rb +3 -3
  42. metadata +20 -3
@@ -163,7 +163,7 @@ def remove_unneeded_parts_of_stdlib
163
163
  end
164
164
 
165
165
  # Corrects bug in krypt that loads FFI.
166
- # Only affects JRuby 1.7.11, 1.7.12, and 9000 (until fixed).
166
+ # Only affects JRuby 1.7.11, 1.7.12, and 9.0.0.0 (until fixed).
167
167
  # FIXME(uwe): Remove when we stop supporting JRuby 1.7.11 and 1.7.12
168
168
  Dir['**/provider.rb'].each do |f|
169
169
  print "patching #{f}..."
@@ -126,6 +126,7 @@ public class JRubyAdapter {
126
126
  @SuppressWarnings({ "unchecked", "rawtypes" })
127
127
  public static synchronized boolean setUpJRuby(Context appContext, PrintStream out) {
128
128
  if (!initialized) {
129
+ Log.d("Max memory: " + (Runtime.getRuntime().maxMemory() / (1024 * 1024)) + "MB");
129
130
  // BEGIN Ruboto HeapAlloc
130
131
  // @SuppressWarnings("unused")
131
132
  // byte[] arrayForHeapAllocation = new byte[13 * 1024 * 1024];
@@ -6,16 +6,17 @@ module Ruboto
6
6
  '2.3.3' => 10, '2.3.4' => 10, '2.3.5' => 10, '2.3.6' => 10, '2.3.7' => 10,
7
7
  '3.0' => 11, '3.1' => 12, '3.2' => 13, '4.0.1' => 14, '4.0.3' => 15,
8
8
  '4.0.4' => 15, '4.1' => 16, '4.1.1' => 16, '4.1.2' => 16, '4.2' => 17,
9
- '4.2.2' => 17, '4.3' => 18, '4.4.2' => 19,
9
+ '4.2.2' => 17, '4.3' => 18, '4.3.1' => 18, '4.4.2' => 19, '5.0.1' => 21, '5.1' => 22
10
10
  }
11
11
  API_LEVEL_TO_VERSION = {
12
12
  10 => '2.3.3', 11 => '3.0', 12 => '3.1', 13 => '3.2', 14 => '4.0',
13
- 15 => '4.0.3', 16 => '4.1.2', 17 => '4.2.2', 18 => '4.3', 19 => '4.4.2',
13
+ 15 => '4.0.3', 16 => '4.1.2', 17 => '4.2.2', 18 => '4.3.1',
14
+ 19 => '4.4.2', 21 => '5.0.1', 22 => '5.1'
14
15
  }
15
16
 
16
- MINIMUM_SUPPORTED_SDK_LEVEL = 10
17
+ MINIMUM_SUPPORTED_SDK_LEVEL = 15
17
18
  MINIMUM_SUPPORTED_SDK = "android-#{MINIMUM_SUPPORTED_SDK_LEVEL}"
18
- DEFAULT_TARGET_SDK_LEVEL = 15
19
+ DEFAULT_TARGET_SDK_LEVEL = 16
19
20
  DEFAULT_TARGET_SDK = "android-#{DEFAULT_TARGET_SDK_LEVEL}"
20
21
  end
21
22
  end
@@ -113,20 +113,21 @@ module Ruboto
113
113
  if sdk_level.to_i == 10
114
114
  abi_opt = '--abi armeabi'
115
115
  elsif has_x86 && (ON_MAC_OS_X || ON_WINDOWS)
116
+ # FIXME(uwe): Use x86 on Linux?
116
117
  abi_opt = '--abi x86'
117
118
  else
118
119
  abi_opt = '--abi armeabi-v7a'
119
120
  end
120
121
  # EMXIF
121
122
 
122
- skin_filename = "#{Ruboto::SdkLocations::ANDROID_HOME}/platforms/android-L/skins/HVGA/hardware.ini"
123
+ skin_filename = "#{Ruboto::SdkLocations::ANDROID_HOME}/platforms/android-#{sdk_level}/skins/HVGA/hardware.ini"
123
124
  if File.exists?(skin_filename)
124
125
  old_skin_config = File.read(skin_filename)
125
126
  new_skin_config = old_skin_config.gsub(/vm.heapSize=([0-9]*)/) { |m| $1.to_i < heap_size ? "vm.heapSize=#{heap_size}" : m }
126
127
  File.write(skin_filename, new_skin_config) if new_skin_config != old_skin_config
127
128
  end
128
129
 
129
- puts `echo n | android create avd -a -n #{avd_name} -t android-#{sdk_level} #{abi_opt} -c 64M -s HVGA -d "Nexus One"`
130
+ puts `echo no | android create avd -a -n #{avd_name} -t android-#{sdk_level} #{abi_opt} -c 64M -s HVGA -d "Nexus One"`
130
131
 
131
132
  if $? != 0
132
133
  puts 'Failed to create AVD.'
@@ -134,10 +135,11 @@ module Ruboto
134
135
  end
135
136
  # avd_config_file_name = "#{avd_home}/config.ini"
136
137
  # old_avd_config = File.read(avd_config_file_name)
137
- # new_avd_config = old_avd_config.gsub(/vm.heapSize=([0-9]*)/) { |m| $1.to_i < heap_size ? "vm.heapSize=#{heap_size}" : m }
138
+ # new_avd_config = old_avd_config.dup
139
+ # new_avd_config.gsub!(/vm.heapSize=([0-9]*)/) { |m| $1.to_i < heap_size ? "vm.heapSize=#{heap_size}" : m }
138
140
  # add_property(new_avd_config, 'hw.device.manufacturer', 'Generic')
139
141
  # add_property(new_avd_config, 'hw.device.name', '3.2" HVGA slider (ADP1)')
140
- # add_property(new_avd_config, 'hw.mainKeys', 'yes')
142
+ # add_property(new_avd_config, 'hw.mainKeys', 'no')
141
143
  # add_property(new_avd_config, 'hw.sdCard', 'yes')
142
144
  # File.write(avd_config_file_name, new_avd_config) if new_avd_config != old_avd_config
143
145
 
@@ -6,7 +6,7 @@ module Ruboto
6
6
  module Setup
7
7
  include Ruboto::Util::Verify
8
8
  REPOSITORY_BASE = 'http://dl-ssl.google.com/android/repository'
9
- REPOSITORY_URL = "#{REPOSITORY_BASE}/repository-8.xml"
9
+ REPOSITORY_URL = "#{REPOSITORY_BASE}/repository-10.xml"
10
10
  SDK_DOWNLOAD_PAGE = 'http://developer.android.com/sdk/index.html?hl=sk'
11
11
 
12
12
  RUBOTO_GEM_ROOT = File.expand_path '../../../..', __FILE__
@@ -110,7 +110,7 @@ module Ruboto
110
110
  require 'open-uri'
111
111
 
112
112
  doc = REXML::Document.new(open(REPOSITORY_URL))
113
- version = doc.root.elements.to_a("sdk:#{type}/sdk:revision").map do |t|
113
+ doc.root.elements.to_a("sdk:#{type}/sdk:revision").map do |t|
114
114
  major = t.elements['sdk:major']
115
115
  minor = t.elements['sdk:minor']
116
116
  micro = t.elements['sdk:micro']
@@ -122,7 +122,6 @@ module Ruboto
122
122
  version += "_rc#{prev.text}" if prev
123
123
  version
124
124
  end.compact.sort_by { |v| Gem::Version.new(v.gsub('_', '.')) }.last
125
- version
126
125
  end
127
126
 
128
127
  def get_android_sdk_version
@@ -145,7 +144,7 @@ module Ruboto
145
144
 
146
145
  link = page_content.scan(/#{regex}/)
147
146
  raise "SDK link cannot be found on download page: #{SDK_DOWNLOAD_PAGE}" if link.nil?
148
-
147
+
149
148
  version = link.to_s.match(/r(\d+.)?(\d+.)?(\d+)/)[0]
150
149
  raise "SDK version cannot be determined from download page: #{SDK_DOWNLOAD_PAGE}" if version.nil?
151
150
 
@@ -190,9 +189,20 @@ module Ruboto
190
189
  when MAC_OS_X
191
190
  @haxm_kext_loc = '/System/Library/Extensions/intelhaxm.kext'
192
191
  found = File.exists?(@haxm_kext_loc)
193
- @haxm_kext_loc = nil unless found
194
- puts "#{'%-25s' % 'Intel HAXM'}: #{(found ? 'Found' : 'Not found')}"
192
+ if found
193
+ @haxm_kext_version = `kextstat | grep com.intel.kext.intelhaxm`.slice(/\(.*\)/)[1..-2]
194
+ else
195
+ @haxm_kext_loc = nil
196
+ end
197
+ # FIXME(uwe): Use the system version to choose the right .dmg
198
+ os_x_version = ENV['_system_version']
195
199
  @haxm_installer_loc = Dir[File.join(android_package_directory, 'extras', 'intel', 'Hardware_Accelerated_Execution_Manager', 'IntelHAXM*.dmg')].first
200
+ @haxm_installer_version = @haxm_installer_loc.slice(/IntelHAXM_1.1.1_/)[10..-2]
201
+ if @haxm_kext_version == @haxm_installer_version
202
+ puts "#{'%-25s' % 'Intel HAXM'}: #{(found ? "Found" : 'Not found')}"
203
+ else
204
+ puts "#{'%-25s' % 'Intel HAXM'}: Old #{@haxm_kext_version}/#{@haxm_installer_version}"
205
+ end
196
206
  when LINUX
197
207
  @haxm_installer_loc = 'Not supported, yet.'
198
208
  @haxm_kext_loc = 'Not supported, yet.'
@@ -213,8 +223,9 @@ module Ruboto
213
223
  end
214
224
 
215
225
  def check_for_build_tools
216
- @dx_loc = check_for('dx', 'Android SDK Command dx',
217
- Dir[File.join android_package_directory, 'build-tools', '*', windows? ? 'dx.bat' : 'dx'][-1])
226
+ dx_locations = Dir[File.join android_package_directory, 'build-tools', '*', windows? ? 'dx.bat' : 'dx']
227
+ sorted_dx_locations = dx_locations.sort_by { |f| Gem::Version.new f[%r{build-tools/[^/]+/}][12..-2] }
228
+ @dx_loc = check_for('dx', 'Android SDK Command dx', sorted_dx_locations[-1])
218
229
  end
219
230
 
220
231
  def check_for_android_sdk
@@ -281,19 +292,23 @@ module Ruboto
281
292
  puts "#{pretty_name} was not found."
282
293
  installer = package_installer
283
294
  if installer
284
- unless accept_all
285
- print 'Would you like to and install it? (Y/n): '
286
- a = STDIN.gets.chomp.upcase
287
- end
288
- if accept_all || a == 'Y' || a.empty?
289
- puts "sudo #{installer} install -y #{package_name}"
290
- IO.popen("sudo #{installer} install -y #{package_name}") {|io| while (l = io.gets) do; puts l; end }
291
- else
292
- puts
293
- puts "You can install #{pretty_name} manually by:"
294
- puts "sudo #{installer} install #{package_name}"
295
- puts
296
- end
295
+ unless accept_all
296
+ print 'Would you like to and install it? (Y/n): '
297
+ a = STDIN.gets.chomp.upcase
298
+ end
299
+ if accept_all || a == 'Y' || a.empty?
300
+ puts "sudo #{installer} install -y #{package_name}"
301
+ IO.popen("sudo #{installer} install -y #{package_name}") do |io|
302
+ while (l = io.gets)
303
+ puts l
304
+ end
305
+ end
306
+ else
307
+ puts
308
+ puts "You can install #{pretty_name} manually by:"
309
+ puts "sudo #{installer} install #{package_name}"
310
+ puts
311
+ end
297
312
  else
298
313
  puts "Package installer not found. You'll need to install #{pretty_name} manually."
299
314
  end
@@ -573,8 +588,10 @@ module Ruboto
573
588
  if accept_all || a == 'Y' || a.empty?
574
589
  case android_package_os_id
575
590
  when MAC_OS_X
591
+ puts "Mounting the HAXM install image"
576
592
  system "hdiutil attach #{@haxm_installer_loc}"
577
593
  fileName = Dir['/Volumes/IntelHAXM*/IntelHAXM*.mpkg'][0]
594
+ puts "Starting the HAXM installer. Sudo password required."
578
595
  system "sudo -S installer -pkg #{fileName} -target /"
579
596
  when LINUX
580
597
  puts ' HAXM installation on Linux is not supported, yet.'
@@ -610,9 +627,9 @@ module Ruboto
610
627
 
611
628
  def update_sdk(update_cmd, accept_all)
612
629
  if accept_all
613
- IO.popen(update_cmd, 'r+') do |cmd_io|
630
+ IO.popen(update_cmd, 'r+', external_encoding: Encoding::BINARY) do |cmd_io|
614
631
  begin
615
- output = ''
632
+ output = ''.encode(Encoding::BINARY)
616
633
  question_pattern = /.*Do you accept the license '[a-z-]+-[0-9a-f]{8}' \[y\/n\]: /m
617
634
  STDOUT.sync = true
618
635
  cmd_io.each_char do |text|
@@ -463,7 +463,7 @@ module Ruboto
463
463
  raise "Unpacking jruby-core jar failed: #$?" unless $? == 0
464
464
  File.delete jruby_core
465
465
  gem_version = Gem::Version.new(jruby_core_version.to_s.tr('-', '.'))
466
- if gem_version >= Gem::Version.new('9000.dev')
466
+ if gem_version >= Gem::Version.new('9.0.0.0.SNAPSHOT')
467
467
  #noinspection RubyLiteralArrayInspection
468
468
  excluded_core_packages = [
469
469
 
@@ -507,7 +507,6 @@ module Ruboto
507
507
  'org/jruby/ant',
508
508
  # 'org/jruby/compiler', # Needed for initialization, but should not be necessary
509
509
  # 'org/jruby/compiler/impl', # Needed for initialization, but should not be necessary
510
- 'org/jruby/compiler/util',
511
510
  'org/jruby/demo',
512
511
  'org/jruby/embed/bsf',
513
512
  'org/jruby/embed/jsr223',
@@ -519,30 +518,79 @@ module Ruboto
519
518
  # 'org/jruby/runtime/invokedynamic', # Should be excluded
520
519
  # 'org/jruby/runtime/opto', # What is this?
521
520
  # 'org/jruby/runtime/opto/OptoFactory*', # What is this?
522
-
523
- # FIXME(uwe): We should filter the whole truffle package...
524
- # 'org/jruby/truffle',
525
-
521
+ 'org/jruby/truffle',
526
522
  'org/jruby/truffle/*.class',
527
523
  'org/jruby/truffle/nodes',
528
524
  'org/jruby/truffle/runtime/control',
529
525
  'org/jruby/truffle/runtime/core',
530
- 'org/jruby/truffle/runtime/lookup',
531
526
  'org/jruby/truffle/runtime/methods',
532
- 'org/jruby/truffle/runtime/objectstorage',
533
527
  'org/jruby/truffle/runtime/signal',
534
528
  'org/jruby/truffle/runtime/subsystems',
535
529
  'org/jruby/truffle/runtime/util',
536
530
  'org/jruby/truffle/runtime/*.class',
537
531
  'org/jruby/truffle/translator',
538
- # EMXIF
539
-
532
+ ]
533
+ elsif gem_version >= Gem::Version.new('1.7.20.dev')
534
+ # TODO(uwe): Remove when we stop supporting jruby-jars 1.7.20
535
+ excluded_core_packages = [
536
+ '**/*.sh',
537
+ '**/*Aix*',
538
+ '**/*Darwin*',
539
+ '**/*darwin*',
540
+ '**/*FreeBSD*',
541
+ '**/*freebsd*',
542
+ '**/*MacOS*',
543
+ '**/*OpenBSD*',
544
+ '**/*openbsd*',
545
+ '**/*Solaris*',
546
+ '**/*sunos*',
547
+ '**/*Windows*',
548
+ '**/*windows*',
549
+ 'META-INF',
550
+ 'com/headius/invokebinder',
551
+ 'com/headius/options/example',
552
+ 'com/kenai/constantine',
553
+ 'com/kenai/jffi',
554
+ 'com/kenai/jnr/x86asm',
555
+ 'com/martiansoftware',
556
+ 'jni',
557
+ 'jnr/constants/platform/fake',
558
+ 'jnr/enxio',
559
+ 'jnr/ffi/annotations',
560
+ 'jnr/ffi/byref',
561
+ 'jnr/ffi/mapper',
562
+ 'jnr/ffi/provider',
563
+ 'jnr/ffi/util',
564
+ 'jnr/ffi/Struct$*',
565
+ 'jnr/ffi/types',
566
+ 'jnr/x86asm',
567
+ 'org/jruby/ant',
568
+ 'org/jruby/cext',
569
+ 'org/jruby/compiler/impl/BaseBodyCompiler*',
570
+ 'org/jruby/compiler/util',
571
+ 'org/jruby/demo',
572
+ 'org/jruby/embed/bsf',
573
+ 'org/jruby/embed/jsr223',
574
+ 'org/jruby/embed/osgi',
575
+ 'org/jruby/ext/ffi/AbstractMemory*',
576
+ 'org/jruby/ext/ffi/Enums*',
577
+ 'org/jruby/ext/ffi/io',
578
+ 'org/jruby/ext/ffi/jffi',
579
+ 'org/jruby/javasupport/bsf',
540
580
  'org/yecht',
541
- 'yaml.rb', # This looks like 1.8 stdlib...
581
+ 'yaml.rb',
542
582
  ]
543
- elsif gem_version >= Gem::Version.new('1.7.17.dev')
583
+ elsif gem_version >= Gem::Version.new('1.7.19')
584
+ # TODO(uwe): Remove when we stop supporting jruby-jars 1.7.19
585
+ excluded_core_packages = %w(**/*.sh **/*Darwin* **/*Solaris* **/*windows* **/*Windows* META-INF com/headius/invokebinder com/headius/options/example com/kenai/constantine com/kenai/jffi com/kenai/jnr/x86asm com/martiansoftware jni jnr/constants/platform/darwin jnr/constants/platform/fake jnr/constants/platform/freebsd jnr/constants/platform/openbsd jnr/constants/platform/sunos jnr/enxio jnr/ffi/annotations jnr/ffi/byref jnr/ffi/mapper jnr/ffi/provider jnr/ffi/util jnr/ffi/Struct$* jnr/ffi/types jnr/posix/Aix* jnr/posix/FreeBSD* jnr/posix/MacOS* jnr/posix/OpenBSD* jnr/x86asm org/jruby/ant org/jruby/cext org/jruby/compiler/impl/BaseBodyCompiler* org/jruby/compiler/util org/jruby/demo org/jruby/embed/bsf org/jruby/embed/jsr223 org/jruby/embed/osgi org/jruby/ext/ffi/AbstractMemory* org/jruby/ext/ffi/Enums* org/jruby/ext/ffi/io org/jruby/ext/ffi/jffi org/jruby/javasupport/bsf org/yecht yaml.rb)
586
+ elsif gem_version >= Gem::Version.new('1.7.18')
587
+ # TODO(uwe): Remove when we stop supporting jruby-jars 1.7.18
588
+ excluded_core_packages = %w(**/*Darwin* **/*Solaris* **/*windows* **/*Windows* META-INF com/headius/invokebinder com/headius/options/example com/kenai/constantine com/kenai/jffi com/kenai/jnr/x86asm com/martiansoftware jni jnr/constants/platform/darwin jnr/constants/platform/fake jnr/constants/platform/freebsd jnr/constants/platform/openbsd jnr/constants/platform/sunos jnr/enxio jnr/ffi/annotations jnr/ffi/byref jnr/ffi/mapper jnr/ffi/provider jnr/ffi/util jnr/ffi/Struct$* jnr/ffi/types jnr/posix/Aix* jnr/posix/FreeBSD* jnr/posix/MacOS* jnr/posix/OpenBSD* jnr/x86asm org/jruby/ant org/jruby/cext org/jruby/compiler/impl/BaseBodyCompiler* org/jruby/compiler/util org/jruby/demo org/jruby/embed/bsf org/jruby/embed/jsr223 org/jruby/embed/osgi org/jruby/ext/ffi/AbstractMemory* org/jruby/ext/ffi/Enums* org/jruby/ext/ffi/io org/jruby/ext/ffi/jffi org/jruby/javasupport/bsf org/yecht yaml.rb)
589
+ elsif gem_version >= Gem::Version.new('1.7.17')
590
+ # TODO(uwe): Remove when we stop supporting jruby-jars 1.7.17
544
591
  excluded_core_packages = %w(*.sh **/*Darwin* **/*Solaris* **/*windows* **/*Windows* META-INF com/headius/invokebinder com/headius/options/example com/kenai/constantine com/kenai/jffi com/kenai/jnr/x86asm com/martiansoftware jni jnr/constants/platform/darwin jnr/constants/platform/fake jnr/constants/platform/freebsd jnr/constants/platform/openbsd jnr/constants/platform/sunos jnr/enxio jnr/ffi/annotations jnr/ffi/byref jnr/ffi/mapper jnr/ffi/provider jnr/ffi/util jnr/ffi/Struct$* jnr/ffi/types jnr/posix/Aix* jnr/posix/FreeBSD* jnr/posix/MacOS* jnr/posix/OpenBSD* jnr/x86asm org/jruby/ant org/jruby/cext org/jruby/compiler/impl/BaseBodyCompiler* org/jruby/compiler/util org/jruby/demo org/jruby/embed/bsf org/jruby/embed/jsr223 org/jruby/embed/osgi org/jruby/ext/ffi/AbstractMemory* org/jruby/ext/ffi/Enums* org/jruby/ext/ffi/io org/jruby/ext/ffi/jffi org/jruby/javasupport/bsf org/yecht yaml.rb)
545
592
  elsif gem_version >= Gem::Version.new('1.7.12')
593
+ # TODO(uwe): Remove when we stop supporting jruby-jars 1.7.12
546
594
  excluded_core_packages = %w(**/*Darwin* **/*Solaris* **/*windows* **/*Windows* META-INF com/headius/invokebinder com/headius/options/example com/kenai/constantine com/kenai/jffi com/kenai/jnr/x86asm com/martiansoftware jni jnr/constants/platform/darwin jnr/constants/platform/fake jnr/constants/platform/freebsd jnr/constants/platform/openbsd jnr/constants/platform/sunos jnr/enxio jnr/ffi/annotations jnr/ffi/byref jnr/ffi/mapper jnr/ffi/provider jnr/ffi/util jnr/ffi/Struct$* jnr/ffi/types jnr/posix/Aix* jnr/posix/FreeBSD* jnr/posix/MacOS* jnr/posix/OpenBSD* jnr/x86asm org/jruby/ant org/jruby/cext org/jruby/compiler/impl/BaseBodyCompiler* org/jruby/compiler/util org/jruby/demo org/jruby/embed/bsf org/jruby/embed/jsr223 org/jruby/embed/osgi org/jruby/ext/ffi/AbstractMemory* org/jruby/ext/ffi/Enums* org/jruby/ext/ffi/io org/jruby/ext/ffi/jffi org/jruby/javasupport/bsf org/yecht yaml.rb)
547
595
  elsif gem_version >= Gem::Version.new('1.7.5')
548
596
  # TODO(uwe): Remove when we stop supporting jruby-jars 1.7.5
@@ -570,7 +618,7 @@ module Ruboto
570
618
  excluded_core_packages.each do |i|
571
619
  if File.directory? i
572
620
  FileUtils.remove_dir(i, true) rescue puts "Failed to remove package: #{i} (#{$!})"
573
- elsif Dir[i].each { |f| FileUtils.rm_rf f }.empty?
621
+ elsif Dir.glob(i, File::FNM_CASEFOLD).each { |f| FileUtils.rm_rf f }.empty?
574
622
  print "exclude pattern #{i.inspect} found no files..."
575
623
  end
576
624
  end
@@ -1,4 +1,4 @@
1
1
  module Ruboto
2
- VERSION = '1.2.0'
2
+ VERSION = '1.3.0'
3
3
  UPDATE_VERSION_LIMIT = '0.7.0'
4
4
  end
@@ -11,10 +11,10 @@ setup do |activity|
11
11
  end
12
12
 
13
13
  test('__FILE__ is set OK') do |activity|
14
- assert_matches %r{jar:file:/data/app/org.ruboto.test_app-[12].apk!/dir_and_file_activity.rb},
14
+ assert_matches %r{jar:file:/data/app/org.ruboto.test_app-[123](?:/base)?.apk!/dir_and_file_activity.rb},
15
15
  activity.find_view_by_id(42).text.to_s
16
- assert_matches %r{jar:file:/data/app/org.ruboto.test_app-[12].apk!},
16
+ assert_matches %r{jar:file:/data/app/org.ruboto.test_app-[123](?:/base)?.apk!},
17
17
  activity.find_view_by_id(43).text.to_s
18
- assert_matches %r{file:/data/app/org.ruboto.test_app-[12].apk!/AndroidManifest.xml},
18
+ assert_matches %r{file:/data/app/org.ruboto.test_app-[123](?:/base)?.apk!/AndroidManifest.xml},
19
19
  activity.find_view_by_id(44).text.to_s
20
20
  end
@@ -4,6 +4,17 @@ require 'ruboto/widget'
4
4
 
5
5
  ruboto_import_widgets :LinearLayout, :TextView
6
6
 
7
+ # I/System.out( 1700): Starting JSON Parser Service
8
+ # D/dalvikvm( 1700): JIT code cache reset in 102 ms (1048444 bytes 1/0)
9
+ # F/libc ( 1700): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 1709 (FinalizerDaemon)
10
+ # D/dalvikvm( 1700): GC_CONCURRENT freed 2352K, 9% free 28484K/30980K, paused 26ms+126ms, total 834ms
11
+ # D/dalvikvm( 1700): WAIT_FOR_CONCURRENT_GC blocked 673ms
12
+ # I/DEBUG ( 35): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
13
+ # I/DEBUG ( 35): Build fingerprint: 'generic/sdk/generic:4.2.2/JB_MR1.1/576024:eng/test-keys'
14
+ # I/DEBUG ( 35): Revision: '0'
15
+ # I/DEBUG ( 35): pid: 1700, tid: 1709, name: UNKNOWN >>> org.ruboto.test_app <<<
16
+ # I/DEBUG ( 35): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000000
17
+
7
18
  class JsonActivity
8
19
  def onCreate(bundle)
9
20
  super
@@ -90,7 +90,7 @@ def start_activity_by_button(activity, button_id, activity_class_name = 'org.rub
90
90
  puts 'waitForIdleSync'
91
91
  waitForIdleSync
92
92
  puts 'wait_for_monitor_with_timeout'
93
- current_activity = wait_for_monitor_with_timeout(monitor, 10000)
93
+ current_activity = monitor.wait_for_activity_with_timeout(10000)
94
94
  ensure
95
95
  removeMonitor(monitor)
96
96
  end
@@ -101,6 +101,7 @@ end
101
101
 
102
102
  def button_activity_text(button_id, activity, expected_text_id, expected_text_string,
103
103
  activity_class_name = 'org.ruboto.RubotoActivity')
104
+ puts "Start activity: #{expected_text_string}"
104
105
  current_activity = start_activity_by_button(activity, button_id, activity_class_name)
105
106
  start = Time.now
106
107
  loop do
@@ -15,23 +15,27 @@ end
15
15
  # ANDROID: 15, PLATFORM: STANDALONE, JRuby: 1.7.0 '[28, 33, 51, 68]' expected, but got '[28, 33, 47, 64]'
16
16
  # ANDROID: 16, PLATFORM: 0.5.6, JRuby: 1.7.3 '[28, 33, 45, 62]' expected, but got '[28, 33, 44, 61]'
17
17
  # ANDROID: 16, PLATFORM: 0.6.0, JRuby: 9000.dev '[28, 33, 45, 62]' expected, but got '[28, 33, 45, 63]'
18
+ # ANDROID: 19, PLATFORM: STANDALONE, JRuby: 1.7.20-SNAPSHOT '[28, 33, 43, 60]' expected, but got '[28, 33, 44, 61]'
18
19
  # ANDROID: 20, PLATFORM: 1.0.2, JRuby: 1.7.12 '[28, 33, 44, 61]' expected, but got '[28, 33, 43, 60]'
20
+ # ANDROID: 21, PLATFORM: 1.0.2, JRuby: 1.7.12 '[28, 33, 44, 61]' expected, but got '[28, 33, 43, 60]'
21
+ # ANDROID: 22, PLATFORM: STANDALONE, JRuby: 1.7.20-SNAPSHOT '[28, 33, 44, 61]' expected, but got '[28, 33, 43, 60]'
19
22
  test('stack depth') do |activity|
20
- os_offset = {
21
- 10 => [0, 0, -1, -1],
22
- 13 => [1, 1, 0, 0],
23
- 20 => [0, 0, -1, -1],
24
- }[android.os.Build::VERSION::SDK_INT] || [0, 0, 0, 0]
25
- jruby_offset = {
26
- /^1\.7/ => [0, 0, 0, -1],
27
- /^9000/ => [0, 0, 0, 0],
28
- // => [0, 0, 0, 0],
29
- }.find { |k, v| org.jruby.runtime.Constants::VERSION =~ k }[1]
23
+ os_offset =
24
+ case android.os.Build::VERSION::SDK_INT
25
+ when 13 then [1, 1, 1, 1]
26
+ when (15..19) then [0, 0, 1, 1]
27
+ else [0, 0, 0, 0]
28
+ end
29
+ jruby_offset =
30
+ case org.jruby.runtime.Constants::VERSION
31
+ when /^1\.7/ then [0, 0, 0, -1]
32
+ else [0, 0, 0, 0]
33
+ end
30
34
  version_message ="ANDROID: #{android.os.Build::VERSION::SDK_INT}, PLATFORM: #{org.ruboto.JRubyAdapter.uses_platform_apk ? org.ruboto.JRubyAdapter.platform_version_name : 'STANDALONE'}, JRuby: #{org.jruby.runtime.Constants::VERSION}"
31
35
  assert_equal [28 + os_offset[0] + jruby_offset[0],
32
36
  33 + os_offset[1] + jruby_offset[1],
33
- 44 + os_offset[2] + jruby_offset[2],
34
- 62 + os_offset[3] + jruby_offset[3]], [
37
+ 43 + os_offset[2] + jruby_offset[2],
38
+ 61 + os_offset[3] + jruby_offset[3]], [
35
39
  activity.find_view_by_id(42).text.to_i,
36
40
  activity.find_view_by_id(43).text.to_i,
37
41
  activity.find_view_by_id(44).text.to_i,
@@ -38,11 +38,11 @@ module AppTestMethods
38
38
 
39
39
  def run_activity_tests(activity_dir)
40
40
  Dir[File.expand_path("#{activity_dir}/*", File.dirname(__FILE__))].each do |file|
41
- # FIXME(uwe): Remove when we stop testing JRuby < 1.7.14
42
- next if file =~ /rss/ && (JRUBY_JARS_VERSION < Gem::Version.new('1.7.14.dev'))
41
+ # FIXME(uwe): Remove when we stop testing JRuby < 1.7.20.dev
42
+ next if file =~ /rss/ && (JRUBY_JARS_VERSION < Gem::Version.new('1.7.20.dev'))
43
43
  # EMXIF
44
44
 
45
- # FIXME(uwe): Remove when we release RubotoCore based on JRuby 1.7.14
45
+ # FIXME(uwe): Remove when we release RubotoCore based on JRuby 1.7.20
46
46
  next if file =~ /rss/ && (RUBOTO_PLATFORM == 'CURRENT' || RUBOTO_PLATFORM == 'FROM_GEM')
47
47
  # EMXIF
48
48
 
@@ -51,7 +51,7 @@ module AppTestMethods
51
51
  next if file =~ /ssl/ && (ANDROID_OS < 16 ||
52
52
  RUBOTO_PLATFORM == 'CURRENT' || RUBOTO_PLATFORM == 'FROM_GEM' ||
53
53
  JRUBY_JARS_VERSION < Gem::Version.new('1.7.13') ||
54
- JRUBY_JARS_VERSION < Gem::Version.new('9000')) # FIXME(uwe): JRuby 9K should contain the SSLSocket fix.
54
+ JRUBY_JARS_VERSION < Gem::Version.new('9.0.0.0')) # FIXME(uwe): JRuby 9K should contain the SSLSocket fix.
55
55
  # EMXIF
56
56
 
57
57
  # FIXME(uwe): Remove when we stop testing JRuby < 1.7.4.dev
@@ -1,11 +1,21 @@
1
1
  require File.expand_path('test_helper', File.dirname(__FILE__))
2
2
 
3
3
  # FIXME(uwe): Remove check when we stop supporting Android < 4.0.3
4
- if RubotoTest::ANDROID_OS >= 15
4
+ if RubotoTest::ANDROID_OS >= 15 &&
5
+ # FIXME(uwe): Remove when CURRENT works with ARJDBC
6
+ RubotoTest::RUBOTO_PLATFORM != 'CURRENT' &&
7
+ # FIXME(uwe): Remove when CURRENT works with ARJDBC
8
+ RubotoTest::RUBOTO_PLATFORM != 'FROM_GEM'
5
9
 
6
- class ArjdbcTest < Test::Unit::TestCase
10
+ class ArjdbcTest < Minitest::Test
7
11
  def setup
8
- generate_app :bundle => [['activerecord', '<4.0.0'], 'activerecord-jdbcsqlite3-adapter', :sqldroid]
12
+ # FIXME(uwe): Simplify when RubotoCore is released with newer thread_safe
13
+ generate_app bundle: [
14
+ [:activerecord, RUBOTO_PLATFORM == 'CURRENT' ? '<4.0.0' : '<4.2.0'],
15
+ :'activerecord-jdbc-adapter',
16
+ :sqldroid,
17
+ ]
18
+ # EMXIF
9
19
  end
10
20
 
11
21
  def teardown
@@ -17,7 +27,9 @@ class ArjdbcTest < Test::Unit::TestCase
17
27
  File.open('src/ruboto_test_app_activity.rb', 'w'){|f| f << <<EOF}
18
28
  require 'ruboto/widget'
19
29
  require 'ruboto/util/stack'
30
+
20
31
  with_large_stack do
32
+ require 'rubygems'
21
33
  require 'active_record'
22
34
  end
23
35
 
@@ -53,15 +65,14 @@ class RubotoTestAppActivity
53
65
  def onResume
54
66
  super
55
67
 
56
- db_dir = "\#{application_context.files_dir}/sqlite"
68
+ db_file = "\#{application_context.files_dir}/sqlite"
57
69
 
58
70
  with_large_stack do
59
71
 
60
72
  ActiveRecord::Base.establish_connection(
61
- :adapter => 'jdbcsqlite3',
73
+ :adapter => 'sqlite3',
62
74
  :driver => 'org.sqldroid.SQLDroidDriver',
63
- :url => "jdbc:sqldroid:\#{db_dir}?timeout=60000&retry=1000",
64
- :database => db_dir,
75
+ :database => db_file,
65
76
  )
66
77
 
67
78
  begin