You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@grails.apache.org by "codeconsole (via GitHub)" <gi...@apache.org> on 2026/07/31 18:27:30 UTC
[PR] fix: defer compile-classpath probes out of GroovyCompile task configuration [grails-core]
codeconsole opened a new pull request, #16076:
URL: https://github.com/apache/grails-core/pull/16076
### Problem
On Gradle 9.5+, running a task that depends on `compileClasspath` **without** also depending on the compile task — e.g. asset-pipeline's `assetCompile` — fails during task-graph construction:
```
Could not determine the dependencies of task ':assetCompile'.
> Could not resolve all dependencies for configuration ':compileClasspath'.
> Could not create task ':compileGroovy'.
> Could not resolve all dependencies for configuration ':compileClasspath'.
> Cannot observe dependencies before markAsObserved(String) has been called.
```
The chain (observed from a Grails 8.0.0-M4 app on Gradle 9.6.1):
1. Scheduling `assetCompile` resolves `compileClasspath` for build dependencies.
2. Mid-resolve, Gradle freezes the configuration's attributes; the target-JVM attribute's provider chain realizes the `compileGroovy` task.
3. Task realization fires `GrailsGradlePlugin.configureGroovyCompiler`'s `configureEach` callback, which calls `getGroovyCompilerScript` → `isClassOnClasspath(compile.classpath, …)` → `classpath.files` — re-entering the resolution already in flight.
4. Gradle 9.5+'s stricter resolution state machine rejects the re-entrancy with the `markAsObserved` `IllegalStateException`. Older Gradle (9.4.x and below) tolerated it silently.
Invocations that realize the compile tasks during task selection (`build`, `compileGroovy`, or even `assetCompile compileGroovy`) are unaffected, which makes the failure look sporadic.
### Fix
Move the star-import computation — including the two `isClassOnClasspath` classpath probes — inside the closure that `getGroovyCompilerScript` returns. That closure is only invoked from the task's `doFirst`, at execution time, where resolving the classpath is legal. Nothing at task-configuration time touches the classpath anymore.
The `GrailsPluginGradlePlugin` override already invokes the parent closure lazily inside its own closure (`parent?.call() ?: ''`), so it composes unchanged, and the call site's existing null handling covers the no-imports case.
### Verification
- `:grails-gradle-plugins:compileGroovy` passes.
- Published the patched plugin locally and pointed the affected Grails 8.0.0-M4 app at it: `./gradlew assetCompile` now constructs its task graph and runs (previously failed as above), and the generated `grailsGroovyCompilerConfig-compileGroovy.groovy` still contains all three star-import packages (`jakarta.validation.constraints`, `grails.gorm.annotation`, `grails.plugin.scaffolding.annotation`), confirming the deferred probes see the same classpath. Full app compile succeeds with the auto-imports in effect.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix: defer compile-classpath probes out of GroovyCompile task configuration [grails-core]
Posted by "jdaugherty (via GitHub)" <gi...@apache.org>.
jdaugherty merged PR #16076:
URL: https://github.com/apache/grails-core/pull/16076
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix: defer compile-classpath probes out of GroovyCompile task configuration [grails-core]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #16076:
URL: https://github.com/apache/grails-core/pull/16076#issuecomment-5146614753
## [Codecov](https://app.codecov.io/gh/apache/grails-core/pull/16076?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:x: Patch coverage is `0%` with `12 lines` in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 51.8562%. Comparing base ([`57883c4`](https://app.codecov.io/gh/apache/grails-core/commit/57883c41e4519b5e5cdbc6e6a9ef4a67a2c98f0f?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`4fdb88b`](https://app.codecov.io/gh/apache/grails-core/commit/4fdb88b163175ec569816aeedace3a021eac32bd?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
| [Files with missing lines](https://app.codecov.io/gh/apache/grails-core/pull/16076?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
|---|---|---|
| [...rails/gradle/plugin/core/GrailsGradlePlugin.groovy](https://app.codecov.io/gh/apache/grails-core/pull/16076?src=pr&el=tree&filepath=grails-gradle%2Fplugins%2Fsrc%2Fmain%2Fgroovy%2Forg%2Fgrails%2Fgradle%2Fplugin%2Fcore%2FGrailsGradlePlugin.groovy&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Z3JhaWxzLWdyYWRsZS9wbHVnaW5zL3NyYy9tYWluL2dyb292eS9vcmcvZ3JhaWxzL2dyYWRsZS9wbHVnaW4vY29yZS9HcmFpbHNHcmFkbGVQbHVnaW4uZ3Jvb3Z5) | 0.0000% | [12 Missing :warning: ](https://app.codecov.io/gh/apache/grails-core/pull/16076?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
<details><summary>Additional details and impacted files</summary>
[](https://app.codecov.io/gh/apache/grails-core/pull/16076?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
```diff
@@ Coverage Diff @@
## 8.0.x #16076 +/- ##
================================================
+ Coverage 0 51.8562% +51.8562%
- Complexity 0 18110 +18110
================================================
Files 0 2046 +2046
Lines 0 96274 +96274
Branches 0 16727 +16727
================================================
+ Hits 0 49924 +49924
- Misses 0 38980 +38980
- Partials 0 7370 +7370
```
| [Files with missing lines](https://app.codecov.io/gh/apache/grails-core/pull/16076?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [...rails/gradle/plugin/core/GrailsGradlePlugin.groovy](https://app.codecov.io/gh/apache/grails-core/pull/16076?src=pr&el=tree&filepath=grails-gradle%2Fplugins%2Fsrc%2Fmain%2Fgroovy%2Forg%2Fgrails%2Fgradle%2Fplugin%2Fcore%2FGrailsGradlePlugin.groovy&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Z3JhaWxzLWdyYWRsZS9wbHVnaW5zL3NyYy9tYWluL2dyb292eS9vcmcvZ3JhaWxzL2dyYWRsZS9wbHVnaW4vY29yZS9HcmFpbHNHcmFkbGVQbHVnaW4uZ3Jvb3Z5) | `0.0000% <0.0000%> (ø)` | |
... and [2045 files with indirect coverage changes](https://app.codecov.io/gh/apache/grails-core/pull/16076/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
</details>
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix: defer compile-classpath probes out of GroovyCompile task configuration [grails-core]
Posted by "testlens-app[bot] (via GitHub)" <gi...@apache.org>.
testlens-app[bot] commented on PR #16076:
URL: https://github.com/apache/grails-core/pull/16076#issuecomment-5147257687
## ✅ All tests passed ✅
🏷️ Commit: 4fdb88b163175ec569816aeedace3a021eac32bd
▶️ Tests: 57599 executed
⚪️ Checks: 60/60 completed
---
_Learn more about TestLens at [testlens.app](https://testlens.app)._
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org