Skip to content

Commit

Permalink
[Truffle] jt install suite.py to install into an mx suite definition.
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisseaton committed Feb 8, 2015
1 parent 9b3d23a commit 3712207
Showing 1 changed file with 32 additions and 2 deletions.
34 changes: 32 additions & 2 deletions tool/jt.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@

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

require 'fileutils'
require 'digest/sha1'

JRUBY_DIR = File.expand_path('../..', __FILE__)

module Utilities
Expand Down Expand Up @@ -43,6 +46,10 @@ def self.find_bench
end
end

def self.jruby_version
File.read('VERSION').strip
end

end

module ShellUtils
Expand Down Expand Up @@ -101,6 +108,7 @@ def help
puts ' by bench9000, eg all, classic, chunky, 3, 5, 10, 15 - default is 5'
puts 'jt findbugs run findbugs'
puts 'jt findbugs report run findbugs and generate an HTML report'
puts 'jt install ..../graal/mx/suite.py install a JRuby distribution into an mx suite'
puts
puts 'you can also put build or rebuild in front of any command'
end
Expand Down Expand Up @@ -192,14 +200,36 @@ def bench(command, *args)
def findbugs(report=nil)
case report
when 'report'
sh 'tool/truffle-findbugs.sh', '--report' rescue nil
sh 'open', 'truffle-findbugs-report.html' rescue nil
sh 'tool/truffle-findbugs.sh', '--report'
sh 'open', 'truffle-findbugs-report.html'
when nil
sh 'tool/truffle-findbugs.sh'
else
raise ArgumentError, report
end
end

def install(arg)
case arg
when /.*suite.*\.py$/
suite_file = arg
mvn '-Pcomplete'
sh 'tool/remove-bundled-truffle.sh'
jar_name = "jruby-complete-no-truffle-#{Utilities.jruby_version}.jar"
source_jar_name = "maven/jruby-complete/target/#{jar_name}"
shasum = Digest::SHA1.hexdigest File.read(source_jar_name)
shasum_jar_name = "jruby-complete-no-truffle-#{Utilities.jruby_version}-#{shasum}.jar"
FileUtils.cp source_jar_name, "#{File.expand_path('../..', suite_file)}/lib/#{shasum_jar_name}"
suite_lines = File.readlines(suite_file)
line_index = suite_lines.find_index { |line| line.start_with? ' "path" : "lib/jruby-complete-no-truffle' }
suite_lines[line_index] = " \"path\" : \"lib/#{shasum_jar_name}\",\n"
suite_lines[line_index + 1] = " \#\"urls\" : [\"http://lafo.ssw.uni-linz.ac.at/truffle/ruby/#{shasum_jar_name}\"],\n"
suite_lines[line_index + 2] = " \"sha1\" : \"#{shasum}\"\n"
File.write(suite_file, suite_lines.join())
else
raise ArgumentError, kind
end
end
end

class JT
Expand Down

0 comments on commit 3712207

Please sign in to comment.