Package com.google.javascript.jscomp
Class AbstractCommandLineRunner.CommandLineConfig
java.lang.Object
com.google.javascript.jscomp.AbstractCommandLineRunner.CommandLineConfig
- Enclosing class:
AbstractCommandLineRunner<A extends Compiler,
B extends CompilerOptions>
Configurations for the command line configs. Designed for easy building, so that we can
decouple the flags-parsing library from the actual configuration options.
TODO(tjgq): Investigate whether this class is really needed to mediate between the CompilerOptions and runner implementations. An alternative would be for the runners to fill in the CompilerOptions directly, but that conflicts with the latter's mutability and the desire to reuse the same options across multiple compilations.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static enum
Set of options that can be used with the --formatting flag. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionsetAngularPass
(boolean angularPass) Sets whether to process AngularJS-specific annotations.setApplyInputSourceMaps
(boolean applyInputSourceMaps) Whether to apply input source maps to the output, i.e.setBrowserFeaturesetYear
(Integer browserFeaturesetYear) Indicates target browser's yearsetCharset
(String charset) Input charset for all files.setCodingConvention
(CodingConvention codingConvention) Sets rules and conventions to enforce.setContinueSavedCompilationFileName
(String fileName, int restoredCompilationStage) Set the compiler to resume a saved compilation state from a file.setCreateNameMapFiles
(boolean createNameMapFiles) If true, variable renaming and property renaming map files will be produced as {binary name}_vars_map.out and {binary name}_props_map.out.setCreateSourceMap
(String createSourceMap) If specified, a source map file mapping the generated source files back to the original source file will be output to the specified path.Whether to read a single source file from standard input if no input files are explicitly specified.Override the value of a variable annotated @define.setDependencyOptions
(@Nullable DependencyOptions dependencyOptions) Sets the dependency management options.setExterns
(List<String> externs) The file containing JavaScript externs.setHideWarningsFor
(List<String> hideWarningsFor) Sets the paths for which warnings will be hidden.setInstrumentationMappingFile
(String instrumentationMappingFile) setJscompDevMode
(CompilerOptions.DevMode jscompDevMode) Turns on extra validity checkssetJsonStreamMode
(com.google.javascript.jscomp.CompilerOptions.JsonStreamMode mode) setJsonWarningsFile
(String jsonWarningsFile) setJsOutputFile
(String jsOutputFile) Primary output filename.setLoggingLevel
(String loggingLevel) The logging level (standard java.util.logging.Level values) for Compiler progress.setManifestMaps
(List<String> manifestMaps) Sets the execPath:rootRelativePath mappingssetMixedJsSources
(List<AbstractCommandLineRunner.FlagEntry<AbstractCommandLineRunner.JsSourceType>> mixedJsSources) The JavaScript source file names, including .js and .zip files.A JavaScript module specification.setModuleConformanceFiles
(List<String> moduleConformanceFiles) The conformance report file name for a JavaScript chunk (optional).setModuleOutputFiles
(List<String> moduleOutputFiles) The output file name for a JavaScript chunk (optional).setModuleOutputPathPrefix
(String moduleOutputPathPrefix) Prefix for filenames of compiled chunks.setModuleRoots
(List<String> jsChunkRoots) Sets the module roots.setModuleWrapper
(List<String> moduleWrapper) An output wrapper for a JavaScript module (optional).setOutputBundle
(List<String> outputBundles) Sets whether to print output bundle files.setOutputManifest
(List<String> outputManifests) Sets whether to print output manifest files.setOutputModuleDependencies
(String outputModuleDependencies) Sets whether a JSON file representing the dependencies between modules should be created.setOutputWrapper
(String outputWrapper) Interpolate output into this string at the place denoted by the marker token %output%, or %output|jsstring%setParseInlineSourceMaps
(boolean parseInlineSourceMaps) setPrintAst
(boolean printAst) Prints a dot file describing the internal abstract syntax tree and exitssetProcessCommonJSModules
(boolean processCommonJSModules) Sets whether to process Commonchunks.setPropertyMapInputFile
(String propertyMapInputFile) File containing the serialized version of the property renaming map produced by a previous compilationsetPropertyMapOutputFile
(String propertyMapOutputFile) File where the serialized version of the property renaming map produced should be savedsetSaveCompilationStateToFilename
(String fileName, int saveAfterCompilationStage) Set the compiler to perform the first phase and save the intermediate result to a file.setSkipNormalOutputs
(boolean skipNormalOutputs) Sets whether the normal outputs of compilation should be skipped.The detail supplied in the source map file, if generated.setSourceMapFormat
(SourceMap.Format format) The source map format to use, if generated.setSourceMapInputFiles
(Map<String, String> sourceMapInputFiles) setSourceMapLocationMappings
(List<SourceMap.LocationMapping> locationMappings) The source map location mappings to use, if generated.setStringMapOutputFile
(String stringMapOutputPath) File where the serialized version of the string map produced by the ReplaceStrings pass should be saved.setSummaryDetailLevel
(int summaryDetailLevel) Controls how detailed the compilation summary is.setTweakProcessing
(CompilerOptions.TweakProcessing tweakProcessing) Sets the kind of processing to do for goog.tweak functions.setTypedAstListInputFilename
(@Nullable String fileName) setVariableMapInputFile
(String variableMapInputFile) File containing the serialized version of the variable renaming map produced by a previous compilationsetVariableMapOutputFile
(String variableMapOutputFile) File where the serialized version of the variable renaming map produced should be savedsetWarningGuards
(List<AbstractCommandLineRunner.FlagEntry<CheckLevel>> warningGuards) Add warning guards.setWarningsAllowlistFile
(String fileName) Sets a allowlist file that suppresses warnings.
-
Constructor Details
-
CommandLineConfig
protected CommandLineConfig()
-
-
Method Details
-
setPrintAst
@CanIgnoreReturnValue public AbstractCommandLineRunner.CommandLineConfig setPrintAst(boolean printAst) Prints a dot file describing the internal abstract syntax tree and exits -
setJscompDevMode
@CanIgnoreReturnValue public AbstractCommandLineRunner.CommandLineConfig setJscompDevMode(CompilerOptions.DevMode jscompDevMode) Turns on extra validity checks -
setLoggingLevel
@CanIgnoreReturnValue public AbstractCommandLineRunner.CommandLineConfig setLoggingLevel(String loggingLevel) The logging level (standard java.util.logging.Level values) for Compiler progress. Does not control errors or warnings for the JavaScript code under compilation -
setExterns
@CanIgnoreReturnValue public AbstractCommandLineRunner.CommandLineConfig setExterns(List<String> externs) The file containing JavaScript externs. You may specify multiple. -
setMixedJsSources
@CanIgnoreReturnValue public AbstractCommandLineRunner.CommandLineConfig setMixedJsSources(List<AbstractCommandLineRunner.FlagEntry<AbstractCommandLineRunner.JsSourceType>> mixedJsSources) The JavaScript source file names, including .js and .zip files. You may specify multiple. -
setDefaultToStdin
Whether to read a single source file from standard input if no input files are explicitly specified. -
setJsOutputFile
@CanIgnoreReturnValue public AbstractCommandLineRunner.CommandLineConfig setJsOutputFile(String jsOutputFile) Primary output filename. If not specified, output is written to stdout -
setContinueSavedCompilationFileName
@CanIgnoreReturnValue public AbstractCommandLineRunner.CommandLineConfig setContinueSavedCompilationFileName(String fileName, int restoredCompilationStage) Set the compiler to resume a saved compilation state from a file. -
setTypedAstListInputFilename
@CanIgnoreReturnValue public AbstractCommandLineRunner.CommandLineConfig setTypedAstListInputFilename(@Nullable String fileName) -
setSaveCompilationStateToFilename
@CanIgnoreReturnValue public AbstractCommandLineRunner.CommandLineConfig setSaveCompilationStateToFilename(String fileName, int saveAfterCompilationStage) Set the compiler to perform the first phase and save the intermediate result to a file. -
getSaveCompilationStateToFilename
-
setModule
@CanIgnoreReturnValue public AbstractCommandLineRunner.CommandLineConfig setModule(List<String> module) A JavaScript module specification. The format is<name>:<num-js-files>[:[<dep>,...][:]]]
. Module names must be unique. Each dep is the name of a module that this module depends on. Modules must be listed in dependency order, and JS source files must be listed in the corresponding order. Where --module flags occur in relation to --js flags is unimportant -
setSourceMapInputFiles
@CanIgnoreReturnValue public AbstractCommandLineRunner.CommandLineConfig setSourceMapInputFiles(Map<String, String> sourceMapInputFiles) -
setParseInlineSourceMaps
@CanIgnoreReturnValue public AbstractCommandLineRunner.CommandLineConfig setParseInlineSourceMaps(boolean parseInlineSourceMaps) -
setVariableMapInputFile
@CanIgnoreReturnValue public AbstractCommandLineRunner.CommandLineConfig setVariableMapInputFile(String variableMapInputFile) File containing the serialized version of the variable renaming map produced by a previous compilation -
setPropertyMapInputFile
@CanIgnoreReturnValue public AbstractCommandLineRunner.CommandLineConfig setPropertyMapInputFile(String propertyMapInputFile) File containing the serialized version of the property renaming map produced by a previous compilation -
setVariableMapOutputFile
@CanIgnoreReturnValue public AbstractCommandLineRunner.CommandLineConfig setVariableMapOutputFile(String variableMapOutputFile) File where the serialized version of the variable renaming map produced should be saved -
setCreateNameMapFiles
@CanIgnoreReturnValue public AbstractCommandLineRunner.CommandLineConfig setCreateNameMapFiles(boolean createNameMapFiles) If true, variable renaming and property renaming map files will be produced as {binary name}_vars_map.out and {binary name}_props_map.out. Note that this flag cannot be used in conjunction with either variable_map_output_file or property_map_output_file -
setPropertyMapOutputFile
@CanIgnoreReturnValue public AbstractCommandLineRunner.CommandLineConfig setPropertyMapOutputFile(String propertyMapOutputFile) File where the serialized version of the property renaming map produced should be saved -
setStringMapOutputFile
@CanIgnoreReturnValue public AbstractCommandLineRunner.CommandLineConfig setStringMapOutputFile(String stringMapOutputPath) File where the serialized version of the string map produced by the ReplaceStrings pass should be saved. -
setInstrumentationMappingFile
@CanIgnoreReturnValue public AbstractCommandLineRunner.CommandLineConfig setInstrumentationMappingFile(String instrumentationMappingFile) -
setCodingConvention
@CanIgnoreReturnValue public AbstractCommandLineRunner.CommandLineConfig setCodingConvention(CodingConvention codingConvention) Sets rules and conventions to enforce. -
setSummaryDetailLevel
@CanIgnoreReturnValue public AbstractCommandLineRunner.CommandLineConfig setSummaryDetailLevel(int summaryDetailLevel) Controls how detailed the compilation summary is. Values: 0 (never print summary), 1 (print summary only if there are errors or warnings), 2 (print summary if type checking is on), 3 (always print summary). The default level is 1 -
setOutputWrapper
@CanIgnoreReturnValue public AbstractCommandLineRunner.CommandLineConfig setOutputWrapper(String outputWrapper) Interpolate output into this string at the place denoted by the marker token %output%, or %output|jsstring% -
setModuleWrapper
@CanIgnoreReturnValue public AbstractCommandLineRunner.CommandLineConfig setModuleWrapper(List<String> moduleWrapper) An output wrapper for a JavaScript module (optional). See the flag description for formatting requirements. -
setModuleOutputPathPrefix
@CanIgnoreReturnValue public AbstractCommandLineRunner.CommandLineConfig setModuleOutputPathPrefix(String moduleOutputPathPrefix) Prefix for filenames of compiled chunks.<module-name>.js
will be appended to this prefix. Directories will be created as needed. Use with --module -
setModuleOutputFiles
@CanIgnoreReturnValue public AbstractCommandLineRunner.CommandLineConfig setModuleOutputFiles(List<String> moduleOutputFiles) The output file name for a JavaScript chunk (optional). See the flag description for formatting requirements. -
setModuleConformanceFiles
@CanIgnoreReturnValue public AbstractCommandLineRunner.CommandLineConfig setModuleConformanceFiles(List<String> moduleConformanceFiles) The conformance report file name for a JavaScript chunk (optional). See the flag description for formatting requirements. -
setCreateSourceMap
@CanIgnoreReturnValue public AbstractCommandLineRunner.CommandLineConfig setCreateSourceMap(String createSourceMap) If specified, a source map file mapping the generated source files back to the original source file will be output to the specified path. The %outname% placeholder will expand to the name of the output file that the source map corresponds to. -
setSourceMapDetailLevel
@CanIgnoreReturnValue public AbstractCommandLineRunner.CommandLineConfig setSourceMapDetailLevel(SourceMap.DetailLevel level) The detail supplied in the source map file, if generated. -
setSourceMapFormat
@CanIgnoreReturnValue public AbstractCommandLineRunner.CommandLineConfig setSourceMapFormat(SourceMap.Format format) The source map format to use, if generated. -
setSourceMapLocationMappings
@CanIgnoreReturnValue public AbstractCommandLineRunner.CommandLineConfig setSourceMapLocationMappings(List<SourceMap.LocationMapping> locationMappings) The source map location mappings to use, if generated. -
setApplyInputSourceMaps
@CanIgnoreReturnValue public AbstractCommandLineRunner.CommandLineConfig setApplyInputSourceMaps(boolean applyInputSourceMaps) Whether to apply input source maps to the output, i.e. map back to original inputs from input files that have source maps applied to them. -
setWarningGuards
@CanIgnoreReturnValue public AbstractCommandLineRunner.CommandLineConfig setWarningGuards(List<AbstractCommandLineRunner.FlagEntry<CheckLevel>> warningGuards) Add warning guards. -
setDefine
@CanIgnoreReturnValue public AbstractCommandLineRunner.CommandLineConfig setDefine(List<String> define) Override the value of a variable annotated @define. The format is<name>[=<val>]
, where<name>
is the name of a @define variable and<val>
is a boolean, number, or a single-quoted string that contains no single quotes. If[=<val>]
is omitted, the variable is marked true -
setBrowserFeaturesetYear
@CanIgnoreReturnValue public AbstractCommandLineRunner.CommandLineConfig setBrowserFeaturesetYear(Integer browserFeaturesetYear) Indicates target browser's year -
setTweakProcessing
@CanIgnoreReturnValue public AbstractCommandLineRunner.CommandLineConfig setTweakProcessing(CompilerOptions.TweakProcessing tweakProcessing) Sets the kind of processing to do for goog.tweak functions. -
setCharset
Input charset for all files. -
setDependencyOptions
@CanIgnoreReturnValue public AbstractCommandLineRunner.CommandLineConfig setDependencyOptions(@Nullable DependencyOptions dependencyOptions) Sets the dependency management options. -
setOutputManifest
@CanIgnoreReturnValue public AbstractCommandLineRunner.CommandLineConfig setOutputManifest(List<String> outputManifests) Sets whether to print output manifest files. Filter out empty file names. -
setOutputModuleDependencies
@CanIgnoreReturnValue public AbstractCommandLineRunner.CommandLineConfig setOutputModuleDependencies(String outputModuleDependencies) Sets whether a JSON file representing the dependencies between modules should be created. -
setOutputBundle
@CanIgnoreReturnValue public AbstractCommandLineRunner.CommandLineConfig setOutputBundle(List<String> outputBundles) Sets whether to print output bundle files. -
setSkipNormalOutputs
@CanIgnoreReturnValue public AbstractCommandLineRunner.CommandLineConfig setSkipNormalOutputs(boolean skipNormalOutputs) Sets whether the normal outputs of compilation should be skipped. -
setManifestMaps
@CanIgnoreReturnValue public AbstractCommandLineRunner.CommandLineConfig setManifestMaps(List<String> manifestMaps) Sets the execPath:rootRelativePath mappings -
setProcessCommonJSModules
@CanIgnoreReturnValue public AbstractCommandLineRunner.CommandLineConfig setProcessCommonJSModules(boolean processCommonJSModules) Sets whether to process Commonchunks. -
setModuleRoots
@CanIgnoreReturnValue public AbstractCommandLineRunner.CommandLineConfig setModuleRoots(List<String> jsChunkRoots) Sets the module roots. -
setWarningsAllowlistFile
@CanIgnoreReturnValue public AbstractCommandLineRunner.CommandLineConfig setWarningsAllowlistFile(String fileName) Sets a allowlist file that suppresses warnings. -
setHideWarningsFor
@CanIgnoreReturnValue public AbstractCommandLineRunner.CommandLineConfig setHideWarningsFor(List<String> hideWarningsFor) Sets the paths for which warnings will be hidden. -
setAngularPass
@CanIgnoreReturnValue public AbstractCommandLineRunner.CommandLineConfig setAngularPass(boolean angularPass) Sets whether to process AngularJS-specific annotations. -
setJsonStreamMode
@CanIgnoreReturnValue public AbstractCommandLineRunner.CommandLineConfig setJsonStreamMode(com.google.javascript.jscomp.CompilerOptions.JsonStreamMode mode) -
setErrorFormat
@CanIgnoreReturnValue public AbstractCommandLineRunner.CommandLineConfig setErrorFormat(AbstractCommandLineRunner.CommandLineConfig.ErrorFormatOption errorFormat) -
setJsonWarningsFile
@CanIgnoreReturnValue public AbstractCommandLineRunner.CommandLineConfig setJsonWarningsFile(String jsonWarningsFile)
-