Skip to content

Commit

Permalink
maven-plugin: Skip compilation if nothing to do
Browse files Browse the repository at this point in the history
  • Loading branch information
kohlschuetter committed Nov 30, 2023
1 parent 4c37306 commit b40293b
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -293,24 +293,35 @@ private void closureCompile(Path transpiledOut) throws IOException,
ClosureCompilerSources cs = new ClosureCompilerSources();

cs.addSource(transpiledOut);

boolean haveSourceRoots = false;
for (String s : javascriptSourceRoots) {
Path p = absolutePath(s);
if (!Files.exists(p)) {
log.warn("Skipping missing source root: " + p);
continue;
}
haveSourceRoots = true;
cs.addSource(p);
}

boolean haveEntryPoints = false;
for (String s : entryPoints) {
Path p = absolutePath(s);
if (!Files.exists(p)) {
log.warn("Skipping missing entry point: " + p);
continue;
}

haveEntryPoints = true;
cs.addEntryPoint(p);
}

if (!haveSourceRoots && !haveEntryPoints) {
log.info("Nothing to do for the closure-compiler");
return;
}

List<String> compileClasspathElements = project.getCompileClasspathElements();
cs.addSourcesFromClasspath(compileClasspathElements);

Expand Down

0 comments on commit b40293b

Please sign in to comment.