Extracting baseconfig inputs from extensionview #48769
Merged
+463
−245
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.
Issue #48651 describes a build failure when executing the classes task:
Initially, the failure didn’t make much sense because there is a known relationship between the
ApplicationModel
task and the generated tasks. Something was breaking the task dependency hierarchy.Investigation Summary
We observed:
The issue did not occur when executing assemble, build, or other typical Quarkus tasks.
It could be reproduced in Quarkus projects if the extension configuration triggered eager task resolution, for example:
In contrast, replacing .get() with .flatMap avoided the resolution but did not fix the issue on the client side.
User reports confirm the issue occurs on Quarkus 3.23.1 but not in 3.23.0, although we could not directly link the behavior to the project descriptor rework.
We also verified that in a non-Quarkus project, we could not reproduce the issue using the same structure as the Quarkus plugin. Even with eager resolution in place, task dependencies were respected as expected.
Root Cause
Deeper investigation revealed that the issue was triggered by the initialization of
QuarkusPluginExtensionView
, specifically due to inputs that rely on the instantiation of the BaseConfig object:It’s unclear why this initialization disrupts the task graph, but it causes a failure when tasks like
classes
are executed in isolation.Fix Summary (this PR)
Extracted inputs requiring BaseConfig from
QuarkusPluginExtensionView
.Decoupled inputs specific to
QuarkusBuildTask
and moved them out of the shared extension view, keeping only common inputs.Introduced a new base task class to hold common inputs and
QuarkusPluginExtensionView
.Inputs depending on baseConfig are now set during task configuration time (not during extension instantiation).
Added a new
EffectiveConfigProvider
in the base task to abstract effective configuration.Added a regression test to cover the issue reported.
Motivation
Given the unexpected side effects caused by the early instantiation of BaseConfig inside the extension, especially since it is injected into both
QuarkusGenerateCode
andQuarkusBuildTask
, we chose to restructure the task input declaration.Previously, QuarkusPluginExtensionView held all inputs for both tasks, including those not required for
QuarkusGenerateCode
. We split these inputs into their respective tasks and delegated common ones to a shared base task.This change ensures that only the required inputs are declared eagerly, and those dependent on BaseConfig are delayed until configuration time, improving configuration cache compatibility and fixing the task failure issue.
CI checks
https://github.com/cdsap/quarkus/actions/runs/16061544644