Skip to content

Commit

Permalink
Validate compilationLevel string before building task (#216)
Browse files Browse the repository at this point in the history
Fixes #214
  • Loading branch information
niloc132 authored Mar 9, 2023
1 parent 174ae56 commit d90ded0
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,11 @@ public Task resolve(Project project, Config config) {
.collect(Collectors.toUnmodifiableList());

// grab configs we plan to use
String compilationLevelConfig = config.getCompilationLevel();
CompilationLevel compilationLevel = CompilationLevel.fromString(config.getCompilationLevel());
if (compilationLevel == null) {
throw new IllegalArgumentException("Unrecognized compilationLevel: " + config.getCompilationLevel());
}

String initialScriptFilename = config.getInitialScriptFilename();
Map<String, String> configDefines = config.getDefines();
DependencyOptions.DependencyMode dependencyMode = DependencyOptions.DependencyMode.valueOf(config.getDependencyMode());
Expand Down Expand Up @@ -201,8 +205,6 @@ public void execute(TaskContext context) throws Exception {

File closureOutputDir = context.outputPath().toFile();

CompilationLevel compilationLevel = CompilationLevel.fromString(compilationLevelConfig);

// set up a source directory to build from, and to make sourcemaps work
// TODO move logic to the "post" phase to decide whether or not to copy the sourcemap dir
String jsOutputDir = new File(closureOutputDir + "/" + initialScriptFilename).getParent();
Expand Down

0 comments on commit d90ded0

Please sign in to comment.