Skip to content
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

Required fixes for future Groovy 4 compatibility #21986

Merged
merged 8 commits into from
Sep 16, 2022

Conversation

DPUkyle
Copy link
Member

@DPUkyle DPUkyle commented Sep 12, 2022

Extracted from #20038

@DPUkyle DPUkyle added this to the 8.0 RC1 milestone Sep 12, 2022
@DPUkyle DPUkyle requested a review from a team September 12, 2022 23:21
@DPUkyle DPUkyle self-assigned this Sep 12, 2022
@DPUkyle DPUkyle force-pushed the km/groovy-4-safe-changes branch 5 times, most recently from 182646f to 387ae22 Compare September 13, 2022 16:04
@DPUkyle DPUkyle marked this pull request as ready for review September 13, 2022 16:48
@DPUkyle DPUkyle requested a review from a team as a code owner September 13, 2022 16:48
@gradle gradle deleted a comment from DPUkyle Sep 14, 2022
@gradle gradle deleted a comment from DPUkyle Sep 14, 2022
@gradle gradle deleted a comment from DPUkyle Sep 14, 2022
@gradle gradle deleted a comment from DPUkyle Sep 14, 2022
@gradle gradle deleted a comment from DPUkyle Sep 15, 2022
@bot-gradle
Copy link
Collaborator

OK, I've already triggered a build for you.

@bot-gradle
Copy link
Collaborator

Pre-tested commit build failed.

@octylFractal
Copy link
Member

@bot-gradle test and merge

@gradle gradle deleted a comment from DPUkyle Sep 15, 2022
@bot-gradle
Copy link
Collaborator

OK, I've already triggered a build for you.

@bot-gradle bot-gradle merged commit 8288ce7 into master Sep 16, 2022
@blindpirate blindpirate deleted the km/groovy-4-safe-changes branch September 16, 2022 02:27
bot-gradle added a commit that referenced this pull request Jan 4, 2023
This is a cleaned up version of #18552.

Building with `-DbundleGroovy4=true` on the CLI will use Groovy 4.0.7 libs.  An additional Gradleception job is already in place to invoke this code path.

If we choose to unconditionally upgrade to Groovy 4, we should revert this PR followed by setting the Groovy version value in `ExternalModulesExtension.kt`.

Alternatively, we could modify this PR to test forward with Groovy 5.  This would likely also need temporary inclusion of apache snapshot repositories; see #20972.

## Preparation PRs

- #18665
- #20037
- #21504
- #21497
- #21986
- #22097
- #22130
- #22133
- #22151
- #22157
- #22158
- #22178
- #22208
- #22213

## TODO

- [x] allow configuration-cache instrumentation to handle `INVOKEDYNAMIC`
  - #20795
  - #20799
  - #20616
- [x] fix capabilities
- [ ] mention relevant breaking changes in release notes/upgrade guide
  - [x] `is*()` getters are not supported for `Boolean` properties anymore; see #22218
  - [ ] `INVOKEDYNAMIC` is the only way forward
- [x] upgrade Spock to Groovy 4-compatible version – spockframework/spock#1382
  - [x] upgrade to Spock 2.2 GA
  - [x] upgrade to Spock 2.2-M1
- [x] upgrade CodeNarc – #20655
  - [x] CodeNarc/CodeNarc#678
    - this prevents running CodeNarc because it depends on the now-removed `groovy.utils.XmlParser`
    - it makes `IsolatedAntBuilderMemoryLeakIntegrationTest.CodeNarc does not fail with PermGen space error` fail
  - [x] CodeNarc/CodeNarc#682
