Example #1
0
 /** Executes the compiler on the parsed arguments */
 @NotNull
 public ExitCode exec(final PrintStream errStream, A arguments) {
   if (arguments.isHelp()) {
     usage(errStream);
     return OK;
   }
   System.setProperty("java.awt.headless", "true");
   final MessageRenderer messageRenderer = getMessageRenderer(arguments);
   errStream.print(messageRenderer.renderPreamble());
   printVersionIfNeeded(errStream, arguments, messageRenderer);
   PrintingMessageCollector messageCollector =
       new PrintingMessageCollector(errStream, messageRenderer, arguments.isVerbose());
   Disposable rootDisposable = CompileEnvironmentUtil.createMockDisposable();
   try {
     return doExecute(arguments, messageCollector, rootDisposable);
   } finally {
     messageCollector.printToErrStream();
     errStream.print(messageRenderer.renderConclusion());
     Disposer.dispose(rootDisposable);
   }
 }
Example #2
0
 protected void printVersionIfNeeded(
     @NotNull PrintStream errStream,
     @NotNull A arguments,
     @NotNull MessageRenderer messageRenderer) {
   if (arguments.isVersion()) {
     String versionMessage =
         messageRenderer.render(
             CompilerMessageSeverity.INFO,
             "Kotlin Compiler version " + CompilerVersion.VERSION,
             CompilerMessageLocation.NO_LOCATION);
     errStream.println(versionMessage);
   }
 }