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

Clear root metadata when adding or removing configurations #23992

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -84,4 +84,31 @@ class AddingConfigurationIntegrationTest extends AbstractIntegrationSpec {
expect:
succeeds "addConfigs"
}

def "can remove and add configurations between resolutions"() {
given:
mavenRepo.module("org", "foo", "1.0").publish()

buildFile << """
repositories {
maven { url '$mavenRepo.uri' }
}

task resolve {
doLast {
def conf = configurations.create("conf")
conf.dependencies.add(project.dependencies.create("org:foo:1.0"))
conf.files
configurations.remove(conf)

def conf2 = configurations.create("conf2")
conf2.dependencies.add(project.dependencies.create("org:foo:1.0"))
conf2.files
}
}
"""

expect:
succeeds("resolve")
}
}
Expand Up @@ -81,6 +81,8 @@ public DefaultConfigurationContainer(
};
this.rootComponentMetadataBuilder = rootComponentMetadataBuilderFactory.create(this);
this.defaultConfigurationFactory = defaultConfigurationFactory;
this.whenObjectAdded(x -> rootComponentMetadataBuilder.discardAll());
this.whenObjectRemoved(x -> rootComponentMetadataBuilder.discardAll());
}

@Override
Expand Down