- [x] upgrade to Groovy 4
  - [x] upgrade to Groovy 4.0.7
  - [x] [GROOVY-10765](https://issues.apache.org/jira/browse/GROOVY-10765) _STC: Closure implementation of Java @FunctionalInterface loses type information_
    - Can workaround using a cast in UnitOfWorkBuilder
    - Fix coming in 4.0.6
  - [x] [GROOVY-10731](https://issues.apache.org/jira/browse/GROOVY-10731) _Exceptions thrown from MarkupTemplateEngine when map accessors and GString interpolation are used_
    - fixed in 4.0.5
  - [ ] [GROOVY-10709](https://issues.apache.org/jira/browse/GROOVY-10709) _Performance regression in Gradle with Groovy 4_
    - no clear cause; mitigation/investigation is ongoing
  - [x] [GROOVY-10708](https://issues.apache.org/jira/browse/GROOVY-10708) _Property access for wrapped vs. primitive boolean_
    - Groovy team will not fix
    - @big-guy has suggested a workaround in Gradle to prevent breaking legacy plugins/tasks, to be implemented as #22218
  - [x] [GROOVY-10772](https://issues.apache.org/jira/browse/GROOVY-10772) _Possible memory leak, CacheableCallSite retains objects across invocations_
    - Causes OOME-related flakiness in `o.g.w.i.WorkerExecutorIntegrationTest#does not leak project state across multiple builds`, and OOME mostly happens with Java 8
  - [x] [GROOVY-10707](https://issues.apache.org/jira/browse/GROOVY-10707) _Regression in property access for conflicting isXxx and getXxx accessors_
    - Groovy team will not fix
    - Our tests are refactored to accommodate the breaking change
  - [x] [GROOVY-10591](https://issues.apache.org/jira/browse/GROOVY-10591) _Static method not found on Java interface_
    - no fix planned yet
  - [x] [GROOVY-10543](https://issues.apache.org/jira/browse/GROOVY-10543) _Problem with groovy-all Gradle module metadata_
    - fixed in 4.0.2
  - [x] [GROOVY-10514](https://issues.apache.org/jira/browse/GROOVY-10514) _Class method is not called anymore from inside closure_
    - apparently works as designed, added workarounds
  - [x] [GROOVY-10555](https://issues.apache.org/jira/browse/GROOVY-10555) _MetaClass.getProperites() returns package private fields_
    - no plan to fix yet, but added a workaround
  - [x] [GROOVY-10521](https://issues.apache.org/jira/browse/GROOVY-10521) _Compiler complains about abstract method not implemented when implementing trait_
    - not fixed yet, but we added a workaround
  - [x] ~~[GROOVY-10466](https://issues.apache.org/jira/browse/GROOVY-10466) _Compilation error on Spock expectation_~~
    - To be fixed in apache/groovy#1698
    - Fixed in 4.0.2-SNAPSHOT
  - [x] ~~[GROOVY-10467](https://issues.apache.org/jira/browse/GROOVY-10467) _Compilation fails with method detected as transient_~~
    - doesn't seem to be a problem with `4.0.1`
  - [x] ~~[GROOVY-10299](https://issues.apache.org/jira/browse/GROOVY-10299) _Groovy compiler generates invalid Java stubs_~~
    - already fixed in `4.0.0-beta-2`
  - [x] ~~[GROOVY-10290](https://issues.apache.org/jira/browse/GROOVY-10290) _Dynamic Groovy code in Gradle doesn't compile because of $getLookup() method is not static_~~
    - fixed in `4.0.1`
- [x] fix build scripts being compiled with binary compatibility (=class format version) of the runtime Java version
  - this makes the following tests fail:
    - `WorkerDaemonIntegrationTest`
    - `ConfigureRuntimeClasspathNormalizationIntegrationTest`
    - `CheckstylePluginToolchainsIntegrationTest`
    - `BuildEnvironmentIntegrationTest`
- [x] use non-deprecated Groovy `AntBuilder` for the super-class of our own `AntBuilder`
- [x] upgrade Groovy version in `AbstractSourcesAndJavadocJarsIntegrationTest`
- [x] use `org.apache.groovy` group ID for Groovy versions > 4 in `GroovyParametersMetadataIntegrationTest` (and probably in many other places)

Co-authored-by: Octavia Togami <otogami@gradle.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants