Skip to content

Commit d03b1e1

Browse files
committed
Make READ_RUBYOPT a launcher-only option
1 parent fc52ebd commit d03b1e1

File tree

6 files changed

+4
-18
lines changed

6 files changed

+4
-18
lines changed

src/launcher/java/org/truffleruby/launcher/CommandLineOptions.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ public class CommandLineOptions {
4545
boolean showVersion = false;
4646
boolean showCopyright = false;
4747
ShowHelp showHelp = ShowHelp.NONE;
48+
/** Read the RUBYOPT and TRUFFLERUBYOPT environment variables */
49+
boolean readRubyOptEnv = true;
4850
/** What should be done after context is created */
4951
ExecutionAction executionAction = ExecutionAction.NONE;
5052
/** What should be done when no action is set */

src/launcher/java/org/truffleruby/launcher/CommandLineParser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@ private CommandLineException notImplemented(String option) {
605605
FEATURES.get("frozen-string-literal"));
606606

607607
FEATURES.put("rubyopt",
608-
(processor, enable) -> processor.config.setOption(OptionsCatalog.READ_RUBYOPT, enable));
608+
(processor, enable) -> processor.config.readRubyOptEnv = enable);
609609
}
610610

611611
private static Logger createLogger() {

src/launcher/java/org/truffleruby/launcher/RubyLauncher.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ protected List<String> preprocessArguments(List<String> args, Map<String, String
6868
final CommandLineParser argumentCommandLineParser = new CommandLineParser(args, config, true, false);
6969
argumentCommandLineParser.processArguments();
7070

71-
if ((boolean) config.getOption(OptionsCatalog.READ_RUBYOPT)) {
71+
if (config.readRubyOptEnv) {
7272
// Process RUBYOPT
7373
final List<String> rubyoptArgs = getArgsFromEnvVariable("RUBYOPT");
7474
new CommandLineParser(rubyoptArgs, config, false, true).processArguments();

src/main/java/org/truffleruby/options/Options.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ public class Options {
8080
public final boolean ARGV_GLOBALS;
8181
public final boolean IGNORE_LINES_BEFORE_RUBY_SHEBANG;
8282
public final boolean SYNTAX_CHECK;
83-
public final boolean READ_RUBYOPT;
8483
public final String[] ARGV_GLOBAL_VALUES;
8584
public final String[] ARGV_GLOBAL_FLAGS;
8685
public final boolean BUILDING_CORE_CEXTS;
@@ -207,7 +206,6 @@ public Options(Env env, OptionValues options) {
207206
ARGV_GLOBALS = options.get(OptionsCatalog.ARGV_GLOBALS_KEY);
208207
IGNORE_LINES_BEFORE_RUBY_SHEBANG = options.get(OptionsCatalog.IGNORE_LINES_BEFORE_RUBY_SHEBANG_KEY);
209208
SYNTAX_CHECK = options.get(OptionsCatalog.SYNTAX_CHECK_KEY);
210-
READ_RUBYOPT = options.get(OptionsCatalog.READ_RUBYOPT_KEY);
211209
ARGV_GLOBAL_VALUES = options.get(OptionsCatalog.ARGV_GLOBAL_VALUES_KEY);
212210
ARGV_GLOBAL_FLAGS = options.get(OptionsCatalog.ARGV_GLOBAL_FLAGS_KEY);
213211
BUILDING_CORE_CEXTS = options.get(OptionsCatalog.BUILDING_CORE_CEXTS_KEY);
@@ -393,8 +391,6 @@ public Object fromDescriptor(OptionDescriptor descriptor) {
393391
return IGNORE_LINES_BEFORE_RUBY_SHEBANG;
394392
case "ruby.syntax_check":
395393
return SYNTAX_CHECK;
396-
case "ruby.read_rubyopt":
397-
return READ_RUBYOPT;
398394
case "ruby.argv_global_values":
399395
return ARGV_GLOBAL_VALUES;
400396
case "ruby.argv_global_flags":

src/options.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ INTERNAL: # Options for debugging the TruffleRuby implementation
8585
SYNTAX_CHECK: [[syntax_check, -c], boolean, false, Do not execute just check syntax]
8686

8787
# Used internally for the launcher to communicate with the RubyContext
88-
READ_RUBYOPT: [read_rubyopt, boolean, true, Read RUBYOPT and TRUFFLERUBYOPT environment variables]
8988
ARGV_GLOBAL_VALUES: [argv_global_values, string-array, [], Parsed options from script argv with a value]
9089
ARGV_GLOBAL_FLAGS: [argv_global_flags, string-array, [], Parsed options from script argv acting as flags (no value)]
9190
BUILDING_CORE_CEXTS: [building.core.cexts, boolean, false, 'Used while building TruffleRuby to build core C extensions']

src/shared/java/org/truffleruby/shared/options/OptionsCatalog.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ public class OptionsCatalog {
7878
public static final OptionKey<Boolean> ARGV_GLOBALS_KEY = new OptionKey<>(false);
7979
public static final OptionKey<Boolean> IGNORE_LINES_BEFORE_RUBY_SHEBANG_KEY = new OptionKey<>(false);
8080
public static final OptionKey<Boolean> SYNTAX_CHECK_KEY = new OptionKey<>(false);
81-
public static final OptionKey<Boolean> READ_RUBYOPT_KEY = new OptionKey<>(true);
8281
public static final OptionKey<String[]> ARGV_GLOBAL_VALUES_KEY = new OptionKey<>(new String[]{}, StringArrayOptionType.INSTANCE);
8382
public static final OptionKey<String[]> ARGV_GLOBAL_FLAGS_KEY = new OptionKey<>(new String[]{}, StringArrayOptionType.INSTANCE);
8483
public static final OptionKey<Boolean> BUILDING_CORE_CEXTS_KEY = new OptionKey<>(false);
@@ -546,13 +545,6 @@ public class OptionsCatalog {
546545
.stability(OptionStability.EXPERIMENTAL)
547546
.build();
548547

549-
public static final OptionDescriptor READ_RUBYOPT = OptionDescriptor
550-
.newBuilder(READ_RUBYOPT_KEY, "ruby.read_rubyopt")
551-
.help("Read RUBYOPT and TRUFFLERUBYOPT environment variables")
552-
.category(OptionCategory.INTERNAL)
553-
.stability(OptionStability.EXPERIMENTAL)
554-
.build();
555-
556548
public static final OptionDescriptor ARGV_GLOBAL_VALUES = OptionDescriptor
557549
.newBuilder(ARGV_GLOBAL_VALUES_KEY, "ruby.argv_global_values")
558550
.help("Parsed options from script argv with a value")
@@ -1138,8 +1130,6 @@ public static OptionDescriptor fromName(String name) {
11381130
return IGNORE_LINES_BEFORE_RUBY_SHEBANG;
11391131
case "ruby.syntax_check":
11401132
return SYNTAX_CHECK;
1141-
case "ruby.read_rubyopt":
1142-
return READ_RUBYOPT;
11431133
case "ruby.argv_global_values":
11441134
return ARGV_GLOBAL_VALUES;
11451135
case "ruby.argv_global_flags":
@@ -1377,7 +1367,6 @@ public static OptionDescriptor[] allDescriptors() {
13771367
POLYGLOT_STDIO,
13781368
PREINITIALIZATION,
13791369
PRIMITIVE_CALLERS_ALWAYS_CLONE,
1380-
READ_RUBYOPT,
13811370
REGEXP_INSTRUMENT_CREATION,
13821371
REGEXP_INSTRUMENT_MATCH,
13831372
REQUIRED_LIBRARIES,

0 commit comments

Comments
 (0)