ruboto 1.0.2 → 1.0.3

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: 57638eee95f5a2cba9bf8c77af5a68250c23c7bb
4
- data.tar.gz: 9ed24085fa7c14979aa4a5e8582608753f0323c0
3
+ metadata.gz: aa80ecb3d9c8d5a37b94142f2a1fe730daad9563
4
+ data.tar.gz: bca65a11d086368713f67496b1ce279e17c56480
5
5
  SHA512:
6
- metadata.gz: 13dbc48f6712b77210a2403e9e6bd69f381ec5a3a9a9d840e114b9e326f8e56a2ad3acf23e5ab0196884b9eea87a97969b06c76ac71c6007c50d1d30436655dd
7
- data.tar.gz: 741ede8a69755af779acceadc5957b7d165f0441bd3d3b1b216b6ccc923828b847c935843e283d101431ebf81aed4734c06c3e19440018e213ef659e6bdad3cd
6
+ metadata.gz: d2b7f8bd447f38c527684f6b4caaa193f5ea7e88388a98888ace26ab6e85228d0f122d9ce6e1ef0c9c20c33bd50b69cda678fb4ce8e6cacd0382ea8596c8c10f
7
+ data.tar.gz: 7c929fcee3c3f860dd33930618d46dfc0350c21a745872db259435c8b2993ce674fe9afdd2698dcda94ef0a02410aa423a4a2792d37d79cee92dee9da700e640
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ruboto (1.0.2)
4
+ ruboto (1.0.3)
5
5
  main (~> 5.2.0)
6
6
  rake (~> 10.0)
7
7
  rubyzip (~> 1.0)
@@ -9,17 +9,17 @@ PATH
9
9
  GEM
10
10
  remote: http://rubygems.org/
11
11
  specs:
12
- arrayfields (4.9.0)
12
+ arrayfields (4.9.2)
13
13
  chronic (0.10.2)
14
- fattr (2.2.1)
14
+ fattr (2.2.2)
15
15
  main (5.2.0)
16
16
  arrayfields (>= 4.7.4)
17
17
  chronic (>= 0.6.2)
18
18
  fattr (>= 2.2.0)
19
19
  map (>= 5.1.0)
20
- map (6.5.1)
21
- rake (10.1.1)
22
- rubyzip (1.1.0)
20
+ map (6.5.3)
21
+ rake (10.3.0)
22
+ rubyzip (1.1.3)
23
23
 
24
24
  PLATFORMS
25
25
  java
@@ -1,11 +1,14 @@
1
- Subject: [ANN] Ruboto 1.0.2 release candidate
1
+ Subject: [ANN] Ruboto 1.0.3 release candidate
2
2
 
3
3
  Hi all!
4
4
 
5
- The Ruboto 1.0.2 release candidate is now available.
5
+ The Ruboto 1.0.3 release candidate is now available.
6
6
 
7
- This releases updates to JRuby 1.7.10 and improves installation with
8
- automated setup of Apache ANT on Windows and Linux.
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.
9
12
 
10
13
  As always we need your help and feedback to ensure the quality of the release. Please install the release candidate using
11
14
 
@@ -1,6 +1,6 @@
1
- Subject: [ANN] Ruboto 1.0.2 released!
1
+ Subject: [ANN] Ruboto 1.0.3 released!
2
2
 
3
- The Ruboto team is pleased to announce the release of Ruboto 1.0.2.
3
+ The Ruboto team is pleased to announce the release of Ruboto 1.0.3.
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,37 +8,43 @@ 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.2:
11
+ New in version 1.0.3:
12
12
 
13
- This releases updates to JRuby 1.7.10 and improves installation with
14
- automated setup of Apache ANT on Windows and Linux.
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.
15
18
 
16
19
  Features:
17
20
 
18
- * Issue #447 Use "ruboto setup" to flag and install ant
19
- * Issue #564 Update to JRuby 1.7.10
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
20
24
 
21
25
  Bugfixes:
22
26
 
23
- * Issue #525 Quick Start : "Unfortunately, Browser has stopped"
24
- * Issue #565 Odd behaviour when changing orientation with Fragments
25
- * Issue #575 Gemfile.lock contains references to gems that are not part
26
- of the dependencies
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?
27
36
 
28
- Documentation:
37
+ Support:
29
38
 
