experiment: leverage BuildContext API for skip-execution signaling - #1096
Draft
gnodet wants to merge 2 commits into
Draft
experiment: leverage BuildContext API for skip-execution signaling#1096gnodet wants to merge 2 commits into
gnodet wants to merge 2 commits into
Conversation
Integrate the Maven 4 BuildContext API into the compiler plugin to signal markSkipExecution() when compilation is skipped. This covers: - CompilerMojo: when skipMain is true - TestCompilerMojo: when skip is true - AbstractCompilerMojo: when applyIncrementalBuild() returns false This enables downstream mojos to detect that the compiler was skipped and react accordingly (e.g., skip JAR creation). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace the compiler plugin's custom IncrementalBuild change-detection engine with the Maven 4 BuildContext API for source tracking, change detection, stale output cleanup, and state persistence. Key changes: - ToolExecutor.applyIncrementalBuild() now registers source files via BuildContext.registerInput() and checks Status (NEW/MODIFIED/UNMODIFIED) instead of the old timestamp-based IncrementalBuild logic - OPTIONS aspect delegates to BuildContext's MojoConfigurationDigester (automatic parameter digestion replaces manual options hashing) - DEPENDENCIES aspect registers dependency JARs as BuildContext inputs (content-based SHA-1 hashing replaces timestamp comparison) - After compilation, associateOutputs() discovers class files including inner classes (Foo$Bar.class, Foo$1.class) and calls Input.associateOutput() for each, enabling automatic stale output cleanup when sources are removed - IncrementalBuild class reduced to Aspect enum and isEmptyOrIgnorable() utility — all instance state, cache I/O, and change detection logic removed - meta.process() calls deferred until after isEmptyOrIgnorable() check to avoid IllegalStateException when markSkipExecution() is called - Test updated to reinitialize BuildContext between executions (matching Maven DI behavior where each execution gets a fresh context) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
markSkipExecution()when compilation is skippedCompilerMojo(whenskipMainis true),TestCompilerMojo(whenskipis true), andAbstractCompilerMojo(whenapplyIncrementalBuild()returns false)Details
This is an experimental branch that depends on:
4.1.0-SNAPSHOT)Changes
AbstractCompilerMojo.java: Added@Inject BuildContext buildContextfield, signalsmarkSkipExecution()whenapplyIncrementalBuild()returns false (nothing to compile)CompilerMojo.java: AddedmarkSkipExecution()whenskipMainis trueTestCompilerMojo.java: AddedmarkSkipExecution()whenskipis trueCompilerMojoTestCase.java: Updated test imports to neworg.apache.maven.testing.pluginpackage, added@Providesmethods forBuildContextandPathMatcherFactorypom.xml: BumpedmavenVersionto4.1.0-SNAPSHOTTest plan
🤖 Generated with Claude Code