ruboto 0.8.1 → 0.9.0.rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +75 -1
- data/assets/libs/dx.jar +0 -0
- data/assets/src/org/ruboto/JRubyAdapter.java +6 -1
- data/assets/src/org/ruboto/Script.java +2 -2
- data/lib/DalvikProxyClassFactory.java +107 -0
- data/lib/DexClient.java +85 -0
- data/lib/ruboto/commands/base.rb +2 -2
- data/lib/ruboto/util/update.rb +38 -48
- data/lib/ruboto/version.rb +1 -1
- data/test/activity/stack_activity_test.rb +4 -2
- data/test/activity/subclass_activity.rb +33 -0
- data/test/activity/{generate_activity_test.rb → subclass_activity_test.rb} +1 -1
- data/test/app_test_methods.rb +4 -0
- data/test/block_def_activity/stack_activity_test.rb +1 -0
- data/test/handle_activity/stack_activity_test.rb +1 -0
- data/test/minimal_app_test.rb +10 -2
- data/test/ruboto_gen_test.rb +31 -11
- data/test/sqldroid_test.rb +13 -15
- data/test/test_helper.rb +40 -27
- metadata +19 -14
- data/assets/libs/dexmaker20120305.jar +0 -0
- data/assets/src/ruboto/generate.rb +0 -462
- data/test/activity/generate_activity.rb +0 -35
data/test/ruboto_gen_test.rb
CHANGED
@@ -21,6 +21,17 @@ class RubotoGenTest < Test::Unit::TestCase
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
+
def test_activity_with_number_in_name
|
25
|
+
Dir.chdir APP_DIR do
|
26
|
+
system "#{RUBOTO_CMD} gen class Activity --name App1Activity"
|
27
|
+
assert_equal 0, $?.exitstatus
|
28
|
+
assert File.exists?('src/org/ruboto/test_app/App1Activity.java')
|
29
|
+
assert File.exists?('src/app1_activity.rb')
|
30
|
+
assert File.exists?('test/src/app1_activity_test.rb')
|
31
|
+
end
|
32
|
+
run_app_tests
|
33
|
+
end
|
34
|
+
|
24
35
|
def test_gen_class_activity_with_lowercase_should_fail
|
25
36
|
Dir.chdir APP_DIR do
|
26
37
|
system "#{RUBOTO_CMD} gen class activity --name VeryNewActivity"
|
@@ -32,22 +43,29 @@ class RubotoGenTest < Test::Unit::TestCase
|
|
32
43
|
end
|
33
44
|
end
|
34
45
|
|
46
|
+
# APK was smaller than 277.2KB: 61.9KB. PLATFORM: CURRENT, ANDROID_TARGET: 10.
|
47
|
+
# APK was larger than 7100.0KB: 7341.1KB. PLATFORM: STANDALONE, ANDROID_TARGET: 10, JRuby: 1.7.0.preview2.
|
48
|
+
# APK was smaller than 278.1KB: 67.2KB. PLATFORM: CURRENT, ANDROID_TARGET: 15.
|
49
|
+
# APK was larger than 5800.0KB: 5879.2KB. PLATFORM: STANDALONE, ANDROID_TARGET: 15, JRuby: 1.6.7.
|
50
|
+
# APK was larger than 7308.0KB: 7558.3KB. PLATFORM: STANDALONE, ANDROID_TARGET: 15, JRuby: 1.7.0.preview2.
|
51
|
+
|
35
52
|
def test_new_apk_size_is_within_limits
|
36
53
|
apk_size = BigDecimal(File.size("#{APP_DIR}/bin/RubotoTestApp-debug.apk").to_s) / 1024
|
37
54
|
version = " PLATFORM: #{RUBOTO_PLATFORM}"
|
38
55
|
version << ", ANDROID_TARGET: #{ANDROID_TARGET}"
|
39
56
|
if RUBOTO_PLATFORM == 'STANDALONE'
|
40
57
|
upper_limit = {
|
41
|
-
'1.6.7' => 5800.0,
|
42
|
-
'1.7.0.preview1' => 7308.0,
|
43
|
-
'1.7.0.preview2' =>
|
58
|
+
'1.6.7' => ANDROID_TARGET < 15 ? 5800.0 : 5900.0,
|
59
|
+
'1.7.0.preview1' => ANDROID_TARGET < 15 ? 7400.0 : 7308.0,
|
60
|
+
'1.7.0.preview2' => ANDROID_TARGET < 15 ? 7400.0 : 7600.0,
|
61
|
+
'1.7.0.rc1' => ANDROID_TARGET < 15 ? 7400.0 : 7600.0,
|
44
62
|
}[JRUBY_JARS_VERSION.to_s] || 4200.0
|
45
63
|
version << ", JRuby: #{JRUBY_JARS_VERSION.to_s}"
|
46
64
|
else
|
47
65
|
upper_limit = {
|
48
66
|
7 => 67.0,
|
49
|
-
10 =>
|
50
|
-
15 =>
|
67
|
+
10 => 64.0,
|
68
|
+
15 => 68.0,
|
51
69
|
}[ANDROID_TARGET] || 64.0
|
52
70
|
end
|
53
71
|
lower_limit = upper_limit * 0.9
|
@@ -224,12 +242,14 @@ EOF
|
|
224
242
|
run_app_tests
|
225
243
|
end
|
226
244
|
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
245
|
+
if RUBOTO_PLATFORM == 'FROM_GEM'
|
246
|
+
def test_gen_jruby
|
247
|
+
Dir.chdir APP_DIR do
|
248
|
+
system "#{RUBOTO_CMD} gen jruby"
|
249
|
+
assert_equal 0, $?.exitstatus
|
250
|
+
assert File.exists?("libs/jruby-core-#{JRUBY_JARS_VERSION}.jar")
|
251
|
+
assert File.exists?("libs/jruby-stdlib-#{JRUBY_JARS_VERSION}.jar")
|
252
|
+
end
|
233
253
|
end
|
234
254
|
end
|
235
255
|
|
data/test/sqldroid_test.rb
CHANGED
@@ -20,12 +20,23 @@ class SqldroidTest < Test::Unit::TestCase
|
|
20
20
|
File.open('src/ruboto_test_app_activity.rb', 'w'){|f| f << <<EOF}
|
21
21
|
require 'ruboto/activity'
|
22
22
|
require 'ruboto/widget'
|
23
|
-
require 'ruboto/generate'
|
24
23
|
require 'sqldroid'
|
25
24
|
|
26
25
|
ruboto_import_widgets :LinearLayout, :ListView, :TextView
|
27
26
|
|
28
|
-
|
27
|
+
class MyArrayAdapter < android.widget.ArrayAdapter
|
28
|
+
def get_view(position, convert_view, parent)
|
29
|
+
puts "IN get_view!!!"
|
30
|
+
@inflater ||= context.getSystemService(Context::LAYOUT_INFLATER_SERVICE)
|
31
|
+
row = convert_view ? convert_view : @inflater.inflate(mResource, nil)
|
32
|
+
row.findViewById(mFieldId).text = get_item(position)
|
33
|
+
row
|
34
|
+
rescue Exception
|
35
|
+
puts "Exception getting list item view: \#$!"
|
36
|
+
puts $!.backtrace.join("\n")
|
37
|
+
convert_view
|
38
|
+
end
|
39
|
+
end
|
29
40
|
|
30
41
|
class RubotoTestAppActivity
|
31
42
|
def on_create(bundle)
|
@@ -33,19 +44,6 @@ class RubotoTestAppActivity
|
|
33
44
|
setTitle File.basename(__FILE__).chomp('_activity.rb').split('_').map { |s| "\#{s[0..0].upcase}\#{s[1..-1]}" }.join(' ')
|
34
45
|
|
35
46
|
adapter = MyArrayAdapter.new(self, android.R.layout.simple_list_item_1 , AndroidIds::text1, ['Record one', 'Record two'])
|
36
|
-
adapter.initialize_ruboto_callbacks do
|
37
|
-
def get_view(position, convert_view, parent)
|
38
|
-
puts "IN get_view!!!"
|
39
|
-
@inflater ||= context.getSystemService(Context::LAYOUT_INFLATER_SERVICE)
|
40
|
-
row = convert_view ? convert_view : @inflater.inflate(mResource, nil)
|
41
|
-
row.findViewById(mFieldId).text = get_item(position)
|
42
|
-
row
|
43
|
-
rescue Exception
|
44
|
-
puts "Exception getting list item view: \#$!"
|
45
|
-
puts $!.backtrace.join("\n")
|
46
|
-
convert_view
|
47
|
-
end
|
48
|
-
end
|
49
47
|
|
50
48
|
self.content_view =
|
51
49
|
linear_layout :orientation => LinearLayout::VERTICAL do
|
data/test/test_helper.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
|
1
|
+
lib = File.dirname(File.dirname(__FILE__)) + '/lib'
|
2
|
+
$:.unshift(lib) unless $:.include?(lib)
|
2
3
|
require 'test/unit'
|
3
4
|
require 'rubygems'
|
4
5
|
require 'fileutils'
|
@@ -59,10 +60,17 @@ module RubotoTest
|
|
59
60
|
end
|
60
61
|
|
61
62
|
def self.install_jruby_jars_gem
|
62
|
-
jars_version_from_env = ENV['JRUBY_JARS_VERSION']
|
63
|
-
version_requirement = "-v #{jars_version_from_env}" if jars_version_from_env
|
64
|
-
`gem query -i -n jruby-jars
|
65
|
-
|
63
|
+
jars_version_from_env = ENV['JRUBY_JARS_VERSION'] unless RUBOTO_PLATFORM == 'CURRENT'
|
64
|
+
version_requirement = " -v #{jars_version_from_env}" if jars_version_from_env
|
65
|
+
`gem query -i -n jruby-jars#{version_requirement}`
|
66
|
+
unless $? == 0
|
67
|
+
local_gem_file = "jruby-jars-#{jars_version_from_env}.gem"
|
68
|
+
if File.exists?(local_gem_file)
|
69
|
+
system "gem install -l #{local_gem_file} --no-ri --no-rdoc"
|
70
|
+
else
|
71
|
+
system "gem install -r jruby-jars#{version_requirement} --no-ri --no-rdoc"
|
72
|
+
end
|
73
|
+
end
|
66
74
|
raise "install of jruby-jars failed with return code #$?" unless $? == 0
|
67
75
|
if jars_version_from_env
|
68
76
|
exclusion_clause = %Q{-v "!=#{jars_version_from_env}"}
|
@@ -103,22 +111,27 @@ module RubotoTest
|
|
103
111
|
puts "ANDROID_HOME: #{ANDROID_HOME}"
|
104
112
|
puts "ANDROID_SDK_TOOLS_REVISION: #{ANDROID_TOOLS_REVISION}"
|
105
113
|
|
114
|
+
RUBOTO_PLATFORM = ENV['RUBOTO_PLATFORM'] || 'CURRENT'
|
115
|
+
puts "RUBOTO_PLATFORM: #{RUBOTO_PLATFORM}"
|
116
|
+
|
106
117
|
install_jruby_jars_gem
|
107
118
|
|
108
|
-
|
109
|
-
|
110
|
-
gem_spec = Gem::Specification.find_by_path 'jruby-jars'
|
119
|
+
if RUBOTO_PLATFORM == 'CURRENT'
|
120
|
+
JRUBY_JARS_VERSION = Gem::Version.new('1.7.0.dev')
|
111
121
|
else
|
112
|
-
|
122
|
+
# FIXME(uwe): Simplify when we stop supporting rubygems < 1.8.0
|
123
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.8.0')
|
124
|
+
gem_spec = Gem::Specification.find_by_path 'jruby-jars'
|
125
|
+
else
|
126
|
+
gem_spec = Gem.searcher.find('jruby-jars')
|
127
|
+
end
|
128
|
+
# EMXIF
|
129
|
+
|
130
|
+
raise StandardError.new("Can't find Gem specification jruby-jars.") unless gem_spec
|
131
|
+
JRUBY_JARS_VERSION = gem_spec.version
|
113
132
|
end
|
114
|
-
# EMXIF
|
115
133
|
|
116
|
-
raise StandardError.new("Can't find Gem specification jruby-jars.") unless gem_spec
|
117
|
-
JRUBY_JARS_VERSION = gem_spec.version
|
118
134
|
puts "JRUBY_JARS_VERSION: #{JRUBY_JARS_VERSION}"
|
119
|
-
|
120
|
-
RUBOTO_PLATFORM = ENV['RUBOTO_PLATFORM'] || 'CURRENT'
|
121
|
-
puts "RUBOTO_PLATFORM: #{RUBOTO_PLATFORM}"
|
122
135
|
end
|
123
136
|
|
124
137
|
class Test::Unit::TestCase
|
@@ -187,7 +200,7 @@ class Test::Unit::TestCase
|
|
187
200
|
FileUtils.touch 'libs/jruby-core-x.x.x.jar'
|
188
201
|
FileUtils.touch 'libs/jruby-stdlib-x.x.x.jar'
|
189
202
|
else
|
190
|
-
FileUtils.rm(Dir['libs/{jruby-*.jar,
|
203
|
+
FileUtils.rm(Dir['libs/{jruby-*.jar,dx.jar}'])
|
191
204
|
end
|
192
205
|
update_app if update
|
193
206
|
end
|
@@ -209,12 +222,12 @@ class Test::Unit::TestCase
|
|
209
222
|
end
|
210
223
|
end
|
211
224
|
|
212
|
-
# FIXME(uwe): Installation with
|
225
|
+
# FIXME(uwe): Installation with dx.jar fails on Android < 4.0.3 due to complex interface structure
|
213
226
|
# Fixme(uwe): Remove when solved
|
214
227
|
#if standalone && ANDROID_OS < 15
|
215
228
|
# Dir.chdir APP_DIR do
|
216
|
-
# puts "Removing
|
217
|
-
# FileUtils.rm(Dir['libs/
|
229
|
+
# puts "Removing dx.jar for android-#{ANDROID_OS}"
|
230
|
+
# FileUtils.rm(Dir['libs/dx.jar'])
|
218
231
|
# end
|
219
232
|
#end
|
220
233
|
# EMXIF
|
@@ -244,7 +257,7 @@ class Test::Unit::TestCase
|
|
244
257
|
puts "Skipping instrumentation tests on #{ANDROID_OS} since they don't work."
|
245
258
|
return
|
246
259
|
end
|
247
|
-
check_platform_installation
|
260
|
+
check_platform_installation
|
248
261
|
Dir.chdir APP_DIR do
|
249
262
|
# FIXME(uwe): Simplify when we stop supporting JRuby < 1.7.0 which causes the ArrayIndexOutOfBoundsException
|
250
263
|
# FIXME(uwe): Simplify if we find a cause for the system crashes.
|
@@ -274,15 +287,15 @@ class Test::Unit::TestCase
|
|
274
287
|
end
|
275
288
|
end
|
276
289
|
|
277
|
-
def check_platform_installation
|
278
|
-
if
|
290
|
+
def check_platform_installation
|
291
|
+
if RUBOTO_PLATFORM == 'STANDALONE'
|
279
292
|
system 'rake platform:uninstall'
|
293
|
+
elsif RUBOTO_PLATFORM == 'CURRENT'
|
294
|
+
system "rake platform:current platform:install"
|
295
|
+
elsif RUBOTO_PLATFORM == 'FROM_GEM'
|
296
|
+
system "rake platform:debug platform:install"
|
280
297
|
else
|
281
|
-
|
282
|
-
system "rake platform:current platform:install"
|
283
|
-
elsif RUBOTO_PLATFORM == 'FROM_GEM'
|
284
|
-
system "rake platform:debug platform:install"
|
285
|
-
end
|
298
|
+
fail "Unknown Ruboto platform: #{RUBOTO_PLATFORM.inspect}"
|
286
299
|
end
|
287
300
|
if $? != 0
|
288
301
|
FileUtils.rm_rf 'tmp/RubotoCore'
|
metadata
CHANGED
@@ -1,13 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruboto
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 752453167
|
5
|
+
prerelease: 6
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
|
8
|
+
- 9
|
9
|
+
- 0
|
10
|
+
- rc
|
11
|
+
- 0
|
12
|
+
version: 0.9.0.rc.0
|
11
13
|
platform: ruby
|
12
14
|
authors:
|
13
15
|
- Daniel Jackoway
|
@@ -18,7 +20,7 @@ autorequire:
|
|
18
20
|
bindir: bin
|
19
21
|
cert_chain: []
|
20
22
|
|
21
|
-
date: 2012-09-
|
23
|
+
date: 2012-09-28 00:00:00 Z
|
22
24
|
dependencies:
|
23
25
|
- !ruby/object:Gem::Dependency
|
24
26
|
name: main
|
@@ -59,7 +61,7 @@ files:
|
|
59
61
|
- Gemfile.lock
|
60
62
|
- Rakefile
|
61
63
|
- README.md
|
62
|
-
- assets/libs/
|
64
|
+
- assets/libs/dx.jar
|
63
65
|
- assets/Rakefile
|
64
66
|
- assets/rakelib/ruboto.rake
|
65
67
|
- assets/res/drawable/get_ruboto_core.png
|
@@ -92,7 +94,6 @@ files:
|
|
92
94
|
- assets/src/ruboto/activity.rb
|
93
95
|
- assets/src/ruboto/base.rb
|
94
96
|
- assets/src/ruboto/broadcast_receiver.rb
|
95
|
-
- assets/src/ruboto/generate.rb
|
96
97
|
- assets/src/ruboto/legacy.rb
|
97
98
|
- assets/src/ruboto/menu.rb
|
98
99
|
- assets/src/ruboto/package.rb
|
@@ -107,6 +108,8 @@ files:
|
|
107
108
|
- assets/src/RubotoService.java
|
108
109
|
- assets/test/src/test_helper.rb
|
109
110
|
- bin/ruboto
|
111
|
+
- lib/DalvikProxyClassFactory.java
|
112
|
+
- lib/DexClient.java
|
110
113
|
- lib/java_class_gen/android_api.xml
|
111
114
|
- lib/java_class_gen/InheritingClass.java.erb
|
112
115
|
- lib/ruboto/api.rb
|
@@ -128,8 +131,6 @@ files:
|
|
128
131
|
- lib/ruboto.rb
|
129
132
|
- test/activity/call_super_activity.rb
|
130
133
|
- test/activity/call_super_activity_test.rb
|
131
|
-
- test/activity/generate_activity.rb
|
132
|
-
- test/activity/generate_activity_test.rb
|
133
134
|
- test/activity/image_button_activity.rb
|
134
135
|
- test/activity/image_button_activity_test.rb
|
135
136
|
- test/activity/image_button_and_button_activity.rb
|
@@ -144,6 +145,8 @@ files:
|
|
144
145
|
- test/activity/psych_activity_test.rb
|
145
146
|
- test/activity/stack_activity.rb
|
146
147
|
- test/activity/stack_activity_test.rb
|
148
|
+
- test/activity/subclass_activity.rb
|
149
|
+
- test/activity/subclass_activity_test.rb
|
147
150
|
- test/app_test_methods.rb
|
148
151
|
- test/block_def_activity/image_button_activity.rb
|
149
152
|
- test/block_def_activity/image_button_activity_test.rb
|
@@ -201,12 +204,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
201
204
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
202
205
|
none: false
|
203
206
|
requirements:
|
204
|
-
- - "
|
207
|
+
- - ">"
|
205
208
|
- !ruby/object:Gem::Version
|
206
|
-
hash:
|
209
|
+
hash: 25
|
207
210
|
segments:
|
208
|
-
-
|
209
|
-
|
211
|
+
- 1
|
212
|
+
- 3
|
213
|
+
- 1
|
214
|
+
version: 1.3.1
|
210
215
|
requirements: []
|
211
216
|
|
212
217
|
rubyforge_project: ruboto/ruboto
|
Binary file
|