ruboto 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4bc93dda49229814d2889824399ff50031071d5a
4
- data.tar.gz: 69ec9f1793ddb2d08e0f715b495d3ec7ec5a5758
3
+ metadata.gz: adc0e9e39a3342af8a9ad5bdd60da98f76052857
4
+ data.tar.gz: d3a242735722909b2e3cee69a018e873b3d02fb9
5
5
  SHA512:
6
- metadata.gz: 5a7416a14f651cee7d9318c4342438c982c8d8a529b79e7dea044424eae1e2abe07461fc9ed5f12ff174dc23be32ade650fa1c9d9c1a9b13370b427ecd992504
7
- data.tar.gz: eb20558feac71d3fa8fd7f513e39c69eac3f965f79547bbbb39992f326925b5ea258a092cdf2c438ece7c244760f6647b69eb0b7be87c436e4898edb9a106457
6
+ metadata.gz: 7e703d5354259b4c66a6f5a25d9f52b16234b8fa42086c7fcd6b9f7900f3a46c9060348153b5e07236b2119b272b6d260bec74fbbd2555bbc6293d823fbc5d17
7
+ data.tar.gz: b85734194cb9a84e1c78f9dbf98e2798228ce8c1c4d7efd42ef23f8d979ad015b74d2ed9b4ef8099280ad24bf2c009c17ca42d7cbb09eb6bc35ef9dc46e545f4
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ruboto (1.1.0)
4
+ ruboto (1.1.1)
5
5
  main (~> 5.2)
6
6
  rake (~> 10.0)
7
7
  rubyzip (~> 1.0)
@@ -18,7 +18,7 @@ GEM
18
18
  fattr (>= 2.2.0)
19
19
  map (>= 5.1.0)
20
20
  map (6.5.3)
21
- rake (10.3.0)
21
+ rake (10.3.2)
22
22
  rubyzip (1.1.3)
23
23
 
24
24
  PLATFORMS
@@ -1,27 +1,12 @@
1
- Subject: [ANN] Ruboto 1.1.0 release candidate
1
+ Subject: [ANN] Ruboto 1.1.1 release candidate
2
2
 
3
3
  Hi all!
4
4
 
5
- The Ruboto 1.1.0 release candidate is now available.
6
-
7
- This release adds support for large projects with more than 64K methods
8
- and Ruby stdlib HTTPS/SSL. HTTPS/SSL using the Android APIs is working as
9
- before.
10
-
11
- To use the Ruby stdlib SSL features you need to include JRuby 1.7.13 or
12
- later in your app, and set the Android target to Android 4.1 (api level
13
- android-16) or later. JRuby 1.7.13 has not been released yet, but you can
14
- use the "jruby-1_7" or "master" branches of JRuby if you want to try it
15
- now.
16
-
17
- The large app feature utilises the "multi-dex" option of the Android
18
- tooling, and also requires the target of your project to be set to Android
19
- 4.1 (api level android-16) or later.
20
-
21
- The SSL feature is still new and will be improved in the coming releases
22
- of Ruboto. An example is that accessing GitHub by https does not work out
23
- of the box. This is being tracked as Issue #627 , and we would very much
24
- like contributors on this.
5
+ The Ruboto 1.1.1 release candidate is now available.
6
+
7
+ This release introduces a significant speedup of all UI actions by only
8
+ overriding those Java methods actually implemented in Ruby code. There
9
+ are also some bug fixes and improvements to the SSL and big-app features.
25
10
 
26
11
  As always we need your help and feedback to ensure the quality of the release. Please install the release candidate using
27
12
 
data/RELEASE_DOC.md CHANGED
@@ -1,6 +1,6 @@
1
- Subject: [ANN] Ruboto 1.1.0 released!
1
+ Subject: [ANN] Ruboto 1.1.1 released!
2
2
 
3
- The Ruboto team is pleased to announce the release of Ruboto 1.1.0.
3
+ The Ruboto team is pleased to announce the release of Ruboto 1.1.1.
4
4
 
5
5
  Ruboto (JRuby on Android) is a platform for developing full stand-alone
6
6
  apps for Android using the Ruby language and libraries. It includes
@@ -8,87 +8,27 @@ support libraries and generators for creating projects, classes, tests,
8
8
  and more. The complete APIs of Android, Java, and Ruby are available to
9
9
  you using the Ruby language.
10
10
 
11
- New in version 1.1.0:
12
-
13
- This release adds support for large projects with more than 64K methods
14
- and Ruby stdlib HTTPS/SSL. HTTPS/SSL using the Android APIs is working as
15
- before.
16
-
17
- To use the Ruby stdlib SSL features you need to include JRuby 1.7.13 or
18
- later in your app, and set the Android target to Android 4.1 (api level
19
- android-16) or later. JRuby 1.7.13 has not been released yet, but you can
20
- use the "jruby-1_7" or "master" branches of JRuby if you want to try it
21
- now.
22
-
23
- The large app feature utilises the "multi-dex" option of the Android
24
- tooling, and also requires the target of your project to be set to Android
25
- 4.1 (api level android-16) or later.
26
-
27
- The SSL feature is still new and will be improved in the coming releases
28
- of Ruboto. An example is that accessing GitHub by https does not work out
29
- of the box. This is being tracked as Issue #627 , and we would very much
30
- like contributors on this.
11
+ New in version 1.1.1:
12
+
13
+ This release introduces a significant speedup of all UI actions by only
14
+ overriding those Java methods actually implemented in Ruby code. There
15
+ are also some bug fixes and improvements to the SSL and big-app features.
31
16
 