30
- * Issue #568 Error with tutorial on "Example: Open a web page"
39
+ * Issue #579 Android platform SDK for android-10 not found (v1.0.2)
31
40
 
32
- Community:
41
+ Internal:
33
42
 
34
- * Issue #533 How can I help? (di3z )
35
- * Issue #562 How can I help? (lucasallan)
36
- * Issue #563 How can I help? (pedroandrade)
37
- * Issue #572 How can I help? (iamrahulroy)
43
+ * Issue #577 Domain expired
38
44
 
39
45
  You can find a complete list of issues here:
40
46
 
41
- * https://github.com/ruboto/ruboto/issues?state=closed&milestone=27
47
+ * https://github.com/ruboto/ruboto/issues?state=closed&milestone=28
42
48
 
43
49
 
44
50
  Installation:
@@ -77,7 +77,7 @@ end
77
77
  PROJECT_DIR = File.expand_path('..', File.dirname(__FILE__))
78
78
  UPDATE_MARKER_FILE = File.join(PROJECT_DIR, 'bin', 'LAST_UPDATE')
79
79
  BUNDLE_JAR = File.expand_path 'libs/bundle.jar'
80
- BUNDLE_PATH = File.expand_path 'bin/bundle'
80
+ BUNDLE_PATH = File.join(PROJECT_DIR, 'bin', 'bundle')
81
81
  MANIFEST_FILE = File.expand_path 'AndroidManifest.xml'
82
82
  PROJECT_PROPS_FILE = File.expand_path 'project.properties'
83
83
  RUBOTO_CONFIG_FILE = File.expand_path 'ruboto.yml'
@@ -239,10 +239,18 @@ file RUBOTO_CONFIG_FILE
239
239
  task :jruby_adapter => JRUBY_ADAPTER_FILE
240
240
  file JRUBY_ADAPTER_FILE => RUBOTO_CONFIG_FILE do
241
241
  require 'yaml'
242
+
243
+ ruboto_yml = (YAML.load(File.read(RUBOTO_CONFIG_FILE)) || {})
244
+ source = File.read(JRUBY_ADAPTER_FILE)
245
+
246
+ #
247
+ # HeapAlloc
248
+ #
249
+ comment = ''
242
250
  marker_topic ='Ruboto HeapAlloc'
243
251
  begin_marker = "// BEGIN #{marker_topic}"
244
252
  end_marker = "// END #{marker_topic}"
245
- unless (heap_alloc = YAML.load(File.read(RUBOTO_CONFIG_FILE))['heap_alloc'])
253
+ unless (heap_alloc = ruboto_yml['heap_alloc'])
246
254
  heap_alloc = 13
247
255
  comment = '// '
248
256
  end
@@ -253,9 +261,31 @@ file JRUBY_ADAPTER_FILE => RUBOTO_CONFIG_FILE do
253
261
  #{comment}arrayForHeapAllocation = null;
254
262
  #{end_marker}
255
263
  EOF
