Skip to content

Commit

Permalink
Factor out --entry_point flag parsing in order to use it in internal …
Browse files Browse the repository at this point in the history
…code.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=198023103
  • Loading branch information
nichtverstehen authored and brad4d committed May 25, 2018
1 parent 62fa1cf commit b6ac9ae
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
20 changes: 12 additions & 8 deletions src/com/google/javascript/jscomp/AbstractCommandLineRunner.java
Expand Up @@ -2559,16 +2559,20 @@ static CompilerOptions.DependencyMode depModeFromClosureDepOptions(
} }


/** /**
* Helper method to convert a list of closure entry points a list of the new * Helper method to convert a list of entry points specifications to a list of the new
* ModuleIdentifier values * ModuleIdentifier values. The specifications can be in form of "path/to/module" for ES6 or
* CommonJS modules, or "goog:some.Namespace" for Closure symbols.
*/ */
static List<ModuleIdentifier> entryPointsFromClosureEntryPoints( static List<ModuleIdentifier> moduleIdentifiersForEntryPoints(List<String> entryPoints) {
List<String> closureEntryPoints) { List<ModuleIdentifier> mids = new ArrayList<>();
List<ModuleIdentifier> entryPoints = new ArrayList<>(); for (String entryPoint : entryPoints) {
for (String closureEntryPoint : closureEntryPoints) { if (entryPoint.startsWith("goog:")) {
entryPoints.add(ModuleIdentifier.forClosure(closureEntryPoint)); mids.add(ModuleIdentifier.forClosure(entryPoint));
} else {
mids.add(ModuleIdentifier.forFile(entryPoint));
}
} }
return entryPoints; return mids;
} }


private List<String> outputManifests = ImmutableList.of(); private List<String> outputManifests = ImmutableList.of();
Expand Down
10 changes: 3 additions & 7 deletions src/com/google/javascript/jscomp/CommandLineRunner.java
Expand Up @@ -1546,13 +1546,9 @@ private void initConfigFromFlags(String[] args, PrintStream out, PrintStream err
moduleRoots.add(ModuleLoader.DEFAULT_FILENAME_PREFIX); moduleRoots.add(ModuleLoader.DEFAULT_FILENAME_PREFIX);
} }


for (String entryPoint : flags.entryPoints) { entryPoints.addAll(
if (entryPoint.startsWith("goog:")) { AbstractCommandLineRunner.CommandLineConfig.moduleIdentifiersForEntryPoints(
entryPoints.add(ModuleIdentifier.forClosure(entryPoint)); flags.entryPoints));
} else {
entryPoints.add(ModuleIdentifier.forFile(entryPoint));
}
}


if (flags.dependencyMode == CompilerOptions.DependencyMode.STRICT && entryPoints.isEmpty()) { if (flags.dependencyMode == CompilerOptions.DependencyMode.STRICT && entryPoints.isEmpty()) {
reportError( reportError(
Expand Down

0 comments on commit b6ac9ae

Please sign in to comment.