- GraalVM for JDK 23(最新)
- GraalVM for JDK 24 (早期アクセス)
- GraalVM for JDK 21
- GraalVM for JDK 17
- アーカイブ
- 開発ビルド
TruffleRubyのオプションとコマンドライン
TruffleRubyは、互換性のあるMRIバージョンと同じコマンドラインインターフェースを備えています。
Usage: truffleruby [switches] [--] [programfile] [arguments]
-0[octal] specify record separator (\0, if no argument)
-a autosplit mode with -n or -p (splits $_ into $F)
-c check syntax only
-Cdirectory cd to directory before executing your script
-d, --debug set debugging flags (set $DEBUG to true)
-e 'command' one line of script. Several -e's allowed. Omit [programfile]
-Eex[:in], --encoding=ex[:in]
specify the default external and internal character encodings
-Fpattern split() pattern for autosplit (-a)
-i[extension] edit ARGV files in place (make backup if extension supplied)
-Idirectory specify $LOAD_PATH directory (may be used more than once)
-l enable line ending processing
-n assume 'while gets(); ... end' loop around your script
-p assume loop like -n but print line also like sed
-rlibrary require the library before executing your script
-s enable some switch parsing for switches after script name
-S look for the script using PATH environment variable
-v print the version number, then turn on verbose mode
-w turn warnings on for your script
-W[level=2|:category]
set warning level; 0=silence, 1=medium, 2=verbose
-x[directory] strip off text before #!ruby line and perhaps cd to directory
--copyright print the copyright
--enable={jit|rubyopt|...}[,...], --disable={jit|rubyopt|...}[,...]
enable or disable features. see below for available features
--external-encoding=encoding, --internal-encoding=encoding
specify the default external or internal character encoding
--backtrace-limit=num
limit the maximum length of backtrace
--verbose turn on verbose mode and disable script from stdin
--version print the version number, then exit
--help show this message, -h for short message
Features:
gems rubygems (only for debugging, default: enabled)
error_highlight error_highlight (default: enabled)
did_you_mean did_you_mean (default: enabled)
syntax_suggest syntax_suggest (default: enabled)
rubyopt RUBYOPT environment variable (default: enabled)
frozen-string-literal
freeze all string literals (default: disabled)
Warning categories:
deprecated deprecated features
experimental experimental features
Runtime options:
--polyglot Run with all other guest languages accessible.
--native Run using the native launcher with limited access to Java libraries
(default).
--jvm Run on the Java Virtual Machine with access to Java libraries.
--vm.[option] Pass options to the host VM. To see available options, use '--help:vm'.
--log.file=<String> Redirect guest languages logging into a given file.
--log.[logger].level=<String> Set language log level to OFF, SEVERE, WARNING, INFO, CONFIG, FINE,
FINER, FINEST or ALL.
--help Print this help message.
--help:vm Print options for the host VM.
--help:engine Print engine options.
--help:compiler Print engine compiler options.
--help:all Print all options.
--version:graalvm Print GraalVM version information and exit.
--show-version:graalvm Print GraalVM version information and continue execution.
Languages:
[id] [name] [website]
llvm LLVM https://graalvm.dokyumento.jp/dev/reference-manual/llvm/
ruby Ruby https://graalvm.dokyumento.jp/ruby/
Tools:
[id] [name] [website]
agentscript Agent Script
coverage Code Coverage https://graalvm.dokyumento.jp/tools/code-coverage/
cpusampler CPU Sampler https://graalvm.dokyumento.jp/tools/profiling/
cputracer CPU Tracer https://graalvm.dokyumento.jp/tools/profiling/
dap Debug Protocol Server https://graalvm.dokyumento.jp/tools/dap/
heap Heap Dump
heapmonitor Heap Allocation Monitor
insight Insight https://graalvm.dokyumento.jp/tools/graalvm-insight/
inspect Chrome Inspector https://graalvm.dokyumento.jp/tools/chrome-debugger/
lsp Language Server https://graalvm.dokyumento.jp/tools/lsp/
memtracer Memory Tracer https://graalvm.dokyumento.jp/tools/profiling/
Use --help:[id] for component options.
See https://graalvm.dokyumento.jp for more information.
TruffleRubyは、標準のRubyと同様に、Rubyランチャーから実行した場合、RUBYOPT
環境変数も読み込みます。
未掲載のRubyスイッチ #
MRIには、ヘルプ出力には通常リストされないものの、Rubyマニュアルページにドキュメント化されている追加のRubyスイッチがいくつかあります。
-Xdirectory cd to directory before executing your script (same as -C)
-U set the internal encoding to UTF-8
-K[EeSsUuNnAa] sets the source and external encoding
--encoding=external[:internal]
the same as --external-encoding=external and optionally --internal-encoding=internal
TruffleRubyオプション #
TruffleRubyオプションは、--option=value
で設定するか、任意のランチャーから--ruby.option=value
を使用できます。=value
を省略すると、true
に設定されます。
利用可能なオプションとドキュメントは、--help:languages
で確認できます。さらに、--help:expert
および--help:internal
を設定して、これらのカテゴリのオプションを表示します。すべてのオプションは実験的なものであり、いつでも変更される可能性があります。
オプションは、JVMシステムプロパティとしても設定でき、polyglot.ruby.
というプレフィックスが付きます。たとえば、--vm.Dpolyglot.ruby.cexts.remap=true
、またはJVMシステムプロパティを設定する他の任意の方法で設定できます。最後に、オプションはGraalVMポリグロットAPI構成オプションとして設定できます。
オプションの優先順位は、コマンドラインが最初、次にGraal-SDKポリグロットAPI構成、最後にシステムプロパティとなります。
TruffleRubyオプションは、従来のRubyオプションおよびVMオプションと同様に、Rubyランチャーから実行した場合、TRUFFLERUBYOPT
およびRUBYOPT
環境変数にも設定できます。
--
または最初の非オプション引数は、Ruby引数の処理を停止するのと同じ方法で、TruffleRubyおよびVMオプションの処理を停止します。
VMオプション #
基盤となるVMでオプションを設定するには、ネイティブ構成とJVM構成の両方で有効な--vm.
を使用します。たとえば、--vm.Dsystem_property=value
または--vm.ea
です。
クラスパスを設定するには、2つの別々の引数ではなく、=
記法を使用します。たとえば、--vm.cp=lib.jar
または--vm.classpath=lib.jar
です。
その他のバイナリスイッチ #
irb
、gem
などの他のバイナリは、標準のRubyとまったく同じスイッチをサポートしています。
TruffleRubyのホームディレクトリの決定 #
TruffleRubyは、標準ライブラリなどのファイルをどこに配置するかを知る必要があります。これらはTruffleRubyのホームディレクトリに保存されます。Rubyのホームディレクトリは、常にTruffleフレームワークが報告するものか、抽出された内部リソースのいずれかです。
Rubyのホームディレクトリが正しくないと思われる場合、または設定されていない場合は、例外がスローされます。