256
- source = File.read(JRUBY_ADAPTER_FILE)
257
- heap_alloc_pattern = %r{^\s*#{begin_marker}\n.*^\s*#{end_marker}\n}m
258
- File.open(JRUBY_ADAPTER_FILE, 'w') { |f| f << source.sub(heap_alloc_pattern, config) }
264
+ pattern = %r{^\s*#{begin_marker}\n.*^\s*#{end_marker}\n}m
265
+ source = source.sub(pattern, config)
266
+
267
+ #
268
+ # RubyVersion
269
+ #
270
+ comment = ''
271
+ marker_topic ='Ruboto RubyVersion'
272
+ begin_marker = "// BEGIN #{marker_topic}"
273
+ end_marker = "// END #{marker_topic}"
274
+ unless (ruby_version = ruboto_yml['ruby_version'])
275
+ ruby_version = 2.0
276
+ comment = '// '
277
+ end
278
+ ruby_version = ruby_version.to_s
279
+ ruby_version['.'] = '_'
280
+ 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}
284
+ EOF
285
+ pattern = %r{^\s*#{begin_marker}\n.*^\s*#{end_marker}\n}m
286
+ source = source.sub(pattern, config)
287
+
288
+ File.open(JRUBY_ADAPTER_FILE, 'w') { |f| f << source }
259
289
  end
260
290
 
261
291
  file APK_FILE => APK_DEPENDENCIES do |t|
@@ -365,25 +395,27 @@ file BUNDLE_JAR => [GEM_FILE, GEM_LOCK_FILE] do
365
395
  puts "Generating #{BUNDLE_JAR}"
366
396
  require 'bundler'
367
397
  # FIXME(uwe): Issue #547 https://github.com/ruboto/ruboto/issues/547
368
- if true || Gem::Version.new(Bundler::VERSION) <= Gem::Version.new('1.5.0')
398
+ if true || Gem::Version.new(Bundler::VERSION) <= Gem::Version.new('1.6.3')
369
399
  require 'bundler/vendored_thor'
370
400
 
371
401
  # Store original RubyGems/Bundler environment
372
402
  platforms = Gem.platforms
373
403
  ruby_engine = defined?(RUBY_ENGINE) && RUBY_ENGINE
374
- gem_paths = {'GEM_HOME' => Gem.path, 'GEM_PATH' => Gem.dir}
404
+ env_home = ENV['GEM_HOME']
405
+ env_path = ENV['GEM_PATH']
375
406
 
376
407
  # Override RUBY_ENGINE (we can bundle from MRI for JRuby)
377
408
  Gem.platforms = [Gem::Platform::RUBY, Gem::Platform.new("universal-dalvik-#{sdk_level}"), Gem::Platform.new('universal-java')]
378
- Gem.paths = {'GEM_HOME' => BUNDLE_PATH, 'GEM_PATH' => BUNDLE_PATH}
409
+ ENV['GEM_HOME'] = BUNDLE_PATH
410
+ ENV['GEM_PATH'] = BUNDLE_PATH
379
411
  old_verbose, $VERBOSE = $VERBOSE, nil
380
412
  begin
381
413
  Object.const_set('RUBY_ENGINE', 'jruby')
382
414
  ensure
383
415
  $VERBOSE = old_verbose
384
416
  end
385
-
386
417
  ENV['BUNDLE_GEMFILE'] = GEM_FILE
418
+
387
419
  Bundler.ui = Bundler::UI::Shell.new
388
420
  Bundler.bundle_path = Pathname.new BUNDLE_PATH
389
421
  definition = Bundler.definition
@@ -402,7 +434,8 @@ file BUNDLE_JAR => [GEM_FILE, GEM_LOCK_FILE] do
402
434
  $VERBOSE = old_verbose
403
435
  end
404
436
  Gem.platforms = platforms
405
- Gem.paths = gem_paths['GEM_PATH']
437
+ ENV['GEM_HOME'] = env_home
438
+ ENV['GEM_PATH'] = env_path
406
439
  else
407
440
  # Bundler.settings[:platform] = Gem::Platform::DALVIK
408
441
  sh "bundle install --gemfile #{GEM_FILE} --path=#{BUNDLE_PATH} --platform=dalvik#{sdk_level}"
@@ -619,8 +652,10 @@ def package_installed?(test = false)
619
652
  package_name = "#{package}#{'.tests' if test}"
620
653
  loop do
621
654
  path_line = `adb shell pm path #{package_name}`.chomp
655
+ path_line.gsub! /^WARNING:.*$/, ''
622
656
  return nil if $? == 0 && path_line.empty?
623
657
  break if $? == 0 && path_line =~ /^package:(.*)$/
658
+ puts path_line
624
659
  sleep 0.5
625
660
  end
626
661
  path = $1
@@ -651,8 +686,8 @@ end
651
686
  def build_apk(t, release)
652
687
  apk_file = release ? RELEASE_APK_FILE : APK_FILE
653
688
  if File.exist?(apk_file)
654
- changed_prereqs = t.prerequisites.select do |p|
655
- File.file?(p) && !Dir[p].empty? && Dir[p].map { |f| File.mtime(f) }.max > File.mtime(apk_file)
689
+ 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)
656
691
  end
657
692
  return false if changed_prereqs.empty?
658
693
  changed_prereqs.each { |f| puts "#{f} changed." }
@@ -666,7 +701,17 @@ def build_apk(t, release)
666
701
  true
667
702
  end
668
703
 
704
+ def wait_for_valid_device
705
+ while `adb shell echo "ping"`.strip != 'ping'
706
+ `adb kill-server`
707
+ `adb devices`
708
+ sleep 5
709
+ end
710
+ end
711
+
669
712
  def install_apk
713
+ wait_for_valid_device
714
+
670
715
  failure_pattern = /^Failure \[(.*)\]/
671
716
  success_pattern = /^Success/
672
717
  case package_installed?
@@ -741,7 +786,8 @@ def uninstall_apk
741
786
  end
742
787
 
743
788
  def update_scripts
744
- `adb shell mkdir -p #{scripts_path}` if !device_path_exists?(scripts_path)
789
+ puts(`adb shell mkdir -p #{scripts_path}`) unless device_path_exists?(scripts_path)
790
+ raise "Unable to create device scripts dir: #{scripts_path}" unless device_path_exists?(scripts_path)
745
791
  last_update = File.exists?(UPDATE_MARKER_FILE) ? Time.parse(File.read(UPDATE_MARKER_FILE)) : Time.parse('1970-01-01T00:00:00')
746
792
  Dir.chdir('src') do
747
793
  source_files = Dir['**/*.rb']
@@ -769,8 +815,8 @@ end
769
815
 
770
816
  # Triggers reload of updated scripts and restart of the current activity
771
817
  def reload_scripts(scripts)
772
- s = scripts.map{|s| s.gsub(/[&;]/){|m| "&#{m[0]}"}}.join(';')
773
- cmd = %Q{adb shell am broadcast -a android.intent.action.VIEW -e reload "#{s}"}
818
+ s = scripts.map{|s| s.gsub(/[&;]/){|m| "&#{m[0]}"}}.join('\;')
819
+ cmd = %Q{adb shell am broadcast -a android.intent.action.VIEW -e reload '#{s}'}
774
820
  puts cmd
775
821
  system cmd
776
822
  end
@@ -0,0 +1,266 @@
1
+ require 'yaml'
2
+ require 'fileutils'
3
+ require 'rexml/document'
4
+
5
+ namespace :libs do
6
+ desc 'take a fresh copy of the stdlib and rebuild it for use with this project'
7
+ task :reconfigure_stdlib do
8
+ require_relative 'stdlib_dependencies'
9
+ reconfigure_jruby_stdlib
10
+ end
11
+
12
+ desc 'check the stdlib dependencies and store them in auto_dependencies.yml'
13
+ task :check_dependencies do
14
+ require_relative 'stdlib_dependencies'
15
+
16
+ if File.exists? 'auto_dependencies.yml'
17
+ old_dep = (YAML::load_file('auto_dependencies.yml') || {})
18
+ end
19
+
20
+ new_dep = find_dependencies
21
+ if new_dep == old_dep
22
+ puts "Dependencies haven't changed: #{new_dep.join(', ')}"
23
+ else
24
+ puts "New dependencies: #{new_dep.join(', ')}"
25
+ File.open( "auto_dependencies.yml", 'w' ) do |out|
26
+ YAML.dump( new_dep, out )
27
+ end
28
+ end
29
+ end
30
+ end
31
+
32
+ def log_action(initial_text, final_text="Done.", &block)
33
+ $stdout.sync = true
34
+
35
+ print initial_text, "..."
36
+ result = yield
37
+ puts final_text
38
+
39
+ result
40
+ end
41
+
42
+ ############################################################################
43
+ #
44
+ # Support for reconfigure_jruby_stdlib
45
+ #
46
+
47
+ # - Moves ruby stdlib to the root of the jruby-stdlib jar
48
+ def reconfigure_jruby_stdlib
49
+ abort "cannot find jruby library in libs" if Dir["libs/jruby*"].empty?
50
+
51
+ require 'jruby-jars'
52
+
53
+ log_action("Copying #{JRubyJars::stdlib_jar_path} to libs") { FileUtils.cp JRubyJars::stdlib_jar_path, "libs/jruby-stdlib-#{JRubyJars::VERSION}.jar" }
54
+ StdlibDependencies.load('rakelib/stdlib.yml')
55
+
56
+ Dir.chdir 'libs' do
57
+ jruby_stdlib = Dir['jruby-stdlib-*.jar'][-1]
58
+ log_action("Reformatting #{jruby_stdlib}") do
59
+ FileUtils.mkdir_p 'tmp'
60
+ Dir.chdir 'tmp' do
61
+ FileUtils.mkdir_p 'old'
62
+ FileUtils.mkdir_p 'new/jruby.home'
63
+ Dir.chdir 'old' do
64
+ `jar -xf ../../#{jruby_stdlib}`
65
+ raise "Unpacking jruby-stdlib jar failed: #$?" unless $? == 0
66
+ end
67
+ FileUtils.move 'old/META-INF/jruby.home/lib', 'new/jruby.home/lib'
68
+ FileUtils.rm_rf 'new/jruby.home/lib/ruby/gems'
69
+
70
+ remove_unneeded_parts_of_stdlib
71
+ cleanup_jars
72
+
73
+ Dir.chdir 'new' do
74
+ `jar -cf ../../#{jruby_stdlib} .`
75
+ raise "Creating repackaged jruby-stdlib jar failed: #$?" unless $? == 0
76
+ end
77
+ end
78
+
79
+ FileUtils.remove_dir 'tmp', true
80
+ end
81
+ end
82
+ end
83
+
84
+ def remove_unneeded_parts_of_stdlib
85
+ if File.exists? '../../ruboto.yml'
86
+ ruboto_config = (YAML::load_file('../../ruboto.yml') || {})
87
+ else
88
+ ruboto_config = {}
89
+ end
90
+
91
+ ruby_version = ruboto_config['ruby_version']
92
+ included_stdlibs = ruboto_config['included_stdlibs']
93
+ excluded_stdlibs = [*ruboto_config['excluded_stdlibs']].compact
94
+
95
+ if included_stdlibs and included_stdlibs == "auto"
96
+ if File.exists? '../../auto_dependencies.yml'
97
+ included_stdlibs = YAML::load_file('../../auto_dependencies.yml')
98
+ else
99
+ puts "No auto_dependencies.yml file found. Use 'rake libs:check_dependencies' to create one."
100
+ included_stdlibs = nil
101
+ end
102
+ end
103
+
104
+ Dir.chdir 'new/jruby.home/lib/ruby' do
105
+ #
106
+ # Add ruby_version (e.g., 1.8, 1.9, 2.0) to ruboto.yml
107
+ # to trim unused versions from stdlib
108
+ #
109
+ if ruby_version
110
+ ruby_stdlib_versions = Dir['*'] - %w(gems shared)
111
+ print "ruby version = #{ruby_version}..."
112
+ ruby_stdlib_versions.each do |ld|
113
+ unless ld == ruby_version.to_s
114
+ print "removing #{ld}..."
115
+ FileUtils.rm_rf ld
116
+ end
117
+ end
118
+ end
119
+
120
+ if included_stdlibs
121
+ ruby_version ||= 1.9
122
+ ruby_version = ruby_version.to_s
123
+
124
+ # Require jruby and java
125
+ included_stdlibs = (included_stdlibs + %w(java jruby)).uniq
126
+
127
+ ruby_stdlib_versions = Dir['*'] - %w(gems)
128
+ print 'excluded...'
129
+ ruby_stdlib_versions.each do |ld|
130
+ Dir.chdir ld do
131
+ libs = Dir['*'].map { |d| d.sub /\.(rb|jar)$/, '' }.uniq
132
+ libs.each do |d|
133
+ next if included_stdlibs.include? d
134
+ FileUtils.rm_rf d if File.exists? d
135
+ file = "#{d}.rb"
136
+ FileUtils.rm_rf file if File.exists? file
137
+ jarfile = "#{d}.jar"
138
+ FileUtils.rm_rf jarfile if File.exists? jarfile
139
+ print "#{d} "
140
+ end
141
+ end
142
+ end
143
+ end
144
+
145
+ if included_stdlibs.nil? and excluded_stdlibs.any?
146
+ # Don't allow jruby and java to be removed
147
+ excluded_stdlibs = excluded_stdlibs - %w(jruby java)
148
+
149
+ ruby_stdlib_versions = Dir['*'] - %w(gems)
150
+ ruby_stdlib_versions.each do |ld|
151
+ excluded_stdlibs.each do |d|
152
+ dir = "#{ld}/#{d}"
153
+ FileUtils.rm_rf dir if File.exists? dir
154
+ file = "#{dir}.rb"
155
+ FileUtils.rm_rf file if File.exists? file
156
+ end
157
+ end
158
+ print "excluded #{excluded_stdlibs.join(' ')}..."
159
+ end
160
+ end
161
+ end
162
+
163
+ def cleanup_jars
164
+ Dir.chdir 'new' do
165
+ Dir['**/*.jar'].each do |j|
166
+
167
+ # FIXME(uwe): Installing bcmail-jdk15-146.jar + bcprov-jdk15-146.jar fails due to
168
+ # http://code.google.com/p/android/issues/detail?id=40409
169
+ # This breaks ssl and https. Remove when we stop supporting JRuby <= 1.7.2
170
+ if j =~ /bcmail|bcprov-jdk15-146/
171
+ FileUtils.rm j
172
+ next
173
+ end
174
+ # EMXIF
175
+
176
+ # FIXME(uwe): Adding the jars triggers the "LinearAlloc exceeded capacity"
177
+ # bug in Android 2.3. Remove when we stop supporting android-10 and older
178
+ abort "cannot find your AndroidManifest.xml to extract info from it" unless File.exists? '../../../AndroidManifest.xml'
179
+ manifest = REXML::Document.new(File.read('../../../AndroidManifest.xml')).root
180
+ min_sdk_version = manifest.elements['uses-sdk'].attributes['android:minSdkVersion'].to_i
181
+ if min_sdk_version <= 10
182
+ FileUtils.rm j
183
+ next
184
+ end
185
+ # EMXIF
186
+
187
+ # FIXME(uwe): These should be included but break the 64K method count limit
188
+ if j =~ /bcpkix-jdk15on-1\.?47|bcprov-jdk15on-1\.?47|jopenssl|kryptcore|kryptproviderjdk/
189
+ FileUtils.rm j
190
+ next
191
+ end
192
+ # EMXIF
193
+
194
+ print "#{File.basename(j).chomp('.jar')}..."
195
+ system "jar xf #{j}"
196
+ FileUtils.rm j
197
+ if ENV['STRIP_INVOKERS']
198
+ invokers = Dir['**/*$INVOKER$*.class']
199
+ if invokers.size > 0
200
+ print "Removing invokers(#{invokers.size})..."
201
+ FileUtils.rm invokers
202
+ end
203
+ populators = Dir['**/*$POPULATOR.class']
204
+ if populators.size > 0
205
+ print "Removing populators(#{populators.size})..."
206
+ FileUtils.rm populators
207
+ end
208
+ end
209
+
210
+ if j =~ %r{json/ext/generator.jar$}
211
+ jar_load_code = <<-END_CODE
212
+ require 'jruby'
213
+ puts 'Starting JSON Generator Service'
214
+ public
215
+ Java::json.ext.GeneratorService.new.basicLoad(JRuby.runtime)
216
+ END_CODE
217
+ elsif j =~ %r{json/ext/parser.jar$}
218
+ jar_load_code = <<-END_CODE
219
+ require 'jruby'
220
+ puts 'Starting JSON Parser Service'
221
+ public
222
+ Java::json.ext.ParserService.new.basicLoad(JRuby.runtime)
223
+ END_CODE
224
+ else
225
+ jar_load_code = ''
226
+ end
227
+
228
+ File.open("#{j}.rb", 'w') { |f| f << jar_load_code }
229
+ File.open("#{j}.jar.rb", 'w') { |f| f << jar_load_code }
230
+ end
231
+ end
232
+ end
233
+
234
+ ############################################################################
235
+ #
236
+ # Support for check_dependencies
237
+ #
238
+
239
+ def find_dependencies
240
+ if File.exists? 'rakefile/ruboto.yml'
241
+ ruboto_config = (YAML::load_file('rakefile/ruboto.yml') || {})
242
+ else
243
+ ruboto_config = {}
244
+ end
245
+ ruby_version = ruboto_config['ruby_version'] || "1.9"
246
+
247
+ local = StdlibDependencies.collect("src").dependencies
248
+ stdlib = StdlibDependencies.load('rakelib/stdlib.yml')[ruby_version]
249
+
250
+ dependencies = local.values.flatten
251
+ new_values = []
252
+ check_values = local.values.flatten
253
+
254
+ while check_values.any?
255
+ check_values.each do |j|
256
+ new_values += stdlib[j] if stdlib[j]
257
+ end
258
+
259
+ check_values = new_values - dependencies
260
+ dependencies = dependencies + new_values
261
+ new_values = []
262
+ end
263
+
264
+ dependencies.map{|d| d.split("/")[0]}.uniq.sort
265
+ end
266
+