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

Inject services into all external module dependencies created by DefaultJvmComponentDependencies #23517

Closed

Conversation

tresat
Copy link
Member

@tresat tresat commented Jan 12, 2023

This fixes an issue where you can decorate a dep with platform and get a runtime failure because an AttributesFactory has not been injected into the dep.

eskatos and others added 30 commits January 4, 2023 10:20
Signed-off-by: Paul Merlin <paul@gradle.com>
feedback from @eskatos

- resolves: #13363

Signed-off-by: Reinhold Degenfellner <rdegenfellner@gradle.com>
Instead of using the Test Retry plugin, the build now uses the test
retry functionality that's included in the Gradle Enterprise Gradle
plugin.
As a follow up for
* #23368

Co-authored-by: Paul Merlin <paul@gradle.com>
feedback from @eskatos

- resolves: #13363

Signed-off-by: Reinhold Degenfellner <rdegenfellner@gradle.com>
Tests should not rely on order of tasks being executed across subprojects.
…terprise plugin

Instead of using the Test Retry plugin, the build now uses the test
retry functionality that's included in the Gradle Enterprise Gradle
plugin.

Co-authored-by: Marc Philipp <marc@gradle.com>
Tests should not rely on order of tasks being executed across subprojects.

Co-authored-by: Rafael Chaves <rchaves@gradle.com>
Signed-off-by: Paul Merlin <paul@gradle.com>
Signed-off-by: Paul Merlin <paul@gradle.com>
Signed-off-by: Paul Merlin <paul@gradle.com>
Signed-off-by: Paul Merlin <paul@gradle.com>
…eplace

### Context

When using TestKit in tests from the default source set, `GradleRunner` is not found in the tests classpath.

This fix allows the generated Gradle Plugin project to have both functional and default test source sets working with TestKit.

Fixes
  - #23298

Co-authored-by: Xavier Arias Seguí <xavier.arias.segui@gradle.com>
Signed-off-by: Paul Merlin <paul@gradle.com>
Signed-off-by: Paul Merlin <paul@gradle.com>
… WriteProperties Task

- resolves: #13363

Signed-off-by: Reinhold Degenfellner <rdegenfellner@gradle.com>

Co-authored-by: Reinhold Degenfellner <rdegenfellner@gradle.com>
UsageContext is a legacy type. We should be using SoftwareComponentVariant instead. We are still stuck
using UsageContext in some places since it is used in SoftwareComponentInternal#getUsages, however this
PR removes all other occurances of UsageContext where it is not strictly required to use. This PR will
make a future transition to a new public API for defining variants easier.

In general, this PR:
* Updates all terminology from using 'usage' to 'variant'. This includes renaming any implementations of UsageContext
to have Variant in their name. Variable and method names are updated where possible
* Remove constructor of DefaultSoftwareComponentVariant which accepts a configuration. Migrate usages to ConfigurationSoftwareComponentVariant.
* Add some documentation explaining difficulties of removing UsageContext altogether.
…ionCacheSmokeTest`

Co-authored-by: Rodrigo B. de Oliveira <rodrigo@gradle.com>
Two things were wrong
1. Elements configurations for test fixtures and feature variants suddenly became un-declarable-against
2. Copied configurations never copied a deprecation. This means a copy of a deprecated configuration showed no warnings.
   Changing those warnings to errors in 8.0 made the copied configurations thow errors without a deprecation log.

To fix this, we:
1. Update the builder which creates elements configuration to not disallow for declaration against.
   We then update our internal code which uses these to explicitly disable declaration against
2. Update the copy method for a configuration to always enable all roles for the new configuration.

   However, if a role is disabled for the source configuration, we will ensure the new configuration is disabled
   for that role. This ensures copied configuration whose source configurations had a role disabled will emit warnings
   when used for a role which was improper for the source configuration.
… property

Fixes #23390

Co-authored-by: Thomas Tresansky <ttresansky@gradle.com>
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>
@tresat tresat added the in:test-suites Work related to the JvmTestSuite Plugin label Jan 12, 2023
@tresat tresat added this to the 8.1 RC1 milestone Jan 12, 2023
@tresat tresat marked this pull request as ready for review January 12, 2023 20:48
@tresat tresat requested review from a team as code owners January 12, 2023 20:48
@marcphilipp marcphilipp removed the request for review from a team January 13, 2023 08:24
- Simplify the test by removing extraneous convention plugin.
- Expand the test to check enforcedPlatform as well.
@tresat
Copy link
Member Author

tresat commented Jan 13, 2023

@bot-gradle test this

@gradle gradle deleted a comment from tresat Jan 13, 2023
@bot-gradle
Copy link
Collaborator

I've triggered the following builds for you:

@tresat tresat changed the base branch from master to release7x January 13, 2023 17:08
@tresat tresat requested review from a team, ldaley and bamboo as code owners January 13, 2023 17:08
@tresat tresat modified the milestones: 8.1 RC1, 7.6.1 Jan 13, 2023
@tresat
Copy link
Member Author

tresat commented Jan 13, 2023

@bot-gradle test this

@gradle gradle deleted a comment from tresat Jan 13, 2023
@bot-gradle
Copy link
Collaborator

I've triggered the following builds for you:

Copy link
Member

@octylFractal octylFractal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might need to do this for anything else that extends AbstractModuleDependency, items that come to mind are:

  • project dependencies
  • version catalog dependencies

Potentially we should just pass all Dependency instances through the method for consistency.

@tresat
Copy link
Member Author

tresat commented Jan 13, 2023

We might need to do this for anything else that extends AbstractModuleDependency

OK. I'm going to start a new branch off of 7.x, copy this work and add some tests for the other modifiers there.

@tresat tresat closed this Jan 13, 2023
@tresat
Copy link
Member Author

tresat commented Jan 13, 2023

Superceded by #23535

@tresat tresat deleted the tt/fix/platforms-and-test-suites-with-convention-plugins branch September 18, 2023 21:53
@ov7a ov7a removed this from the 7.6.1 milestone Mar 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in:test-suites Work related to the JvmTestSuite Plugin
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Platform dependencies not possible in dependency block of test suite plugin