ruboto 1.0.3 → 1.1.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.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/README.md +1 -0
- data/RELEASE_CANDICATE_DOC.md +21 -8
- data/RELEASE_DOC.md +71 -27
- data/Rakefile +27 -25
- data/assets/rakelib/ruboto.rake +137 -21
- data/assets/rakelib/{stdlib.rake → ruboto.stdlib.rake} +80 -29
- data/assets/rakelib/{stdlib_dependencies.rb → ruboto.stdlib.rb} +18 -24
- data/assets/rakelib/{stdlib.yml → ruboto.stdlib.yml} +0 -0
- data/assets/ruboto.yml +28 -18
- data/assets/src/org/ruboto/DexDex.java +329 -0
- data/assets/src/org/ruboto/FrameworkHack.java +177 -0
- data/assets/src/org/ruboto/JRubyAdapter.java +28 -4
- data/assets/src/org/ruboto/ScriptLoader.java +1 -1
- data/assets/src/org/ruboto/SplashActivity.java +1 -2
- data/assets/src/ruboto/activity/reload.rb +1 -0
- data/assets/src/ruboto/activity.rb +11 -5
- data/assets/src/ruboto/util/toast.rb +2 -2
- data/lib/ruboto/commands/base.rb +85 -37
- data/lib/ruboto/util/emulator.rb +32 -14
- data/lib/ruboto/util/setup.rb +34 -12
- data/lib/ruboto/util/update.rb +70 -40
- data/lib/ruboto/version.rb +1 -1
- data/test/activity/navigation_activity_test.rb +2 -0
- data/test/activity/ssl_activity.rb +26 -9
- data/test/activity/ssl_activity_test.rb +14 -6
- data/test/app_test_methods.rb +8 -3
- data/test/ruboto_gen_test.rb +13 -7
- data/test/ruboto_setup_test.rb +21 -0
- data/test/ruboto_update_test.rb +26 -28
- data/test/test_helper.rb +25 -21
- metadata +10 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4bc93dda49229814d2889824399ff50031071d5a
|
4
|
+
data.tar.gz: 69ec9f1793ddb2d08e0f715b495d3ec7ec5a5758
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a7416a14f651cee7d9318c4342438c982c8d8a529b79e7dea044424eae1e2abe07461fc9ed5f12ff174dc23be32ade650fa1c9d9c1a9b13370b427ecd992504
|
7
|
+
data.tar.gz: eb20558feac71d3fa8fd7f513e39c69eac3f965f79547bbbb39992f326925b5ea258a092cdf2c438ece7c244760f6647b69eb0b7be87c436e4898edb9a106457
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
data/RELEASE_CANDICATE_DOC.md
CHANGED
@@ -1,14 +1,27 @@
|
|
1
|
-
Subject: [ANN] Ruboto 1.0
|
1
|
+
Subject: [ANN] Ruboto 1.1.0 release candidate
|
2
2
|
|
3
3
|
Hi all!
|
4
4
|
|
5
|
-
The Ruboto 1.0
|
6
|
-
|
7
|
-
This release
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
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
|
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
|
+
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
|
12
|
-
|
13
|
-
This release
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
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 #
|
22
|
-
* Issue #
|
23
|
-
* Issue #
|
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 #
|
28
|
-
* Issue #
|
29
|
-
* Issue #
|
30
|
-
|
31
|
-
* Issue #
|
32
|
-
* Issue #
|
33
|
-
* Issue #
|
34
|
-
|
35
|
-
* Issue #
|
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 #
|
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
|
-
|
85
|
+
Other:
|
42
86
|
|
43
|
-
* Issue #
|
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=
|
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
|
-
'
|
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
|
-
|
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
|
-
|
464
|
-
|
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
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
headers.update('
|
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
|
data/assets/rakelib/ruboto.rake
CHANGED
@@ -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
|
-
|
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 =>
|
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
|
-
|
259
|
-
|
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
|
-
|
282
|
-
|
283
|
-
|
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 =>
|
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 =>
|
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 =>
|
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
|
345
|
-
|
346
|
-
|
347
|
-
|
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
|
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
|
-
|
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
|
-
|
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
|