Skip to content

Commit 3712207

Browse files
committed
[Truffle] jt install suite.py to install into an mx suite definition.
1 parent 9b3d23a commit 3712207

File tree

1 file changed

+32
-2
lines changed

1 file changed

+32
-2
lines changed

tool/jt.rb

+32-2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010

1111
# Recommended: function jt { ruby PATH/TO/jruby/tool/jt.rb $@; }
1212

13+
require 'fileutils'
14+
require 'digest/sha1'
15+
1316
JRUBY_DIR = File.expand_path('../..', __FILE__)
1417

1518
module Utilities
@@ -43,6 +46,10 @@ def self.find_bench
4346
end
4447
end
4548

49+
def self.jruby_version
50+
File.read('VERSION').strip
51+
end
52+
4653
end
4754

4855
module ShellUtils
@@ -101,6 +108,7 @@ def help
101108
puts ' by bench9000, eg all, classic, chunky, 3, 5, 10, 15 - default is 5'
102109
puts 'jt findbugs run findbugs'
103110
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'
104112
puts
105113
puts 'you can also put build or rebuild in front of any command'
106114
end
@@ -192,14 +200,36 @@ def bench(command, *args)
192200
def findbugs(report=nil)
193201
case report
194202
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'
197205
when nil
198206
sh 'tool/truffle-findbugs.sh'
199207
else
200208
raise ArgumentError, report
201209
end
202210
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
203233
end
204234

205235
class JT

0 commit comments

Comments
 (0)