32
17
  Features:
33
18
 
34
- * Issue #154 Add support for SSL
35
- * Issue #459 openssl jruby error
36
- * Issue #601 Support large projects using multiple dex files
37
- * Issue #605 Easily change the JRuby version with "ruboto <gen|update>
38
- jruby <version>"
39
- * Issue #606 Allow setting the JRuby version when creating or updating a
40
- project with "--with-jruby <version>"
41
- * Issue #608 Allow starting the emulator without using a snapshot
42
- * Issue #610 Screen Scraper alongside Repository XML (daneb)
43
- * Issue #611 Allow setting flags when starting a RubotoActivity
44
- * Issue #623 If the emulator starts, but does not respond, retry without
45
- loading a snapshot
46
- * Issue #624 Allow setting the Android API target level for "ruboto
47
- update app"
48
-
49
- Bugfixes:
50
-
51
- * Issue #342 require 'net/https' makes the app crash
52
- * Issue #586 ruboto doesn't recover from failed adb devices command
53
- * Issue #596 Detecting of dependencies misses open-uri due to dash in
54
- file name
55
- * Issue #597 Auto dependencies should not store application source
56
- * Issue #598 Ruboto-Core Package file is invalid
57
- * Issue #604 Use the correct archive name when downloading Android SDK
58
- components
59
- * Issue #612 Ruboto setup on Failing on Mac OS X
60
- * Issue #618 Intelhaxm - Mac OS X more generic (daneb)
61
- * Issue #622 Intelhaxm (daneb)
19
+ * Issue #619 Automatically switch multi-dex build on and off
20
+ * Issue #625 Avoid storing extra dex files in assets since they are not
21
+ source.
22
+ * Issue #628 Set tmpdir location
62
23
 
63
24
  Performance:
64
25
 
65
- * Issue #599 Speed up displaying Options Menu
66
- * Issue #616 Speed up Activity#setContentView
67
-
68
- Support:
69
-
70
- * Issue #591 Problem completing the "gosu_android game" tutorial
71
-
72
- Community:
73
-
74
- * Issue #567 How can I help? (Noeyfan)
75
- * Issue #570 How can I help? (aripoya)
76
- * Issue #571 How can I help? (cjbcross)
77
- * Issue #602 How can I help? (yamishi13)
78
- * Issue #603 How can I help? (daneb)
79
-
80
- Pull requests:
81
-
82
- * Issue #588 Wait for valid device before installing (bootstraponline)
83
- * Issue #609 Scraping of Android SDK for Latest Version (daneb)
84
-
85
- Other:
86
-
87
- * Issue #607 Remove the deprecated "ruboto update ruboto" command
26
+ * Issue #574 Will Android 4.4 ART influence Ruboto APP?
27
+ * Issue #629 Disable RubotoActivity methods that are not in use
88
28
 
89
29
  You can find a complete list of issues here:
90
30
 
91
- * https://github.com/ruboto/ruboto/issues?state=closed&milestone=19
31
+ * https://github.com/ruboto/ruboto/issues?state=closed&milestone=33
92
32
 
93
33
 
94
34
  Installation:
data/Rakefile CHANGED
@@ -620,3 +620,22 @@ task :get_jruby_jars_snapshot do
620
620
  end
621
621
  File.open(current_gem, 'wb') { |f| f << body }
622
622
  end
623
+
624
+ task '.travis.yml' do
625
+ puts "Regenerating #{'.travis.yml'}"
626
+ source = File.read('.travis.yml')
627
+ matrix = ''
628
+ [17, 16, 15].each.with_index do |api, i|
629
+ n = i
630
+ [['CURRENT', [nil]],['FROM_GEM', [nil]],['STANDALONE', [nil, '1.7.13', '1.7.12'].rotate(-i)]].each do |platform, versions|
631
+ versions.each do |v|
632
+ n = (n % 5) + 1
633
+ matrix << " - ANDROID_TARGET=#{api} RUBOTO_PLATFORM=#{platform.ljust(10)} TEST_PART=#{n}of5#{" JRUBY_JARS_VERSION=#{v}" if v}\n"
634
+ end
635
+ end
636
+ matrix << "\n"
637
+ end
638
+ matrix << " - ANDROID_TARGET=10 RUBOTO_PLATFORM=CURRENT\n"
639
+ matrix_str = " matrix:\n#{matrix}\nmatrix:"
640
+ File.write('.travis.yml', source.sub(/^ matrix:.*?matrix:/m, matrix_str))
641
+ end
@@ -91,6 +91,7 @@ JARS = Dir[File.expand_path 'libs/*.jar'] - JRUBY_JARS
91
91
  RESOURCE_FILES = Dir[File.expand_path 'res/**/*']
92
92
  JAVA_SOURCE_FILES = Dir[File.expand_path 'src/**/*.java']
93
93
  RUBY_SOURCE_FILES = Dir[File.expand_path 'src/**/*.rb']
94
+ RUBY_ACTIVITY_SOURCE_FILES = RUBY_SOURCE_FILES.select { |fn| fn =~ /_activity.rb$/ }
94
95
  OTHER_SOURCE_FILES = Dir[File.expand_path 'src/**/*'] - JAVA_SOURCE_FILES - RUBY_SOURCE_FILES
95
96
  CLASSES_CACHE = "#{PROJECT_DIR}/bin/#{build_project_name}-debug-unaligned.apk.d"
96
97
  BUILD_XML_FILE = "#{PROJECT_DIR}/build.xml"
@@ -100,6 +101,7 @@ KEYSTORE_FILE = (key_store = File.readlines('ant.properties').grep(/^key.store=/
100
101
  KEYSTORE_ALIAS = (key_alias = File.readlines('ant.properties').grep(/^key.alias=/).first) ? key_alias.chomp.sub(/^key.alias=/, '') : build_project_name
101
102
  APK_FILE_REGEXP = /^-rw-r--r--\s+(?:system|\d+\s+\d+)\s+(?:system|\d+)\s+(\d+)\s+(\d{4}-\d{2}-\d{2} \d{2}:\d{2}|\w{3} \d{2}\s+(?:\d{4}|\d{2}:\d{2}))\s+(.*)$/
102
103
  JRUBY_ADAPTER_FILE = "#{PROJECT_DIR}/src/org/ruboto/JRubyAdapter.java"
104
+ RUBOTO_ACTIVITY_FILE = "#{PROJECT_DIR}/src/org/ruboto/RubotoActivity.java"
103
105
 
104
106
  CLEAN.include('bin', 'gen', 'test/bin', 'test/gen')
105
107
 
@@ -241,41 +243,23 @@ file RUBOTO_CONFIG_FILE
241
243
  task :build_xml => BUILD_XML_FILE
242
244
  file BUILD_XML_FILE => RUBOTO_CONFIG_FILE do
243
245
  puts 'patching build.xml'
244
-
245
- require 'yaml'
246
-
247
- multi_dex = (YAML.load(File.read(RUBOTO_CONFIG_FILE)) || {})['multi_dex']
248
246
  ant_script = File.read(BUILD_XML_FILE)
249
247
 
250
248
  # FIXME(uwe): There is no output from this DEX helper. Difficult to debug.
251
249
  # FIXME(uwe): Ensure that pre-dexed jars are not dexed again.
252
- # FIXME(uwe): Move this logic to the rakelib to enable reacting to ruboto.yml changes.
250
+ # FIXME(uwe): Move this logic to ruboto/util/update.rb since it is independent of ruboto.yml changes.
253
251
  # https://android.googlesource.com/platform/tools/base/+/master/legacy/ant-tasks/src/main/java/com/android/ant/DexExecTask.java
254
252
  # def patch_ant_script(min_sdk, ant_script = File.read('build.xml'))
253
+ indent = ' '
255
254
  start_marker = '<!-- BEGIN added by Ruboto -->'
256
255
  end_marker = '<!-- END added by Ruboto -->'
257
256
  dx_override = <<-EOF
258
- #{start_marker}
259
- <macrodef name="dex-helper">
260
- <element name="external-libs" optional="yes" />
261
- <element name="extra-parameters" optional="yes" />
262
- <sequential>
263
- <!-- set the secondary dx input: the project (and library) jar files
264
- If a pre-dex task sets it to something else this has no effect -->
265
- <if>
266
- <condition>
267
- <isreference refid="out.dex.jar.input.ref" />
268
- </condition>
269
- <else>
270
- <path id="out.dex.jar.input.ref">
271
- <path refid="project.all.jars.path" />
272
- </path>
273
- </else>
274
- </if>
275
- <condition property="verbose.option" value="--verbose" else="">
276
- <istrue value="${verbose}" />
277
- </condition>
257
+ #{indent}#{start_marker}
258
+ <property name="second_dex_file" value="${out.absolute.dir}/classes2.dex" />
278
259
 
260
+ <macrodef name="multi-dex-helper">
261
+ <element name="external-libs" optional="yes" />
262
+ <sequential>
279
263
  <union id="out.dex.jar.input.ref.union">
280
264
  <resources refid="out.dex.jar.input.ref"/>
281
265
  </union>
@@ -290,50 +274,191 @@ file BUILD_XML_FILE => RUBOTO_CONFIG_FILE do
290
274
  <echo>Java classes and jars are unchanged.</echo>
291
275
  </then>
292
276
  <else>
293
- <echo>Converting compiled files and external libraries into ${intermediate.dex.file} (multi-dex)</echo>
277
+ <echo>Converting compiled files and external libraries into ${out.absolute.dir} (multi-dex)</echo>
294
278
  <delete file="${out.absolute.dir}/classes2.dex"/>
295
- <echo>Dexing from ${out.classes.absolute.dir} and ${toString:out.dex.jar.input.ref} to ${out.absolute.dir}</echo>
279
+ <echo>Dexing ${out.classes.absolute.dir} and ${toString:out.dex.jar.input.ref}</echo>
296
280
  <apply executable="${dx}" failonerror="true" parallel="true">
297
281
  <arg value="--dex" />
298
282
  <arg value="--multi-dex" />
299
283
  <arg value="--output=${out.absolute.dir}" />
300
- <extra-parameters />
284
+ <arg line="${jumbo.option}" />
301
285
  <arg line="${verbose.option}" />
302
286
  <arg path="${out.classes.absolute.dir}" />
303
287
  <path refid="out.dex.jar.input.ref" />
304
288
  <external-libs />
305
289
  </apply>
306
-
307
- <delete file="assets/classes2.jar"/>
308
- <if>
309
- <condition>
310
- <available file="${out.absolute.dir}/classes2.dex" />
311
- </condition>
312
- <then>
313
- <echo>Zipping extra classes in ${out.absolute.dir} into assets/classes2.jar</echo>
314
- <mkdir dir="${out.absolute.dir}/../assets"/>
315
- <!-- FIXME(uwe): This is hardcoded for one extra dex file.
316
- It should iterate over all classes?.dex files -->
317
- <copy file="${out.absolute.dir}/classes2.dex" tofile="classes.dex"/>
318
- <zip destfile="${out.absolute.dir}/../assets/classes2.jar" basedir="." includes="classes.dex" />
319
- <delete file="classes.dex"/>
320
- </then>
321
- </if>
290
+ <sleep seconds="1"/>
322
291
  </else>
323
292
  </if>
324
- </sequential>
293
+ </sequential>
325
294
  </macrodef>
326
- #{end_marker}
295
+
296
+ <macrodef name="dex-helper">
297
+ <element name="external-libs" optional="yes" />
298
+ <attribute name="nolocals" default="false" />
299
+ <sequential>
300
+ <!-- sets the primary input for dex. If a pre-dex task sets it to
301
+ something else this has no effect -->
302
+ <property name="out.dex.input.absolute.dir" value="${out.classes.absolute.dir}" />
303
+
304
+ <!-- set the secondary dx input: the project (and library) jar files
305
+ If a pre-dex task sets it to something else this has no effect -->
306
+ <if>
307
+ <condition>
308
+ <isreference refid="out.dex.jar.input.ref" />
309
+ </condition>
310
+ <else>
311
+ <path id="out.dex.jar.input.ref">
312
+ <path refid="project.all.jars.path" />
313
+ </path>
314
+ </else>
315
+ </if>
316
+ <condition property="verbose.option" value="--verbose" else="">
317
+ <istrue value="${verbose}" />
318
+ </condition>
319
+ <condition property="jumbo.option" value="--force-jumbo" else="">
320
+ <istrue value="${dex.force.jumbo}" />
321
+ </condition>
322
+
323
+ <if>
324
+ <condition>
325
+ <not>
326
+ <available file="${second_dex_file}" />
327
+ </not>
328
+ </condition>
329
+ <then>
330
+ <!-- Regular DEX process. We would prefer to use the Android SDK
331
+ ANT target, but we need to detect the "use multidex" error.
332
+ https://android.googlesource.com/platform/sdk/+/tools_r21.1/anttasks/src/com/android/ant/DexExecTask.java
333
+ -->
334
+ <mapper id="pre-dex-mapper" type="glob" from="libs/*.jar" to="bin/dexedLibs/*-dexed.jar"/>
335
+
336
+
337
+ <!-- FIXME(uwe): Output something about what we are doing -->
338
+
339
+ <apply executable="${dx}" failonerror="true" parallel="false" dest="${out.dexed.absolute.dir}" relative="true">
340
+ <arg value="--dex" />
341
+ <arg value="--output" />
342
+ <targetfile/>
343
+ <arg line="${jumbo.option}" />
344
+ <arg line="${verbose.option}" />
345
+ <fileset dir="." includes="libs/*" />
346
+ <external-libs />
347
+ <mapper refid="pre-dex-mapper"/>
348
+ </apply>
349
+
350
+ <apply executable="${dx}" resultproperty="dex.merge.result" outputproperty="dex.merge.output" parallel="true">
351
+ <arg value="--dex" />
352
+ <arg value="--output=${intermediate.dex.file}" />
353
+ <arg line="${jumbo.option}" />
354
+ <arg line="${verbose.option}" />
355
+ <arg path="${out.classes.absolute.dir}" />
356
+ <fileset dir="${out.dexed.absolute.dir}" includes="*-dexed.jar" />
357
+ <external-libs />
358
+ </apply>
359
+
360
+ <if>
361
+ <condition>
362
+ <contains string="${dex.merge.output}" substring="method ID not in [0, 0xffff]: 65536"/>
363
+ </condition>
364
+ <then>
365
+ <echo message="The package contains too many methods. Switching to multi-dex build." />
366
+ <multi-dex-helper>
367
+ <external-libs>
368
+ <external-libs/>
369
+ </external-libs>
370
+ </multi-dex-helper>
371
+ </then>
372
+ <else>
373
+ <echo message="${dex.merge.output}"/>
374
+ <fail status="${dex.merge.result}">
375
+ <condition>
376
+ <not>
377
+ <equals arg1="${dex.merge.result}" arg2="0"/>
378
+ </not>
379
+ </condition>
380
+ </fail>
381
+ </else>
382
+ </if>
383
+
384
+ </then>
385
+ <else>
386
+ <multi-dex-helper>
387
+ <external-libs>
388
+ <external-libs/>
389
+ </external-libs>
390
+ </multi-dex-helper>
391
+ </else>
392
+ </if>
393
+ </sequential>
394
+ </macrodef>
395
+
396
+ <!-- This is copied directly from <android-sdk>/tools/ant/build.xml,
397
+ just added the "-post-package-resources" dependency -->
398
+ <target name="-package" depends="-dex, -package-resources, -post-package-resources">
399
+ <!-- only package apk if *not* a library project -->
400
+ <do-only-if-not-library elseText="Library project: do not package apk..." >
401
+ <if condition="${build.is.instrumented}">
402
+ <then>
403
+ <package-helper>
404
+ <extra-jars>
405
+ <!-- Injected from external file -->
406
+ <jarfile path="${emma.dir}/emma_device.jar" />
407
+ </extra-jars>
408
+ </package-helper>
409
+ </then>
410
+ <else>
411
+ <package-helper />
412
+ </else>
413
+ </if>
414
+ </do-only-if-not-library>
415
+ </target>
416
+
417
+ <target name="-post-package-resources">
418
+ <!-- FIXME(uwe): This is hardcoded for one extra dex file.
419
+ It should iterate over all classes?.dex files -->
420
+ <property name="second_dex_path" value="assets/classes2.jar" />
421
+ <property name="second_dex_jar" value="${out.dexed.absolute.dir}/${second_dex_path}" />
422
+ <property name="second_dex_copy" value="${out.dexed.absolute.dir}/classes.dex" />
423
+ <if>
424
+ <condition>
425
+ <and>
426
+ <available file="${second_dex_file}" />
427
+ <or>
428
+ <not>
429
+ <uptodate srcfile="${second_dex_file}" targetfile="${out.absolute.dir}/${resource.package.file.name}" />
430
+ </not>
431
+ <uptodate srcfile="${out.absolute.dir}/${resource.package.file.name}" targetfile="${out.absolute.dir}/${resource.package.file.name}.d" />
432
+ </or>
433
+ </and>
434
+ </condition>
435
+ <then>
436
+ <echo>Adding ${second_dex_path} to ${resource.package.file.name}</echo>
437
+ <exec executable="aapt" dir="${out.dexed.absolute.dir}">
438
+ <arg line='remove -v "${out.absolute.dir}/${resource.package.file.name}" ${second_dex_path}'/>
439
+ </exec>
440
+ <copy file="${second_dex_file}" tofile="${second_dex_copy}"/>
441
+ <mkdir dir="${out.dexed.absolute.dir}/assets"/>
442
+ <zip destfile="${second_dex_jar}" basedir="${out.dexed.absolute.dir}" includes="classes.dex" />
443
+ <delete file="${second_dex_copy}"/>
444
+
445
+ <!-- FIXME(uwe): Use zip instead of aapt? -->
446
+ <exec executable="aapt" dir="${out.dexed.absolute.dir}" failonerror="true">
447
+ <arg line='add -v "${out.absolute.dir}/${resource.package.file.name}" ${second_dex_path}'/>
448
+ </exec>
449
+ <!-- EMXIF -->
450
+
451
+ </then>
452
+ </if>
453
+ </target>
454
+ #{end_marker}
327
455
  EOF
328
456
 
329
457
  ant_script.gsub!(/\s*#{start_marker}.*?#{end_marker}\s*/m, '')
330
- if multi_dex
331
- if sdk_level >= 16
332
- unless ant_script.gsub!(/\s*(<\/project>)/, "\n\n#{dx_override}\n\n\\1")
333
- raise 'Bad ANT script'
334
- end
335
- else
336
- raise "I am sorry, but the 'multi_dex' option is only available for projects targeting api level android-16 (Android 4.1) or higher due to a bug in earlier versions of Android."
458
+ # FIXME(uwe): Remove condition when we stop supporting Android 4.0 and older.
459
+ if sdk_level >= 16
460
+ unless ant_script.gsub!(/\s*(<\/project>)/, "\n\n#{dx_override}\n\n\\1")
461
+ raise 'Bad ANT script'
337
462
  end
338
463
  end
339
464
  File.open(BUILD_XML_FILE, 'w') { |f| f << ant_script }
@@ -357,12 +482,13 @@ file JRUBY_ADAPTER_FILE => RUBOTO_CONFIG_FILE do
357
482
  heap_alloc = 13
358
483
  comment = '// '
359
484
  end
485
+ indent = ' ' * 12
360
486
  config = <<EOF
361
- #{begin_marker}
362
- #{comment}@SuppressWarnings("unused")
363
- #{comment}byte[] arrayForHeapAllocation = new byte[#{heap_alloc} * 1024 * 1024];
364
- #{comment}arrayForHeapAllocation = null;
365
- #{end_marker}
487
+ #{indent}#{begin_marker}
488
+ #{indent}#{comment}@SuppressWarnings("unused")
489
+ #{indent}#{comment}byte[] arrayForHeapAllocation = new byte[#{heap_alloc} * 1024 * 1024];
490
+ #{indent}#{comment}arrayForHeapAllocation = null;
491
+ #{indent}#{end_marker}
366
492
  EOF
367
493
  pattern = %r{^\s*#{begin_marker}\n.*^\s*#{end_marker}\n}m
368
494
  source = source.sub(pattern, config)
@@ -380,10 +506,9 @@ EOF
380
506
  end
381
507
  ruby_version = ruby_version.to_s
382
508
  ruby_version['.'] = '_'
383
- indent = ' ' * 12
384
509
  config = <<EOF
385
510
  #{indent}#{begin_marker}
386
- #{indent}#{comment}System.setProperty("jruby.compat.version", "RUBY#{ruby_version}"); // RUBY1_9 is the default in JRuby 1.7
511
+ #{indent}#{comment}System.setProperty("jruby.compat.version", "RUBY#{ruby_version}"); // RUBY1_9 is the default in JRuby 1.7
387
512
  #{indent}#{end_marker}
388
513
  EOF
389
514
  pattern = %r{^\s*#{begin_marker}\n.*^\s*#{end_marker}\n}m
@@ -392,6 +517,23 @@ EOF
392
517
  File.open(JRUBY_ADAPTER_FILE, 'w') { |f| f << source }
393
518
  end
394
519
 
520
+ task :ruboto_activity => RUBOTO_ACTIVITY_FILE
521
+ file RUBOTO_ACTIVITY_FILE => RUBY_ACTIVITY_SOURCE_FILES do |task|
522
+ original_source = File.read(RUBOTO_ACTIVITY_FILE)
523
+ next unless original_source =~ %r{\A(.*Generated Methods.*?\*/\n*)(.*)\B}m
524
+ intro, generated_methods = $1, $2.scan(/(?:\s*\n*)(^\s*?public.*?^ }\n)/m).flatten
525
+ implemented_methods = task.prerequisites.map { |f| File.read(f).scan(/(?:^\s*def\s+)([^\s(]+)/) }.flatten.sort
526
+ commented_methods = generated_methods.map do |gm|
527
+ implemented_methods.
528
+ any? { |im| gm.upcase.include?(" #{im.upcase.gsub('_', '')}(") } ?
529
+ gm : "/*\n#{gm}*/\n"
530
+ end
531
+ new_source = "#{intro}#{commented_methods.join("\n")}\n}\n"
532
+ if new_source != original_source
533
+ File.open(RUBOTO_ACTIVITY_FILE, 'w') { |f| f << new_source }
534
+ end
535
+ end
536
+
395
537
  task apk_dependencies: APK_DEPENDENCIES
396
538
 
397
539
  file APK_FILE => APK_DEPENDENCIES do |t|
@@ -447,7 +589,7 @@ namespace :update_scripts do
447
589
  start_app
448
590
  else
449
591
  scripts = update_scripts
450
- if app_running?
592
+ if scripts && app_running?
451
593
  reload_scripts(scripts)
452
594
  else
453
595
  start_app
@@ -690,8 +832,12 @@ task :log, [:filter] do |t, args|
690
832
  started_regex = Regexp.new "^\\I/ActivityManager.+Start proc #{package} for activity #{package}/\\.#{main_activity}: pid=(?<pid>\\d+)"
691
833
  restarted_regex = Regexp.new "^\\I/ActivityManager.+START u0 {cmp=#{package}/org.ruboto.RubotoActivity.+} from pid (?<pid>\\d+)"
692
834
  related_regex = Regexp.new "#{package}|#{main_activity}"
835
+ android_4_2_noise_regex = /Unexpected value from nativeGetEnabledTags/
693
836
  pid_regex = nil
694
837
  logcat.each_line do |line|
838
+ # FIXME(uwe): Remove when we stop supporting Ancdroid 4.2
839
+ next if line =~ android_4_2_noise_regex
840
+ # EMXIF
695
841
  if (activity_start_match = started_regex.match(line) || restarted_regex.match(line))
696
842
  activity_started = true
697
843
  pid = activity_start_match[:pid]
data/assets/ruboto.yml CHANGED
@@ -59,14 +59,3 @@
59
59
  # - webrick
60
60
  # - win32
61
61
  # - Win32API
62
-
63
- ###################################
64
- #
65
- # multi_dex
66
- #
67
- # Switch on use of multiple classes.dex files when building.
68
- # This will allow you to have more than 65535 methods in your app.
69
- # WARNING: This disables pre-dex during build which will increase your
70
- # incremental build time substantially.
71
- #
72
- # multi_dex: true
@@ -35,7 +35,7 @@ public class EntryPointActivity extends org.ruboto.RubotoActivity {
35
35
  // The Intent to to call when done. Defaults to calling this Activity again.
36
36
  // Override to change.
37
37
  protected Intent futureIntent() {
38
- if (!getIntent().getAction().equals(Intent.ACTION_VIEW)) {
38
+ if (getIntent().getAction() == null || !getIntent().getAction().equals(Intent.ACTION_VIEW)) {
39
39
  return new Intent(getIntent()).setAction(Intent.ACTION_VIEW);
40
40
  } else {
41
41
  return getIntent();
@@ -157,6 +157,7 @@ public class JRubyAdapter {
157
157
  System.setProperty("jruby.ji.proxyClassFactory", "org.ruboto.DalvikProxyClassFactory");
158
158
  System.setProperty("jruby.ji.upper.case.package.name.allowed", "true");
159
159
  System.setProperty("jruby.class.cache.path", appContext.getDir("dex", 0).getAbsolutePath());
160
+ System.setProperty("java.io.tmpdir", appContext.getCacheDir().getAbsolutePath());
160
161
 
161
162
  // FIXME(uwe): Simplify when we stop supporting android-15
162
163
  if (Build.VERSION.SDK_INT >= 16) {
@@ -392,7 +393,8 @@ public class JRubyAdapter {
392
393
  //try {
393
394
  // t.printStackTrace(output);
394
395
  //} catch (NullPointerException npe) {
395
- // TODO(uwe): printStackTrace should not fail
396
+ // TODO(uwe): t.printStackTrace() should not fail
397
+ System.err.println(t.getClass().getName() + ": " + t);
396
398
  for (java.lang.StackTraceElement ste : t.getStackTrace()) {
397
399
  output.append(ste.toString() + "\n");
398
400
  }
@@ -7,11 +7,11 @@
7
7
  #######################################################
8
8
 
9
9
  Java::android.content.Context.class_eval do
10
- def toast(text, duration=android.widget.Toast::LENGTH_SHORT)
10
+ def toast(text, duration=Java::android.widget.Toast::LENGTH_SHORT)
11
11
  Java::android.widget.Toast.makeText(self, text, duration).show
12
12
  end
13
13
 
14
- def toast_result(result, success, failure, duration=android.widget.Toast::LENGTH_SHORT)
14
+ def toast_result(result, success, failure, duration=Java::android.widget.Toast::LENGTH_SHORT)
15
15
  toast(result ? success : failure, duration)
16
16
  end
17
17
  end
@@ -389,7 +389,7 @@ module Ruboto
389
389
  update_test force
390
390
  end
391
391
 
392
- update_assets
392
+ update_assets old_version
393
393
  update_ruboto force
394
394
  update_classes old_version, force
395
395
  update_dx_jar force
@@ -202,6 +202,7 @@ module Ruboto
202
202
  *
203
203
  * Generated Methods
204
204
  */
205
+
205
206
  EOF
206
207
  end
207
208
 
@@ -186,7 +186,7 @@ module Ruboto
186
186
  end
187
187
  puts
188
188
  break if device_ready?
189
- puts 'Device started, but failed to respond.'
189
+ puts 'Emulator started, but failed to respond.'
190
190
  unless no_snapshot
191
191
  puts 'Retrying without loading snapshot.'
192
192
  no_snapshot = true
@@ -234,7 +234,15 @@ module Ruboto
234
234
  log_action('Copying dx.jar to libs') { copier.copy 'libs' }
235
235
  end
236
236
 
237
- def update_assets
237
+ def update_assets(old_version = nil)
238
+ # FIXME(uwe): Remove when we stop support for updating from Ruboto 1.1.0
239
+ old_extra_classes = 'assets/classes2.jar'
240
+ if old_version == '1.1.0' && File.exists?(old_extra_classes)
241
+ puts "Deleting old extra dex file #{old_extra_classes}."
242
+ File.delete(string)
243
+ end
244
+ # EMXIF
245
+
238
246
  puts "\nCopying files:"
239
247
  weak_copier = Ruboto::Util::AssetCopier.new Ruboto::ASSETS, '.', false
240
248
  %w{.gitignore Rakefile ruboto.yml}.each { |f| log_action(f) { weak_copier.copy f } }
@@ -373,8 +381,9 @@ module Ruboto
373
381
  if File.exists?('ruboto.yml')
374
382
  sleep 1
375
383
  FileUtils.touch 'ruboto.yml'
376
- system 'rake build_xml jruby_adapter'
377
384
  end
385
+ Dir['src/*_activity.rb'].each{|f|FileUtils.touch(f)}
386
+ system 'rake build_xml jruby_adapter ruboto_activity'
378
387
  end
379
388
 
380
389
  def read_ruboto_version
@@ -488,7 +497,7 @@ module Ruboto
488
497
  'yaml.rb', # This looks like 1.8 stdlib...
489
498
  ]
490
499
  elsif gem_version >= Gem::Version.new('1.7.12')
491
- 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/ext/tracepoint org/jruby/javasupport/bsf org/yecht yaml.rb)
500
+ 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)
492
501
  elsif gem_version >= Gem::Version.new('1.7.5')
493
502
  # TODO(uwe): Remove when we stop supporting jruby-jars 1.7.5
494
503
  excluded_core_packages = %w(**/*Darwin* **/*Solaris* **/*windows* **/*Windows* META-INF com/headius 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/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/io org/jruby/ext/ffi/jffi org/jruby/ext/tracepoint org/jruby/javasupport/bsf org/yecht)
@@ -1,4 +1,4 @@
1
1
  module Ruboto
2
- VERSION = '1.1.0'
2
+ VERSION = '1.1.1'
3
3
  UPDATE_VERSION_LIMIT = '0.7.0'
4
4
  end
@@ -29,7 +29,6 @@ class SslActivity
29
29
  @open_uri_thread.join
30
30
  run_on_ui_thread { @response_view.text = 'open-uri loaded OK!' }
31
31
  puts 'before open'
32
- ENV['TMPDIR'] = files_dir.absolute_path
33
32
  open('https://google.com/', ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE) do |f|
34
33
  puts 'inside open'
35
34
  body = f.read
@@ -50,10 +50,11 @@ class RubotoGenTest < Test::Unit::TestCase
50
50
  end
51
51
 
52
52
  # APK was 59.6KB. PLATFORM: CURRENT, ANDROID_TARGET: 10
53
- # APK was 60.2KB. PLATFORM: CURRENT, ANDROID_TARGET: 15
53
+ # APK was 66.6KB. PLATFORM: CURRENT, ANDROID_TARGET: 15
54
54
  # APK was 74.9KB. PLATFORM: CURRENT, ANDROID_TARGET: 16
55
55
  # APK was 80.4KB. PLATFORM: CURRENT, ANDROID_TARGET: 19
56
56
  # APK was 65.0KB. PLATFORM: FROM_GEM, ANDROID_TARGET: 10
57
+ # APK was 81.0KB. PLATFORM: FROM_GEM, ANDROID_TARGET: 16
57
58
  # APK was 80.2KB. PLATFORM: FROM_GEM, ANDROID_TARGET: 17
58
59
  # APK was 8428.4KB. PLATFORM: STANDALONE, ANDROID_TARGET: 10, JRuby: 1.7.4
59
60
  # APK was 7405.8KB. PLATFORM: STANDALONE, ANDROID_TARGET: 15, JRuby: 1.7.4
@@ -92,8 +93,8 @@ class RubotoGenTest < Test::Unit::TestCase
92
93
  else
93
94
  upper_limit = {
94
95
  10 => 66.0,
95
- 15 => 62.0,
96
- 16 => 75.0,
96
+ 15 => 67.0,
97
+ 16 => 82.0,
97
98
  17 => 81.0,
98
99
  19 => 81.0,
99
100
  }[ANDROID_TARGET] || 75.0
@@ -1,7 +1,7 @@
1
1
  require File.expand_path('test_helper', File.dirname(__FILE__))
2
2
  require 'net/http'
3
3
 
4
- class SetupTest < Test::Unit::TestCase
4
+ class RubotoSetupTest < Test::Unit::TestCase
5
5
  SDK_DOWNLOAD_PAGE = 'http://developer.android.com/sdk/index.html?hl=sk'
6
6
 
7
7
  def test_if_page_still_exists
@@ -15,7 +15,7 @@ class SetupTest < Test::Unit::TestCase
15
15
  regex = '(\>installer_.*.exe)'
16
16
  page_content = Net::HTTP.get(URI.parse(SDK_DOWNLOAD_PAGE))
17
17
  link = page_content.scan(/#{regex}/).to_s
18
- assert_match /(\d+).(\d+).(\d+)/, link
18
+ assert_match /\d+(\.\d+)?(\.\d+)?/, link
19
19
  end
20
20
 
21
21
  end
data/test/test_helper.rb CHANGED
@@ -160,8 +160,6 @@ class Test::Unit::TestCase
160
160
  standalone = options.delete(:standalone) || !!included_stdlibs || !!excluded_stdlibs || ENV['RUBOTO_PLATFORM'] == 'STANDALONE'
161
161
  update = options.delete(:update) || false
162
162
  ruby_version = options.delete(:ruby_version) || (JRUBY_JARS_VERSION.to_s[0..0] == '9' ? 2.1 : 1.9)
163
- multi_dex = options.has_key?(:multi_dex) ? options.delete(:multi_dex) :
164
- (standalone && !example && ANDROID_TARGET >= 16)
165
163
 
166
164
  raise "Unknown options: #{options.inspect}" unless options.empty?
167
165
  raise 'Inclusion/exclusion of libs requires standalone mode.' if (included_stdlibs || excluded_stdlibs) && !standalone
@@ -177,7 +175,6 @@ class Test::Unit::TestCase
177
175
  template_dir << "_bundle_#{[*bundle].join('_')}" if bundle
178
176
  template_dir << '_updated' if update
179
177
  template_dir << '_standalone' if standalone
180
- template_dir << '_multi-dex' if multi_dex
181
178
  template_dir << "_without_#{excluded_stdlibs.map { |ed| ed.gsub(/[.\/]/, '_') }.join('_')}" if excluded_stdlibs
182
179
  template_dir << "_with_#{included_stdlibs.map { |ed| ed.gsub(/[.\/]/, '_') }.join('_')}" if included_stdlibs
183
180
  if File.exists?(template_dir)
@@ -192,8 +189,8 @@ class Test::Unit::TestCase
192
189
  File.open('local.properties', 'w') { |f| f.puts "sdk.dir=#{ANDROID_HOME}" }
193
190
  File.open('test/local.properties', 'w') { |f| f.puts "sdk.dir=#{ANDROID_HOME}" }
194
191
  if standalone
195
- if included_stdlibs || excluded_stdlibs || heap_alloc || ruby_version || multi_dex
196
- write_ruboto_yml(included_stdlibs, excluded_stdlibs, heap_alloc, ruby_version, multi_dex)
192
+ if included_stdlibs || excluded_stdlibs || heap_alloc || ruby_version
193
+ write_ruboto_yml(included_stdlibs, excluded_stdlibs, heap_alloc, ruby_version)
197
194
  end
198
195
  FileUtils.touch 'libs/jruby-core-x.x.x.jar'
199
196
  FileUtils.touch 'libs/jruby-stdlib-x.x.x.jar'
@@ -216,13 +213,13 @@ class Test::Unit::TestCase
216
213
  end
217
214
  Dir.chdir APP_DIR do
218
215
  write_gemfile(bundle) if bundle
219
- if included_stdlibs || excluded_stdlibs || heap_alloc || ruby_version || multi_dex
216
+ if included_stdlibs || excluded_stdlibs || heap_alloc || ruby_version
220
217
  sleep 1
221
- write_ruboto_yml(included_stdlibs, excluded_stdlibs, heap_alloc, ruby_version, multi_dex)
218
+ write_ruboto_yml(included_stdlibs, excluded_stdlibs, heap_alloc, ruby_version)
222
219
  system 'rake build_xml jruby_adapter'
223
220
  end
224
221
  if standalone
225
- system "#{RUBOTO_CMD} gen jruby"
222
+ system "#{RUBOTO_CMD} gen jruby #{JRUBY_JARS_VERSION}"
226
223
  raise "update jruby failed with return code #$?" if $? != 0
227
224
  end
228
225
  end
@@ -291,12 +288,11 @@ class Test::Unit::TestCase
291
288
  end
292
289
  end
293
290
 
294
- def write_ruboto_yml(included_stdlibs, excluded_stdlibs, heap_alloc, ruby_version, multi_dex)
291
+ def write_ruboto_yml(included_stdlibs, excluded_stdlibs, heap_alloc, ruby_version)
295
292
  yml = YAML.dump({'included_stdlibs' => included_stdlibs,
296
293
  'excluded_stdlibs' => excluded_stdlibs,
297
294
  # 'ruby_version' => ruby_version,
298
295
  'heap_alloc' => heap_alloc,
299
- 'multi_dex' => multi_dex,
300
296
  })
301
297
  puts "Adding ruboto.yml:\n#{yml}"
302
298
  File.open('ruboto.yml', 'w') { |f| f << yml }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruboto
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Jackoway
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2014-05-25 00:00:00.000000000 Z
14
+ date: 2014-07-01 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: main
@@ -240,3 +240,4 @@ signing_key:
240
240
  specification_version: 4
241
241
  summary: A platform for developing apps using JRuby on Android.
242
242
  test_files: []
243
+ has_rdoc: