THRIFT-5920: modernize thrift-maven-plugin and add thread-safety regression proofs#7
Open
greggdonovan wants to merge 4 commits intomasterfrom
Open
THRIFT-5920: modernize thrift-maven-plugin and add thread-safety regression proofs#7greggdonovan wants to merge 4 commits intomasterfrom
greggdonovan wants to merge 4 commits intomasterfrom
Conversation
Greptile OverviewGreptile SummaryThis PR successfully modernizes the Key Changes:
Testing & Validation:
Observations:
Confidence Score: 5/5
|
| Filename | Overview |
|---|---|
| contrib/thrift-maven-plugin/pom.xml | Updated to Maven 3.9 API with modern plugin versions, added maven-invoker-plugin profile for integration tests, and migrated from maven-project to maven-core dependency |
| contrib/thrift-maven-plugin/src/main/java/org/apache/thrift/maven/ThriftCompileMojo.java | Migrated from JavaDoc annotations to @mojo annotation with threadSafe=true, changed from getCompileArtifacts() to getArtifacts() |
| contrib/thrift-maven-plugin/src/main/java/org/apache/thrift/maven/ThriftTestCompileMojo.java | Migrated from JavaDoc annotations to @mojo annotation with threadSafe=true, changed from getTestArtifacts() to getArtifacts(), updated method signature from ArtifactRepository to String |
| contrib/thrift-maven-plugin/src/main/java/org/apache/thrift/maven/AbstractThriftMojo.java | Migrated from JavaDoc annotations to @Parameter/@component annotations, changed from ArtifactRepository to String localRepositoryPath, added try-with-resources for JarFile handling |
| contrib/thrift-maven-plugin/src/test/java/org/apache/thrift/maven/TestThreadSafePluginDescriptor.java | New test that validates generated plugin.xml contains threadSafe=true for compile and testCompile goals using XPath assertions |
| contrib/thrift-maven-plugin/src/test/java/org/apache/thrift/maven/TestThriftOutputRegression.java | New regression test that verifies thrift codegen output matches baseline SHA256 checksums for java and java:private_members generators |
Sequence Diagram
sequenceDiagram
participant Maven
participant ThriftCompileMojo
participant AbstractThriftMojo
participant Thrift Compiler
participant FileSystem
Maven->>ThriftCompileMojo: execute() [compile goal]
ThriftCompileMojo->>AbstractThriftMojo: execute()
AbstractThriftMojo->>AbstractThriftMojo: checkParameters()
AbstractThriftMojo->>AbstractThriftMojo: findThriftFilesInDirectory()
AbstractThriftMojo->>FileSystem: scan for .thrift files
FileSystem-->>AbstractThriftMojo: thrift files list
AbstractThriftMojo->>AbstractThriftMojo: getDependencyArtifacts()
Note over AbstractThriftMojo: Now uses project.getArtifacts()<br/>instead of getCompileArtifacts()
AbstractThriftMojo->>AbstractThriftMojo: makeThriftPathFromJars()
AbstractThriftMojo->>FileSystem: extract .thrift from JARs
FileSystem-->>AbstractThriftMojo: extracted thrift files
AbstractThriftMojo->>Thrift Compiler: compile(thriftFiles, generator, paths)
Thrift Compiler-->>AbstractThriftMojo: exit status
AbstractThriftMojo->>ThriftCompileMojo: attachFiles()
ThriftCompileMojo->>Maven: addCompileSourceRoot(outputDirectory)
Note over Maven: Parallel execution safe<br/>with threadSafe=true
Last reviewed commit: 06704a7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
This modernizes
contrib/thrift-maven-pluginto current Maven plugin conventions (Maven 3.9.x metadata/API usage), addresses parallel-build thread-safety warnings, and adds explicit regression proof that core code generation behavior is unchanged.What changed
1) Modernized plugin metadata and Maven API usage
contrib/thrift-maven-plugin/src/main/java/org/apache/thrift/maven/ThriftCompileMojo.javacontrib/thrift-maven-plugin/src/main/java/org/apache/thrift/maven/ThriftTestCompileMojo.javacontrib/thrift-maven-plugin/src/main/java/org/apache/thrift/maven/AbstractThriftMojo.javathreadSafe = true).project.getArtifacts()).2) Modernized module build setup
contrib/thrift-maven-plugin/pom.xmlfor modern Maven plugin best practices:maven-plugin-annotationsmockito-all)3) Added unit-level regression proofs
contrib/thrift-maven-plugin/src/test/java/org/apache/thrift/maven/TestThreadSafePluginDescriptor.javaplugin.xmlcontains thread-safe metadata forcompileandtestCompilegoals.contrib/thrift-maven-plugin/src/test/java/org/apache/thrift/maven/TestThriftOutputRegression.javacontrib/thrift-maven-plugin/src/test/resources/expected/java.sha256contrib/thrift-maven-plugin/src/test/resources/expected/java_private_members.sha2564) Added Maven Invoker integration test suite
run-itsprofile and invoker execution incontrib/thrift-maven-plugin/pom.xml.contrib/thrift-maven-plugin/src/it/:compile-output-equivalence: asserts generated main sources match expected checksums.test-compile-output-equivalence: asserts generated test sources match expected checksums.parallel-thread-safe: runs multi-module build with-T 2, verifies generated output and absence of the thread-safety warning inbuild.log.Proof of no regression
Local validation run on this branch
mvn -f contrib/thrift-maven-plugin/pom.xml clean testmvn -f contrib/thrift-maven-plugin/pom.xml -Prun-its clean verifyBoth pass, including:
Maintainer reproduction steps
Prereqs
thriftexecutable available onPATH1) Unit tests
mvn -f contrib/thrift-maven-plugin/pom.xml clean test2) Integration tests (invoker)
If
thriftis not onPATH, use:3) Optional A/B comparison against released plugin
Generate the same IDLs with
org.apache.thrift:thrift-maven-plugin:0.10.0and this branch version, thendiff -rugenerated output directories. This branch includes in-repo checksum tests and invoker fixtures that already provide automated equivalence checks for representative IDLs.