Defining a Property to Resolve Conditional Dependencies in Gradle builds #45019
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.
The configuration cache compatibility proposal aimed to avoid resolving dependencies during execution while ensuring no incompatible types were introduced. However, the initial PRs revealed failing tests related to ConditionalDependencies. To address this issue, we implemented eager resolution of the deployment configuration to support the required logic for this feature.
While this approach worked, as noted in issue #44940, it introduced an overhead in configuration time for medium-to-large projects.
I evaluated alternative approaches, but resolving the deployment configuration is necessary to handle the conditional dependencies logic. Since the reproducer for the original issue did not implement conditional dependencies, I propose this PR. It introduces logic in the Quarkus Extension to check whether a project uses conditional dependencies. If no conditional dependencies are present, we skip the eager resolution, reducing unnecessary overhead.
My assumption is that most projects do not use conditional dependencies, making this the optimal approach. However, if you believe the logic should be inverted or prefer that a Quarkus build property be used to control this behavior, please let me know.
Tests
#44940 Reproducer, configuration time first build(
build
): 14s https://ge.solutions-team.gradle.com/s/golwhimdl5sby/performance/configuration#44940 Reproducer, configuration time second build(
build
): 3s https://ge.solutions-team.gradle.com/s/owqbjbbdvhz6u/performance/configuration#44940 Reproducer, configuration time first build,
quarkusBuild
with configuration cache: 42s https://ge.solutions-team.gradle.com/s/hmzeglndpvh7u/performance/configuration#44940 Reproducer, configuration time second build,
quarkusBuild
with configuration cache: 1.9s https://ge.solutions-team.gradle.com/s/l72l75e575eea/performance/configuration