ruboto 1.0.3 → 1.1.0

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: aa80ecb3d9c8d5a37b94142f2a1fe730daad9563
4
- data.tar.gz: bca65a11d086368713f67496b1ce279e17c56480
3
+ metadata.gz: 4bc93dda49229814d2889824399ff50031071d5a
4
+ data.tar.gz: 69ec9f1793ddb2d08e0f715b495d3ec7ec5a5758
5
5
  SHA512:
6
- metadata.gz: d2b7f8bd447f38c527684f6b4caaa193f5ea7e88388a98888ace26ab6e85228d0f122d9ce6e1ef0c9c20c33bd50b69cda678fb4ce8e6cacd0382ea8596c8c10f
7
- data.tar.gz: 7c929fcee3c3f860dd33930618d46dfc0350c21a745872db259435c8b2993ce674fe9afdd2698dcda94ef0a02410aa423a4a2792d37d79cee92dee9da700e640
6
+ metadata.gz: 5a7416a14f651cee7d9318c4342438c982c8d8a529b79e7dea044424eae1e2abe07461fc9ed5f12ff174dc23be32ade650fa1c9d9c1a9b13370b427ecd992504
7
+ data.tar.gz: eb20558feac71d3fa8fd7f513e39c69eac3f965f79547bbbb39992f326925b5ea258a092cdf2c438ece7c244760f6647b69eb0b7be87c436e4898edb9a106457
data/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ruboto (1.0.3)
5
- main (~> 5.2.0)
4
+ ruboto (1.1.0)
5
+ main (~> 5.2)
6
6
  rake (~> 10.0)
7
7
  rubyzip (~> 1.0)
8
8
 
data/README.md CHANGED
@@ -1,3 +1,4 @@
1
+ [![Build Status](https://travis-ci.org/ruboto/ruboto.png?branch=master)](https://travis-ci.org/ruboto/ruboto)
1
2
  [![Code Climate](https://codeclimate.com/github/ruboto/ruboto.png)](https://codeclimate.com/github/ruboto/ruboto)
2
3
 
3
4
  Ruboto - JRuby On Android
@@ -1,14 +1,27 @@
1
- Subject: [ANN] Ruboto 1.0.3 release candidate
1
+ Subject: [ANN] Ruboto 1.1.0 release candidate
2
2
 
3
3
  Hi all!
4
4
 
5
- The Ruboto 1.0.3 release candidate is now available.
6
-
7
- This release focuses on stability and introduces a new mechanism for
8
- reducing the footprint of your app using the ruboto.yml config file. You
9
- can now specify the Ruby compatibility level of your app (1.8/1.9/2.0) and
10
- which parts of the Ruby Standard Library you want to use. Ruboto will now
11
- strip the parts you don't need, making your app a bit smaller.
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.
12
25
 
13
26
  As always we need your help and feedback to ensure the quality of the release. Please install the release candidate using
14
27
 
data/RELEASE_DOC.md CHANGED
@@ -1,6 +1,6 @@
1
- Subject: [ANN] Ruboto 1.0.3 released!
1
+ Subject: [ANN] Ruboto 1.1.0 released!
2
2
 
3
- The Ruboto team is pleased to announce the release of Ruboto 1.0.3.
3
+ The Ruboto team is pleased to announce the release of Ruboto 1.1.0.
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,43 +8,87 @@ 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.0.3:
12
-
13
- This release focuses on stability and introduces a new mechanism for
14
- reducing the footprint of your app using the ruboto.yml config file. You
15
- can now specify the Ruby compatibility level of your app (1.8/1.9/2.0) and
16
- which parts of the Ruby Standard Library you want to use. Ruboto will now
17
- strip the parts you don't need, making your app a bit smaller.
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.
18
31
 
19
32
  Features:
20
33
 
21
- * Issue #418 Dynamic Ruboto runtime sizing and inclusion
22
- * Issue #576 Make Android 4.0 the default target.
23
- * Issue #592 Update to JRuby 1.7.12
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"
24
48
 
25
49
  Bugfixes:
26
50
 
27
- * Issue #529 rake install start fails on windows
28
- * Issue #566 ruboto emulator -t android-19 failed
29
- * Issue #580 Ruboto setup fails if the path configuration script doesn't
30
- exist
31
- * Issue #582 JRuby 9000 tests fail
32
- * Issue #583 'ruboto setup' crashes when config file does not exist.
33
- * Issue #585 rake install start does not power up app in Android 4.4
34
- Kitkat emulator and sleeps at build successful
35
- * Issue #587 warning breaks is_installed?
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)
62
+
63
+ Performance:
64
+
65
+ * Issue #599 Speed up displaying Options Menu
66
+ * Issue #616 Speed up Activity#setContentView
36
67
 
37
68
  Support:
38
69
 
39
- * Issue #579 Android platform SDK for android-10 not found (v1.0.2)
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)
40
84
 
41
- Internal:
85
+ Other:
42
86
 
43
- * Issue #577 Domain expired
87
+ * Issue #607 Remove the deprecated "ruboto update ruboto" command
44
88
 
45
89
  You can find a complete list of issues here:
46
90
 
47
- * https://github.com/ruboto/ruboto/issues?state=closed&milestone=28
91
+ * https://github.com/ruboto/ruboto/issues?state=closed&milestone=19
48
92
 
49
93
 
50
94
  Installation:
@@ -53,13 +97,13 @@ To use Ruboto, you need to install a Ruby implementation. Then do
53
97
  (possibly as root/administrator)
54
98
 
55
99
  gem install ruboto
56
- ruboto setup
100
+ ruboto setup -y
57
101
 
58
102
  To create a project do
59
103
 
60
104
  ruboto gen app --package <your.package.name>
61
105
  cd <project directory>
62
- ruboto setup
106
+ ruboto setup -y
63
107
 
64
108
  To run an emulator for your project
65
109
 
data/Rakefile CHANGED
@@ -153,8 +153,8 @@ def get_github_issues
153
153
  milestone_description = milestone_description.split("\r\n").map(&:wrap).join("\r\n")
154
154
  categories = {
155
155
  'Features' => 'feature', 'Bugfixes' => 'bug',
156
- 'Documentation' => 'documentation', 'Support' => 'support',
157
- 'Community' => 'community',
156
+ 'Performance' => 'performance', 'Documentation' => 'documentation',
157
+ 'Support' => 'support', 'Community' => 'community',
158
158
  'Pull requests' => nil, 'Internal' => 'internal',
159
159
  'Rejected' => 'rejected', 'Other' => nil
160
160
  }
@@ -233,10 +233,10 @@ New in version #{milestone_name}:
233
233
  #{milestone_description}
234
234
 
235
235
  #{(categories.keys & grouped_issues.keys).map do |cat|
236
- "#{cat}:\n
237
- #{grouped_issues[cat].map { |i| %Q{* Issue ##{i['number']} #{i['title'].gsub('`', "'")}}.wrap(2) }.join("\n")}
236
+ "#{cat}:\n
237
+ #{grouped_issues[cat].map { |i| %Q{* Issue ##{i['number']} #{i['title'].gsub('`', "'")}#{" (#{i['user']['login']})" if i['pull_request'] && i['pull_request']['html_url']}}.wrap(2) }.join("\n")}
238
238
  "
239
- end.join("\n")}
239
+ end.join("\n")}
240
240
  You can find a complete list of issues here:
241
241
 
242
242
  * https://github.com/ruboto/ruboto/issues?state=closed&milestone=#{milestone}
@@ -248,13 +248,13 @@ To use Ruboto, you need to install a Ruby implementation. Then do
248
248
  (possibly as root/administrator)
249
249
 
250
250
  gem install ruboto
251
- ruboto setup
251
+ ruboto setup -y
252
252
 
253
253
  To create a project do
254
254
 
255
255
  ruboto gen app --package <your.package.name>
256
256
  cd <project directory>
257
- ruboto setup
257
+ ruboto setup -y
258
258
 
259
259
  To run an emulator for your project
260
260
 
@@ -426,7 +426,7 @@ namespace :platform do
426
426
  file PLATFORM_PROJECT do
427
427
  sh "git clone --depth 1 https://github.com/ruboto/ruboto-core.git #{PLATFORM_PROJECT}"
428
428
  Dir.chdir PLATFORM_PROJECT do
429
- sh "ruby -rubygems -I#{File.expand_path('lib', File.dirname(__FILE__))} ../../bin/ruboto update app"
429
+ sh "ruby -rubygems -I#{File.expand_path('lib', File.dirname(__FILE__))} ../../bin/ruboto update app --force"
430
430
  end
431
431
  end
432
432
 
@@ -460,25 +460,27 @@ namespace :platform do
460
460
  puts 'Downloading the current RubotoCore platform release apk'
461
461
  uri = URI('https://raw.github.com/ruboto/ruboto.github.com/master/downloads/RubotoCore-release.apk')
462
462
  begin
