@GwtIncompatible(value="Unnecessary") public class CommandLineRunner extends AbstractCommandLineRunner<Compiler,CompilerOptions>
class MyCommandLineRunner extends CommandLineRunner {
MyCommandLineRunner(String[] args) {
super(args);
}
@Override
protected CompilerOptions createOptions() {
CompilerOptions options = super.createOptions();
addMyCrazyCompilerPassThatOutputsAnExtraFile(options);
return options;
}
public static void main(String[] args) {
MyCommandLineRunner runner = new MyCommandLineRunner(args);
if (runner.shouldRunCompiler()) {
runner.run();
}
if (runner.hasErrors()) {
System.exit(-1);
}
}
}
This class is totally not thread-safe.AbstractCommandLineRunner.CommandLineConfig, AbstractCommandLineRunner.FlagEntry<T>, AbstractCommandLineRunner.FlagUsageException, AbstractCommandLineRunner.JsModuleSpec, AbstractCommandLineRunner.JsonFileSpec, AbstractCommandLineRunner.JsSourceType
Modifier and Type | Field and Description |
---|---|
static String |
OUTPUT_MARKER |
static int |
UTF8_BOM_CODE |
Modifier | Constructor and Description |
---|---|
protected |
CommandLineRunner(String[] args)
Create a new command-line runner.
|
protected |
CommandLineRunner(String[] args,
InputStream in,
PrintStream out,
PrintStream err) |
protected |
CommandLineRunner(String[] args,
PrintStream out,
PrintStream err) |
Modifier and Type | Method and Description |
---|---|
protected void |
addWhitelistWarningsGuard(CompilerOptions options,
File whitelistFile) |
protected void |
checkModuleName(String name)
Validates the module name.
|
protected Compiler |
createCompiler()
Returns the instance of the Compiler to use when
AbstractCommandLineRunner.run() is
called. |
protected List<SourceFile> |
createExterns(CompilerOptions options) |
protected CompilerOptions |
createOptions()
Returns the instance of the Options to use when
AbstractCommandLineRunner.run() is called. |
static List<String> |
findJsFiles(Collection<String> patterns)
Returns all the JavaScript files from the set of patterns.
|
static List<SourceFile> |
getDefaultExterns()
Deprecated.
|
boolean |
hasErrors() |
static void |
main(String[] args)
Runs the Compiler.
|
boolean |
shouldRunCompiler() |
createInputs, createInputs, createInputs, doRun, filenameToOutputStream, getBuiltinExterns, getCommandLineConfig, getCompiler, getDiagnosticGroups, getErrorPrintStream, isInTestMode, parseJsonFilesFromInputStream, removeDuplicateZipEntries, run, setExitCodeReceiver, setRunOptions, setWarningGuardOptions
public static final String OUTPUT_MARKER
public static final int UTF8_BOM_CODE
protected CommandLineRunner(String[] args)
protected CommandLineRunner(String[] args, PrintStream out, PrintStream err)
protected CommandLineRunner(String[] args, InputStream in, PrintStream out, PrintStream err)
protected void addWhitelistWarningsGuard(CompilerOptions options, File whitelistFile)
addWhitelistWarningsGuard
in class AbstractCommandLineRunner<Compiler,CompilerOptions>
protected void checkModuleName(String name)
AbstractCommandLineRunner
checkModuleName
in class AbstractCommandLineRunner<Compiler,CompilerOptions>
name
- The module nameprotected CompilerOptions createOptions()
AbstractCommandLineRunner
AbstractCommandLineRunner.run()
is called.
createCompiler() is called before createOptions(), so getCompiler()
will not return null when createOptions() is called.createOptions
in class AbstractCommandLineRunner<Compiler,CompilerOptions>
protected Compiler createCompiler()
AbstractCommandLineRunner
AbstractCommandLineRunner.run()
is
called.createCompiler
in class AbstractCommandLineRunner<Compiler,CompilerOptions>
protected List<SourceFile> createExterns(CompilerOptions options) throws IOException
createExterns
in class AbstractCommandLineRunner<Compiler,CompilerOptions>
IOException
@Deprecated public static List<SourceFile> getDefaultExterns() throws IOException
IOException
public static List<String> findJsFiles(Collection<String> patterns) throws IOException
IOException
public boolean shouldRunCompiler()
public boolean hasErrors()
public static void main(String[] args)
Copyright © 2009-2017 Google. All Rights Reserved.