greggdonovan opened a new pull request, #3306:
URL: https://github.com/apache/thrift/pull/3306
## Why
This modernizes `contrib/thrift-maven-plugin` to 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
- Migrated legacy mojo metadata to annotation-based metadata in:
-
`contrib/thrift-maven-plugin/src/main/java/org/apache/thrift/maven/ThriftCompileMojo.java`
-
`contrib/thrift-maven-plugin/src/main/java/org/apache/thrift/maven/ThriftTestCompileMojo.java`
-
`contrib/thrift-maven-plugin/src/main/java/org/apache/thrift/maven/AbstractThriftMojo.java`
- Marked goals as thread-safe via annotation metadata (`threadSafe = true`).
- Updated dependency resolution usage to modern APIs
(`project.getArtifacts()`).
- Updated local repository handling to modern parameterized path usage.
### 2) Modernized module build setup
- Updated `contrib/thrift-maven-plugin/pom.xml` for modern Maven plugin best
practices:
- explicit modern plugin versions
- `maven-plugin-annotations`
- modern provided-scope Maven API/core dependencies
- removed obsolete test dependency (`mockito-all`)
### 3) Added unit-level regression proofs
- Added descriptor metadata test:
-
`contrib/thrift-maven-plugin/src/test/java/org/apache/thrift/maven/TestThreadSafePluginDescriptor.java`
- verifies generated `plugin.xml` contains thread-safe metadata for
`compile` and `testCompile` goals.
- Added generated-output checksum regression test:
-
`contrib/thrift-maven-plugin/src/test/java/org/apache/thrift/maven/TestThriftOutputRegression.java`
- baseline manifests:
- `contrib/thrift-maven-plugin/src/test/resources/expected/java.sha256`
-
`contrib/thrift-maven-plugin/src/test/resources/expected/java_private_members.sha256`
### 4) Added Maven Invoker integration test suite
- Added `run-its` profile and invoker execution in
`contrib/thrift-maven-plugin/pom.xml`.
- Added fixtures under `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 in `build.log`.
## Proof of no regression
### Local validation run on this branch
- `mvn -f contrib/thrift-maven-plugin/pom.xml clean test`
- `mvn -f contrib/thrift-maven-plugin/pom.xml -Prun-its clean verify`
Both pass, including:
- unit tests (descriptor + checksum regression)
- invoker integration tests (real Maven executions in fixture projects)
## Maintainer reproduction steps
### Prereqs
- Maven 3.9.x
- `thrift` executable available on `PATH`
### 1) Unit tests
```bash
mvn -f contrib/thrift-maven-plugin/pom.xml clean test
```
### 2) Integration tests (invoker)
```bash
mvn -f contrib/thrift-maven-plugin/pom.xml -Prun-its clean verify
```
If `thrift` is not on `PATH`, use:
```bash
mvn -f contrib/thrift-maven-plugin/pom.xml -Prun-its clean verify \
-Dthrift.executable.for.it=/absolute/path/to/thrift
```
### 3) Optional A/B comparison against released plugin
Generate the same IDLs with `org.apache.thrift:thrift-maven-plugin:0.10.0`
and this branch version, then `diff -ru` generated output directories. This
branch includes in-repo checksum tests and invoker fixtures that already
provide automated equivalence checks for representative IDLs.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]