command line flag to repeat compilation multiple times

This commit is contained in:
Dmitry Jemerov
2015-06-16 19:34:27 +02:00
parent ab33e4935e
commit 5eb4a47a1a
4 changed files with 28 additions and 7 deletions
@@ -43,6 +43,11 @@ public abstract class CommonCompilerArguments {
@Argument(value = "Xno-inline", description = "Disable method inlining")
public boolean noInline;
// TODO Remove in 1.0
@Argument(value = "Xrepeat", description = "Repeat compilation (for performance analysis)")
@ValueDescription("<count>")
public String repeat;
@Argument(value = "Xplugin", description = "Load plugins from the given classpath")
@ValueDescription("<path>")
public String[] pluginClasspaths;
@@ -144,15 +144,29 @@ public abstract class CLICompiler<A extends CommonCompilerArguments> {
GroupingMessageCollector groupingCollector = new GroupingMessageCollector(messageCollector);
try {
Disposable rootDisposable = Disposer.newDisposable();
try {
MessageSeverityCollector severityCollector = new MessageSeverityCollector(groupingCollector);
ExitCode code = doExecute(arguments, services, severityCollector, rootDisposable);
return severityCollector.anyReported(CompilerMessageSeverity.ERROR) ? COMPILATION_ERROR : code;
ExitCode exitCode = OK;
int repeatCount = 1;
if (arguments.repeat != null) {
try {
repeatCount = Integer.parseInt(arguments.repeat);
}
catch (NumberFormatException ignored) {
}
}
finally {
Disposer.dispose(rootDisposable);
for (int i = 0; i < repeatCount; i++) {
Disposable rootDisposable = Disposer.newDisposable();
try {
MessageSeverityCollector severityCollector = new MessageSeverityCollector(groupingCollector);
ExitCode code = doExecute(arguments, services, severityCollector, rootDisposable);
exitCode = severityCollector.anyReported(CompilerMessageSeverity.ERROR) ? COMPILATION_ERROR : code;
}
finally {
Disposer.dispose(rootDisposable);
}
}
return exitCode;
}
catch (Throwable t) {
groupingCollector.report(CompilerMessageSeverity.EXCEPTION, OutputMessageUtil.renderException(t),
+1
View File
@@ -1,6 +1,7 @@
Usage: kotlinc-js <options> <source files>
where advanced options include:
-Xno-inline Disable method inlining
-Xrepeat <count> Repeat compilation (for performance analysis)
-Xplugin <path> Load plugins from the given classpath
Advanced options are non-standard and may be changed or removed without any notice.
+1
View File
@@ -5,6 +5,7 @@ where advanced options include:
-Xno-optimize Disable optimizations
-Xreport-perf Report detailed performance statistics
-Xno-inline Disable method inlining
-Xrepeat <count> Repeat compilation (for performance analysis)
-Xplugin <path> Load plugins from the given classpath
Advanced options are non-standard and may be changed or removed without any notice.