Skip to content

Commit

Permalink
Merge pull request #138 from ascopes/task/import-path-naming
Browse files Browse the repository at this point in the history
Rename additionalImportPaths parameter to importPaths
  • Loading branch information
ascopes authored Mar 22, 2024
2 parents c7ffba8 + 4fe4f0b commit 8de0163
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,15 @@ public abstract class AbstractGenerateMojo extends AbstractMojo {
* <p>If you wish to depend on a JAR containing protobuf sources, add it as a dependency
* with the {@code provided} or {@code test} scope instead.
*
* <p>Prior to v1.2.0, this was called {@code additionalImportPaths}. This old name will
* be maintained as a valid alias until v2.0.0.
*
* <p>This parameter is optional.
*
* @since 0.1.0
*/
@Parameter
private @Nullable List<File> additionalImportPaths;
@Parameter(alias = "additionalImportPaths")
private @Nullable List<File> importPaths;

/**
* Binary plugins to use with the protobuf compiler, sourced from a Maven repository.
Expand Down Expand Up @@ -392,15 +395,15 @@ public void execute() throws MojoExecutionException, MojoFailureException {
}

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))
.importPaths(nonNullList(importPaths)
.stream()
.map(File::toPath)
.collect(Collectors.toList()))
.isCppEnabled(cppEnabled)
.isCsharpEnabled(csharpEnabled)
.isFailOnMissingSources(failOnMissingSources)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@
@Immutable
public interface GenerationRequest {

Collection<Path> getAdditionalImportPaths();

Collection<MavenArtifact> getBinaryMavenPlugins();

Collection<String> getBinaryPathPlugins();

Collection<URL> getBinaryUrlPlugins();

Collection<Path> getImportPaths();

Collection<MavenArtifact> getJvmMavenPlugins();

Set<String> getAllowedDependencyScopes();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ private Collection<ProtoFileListing> discoverImportPaths(
// Always use all provided additional import paths, as we assume they are valid given the user
// has explicitly included them in their configuration.
var explicitDependencies = protoListingResolver
.createProtoFileListings(request.getAdditionalImportPaths());
.createProtoFileListings(request.getImportPaths());

return concat(inheritedDependencies, explicitDependencies);
}
Expand Down
2 changes: 1 addition & 1 deletion src/site/markdown/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ just like you would expect when using Java code. This plugin considers any depen
`provided`, or `system` scope (or additionally `test` if the `generate-test` goal is used).

If there are additional paths on the file system that you wish to add to the import path, then
you can specify these using the `additionalImportPaths` parameter. Note that these will not be
you can specify these using the `importPaths` parameter. Note that these will not be
compiled, only made visible to the protobuf compiler.

## Kotlin generation
Expand Down

0 comments on commit 8de0163

Please sign in to comment.