-
Notifications
You must be signed in to change notification settings - Fork 1
Fix Gradle configuration-time resolution warning in demo task setup #66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ead of tasks.getting() Co-authored-by: ShreckYe <[email protected]>
|
@copilot No I still get these from running
|
... You're correct - I investigated further and found that these warnings are coming from the Kotlin Multiplatform Gradle plugin itself (version 2.2.10), not from the task configuration I fixed earlier. The plugin internally resolves This is a known issue tracked in the Kotlin project (see KT-55620 and KT-49109). The warnings don't affect build functionality but indicate a performance issue in the plugin itself. Unfortunately, there's no workaround available in user code for this particular issue with Kotlin 2.2.10. The solutions would be:
My earlier fix (commit 1a00969) was still valid for preventing configuration-time resolution in the demo's task setup, but it doesn't address these plugin-internal warnings. |
Temporarily closed. |
Problem
The build was generating configuration-time resolution warnings. Investigation revealed two sources:
User code issue (fixed): Task references in
demo/build.gradle.kts
were being eagerly resolved usingtasks.getting()
, which forces Gradle to resolve tasks during the configuration phase.Kotlin plugin limitation (not fixable in user code): The Kotlin Multiplatform Gradle plugin (version 2.2.10) internally resolves npm configurations (
jsNpmAggregated
,wasmJsNpmAggregated
, and related test configurations) during the configuration phase when setting up JavaScript/Wasm compilation for each module. This is a known issue tracked in the Kotlin project (KT-55620, KT-49109).Solution
Fixed the user code issue by replacing eager task resolution with lazy task providers following Gradle's Task Configuration Avoidance API best practices:
Before:
After:
Benefits
The
tasks.named()
method returns aTaskProvider<Task>
which provides lazy configuration, ensuring tasks are only resolved when actually needed during the execution phase.Note on Remaining Warnings
The npm configuration warnings from the Kotlin Multiplatform Gradle plugin itself cannot be resolved through user code changes. These warnings don't affect build functionality but indicate a performance issue in the plugin that will need to be addressed by the Kotlin team in a future release.
Original prompt
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.