Skip to content

Commit 0c4cad3

Browse files
committed
[GR-10130] jt build ... updates
PullRequest: truffleruby/673
2 parents f6b387c + 38e63e1 commit 0c4cad3

File tree

1 file changed

+24
-12
lines changed

1 file changed

+24
-12
lines changed

tool/jt.rb

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,9 @@ def help
515515
parser build the parser
516516
options build the options
517517
cexts build only the C extensions (part of "jt build")
518-
graalvm build a minimal JVM-only GraalVM containing only TruffleRuby
518+
graalvm [--graal] [--native] build a minimal JVM-only GraalVM containing only TruffleRuby
519+
--graal include graal compiler in the build
520+
--native build native ruby image as well
519521
native [--no-sulong] [--no-jvmci] [--no-sforceimports] [--no-tools] [extra mx image options]
520522
build a native image of TruffleRuby (--no-jvmci to use the system Java)
521523
(--no-tools to exclude chromeinspector and profiler)
@@ -579,11 +581,11 @@ def help
579581
jt metrics minheap ... what is the smallest heap you can use to run an application
580582
jt metrics time ... how long does it take to run a command, broken down into different phases
581583
jt benchmark [options] args... run benchmark-interface (implies --graal)
582-
--no-graal don't imply --graal
583-
JT_BENCHMARK_RUBY=ruby benchmark some other Ruby, like MRI
584-
note that to run most MRI benchmarks, you should translate them first with normal Ruby and cache the result, such as
585-
benchmark bench/mri/bm_vm1_not.rb --cache
586-
jt benchmark bench/mri/bm_vm1_not.rb --use-cache
584+
--no-graal don't imply --graal
585+
JT_BENCHMARK_RUBY=ruby benchmark some other Ruby, like MRI
586+
note that to run most MRI benchmarks, you should translate them first with normal
587+
Ruby and cache the result, such as benchmark bench/mri/bm_vm1_not.rb --cache
588+
jt benchmark bench/mri/bm_vm1_not.rb --use-cache
587589
jt profile profiles an application, including the TruffleRuby runtime, and generates a flamegraph
588590
jt where repos ... find these repositories
589591
jt next tell you what to work on next (give you a random core library spec)
@@ -626,13 +628,11 @@ def build(*options)
626628
when "cexts" # Included in 'mx build' but useful to recompile just that part
627629
mx 'build', '--dependencies', 'org.truffleruby.cext'
628630
when 'graalvm'
629-
build_graalvm *options
631+
build_graalvm(*options)
630632
when 'native'
631-
build_native_image *options
632-
when nil
633-
build_graalvm
633+
build_native_image(*options)
634634
else
635-
raise ArgumentError, project
635+
build_graalvm(*project, *options)
636636
end
637637
end
638638

@@ -1869,16 +1869,28 @@ def install_graal(*options)
18691869

18701870
def build_graalvm(*options)
18711871
mx('-p', TRUFFLERUBY_DIR, 'sforceimports') unless ci?
1872+
graal = options.delete('--graal')
1873+
native = options.delete('--native')
18721874

18731875
java_home = ci? ? nil : ENV["JVMCI_HOME"] || install_jvmci
1874-
mx_args = ['-p', TRUFFLERUBY_DIR, '--dynamicimports', '/vm']
1876+
mx_args = ['-p', TRUFFLERUBY_DIR,
1877+
'--dynamicimports', '/vm',
1878+
*(%w[--dynamicimports /compiler] if graal),
1879+
*(%w[--dynamicimports /substratevm --disable-libpolyglot --disable-polyglot --force-bash-launchers=lli,native-image] if native),
1880+
*options]
18751881

18761882
mx(*mx_args, 'build', java_home: java_home)
18771883
build_dir = mx(*mx_args, 'graalvm-home', capture: true).lines.last.chomp
18781884

18791885
dest = "#{TRUFFLERUBY_DIR}/mxbuild/graalvm"
18801886
FileUtils.rm_rf dest
18811887
FileUtils.cp_r build_dir, dest
1888+
1889+
if MAC && !native
1890+
bin = "#{dest}/jre/languages/ruby/bin"
1891+
FileUtils.mv "#{bin}/truffleruby", "#{bin}/truffleruby.sh"
1892+
FileUtils.cp "#{TRUFFLERUBY_DIR}/tool/native_launcher_darwin", "#{bin}/truffleruby"
1893+
end
18821894
end
18831895

18841896
def build_native_image(*options)

0 commit comments

Comments
 (0)