Skip to content

Commit

Permalink
Use SubstrateOptionsParser.commandArgument for printing help message …
Browse files Browse the repository at this point in the history
…(Thanks Codrut)
  • Loading branch information
liufengyun committed Aug 2, 2023
1 parent 8cb5409 commit 6e78fba
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import com.oracle.graal.pointsto.util.AnalysisError;
import com.oracle.svm.core.option.HostedOptionKey;
import com.oracle.svm.core.option.LocatableMultiOptionValue;
import com.oracle.svm.core.option.SubstrateOptionsParser;

public final class ReachabilityTracePrinter {
public static class Options {
Expand All @@ -68,7 +69,7 @@ public static void report(String imageName, OptionValues options, String reports
String trace = stringWriter.toString();
ReportUtils.report("trace for types", reportsPath, "trace_types_" + baseImageName, "txt",
writer -> writer.print(trace));
String abortOnTypeReachableOption = "-H:" + Options.AbortOnTypeReachable.getName() + "=" + String.join(",", typePatterns);
String abortOnTypeReachableOption = SubstrateOptionsParser.commandArgument(Options.AbortOnTypeReachable, String.join(",", typePatterns));
String message = "Image building is interrupted as the types specified via " + abortOnTypeReachableOption +
" are reachable. See the generated report for a complete reachability trace.";
consoleMessageBuilder.append(message);
Expand All @@ -83,7 +84,7 @@ public static void report(String imageName, OptionValues options, String reports
String trace = stringWriter.toString();
ReportUtils.report("trace for methods", reportsPath, "trace_methods_" + baseImageName, "txt",
writer -> writer.print(trace));
String abortOnMethodReachableOption = "-H:" + Options.AbortOnMethodReachable.getName() + "=" + String.join(",", methodPatterns);
String abortOnMethodReachableOption = SubstrateOptionsParser.commandArgument(Options.AbortOnMethodReachable, String.join(",", methodPatterns));
String message = "Image building is interrupted as the methods specified via " + abortOnMethodReachableOption +
" are reachable. See the generated report for a complete reachability trace.";
consoleMessageBuilder.append(message);
Expand All @@ -98,7 +99,7 @@ public static void report(String imageName, OptionValues options, String reports
String trace = stringWriter.toString();
ReportUtils.report("trace for fields", reportsPath, "trace_fields_" + baseImageName, "txt",
writer -> writer.print(trace));
String abortOnFieldReachableOption = "-H:" + Options.AbortOnFieldReachable.getName() + "=" + String.join(",", fieldPatterns);
String abortOnFieldReachableOption = SubstrateOptionsParser.commandArgument(Options.AbortOnFieldReachable, String.join(",", fieldPatterns));
String message = "Image building is interrupted as the fields specified via " + abortOnFieldReachableOption +
" are reachable. See the generated report for a complete reachability trace.";
consoleMessageBuilder.append(message);
Expand Down

0 comments on commit 6e78fba

Please sign in to comment.