Skip to content

Commit

Permalink
Merge pull request #62 from ascopes/bugfix/skip-for-empty-sources
Browse files Browse the repository at this point in the history
Skip execution if no sources are discovered
  • Loading branch information
ascopes committed Jan 12, 2024
2 parents 6aa7034 + 117cd17 commit d399c56
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,15 @@ public boolean generate(GenerationRequest request) throws ResolutionException, I
var plugins = discoverPlugins(request);
var importPaths = discoverImportPaths(request);
var sources = discoverCompilableSources(request);

if (sources.isEmpty()) {
// We might want to add the ability to throw an error here in the future.
// For now, let's just avoid doing additional work. This also prevents protobuf
// failing because we provided no sources to it.
log.info("No protobuf sources found; nothing to do!");
return true;
}

createOutputDirectories(request);

var argLineBuilder = new ArgLineBuilder(protocPath)
Expand Down

0 comments on commit d399c56

Please sign in to comment.