Skip to content

chore(spin-java-module, spin-junit-module): unify detect resolution - #175

Merged
deer merged 1 commit into
mainfrom
resolution_consolidation
Aug 3, 2026
Merged

chore(spin-java-module, spin-junit-module): unify detect resolution#175
deer merged 1 commit into
mainfrom
resolution_consolidation

Conversation

@deer

@deer deer commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

AbstractDetectTestResolution used to duplicate the entire AbstractDetectResolution algorithm just to override two protected hook methods (additionalSiblingCandidates() and additionalArtifacts()) for TEST-scope resolutions, keeping the main-vs-test specialization at the Java subclassing level.

This replaces that with a DI-driven approach. Plugin gains a new default method, contributeBindings(Binder), invoked by DefaultProgram once per Task context before the task is instantiated, so contributed bindings are visible to its injection points. AbstractJavaPlugin and AbstractJUnitPlugin now each provide a SourcePathKind-typed scope() via @Provides (MAIN vs TEST), and AbstractJUnitPlugin uses contributeBindings to multibind the JUnit Platform ConsoleLauncher and Jupiter engine artifacts into a Set<Artifact> that AbstractDetectResolution injects directly as additionalInfrastructureArtifacts. AbstractDetectResolution.create() now gates the TEST-only sibling-main-output lookup on the injected scope field instead of delegating to an overridable hook.

AbstractDetectTestResolution is deleted; its static helpers (jupiterVersion, jupiterMajorVersion, derivePlatformVersion) move onto AbstractJUnitPlugin, and Java25JUnitPlugin/Java8JUnitPlugin's DetectTestResolution inner classes now extend AbstractDetectResolution directly, matching how the main-scope compiler plugins already worked.

This is scoped to the detect-resolution merge only. The related "main/"/"test/" build-output-prefix literals still duplicated across the Compile tasks and both ResourcePlugins, and CleanPlugin's lack of any main/test/generated distinction, are deliberately out of scope here and left for a follow-up -- the SourcePathKind @Provides wiring added in this change is meant to be the reusable foundation for that follow-up.

@deer
deer merged commit 7a0b25d into main Aug 3, 2026
1 check passed
@deer
deer deleted the resolution_consolidation branch August 3, 2026 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant