@@ -515,7 +515,9 @@ def help
515
515
parser build the parser
516
516
options build the options
517
517
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
519
521
native [--no-sulong] [--no-jvmci] [--no-sforceimports] [--no-tools] [extra mx image options]
520
522
build a native image of TruffleRuby (--no-jvmci to use the system Java)
521
523
(--no-tools to exclude chromeinspector and profiler)
@@ -579,11 +581,11 @@ def help
579
581
jt metrics minheap ... what is the smallest heap you can use to run an application
580
582
jt metrics time ... how long does it take to run a command, broken down into different phases
581
583
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
587
589
jt profile profiles an application, including the TruffleRuby runtime, and generates a flamegraph
588
590
jt where repos ... find these repositories
589
591
jt next tell you what to work on next (give you a random core library spec)
@@ -626,13 +628,11 @@ def build(*options)
626
628
when "cexts" # Included in 'mx build' but useful to recompile just that part
627
629
mx 'build' , '--dependencies' , 'org.truffleruby.cext'
628
630
when 'graalvm'
629
- build_graalvm *options
631
+ build_graalvm ( *options )
630
632
when 'native'
631
- build_native_image *options
632
- when nil
633
- build_graalvm
633
+ build_native_image ( *options )
634
634
else
635
- raise ArgumentError , project
635
+ build_graalvm ( * project , * options )
636
636
end
637
637
end
638
638
@@ -1869,16 +1869,28 @@ def install_graal(*options)
1869
1869
1870
1870
def build_graalvm ( *options )
1871
1871
mx ( '-p' , TRUFFLERUBY_DIR , 'sforceimports' ) unless ci?
1872
+ graal = options . delete ( '--graal' )
1873
+ native = options . delete ( '--native' )
1872
1874
1873
1875
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 ]
1875
1881
1876
1882
mx ( *mx_args , 'build' , java_home : java_home )
1877
1883
build_dir = mx ( *mx_args , 'graalvm-home' , capture : true ) . lines . last . chomp
1878
1884
1879
1885
dest = "#{ TRUFFLERUBY_DIR } /mxbuild/graalvm"
1880
1886
FileUtils . rm_rf dest
1881
1887
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
1882
1894
end
1883
1895
1884
1896
def build_native_image ( *options )
0 commit comments