From 53137d85cdf1b8a4534fbdc6877c3746ae634169 Mon Sep 17 00:00:00 2001 From: ascopes <73482956+ascopes@users.noreply.github.com> Date: Sat, 23 Mar 2024 08:17:23 +0000 Subject: [PATCH] GH-135: rename dependencyResolutionScope to dependencyResolutionDepth --- .../ascopes/protobufmavenplugin/AbstractGenerateMojo.java | 6 +++--- ...esolutionScope.java => DependencyResolutionDepth.java} | 2 +- .../protobufmavenplugin/dependency/JvmPluginResolver.java | 2 +- .../dependency/MavenDependencyPathResolver.java | 8 ++++---- .../protobufmavenplugin/generate/GenerationRequest.java | 4 ++-- .../protobufmavenplugin/generate/SourceCodeGenerator.java | 6 +++--- 6 files changed, 14 insertions(+), 14 deletions(-) rename src/main/java/io/github/ascopes/protobufmavenplugin/dependency/{DependencyResolutionScope.java => DependencyResolutionDepth.java} (95%) diff --git a/src/main/java/io/github/ascopes/protobufmavenplugin/AbstractGenerateMojo.java b/src/main/java/io/github/ascopes/protobufmavenplugin/AbstractGenerateMojo.java index 34709edc..53ff8dd1 100644 --- a/src/main/java/io/github/ascopes/protobufmavenplugin/AbstractGenerateMojo.java +++ b/src/main/java/io/github/ascopes/protobufmavenplugin/AbstractGenerateMojo.java @@ -19,7 +19,7 @@ import static java.util.Objects.requireNonNullElse; import static java.util.Objects.requireNonNullElseGet; -import io.github.ascopes.protobufmavenplugin.dependency.DependencyResolutionScope; +import io.github.ascopes.protobufmavenplugin.dependency.DependencyResolutionDepth; import io.github.ascopes.protobufmavenplugin.dependency.MavenArtifact; import io.github.ascopes.protobufmavenplugin.dependency.ResolutionException; import io.github.ascopes.protobufmavenplugin.generate.ImmutableGenerationRequest; @@ -115,7 +115,7 @@ public abstract class AbstractGenerateMojo extends AbstractMojo { * @since 1.2.0 */ @Parameter(defaultValue = "TRANSITIVE") - private DependencyResolutionScope dependencyResolutionScope; + private DependencyResolutionDepth dependencyResolutionDepth; /** * Specify additional paths to import protobuf sources from on the local file system. @@ -415,7 +415,7 @@ public void execute() throws MojoExecutionException, MojoFailureException { .binaryMavenPlugins(nonNullList(binaryMavenPlugins)) .binaryPathPlugins(nonNullList(binaryPathPlugins)) .binaryUrlPlugins(nonNullList(binaryUrlPlugins)) - .dependencyResolutionScope(dependencyResolutionScope) + .dependencyResolutionDepth(dependencyResolutionDepth) .jvmMavenPlugins(nonNullList(jvmMavenPlugins)) .importPaths(nonNullList(importPaths) .stream() diff --git a/src/main/java/io/github/ascopes/protobufmavenplugin/dependency/DependencyResolutionScope.java b/src/main/java/io/github/ascopes/protobufmavenplugin/dependency/DependencyResolutionDepth.java similarity index 95% rename from src/main/java/io/github/ascopes/protobufmavenplugin/dependency/DependencyResolutionScope.java rename to src/main/java/io/github/ascopes/protobufmavenplugin/dependency/DependencyResolutionDepth.java index 58efc2f5..4226d915 100644 --- a/src/main/java/io/github/ascopes/protobufmavenplugin/dependency/DependencyResolutionScope.java +++ b/src/main/java/io/github/ascopes/protobufmavenplugin/dependency/DependencyResolutionDepth.java @@ -22,7 +22,7 @@ * @author Ashley Scopes * @since 1.2.0 */ -public enum DependencyResolutionScope { +public enum DependencyResolutionDepth { /** * Resolve all transitive dependencies. diff --git a/src/main/java/io/github/ascopes/protobufmavenplugin/dependency/JvmPluginResolver.java b/src/main/java/io/github/ascopes/protobufmavenplugin/dependency/JvmPluginResolver.java index 1ef73bb2..7e6934ca 100644 --- a/src/main/java/io/github/ascopes/protobufmavenplugin/dependency/JvmPluginResolver.java +++ b/src/main/java/io/github/ascopes/protobufmavenplugin/dependency/JvmPluginResolver.java @@ -104,7 +104,7 @@ private List resolveAndBuildArgLine( .resolveDependencyTreePaths( session, SCOPES, - DependencyResolutionScope.TRANSITIVE, + DependencyResolutionDepth.TRANSITIVE, plugin ) .iterator(); diff --git a/src/main/java/io/github/ascopes/protobufmavenplugin/dependency/MavenDependencyPathResolver.java b/src/main/java/io/github/ascopes/protobufmavenplugin/dependency/MavenDependencyPathResolver.java index 4a082dbd..0242480d 100644 --- a/src/main/java/io/github/ascopes/protobufmavenplugin/dependency/MavenDependencyPathResolver.java +++ b/src/main/java/io/github/ascopes/protobufmavenplugin/dependency/MavenDependencyPathResolver.java @@ -57,7 +57,7 @@ public MavenDependencyPathResolver( public Collection resolveProjectDependencyPaths( MavenSession session, Set allowedScopes, - DependencyResolutionScope dependencyResolutionScope + DependencyResolutionDepth dependencyResolutionDepth ) throws ResolutionException { var paths = new ArrayList(); @@ -66,7 +66,7 @@ public Collection resolveProjectDependencyPaths( paths.addAll(resolveDependencyTreePaths( session, allowedScopes, - dependencyResolutionScope, + dependencyResolutionDepth, artifact )); } @@ -77,7 +77,7 @@ public Collection resolveProjectDependencyPaths( public Collection resolveDependencyTreePaths( MavenSession session, Set allowedScopes, - DependencyResolutionScope dependencyResolutionScope, + DependencyResolutionDepth dependencyResolutionDepth, MavenArtifact artifact ) throws ResolutionException { log.debug("Resolving dependency '{}'", artifact); @@ -86,7 +86,7 @@ public Collection resolveDependencyTreePaths( var artifactPath = resolveArtifact(session, artifact); allDependencyPaths.add(artifactPath); - if (dependencyResolutionScope == DependencyResolutionScope.DIRECT) { + if (dependencyResolutionDepth == DependencyResolutionDepth.DIRECT) { log.debug("Not resolving transitive dependencies of '{}'", artifact); return allDependencyPaths; } diff --git a/src/main/java/io/github/ascopes/protobufmavenplugin/generate/GenerationRequest.java b/src/main/java/io/github/ascopes/protobufmavenplugin/generate/GenerationRequest.java index e6c45ca4..529cd6ed 100644 --- a/src/main/java/io/github/ascopes/protobufmavenplugin/generate/GenerationRequest.java +++ b/src/main/java/io/github/ascopes/protobufmavenplugin/generate/GenerationRequest.java @@ -16,7 +16,7 @@ package io.github.ascopes.protobufmavenplugin.generate; -import io.github.ascopes.protobufmavenplugin.dependency.DependencyResolutionScope; +import io.github.ascopes.protobufmavenplugin.dependency.DependencyResolutionDepth; import io.github.ascopes.protobufmavenplugin.dependency.MavenArtifact; import java.net.URL; import java.nio.file.Path; @@ -39,7 +39,7 @@ public interface GenerationRequest { Collection getBinaryUrlPlugins(); - DependencyResolutionScope getDependencyResolutionScope(); + DependencyResolutionDepth getDependencyResolutionDepth(); Collection getImportPaths(); diff --git a/src/main/java/io/github/ascopes/protobufmavenplugin/generate/SourceCodeGenerator.java b/src/main/java/io/github/ascopes/protobufmavenplugin/generate/SourceCodeGenerator.java index 7efbff32..4d2ce50d 100644 --- a/src/main/java/io/github/ascopes/protobufmavenplugin/generate/SourceCodeGenerator.java +++ b/src/main/java/io/github/ascopes/protobufmavenplugin/generate/SourceCodeGenerator.java @@ -17,7 +17,7 @@ package io.github.ascopes.protobufmavenplugin.generate; import io.github.ascopes.protobufmavenplugin.dependency.BinaryPluginResolver; -import io.github.ascopes.protobufmavenplugin.dependency.DependencyResolutionScope; +import io.github.ascopes.protobufmavenplugin.dependency.DependencyResolutionDepth; import io.github.ascopes.protobufmavenplugin.dependency.JvmPluginResolver; import io.github.ascopes.protobufmavenplugin.dependency.MavenDependencyPathResolver; import io.github.ascopes.protobufmavenplugin.dependency.ProtocResolver; @@ -174,13 +174,13 @@ private Collection discoverImportPaths( log.debug( "Finding importable protobuf sources from the classpath ({})", - request.getDependencyResolutionScope() + request.getDependencyResolutionDepth() ); var dependencyPaths = mavenDependencyPathResolver.resolveProjectDependencyPaths( session, request.getAllowedDependencyScopes(), - request.getDependencyResolutionScope() + request.getDependencyResolutionDepth() ); var inheritedDependencies = protoListingResolver