Skip to content

Commit

Permalink
Run checkstyle
Browse files Browse the repository at this point in the history
  • Loading branch information
ascopes committed Mar 19, 2024
1 parent bef4895 commit 5a53852
Showing 1 changed file with 41 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -392,33 +392,36 @@ public void execute() throws MojoExecutionException, MojoFailureException {
throw new MojoExecutionException(ex.getMessage(), ex);
}

var request = ImmutableGenerationRequest.builder()
.additionalImportPaths(nonNullList(additionalImportPaths).stream().map(File::toPath).collect(Collectors.toList()))
.allowedDependencyScopes(allowedScopes())
.binaryMavenPlugins(nonNullList(binaryMavenPlugins))
.binaryPathPlugins(nonNullList(binaryPathPlugins))
.binaryUrlPlugins(nonNullList(binaryUrlPlugins))
.jvmMavenPlugins(nonNullList(jvmMavenPlugins))
.isCppEnabled(cppEnabled)
.isCsharpEnabled(csharpEnabled)
.isFailOnMissingSources(failOnMissingSources)
.isFatalWarnings(fatalWarnings)
.isJavaEnabled(javaEnabled)
.isKotlinEnabled(kotlinEnabled)
.isLiteEnabled(liteOnly)
.isObjcEnabled(objcEnabled)
.isPhpEnabled(phpEnabled)
.isPythonEnabled(pythonEnabled)
.isPythonStubsEnabled(pythonStubsEnabled)
.isRegisterAsCompilationRoot(registerAsCompilationRoot)
.isRubyEnabled(rubyEnabled)
.isRustEnabled(rustEnabled)
.mavenSession(session)
.outputDirectory(outputDirectory())
.protocVersion(protocVersion())
.sourceRootRegistrar(sourceRootRegistrar())
.sourceRoots(sourceDirectories())
.build();
var request = ImmutableGenerationRequest.builder()
.additionalImportPaths(nonNullList(additionalImportPaths)
.stream()
.map(File::toPath)
.collect(Collectors.toList()))
.allowedDependencyScopes(allowedScopes())
.binaryMavenPlugins(nonNullList(binaryMavenPlugins))
.binaryPathPlugins(nonNullList(binaryPathPlugins))
.binaryUrlPlugins(nonNullList(binaryUrlPlugins))
.jvmMavenPlugins(nonNullList(jvmMavenPlugins))
.isCppEnabled(cppEnabled)
.isCsharpEnabled(csharpEnabled)
.isFailOnMissingSources(failOnMissingSources)
.isFatalWarnings(fatalWarnings)
.isJavaEnabled(javaEnabled)
.isKotlinEnabled(kotlinEnabled)
.isLiteEnabled(liteOnly)
.isObjcEnabled(objcEnabled)
.isPhpEnabled(phpEnabled)
.isPythonEnabled(pythonEnabled)
.isPythonStubsEnabled(pythonStubsEnabled)
.isRegisterAsCompilationRoot(registerAsCompilationRoot)
.isRubyEnabled(rubyEnabled)
.isRustEnabled(rustEnabled)
.mavenSession(session)
.outputDirectory(outputDirectory())
.protocVersion(protocVersion())
.sourceRootRegistrar(sourceRootRegistrar())
.sourceRoots(sourceDirectories())
.build();

try {
if (!sourceCodeGenerator.generate(request)) {
Expand All @@ -436,12 +439,12 @@ private Path outputDirectory() {
}

private Collection<Path> sourceDirectories() {
if(sourceDirectories != null){
return sourceDirectories.stream().map(File::toPath).collect(Collectors.toList());
}else{
return List.of(defaultSourceDirectory(session));
}
if (sourceDirectories != null) {
return sourceDirectories.stream().map(File::toPath).collect(Collectors.toList());
} else {
return List.of(defaultSourceDirectory(session));
}
}

/**
* Provides the source root registrar for this Mojo.
Expand Down Expand Up @@ -506,12 +509,12 @@ protected void validate() {
// edge case entirely.
// TODO: move this logic into the source generator class.
Optional.ofNullable(outputDirectory)
.map(File::toPath)
.flatMap(FileUtils::getFileExtension)
.filter(".jar"::equalsIgnoreCase)
.ifPresent(ext -> {
throw new IllegalArgumentException("The output directory cannot be a path with a JAR file extension");
});
.map(File::toPath)
.flatMap(FileUtils::getFileExtension)
.filter(".jar"::equalsIgnoreCase)
.ifPresent(ext -> {
throw new IllegalArgumentException("The output directory cannot be a path with a JAR file extension");
});
}

private String protocVersion() {
Expand Down

0 comments on commit 5a53852

Please sign in to comment.