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

Extending an already resolved configuration no longer works correctly #24109

Closed
DJtheRedstoner opened this issue Mar 2, 2023 · 3 comments
Closed
Assignees
Labels
a:regression This used to work in:dependency-resolution engine metadata
Milestone

Comments

@DJtheRedstoner
Copy link
Contributor

DJtheRedstoner commented Mar 2, 2023

Expected Behavior

Extending an already resolved configuration should include the resolved dependencies of that configuration in the sub configuration.

Current Behavior

Dependencies from the already resolved super configuration are not included in the sub configuration.

Context

This stopped working in Gradle 7.6.1 and 8.0 (also tested with 8.0.1). I noticed this issue with our fork of the fabric-loom gradle plugin. Because of the complex nature of the plugin a lot of things are done "out of order". A simple workaround for this issue exists (adding an extendsFrom in the buildscript/earlier in the plugin).

Steps to Reproduce

Run the following buildscript:

plugins {
    id 'java'
}

repositories {
    mavenCentral()
}

configurations {
    superConfiguration
    subConfiguration
}

dependencies {
    superConfiguration "commons-io:commons-io:2.11.0"
}

// cause superConfiguration to be resolved
println configurations.superConfiguration.files

configurations.subConfiguration.extendsFrom(configurations.superConfiguration)

println configurations.subConfiguration.files

Note the difference in output between gradle 7.6

[C:\Users\admin\.gradle\caches\modules-2\files-2.1\commons-io\commons-io\2.11.0\a2503f302b11ebde7ebc3df41daebe0e4eea3689\commons-io-2.11.0.jar]
[C:\Users\admin\.gradle\caches\modules-2\files-2.1\commons-io\commons-io\2.11.0\a2503f302b11ebde7ebc3df41daebe0e4eea3689\commons-io-2.11.0.jar]

and 7.6.1

[C:\Users\admin\.gradle\caches\modules-2\files-2.1\commons-io\commons-io\2.11.0\a2503f302b11ebde7ebc3df41daebe0e4eea3689\commons-io-2.11.0.jar]
[]

Your Environment

Build scan URL (Gradle 7.6): https://scans.gradle.com/s/uqo7kw7crp4fq
Build scan URL (Gradle 7.6.1): https://scans.gradle.com/s/mpjt6aujq3loc

@ljacomet ljacomet added in:dependency-resolution engine metadata and removed to-triage labels Mar 2, 2023
@ljacomet ljacomet added this to the 8.0.2 milestone Mar 2, 2023
@jvandort jvandort self-assigned this Mar 2, 2023
bot-gradle added a commit that referenced this issue Mar 2, 2023
…ations

The hierarchy is saved as an instance variable in configuration metadata. The mutation type for configuration extension
was DEPENDENCIES, which only caused the cached metadata to be reevaluated. This is not sufficient. We add a new mutation
type for HIERARCHY which completely discards the metadata, allowing it to be recalculated and the new hierarchy value
to be passed to the configuration metadata

Fixes #24109

Co-authored-by: Justin Van Dort <jvandort@gradle.com>
@ljacomet
Copy link
Member

ljacomet commented Mar 2, 2023

Fix has been merged

@ljacomet ljacomet closed this as completed Mar 2, 2023
@DJtheRedstoner
Copy link
Contributor Author

Thanks! Will there be a backport to 7.x with this fix?

@ljacomet
Copy link
Member

ljacomet commented Mar 3, 2023

Filed #24132 for this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:regression This used to work in:dependency-resolution engine metadata
Projects
None yet
Development

No branches or pull requests

3 participants