|
10 | 10 |
|
11 | 11 | # Recommended: function jt { ruby PATH/TO/jruby/tool/jt.rb $@; }
|
12 | 12 |
|
| 13 | +require 'fileutils' |
| 14 | +require 'digest/sha1' |
| 15 | + |
13 | 16 | JRUBY_DIR = File.expand_path('../..', __FILE__)
|
14 | 17 |
|
15 | 18 | module Utilities
|
@@ -43,6 +46,10 @@ def self.find_bench
|
43 | 46 | end
|
44 | 47 | end
|
45 | 48 |
|
| 49 | + def self.jruby_version |
| 50 | + File.read('VERSION').strip |
| 51 | + end |
| 52 | + |
46 | 53 | end
|
47 | 54 |
|
48 | 55 | module ShellUtils
|
@@ -101,6 +108,7 @@ def help
|
101 | 108 | puts ' by bench9000, eg all, classic, chunky, 3, 5, 10, 15 - default is 5'
|
102 | 109 | puts 'jt findbugs run findbugs'
|
103 | 110 | puts 'jt findbugs report run findbugs and generate an HTML report'
|
| 111 | + puts 'jt install ..../graal/mx/suite.py install a JRuby distribution into an mx suite' |
104 | 112 | puts
|
105 | 113 | puts 'you can also put build or rebuild in front of any command'
|
106 | 114 | end
|
@@ -192,14 +200,36 @@ def bench(command, *args)
|
192 | 200 | def findbugs(report=nil)
|
193 | 201 | case report
|
194 | 202 | when 'report'
|
195 |
| - sh 'tool/truffle-findbugs.sh', '--report' rescue nil |
196 |
| - sh 'open', 'truffle-findbugs-report.html' rescue nil |
| 203 | + sh 'tool/truffle-findbugs.sh', '--report' |
| 204 | + sh 'open', 'truffle-findbugs-report.html' |
197 | 205 | when nil
|
198 | 206 | sh 'tool/truffle-findbugs.sh'
|
199 | 207 | else
|
200 | 208 | raise ArgumentError, report
|
201 | 209 | end
|
202 | 210 | end
|
| 211 | + |
| 212 | + def install(arg) |
| 213 | + case arg |
| 214 | + when /.*suite.*\.py$/ |
| 215 | + suite_file = arg |
| 216 | + mvn '-Pcomplete' |
| 217 | + sh 'tool/remove-bundled-truffle.sh' |
| 218 | + jar_name = "jruby-complete-no-truffle-#{Utilities.jruby_version}.jar" |
| 219 | + source_jar_name = "maven/jruby-complete/target/#{jar_name}" |
| 220 | + shasum = Digest::SHA1.hexdigest File.read(source_jar_name) |
| 221 | + shasum_jar_name = "jruby-complete-no-truffle-#{Utilities.jruby_version}-#{shasum}.jar" |
| 222 | + FileUtils.cp source_jar_name, "#{File.expand_path('../..', suite_file)}/lib/#{shasum_jar_name}" |
| 223 | + suite_lines = File.readlines(suite_file) |
| 224 | + line_index = suite_lines.find_index { |line| line.start_with? ' "path" : "lib/jruby-complete-no-truffle' } |
| 225 | + suite_lines[line_index] = " \"path\" : \"lib/#{shasum_jar_name}\",\n" |
| 226 | + suite_lines[line_index + 1] = " \#\"urls\" : [\"http://lafo.ssw.uni-linz.ac.at/truffle/ruby/#{shasum_jar_name}\"],\n" |
| 227 | + suite_lines[line_index + 2] = " \"sha1\" : \"#{shasum}\"\n" |
| 228 | + File.write(suite_file, suite_lines.join()) |
| 229 | + else |
| 230 | + raise ArgumentError, kind |
| 231 | + end |
| 232 | + end |
203 | 233 | end
|
204 | 234 |
|
205 | 235 | class JT
|
|
0 commit comments