463
- Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https',
464
- :verify_mode => OpenSSL::SSL::VERIFY_NONE) do |http|
465
- headers = {'User-Agent' => 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_2; de-at) AppleWebKit/531.21.8 (KHTML, like Gecko) Version/4.0.4 Safari/531.21.10'}
463
+ headers = {'User-Agent' => 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_2; de-at) AppleWebKit/531.21.8 (KHTML, like Gecko) Version/4.0.4 Safari/531.21.10'}
464
+ catch :download_ok do
466
465
  loop do
467
- response = http.get(uri.request_uri, headers)
468
- if response.code == '200'
469
- File.open(PLATFORM_CURRENT_RELEASE_APK, 'wb') { |f| f << response.body }
470
- break
471
- elsif response.code == '302'
472
- headers.update('Referer' => uri.to_s)
473
- if (cookie = response.response['set-cookie'])
474
- headers.update('Cookie' => cookie)
466
+ Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https',
467
+ :verify_mode => OpenSSL::SSL::VERIFY_NONE) do |http|
468
+ response = http.get(uri.request_uri, headers)
469
+ if response.code == '200'
470
+ File.open(PLATFORM_CURRENT_RELEASE_APK, 'wb') { |f| f << response.body }
471
+ throw :download_ok
472
+ elsif response.code == '301' || response.code == '302'
473
+ headers.update('Referer' => uri.to_s)
474
+ if (cookie = response.response['set-cookie'])
475
+ headers.update('Cookie' => cookie)
476
+ end
477
+ uri = URI(response['location'].gsub(/^\//, 'http://ruboto.org/'))
478
+ puts "Following redirect to #{uri}."
479
+ else
480
+ puts "Got an unexpected response (#{response.code}). Retrying download."
481
+ puts response.inspect
482
+ sleep 1
475
483
  end
476
- uri = URI(response['location'].gsub(/^\//, 'http://ruboto.org/'))
477
- puts "Following redirect to #{uri}."
478
- else
479
- puts "Got an unexpected response (#{response.code}). Retrying download."
480
- puts response.inspect
481
- sleep 1
482
484
  end
483
485
  end
484
486
  end
@@ -93,7 +93,9 @@ JAVA_SOURCE_FILES = Dir[File.expand_path 'src/**/*.java']
93
93
  RUBY_SOURCE_FILES = Dir[File.expand_path 'src/**/*.rb']
94
94
  OTHER_SOURCE_FILES = Dir[File.expand_path 'src/**/*'] - JAVA_SOURCE_FILES - RUBY_SOURCE_FILES
95
95
  CLASSES_CACHE = "#{PROJECT_DIR}/bin/#{build_project_name}-debug-unaligned.apk.d"
96
- APK_DEPENDENCIES = [:patch_dex, MANIFEST_FILE, RUBOTO_CONFIG_FILE, BUNDLE_JAR, CLASSES_CACHE] + JRUBY_JARS + JARS + JAVA_SOURCE_FILES + RESOURCE_FILES + RUBY_SOURCE_FILES + OTHER_SOURCE_FILES
96
+ BUILD_XML_FILE = "#{PROJECT_DIR}/build.xml"
97
+ APK_DEPENDENCIES = [:patch_dex, MANIFEST_FILE, BUILD_XML_FILE, RUBOTO_CONFIG_FILE, BUNDLE_JAR, CLASSES_CACHE] + JRUBY_JARS + JARS + JAVA_SOURCE_FILES + RESOURCE_FILES + RUBY_SOURCE_FILES + OTHER_SOURCE_FILES
98
+ QUICK_APK_DEPENDENCIES = APK_DEPENDENCIES - RUBY_SOURCE_FILES
97
99
  KEYSTORE_FILE = (key_store = File.readlines('ant.properties').grep(/^key.store=/).first) ? File.expand_path(key_store.chomp.sub(/^key.store=/, '').sub('${user.home}', '~')) : "#{build_project_name}.keystore"
98
100
  KEYSTORE_ALIAS = (key_alias = File.readlines('ant.properties').grep(/^key.alias=/).first) ? key_alias.chomp.sub(/^key.alias=/, '') : build_project_name
99
101
  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+(.*)$/
@@ -137,7 +139,7 @@ task :debug => APK_FILE
137
139
 
138
140
  namespace :debug do
139
141
  desc 'build debug package if compiled files have changed'
140
- task :quick => APK_DEPENDENCIES - RUBY_SOURCE_FILES do |t|
142
+ task :quick => QUICK_APK_DEPENDENCIES do |t|
141
143
  build_apk(t, false)
142
144
  end
143
145
  end
@@ -236,6 +238,107 @@ end
236
238
 
237
239
  file RUBOTO_CONFIG_FILE
238
240
 
241
+ task :build_xml => BUILD_XML_FILE
242
+ file BUILD_XML_FILE => RUBOTO_CONFIG_FILE do
243
+ puts 'patching build.xml'
244
+
245
+ require 'yaml'
246
+
247
+ multi_dex = (YAML.load(File.read(RUBOTO_CONFIG_FILE)) || {})['multi_dex']
248
+ ant_script = File.read(BUILD_XML_FILE)
249
+
250
+ # FIXME(uwe): There is no output from this DEX helper. Difficult to debug.
251
+ # 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.
253
+ # https://android.googlesource.com/platform/tools/base/+/master/legacy/ant-tasks/src/main/java/com/android/ant/DexExecTask.java
254
+ # def patch_ant_script(min_sdk, ant_script = File.read('build.xml'))
255
+ start_marker = '<!-- BEGIN added by Ruboto -->'
256
+ end_marker = '<!-- END added by Ruboto -->'
257
+ 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>
278
+
279
+ <union id="out.dex.jar.input.ref.union">
280
+ <resources refid="out.dex.jar.input.ref"/>
281
+ </union>
282
+ <if>
283
+ <condition>
284
+ <uptodate targetfile="${out.absolute.dir}/classes.dex" >
285
+ <srcfiles dir="${out.classes.absolute.dir}" includes="**/*.class"/>
286
+ <srcresources refid="out.dex.jar.input.ref.union"/>
287
+ </uptodate>
288
+ </condition>
289
+ <then>
290
+ <echo>Java classes and jars are unchanged.</echo>
291
+ </then>
292
+ <else>
293
+ <echo>Converting compiled files and external libraries into ${intermediate.dex.file} (multi-dex)</echo>
294
+ <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>
296
+ <apply executable="${dx}" failonerror="true" parallel="true">
297
+ <arg value="--dex" />
298
+ <arg value="--multi-dex" />
299
+ <arg value="--output=${out.absolute.dir}" />
300
+ <extra-parameters />
301
+ <arg line="${verbose.option}" />
302
+ <arg path="${out.classes.absolute.dir}" />
303
+ <path refid="out.dex.jar.input.ref" />
304
+ <external-libs />
305
+ </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>
322
+ </else>
323
+ </if>
324
+ </sequential>
325
+ </macrodef>
326
+ #{end_marker}
327
+ EOF
328
+
329
+ 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."
337
+ end
338
+ end
339
+ File.open(BUILD_XML_FILE, 'w') { |f| f << ant_script }
340
+ end
341
+
239
342
  task :jruby_adapter => JRUBY_ADAPTER_FILE
240
343
  file JRUBY_ADAPTER_FILE => RUBOTO_CONFIG_FILE do
241
344
  require 'yaml'
@@ -255,8 +358,8 @@ file JRUBY_ADAPTER_FILE => RUBOTO_CONFIG_FILE do
255
358
  comment = '// '
256
359
  end
257
360
  config = <<EOF
258
- #{begin_marker}
259
- #{comment}@SuppressWarnings("unused")
361
+ #{begin_marker}
362
+ #{comment}@SuppressWarnings("unused")
260
363
  #{comment}byte[] arrayForHeapAllocation = new byte[#{heap_alloc} * 1024 * 1024];
261
364
  #{comment}arrayForHeapAllocation = null;
262
365
  #{end_marker}
@@ -277,10 +380,11 @@ EOF
277
380
  end
278
381
  ruby_version = ruby_version.to_s
279
382
  ruby_version['.'] = '_'
383
+ indent = ' ' * 12
280
384
  config = <<EOF
281
- #{begin_marker}
282
- #{comment}System.setProperty("jruby.compat.version", "RUBY#{ruby_version}"); // RUBY1_9 is the default in JRuby 1.7
283
- #{end_marker}
385
+ #{indent}#{begin_marker}
386
+ #{indent}#{comment}System.setProperty("jruby.compat.version", "RUBY#{ruby_version}"); // RUBY1_9 is the default in JRuby 1.7
387
+ #{indent}#{end_marker}
284
388
  EOF
285
389
  pattern = %r{^\s*#{begin_marker}\n.*^\s*#{end_marker}\n}m
286
390
  source = source.sub(pattern, config)
@@ -288,6 +392,8 @@ EOF
288
392
  File.open(JRUBY_ADAPTER_FILE, 'w') { |f| f << source }
289
393
  end
290
394
 
395
+ task apk_dependencies: APK_DEPENDENCIES
396
+
291
397
  file APK_FILE => APK_DEPENDENCIES do |t|
292
398
  build_apk(t, false)
293
399
  end
@@ -315,7 +421,7 @@ task :boing => %w(update_scripts:reload)
315
421
 
316
422
  namespace :update_scripts do
317
423
  desc 'Copy scripts to emulator and restart the app'
318
- task :restart => APK_DEPENDENCIES - RUBY_SOURCE_FILES do |t|
424
+ task :restart => QUICK_APK_DEPENDENCIES do |t|
319
425
  if build_apk(t, false) || !stop_app
320
426
  install_apk
321
427
  else
@@ -325,7 +431,7 @@ namespace :update_scripts do
325
431
  end
326
432
 
327
433
  desc 'Copy scripts to emulator and restart the app'
328
- task :start => APK_DEPENDENCIES - RUBY_SOURCE_FILES do |t|
434
+ task :start => QUICK_APK_DEPENDENCIES do |t|
329
435
  if build_apk(t, false)
330
436
  install_apk
331
437
  else
@@ -335,18 +441,16 @@ namespace :update_scripts do
335
441
  end
336
442
 
337
443
  desc 'Copy scripts to emulator and reload'
338
- task :reload => APK_DEPENDENCIES - RUBY_SOURCE_FILES do |t|
444
+ task :reload => QUICK_APK_DEPENDENCIES do |t|
339
445
  if build_apk(t, false)
340
446
  install_apk
341
447
  start_app
342
448
  else
343
449
  scripts = update_scripts
344
- if scripts
345
- if app_running?
346
- reload_scripts(scripts)
347
- else
348
- start_app
349
- end
450
+ if app_running?
451
+ reload_scripts(scripts)
452
+ else
453
+ start_app
350
454
  end
351
455
  end
352
456
  end
@@ -687,7 +791,7 @@ def build_apk(t, release)
687
791
  apk_file = release ? RELEASE_APK_FILE : APK_FILE
688
792
  if File.exist?(apk_file)
689
793
  changed_prereqs = t.prerequisites.select do |pr|
690
- File.file?(pr) && !Dir[pr].empty? && Dir[pr].map { |f| File.mtime(f) }.max >= File.mtime(apk_file)
794
+ File.file?(pr) && !Dir[pr].empty? && Dir[pr].map { |f| File.mtime(f) }.max > File.mtime(apk_file)
691
795
  end
692
796
  return false if changed_prereqs.empty?
693
797
  changed_prereqs.each { |f| puts "#{f} changed." }
@@ -786,17 +890,29 @@ def uninstall_apk
786
890
  end
787
891
 
788
892
  def update_scripts
789
- puts(`adb shell mkdir -p #{scripts_path}`) unless device_path_exists?(scripts_path)
893
+ # FIXME(uwe): Simplify when we stop supporting Android 2.3
894
+ if sdk_level < 15
895
+ scripts_path.split('/').tap do |parts|
896
+ parts.size.times do |i|
897
+ path = parts[0..i].join('/')
898
+ puts(`adb shell mkdir #{path}`) unless device_path_exists?(path)
899
+ end
900
+ end
901
+ else
902
+ puts(`adb shell mkdir -p #{scripts_path}`) unless device_path_exists?(scripts_path)
903
+ end
904
+ # EMXIF
905
+
790
906
  raise "Unable to create device scripts dir: #{scripts_path}" unless device_path_exists?(scripts_path)
791
907
  last_update = File.exists?(UPDATE_MARKER_FILE) ? Time.parse(File.read(UPDATE_MARKER_FILE)) : Time.parse('1970-01-01T00:00:00')
792
908
  Dir.chdir('src') do
793
909
  source_files = Dir['**/*.rb']
794
910
  changed_files = source_files.select { |f| !File.directory?(f) && File.mtime(f) >= last_update && f !~ /~$/ }
795
911
  unless changed_files.empty?
796
- puts 'Pushing files to apk public file area.'
912
+ puts 'Pushing files to apk public file area:'
797
913
  changed_files.each do |script_file|
798
914
  print "#{script_file}: "; $stdout.flush
799
- `adb push #{script_file} #{scripts_path}/#{script_file}`
915
+ system "adb push #{script_file} #{scripts_path}/#{script_file}"
800
916
  end
801
917
  mark_update
802
918
  return changed_files
@@ -815,7 +931,7 @@ end
815
931
 
816
932
  # Triggers reload of updated scripts and restart of the current activity
817
933
  def reload_scripts(scripts)
818
- s = scripts.map{|s| s.gsub(/[&;]/){|m| "&#{m[0]}"}}.join('\;')
934
+ s = scripts.map { |s| s.gsub(/[&;]/) { |m| "&#{m[0]}" } }.join('\;')
819
935
  cmd = %Q{adb shell am broadcast -a android.intent.action.VIEW -e reload '#{s}'}
820
936
  puts cmd
821
937
  system cmd