From 453958b78c63d121109b5be79740976df3256276 Mon Sep 17 00:00:00 2001 From: Ashley Scopes <73482956+ascopes@users.noreply.github.com> Date: Sat, 9 Nov 2024 12:03:38 +0000 Subject: [PATCH] GH-438: Rename SourceCodeGenerator to ProtobufBuildOrchestrator This more clearly represents what this class is doing, and will allow separating out source detection logic elsewhere at a later date to reduce the scope of this monolithic class. --- ...deGenerator.java => ProtobufBuildOrchestrator.java} | 6 +++--- .../protobufmavenplugin/mojo/AbstractGenerateMojo.java | 4 ++-- .../mojo/AbstractGenerateMojoTestTemplate.java | 10 +++++----- 3 files changed, 10 insertions(+), 10 deletions(-) rename protobuf-maven-plugin/src/main/java/io/github/ascopes/protobufmavenplugin/generation/{SourceCodeGenerator.java => ProtobufBuildOrchestrator.java} (98%) diff --git a/protobuf-maven-plugin/src/main/java/io/github/ascopes/protobufmavenplugin/generation/SourceCodeGenerator.java b/protobuf-maven-plugin/src/main/java/io/github/ascopes/protobufmavenplugin/generation/ProtobufBuildOrchestrator.java similarity index 98% rename from protobuf-maven-plugin/src/main/java/io/github/ascopes/protobufmavenplugin/generation/SourceCodeGenerator.java rename to protobuf-maven-plugin/src/main/java/io/github/ascopes/protobufmavenplugin/generation/ProtobufBuildOrchestrator.java index 3fc2b230..5f321c53 100644 --- a/protobuf-maven-plugin/src/main/java/io/github/ascopes/protobufmavenplugin/generation/SourceCodeGenerator.java +++ b/protobuf-maven-plugin/src/main/java/io/github/ascopes/protobufmavenplugin/generation/ProtobufBuildOrchestrator.java @@ -52,9 +52,9 @@ * @author Ashley Scopes */ @Named -public final class SourceCodeGenerator { +public final class ProtobufBuildOrchestrator { - private static final Logger log = LoggerFactory.getLogger(SourceCodeGenerator.class); + private static final Logger log = LoggerFactory.getLogger(ProtobufBuildOrchestrator.class); private final MavenSession mavenSession; private final MavenArtifactPathResolver artifactPathResolver; @@ -65,7 +65,7 @@ public final class SourceCodeGenerator { private final CommandLineExecutor commandLineExecutor; @Inject - public SourceCodeGenerator( + public ProtobufBuildOrchestrator( MavenSession mavenSession, MavenArtifactPathResolver artifactPathResolver, ProtocResolver protocResolver, diff --git a/protobuf-maven-plugin/src/main/java/io/github/ascopes/protobufmavenplugin/mojo/AbstractGenerateMojo.java b/protobuf-maven-plugin/src/main/java/io/github/ascopes/protobufmavenplugin/mojo/AbstractGenerateMojo.java index 32da690e..c758701a 100644 --- a/protobuf-maven-plugin/src/main/java/io/github/ascopes/protobufmavenplugin/mojo/AbstractGenerateMojo.java +++ b/protobuf-maven-plugin/src/main/java/io/github/ascopes/protobufmavenplugin/mojo/AbstractGenerateMojo.java @@ -25,7 +25,7 @@ import io.github.ascopes.protobufmavenplugin.dependencies.ResolutionException; import io.github.ascopes.protobufmavenplugin.generation.ImmutableGenerationRequest; import io.github.ascopes.protobufmavenplugin.generation.Language; -import io.github.ascopes.protobufmavenplugin.generation.SourceCodeGenerator; +import io.github.ascopes.protobufmavenplugin.generation.ProtobufBuildOrchestrator; import io.github.ascopes.protobufmavenplugin.generation.SourceRootRegistrar; import io.github.ascopes.protobufmavenplugin.plugins.MavenProtocPluginBean; import io.github.ascopes.protobufmavenplugin.plugins.PathProtocPluginBean; @@ -76,7 +76,7 @@ public AbstractGenerateMojo() { * The source code generator. */ @Inject - SourceCodeGenerator sourceCodeGenerator; + ProtobufBuildOrchestrator sourceCodeGenerator; /** * The active Maven project. diff --git a/protobuf-maven-plugin/src/test/java/io/github/ascopes/protobufmavenplugin/mojo/AbstractGenerateMojoTestTemplate.java b/protobuf-maven-plugin/src/test/java/io/github/ascopes/protobufmavenplugin/mojo/AbstractGenerateMojoTestTemplate.java index 151aa705..2c563905 100644 --- a/protobuf-maven-plugin/src/test/java/io/github/ascopes/protobufmavenplugin/mojo/AbstractGenerateMojoTestTemplate.java +++ b/protobuf-maven-plugin/src/test/java/io/github/ascopes/protobufmavenplugin/mojo/AbstractGenerateMojoTestTemplate.java @@ -34,7 +34,7 @@ import io.github.ascopes.protobufmavenplugin.fixtures.UsesSystemProperties; import io.github.ascopes.protobufmavenplugin.generation.GenerationRequest; import io.github.ascopes.protobufmavenplugin.generation.Language; -import io.github.ascopes.protobufmavenplugin.generation.SourceCodeGenerator; +import io.github.ascopes.protobufmavenplugin.generation.ProtobufBuildOrchestrator; import io.github.ascopes.protobufmavenplugin.generation.SourceRootRegistrar; import io.github.ascopes.protobufmavenplugin.plugins.MavenProtocPluginBean; import io.github.ascopes.protobufmavenplugin.plugins.PathProtocPluginBean; @@ -955,9 +955,9 @@ static Consumer consumer(Consumer co return consumer; } - static SourceCodeGenerator sourceCodeGenerator(boolean result) throws Throwable { + static ProtobufBuildOrchestrator sourceCodeGenerator(boolean result) throws Throwable { var sourceCodeGenerator = mock( - SourceCodeGenerator.class, + ProtobufBuildOrchestrator.class, withSettings().strictness(Strictness.LENIENT) ); when(sourceCodeGenerator.generate(any())) @@ -965,9 +965,9 @@ static SourceCodeGenerator sourceCodeGenerator(boolean result) throws Throwable return sourceCodeGenerator; } - static SourceCodeGenerator erroringSourceCodeGenerator(Throwable cause) throws Throwable { + static ProtobufBuildOrchestrator erroringSourceCodeGenerator(Throwable cause) throws Throwable { var sourceCodeGenerator = mock( - SourceCodeGenerator.class, + ProtobufBuildOrchestrator.class, withSettings().strictness(Strictness.LENIENT) ); when(sourceCodeGenerator.generate(any()))