@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 java.lang.String |
OUTPUT_MARKER |
static int |
UTF8_BOM_CODE |
Modifier | Constructor and Description |
---|---|
protected |
CommandLineRunner(java.lang.String[] args)
Create a new command-line runner.
|
protected |
CommandLineRunner(java.lang.String[] args,
java.io.InputStream in,
java.io.PrintStream out,
java.io.PrintStream err) |
protected |
CommandLineRunner(java.lang.String[] args,
java.io.PrintStream out,
java.io.PrintStream err) |
Modifier and Type | Method and Description |
---|---|
protected void |
addWhitelistWarningsGuard(CompilerOptions options,
java.io.File whitelistFile) |
protected void |
appendRuntimeTo(java.lang.Appendable out)
Writes whatever runtime libraries are needed to bundle.
|
protected void |
checkModuleName(java.lang.String name)
Validates the module name.
|
protected Compiler |
createCompiler()
Returns the instance of the Compiler to use when
AbstractCommandLineRunner.run() is
called. |
protected java.util.List<SourceFile> |
createExterns(CompilerOptions options) |
protected CompilerOptions |
createOptions()
Returns the instance of the Options to use when
AbstractCommandLineRunner.run() is called. |
static java.util.List<java.lang.String> |
findJsFiles(java.util.Collection<java.lang.String> patterns)
Returns all the JavaScript files from the set of patterns.
|
static java.util.List<SourceFile> |
getDefaultExterns()
Deprecated.
|
boolean |
hasErrors() |
static void |
main(java.lang.String[] args)
Runs the Compiler.
|
protected void |
prepForBundleAndAppendTo(java.lang.Appendable out,
CompilerInput input,
java.lang.String content)
Performs any transformation needed on the given compiler input and appends it to the given
output bundle.
|
boolean |
shouldRunCompiler() |
createInputs, createInputs, createInputs, doRun, filenameToOutputStream, getBuiltinExterns, getCommandLineConfig, getCompiler, getDiagnosticGroups, getErrorPrintStream, isInTestMode, parseJsonFilesFromInputStream, removeDuplicateZipEntries, run, setExitCodeReceiver, setRunOptions, setWarningGuardOptions
public static final java.lang.String OUTPUT_MARKER
public static final int UTF8_BOM_CODE
protected CommandLineRunner(java.lang.String[] args)
protected CommandLineRunner(java.lang.String[] args, java.io.PrintStream out, java.io.PrintStream err)
protected CommandLineRunner(java.lang.String[] args, java.io.InputStream in, java.io.PrintStream out, java.io.PrintStream err)
protected void addWhitelistWarningsGuard(CompilerOptions options, java.io.File whitelistFile)
addWhitelistWarningsGuard
in class AbstractCommandLineRunner<Compiler,CompilerOptions>
protected void checkModuleName(java.lang.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 void prepForBundleAndAppendTo(java.lang.Appendable out, CompilerInput input, java.lang.String content) throws java.io.IOException
AbstractCommandLineRunner
prepForBundleAndAppendTo
in class AbstractCommandLineRunner<Compiler,CompilerOptions>
java.io.IOException
protected void appendRuntimeTo(java.lang.Appendable out) throws java.io.IOException
AbstractCommandLineRunner
appendRuntimeTo
in class AbstractCommandLineRunner<Compiler,CompilerOptions>
java.io.IOException
protected java.util.List<SourceFile> createExterns(CompilerOptions options) throws java.io.IOException
createExterns
in class AbstractCommandLineRunner<Compiler,CompilerOptions>
java.io.IOException
@Deprecated public static java.util.List<SourceFile> getDefaultExterns() throws java.io.IOException
java.io.IOException
public static java.util.List<java.lang.String> findJsFiles(java.util.Collection<java.lang.String> patterns) throws java.io.IOException
java.io.IOException
public boolean shouldRunCompiler()
public boolean hasErrors()
public static void main(java.lang.String[] args)
Copyright © 2009-2018 Google. All Rights Reserved.