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

Groovy DSL = for ConfigurableFileCollection changes state of Configuration #30273

Open
asodja opened this issue Aug 22, 2024 · 1 comment
Open
Labels
a:bug in:provider-api property lazy provider MapProperty ListProperty DirectoryProperty p:lazy-migration Issues covered by migration to an all-lazy API

Comments

@asodja
Copy link
Member

asodja commented Aug 22, 2024

When using = in Groovy DSL, Configuration is changed from "UNRESOLVED" to "RESOLVED" even though it shouldn't be.

That is probably a consequence of this code:

fileCollection.visitStructure(new FileCollectionStructureVisitor() {
@Override
public boolean startVisit(FileCollectionInternal.Source source, FileCollectionInternal fileCollection) {
if (DefaultConfigurableFileCollection.this == fileCollection) {
throw new UnsupportedOperationException("Self-referencing ConfigurableFileCollections are not supported. Use the from() method to add to a ConfigurableFileCollection.");
}
return true;
}
@Override
public VisitType prepareForVisit(Source source) {
return VisitType.NoContents;
}
@Override
public void visitCollection(Source source, Iterable<File> contents) {
}
@Override
public void visitFileTree(File root, PatternSet patterns, FileTreeInternal fileTree) {
}
@Override
public void visitFileTreeBackedByFile(File file, FileTreeInternal fileTree, FileSystemMirroringFileTree sourceTree) {
}
});

We should probably fix that.

@asodja asodja added a:bug in:provider-api property lazy provider MapProperty ListProperty DirectoryProperty p:lazy-migration Issues covered by migration to an all-lazy API labels Aug 22, 2024
@asodja asodja changed the title Groovy DSL = for ConfigurableFileCollection changes states of Configuration Groovy DSL = for ConfigurableFileCollection changes state of Configuration Aug 22, 2024
asodja added a commit that referenced this issue Aug 22, 2024
Except for classpath due to issue #30273.
asodja added a commit that referenced this issue Aug 22, 2024
Except for classpath due to issue #30273.
asodja added a commit that referenced this issue Aug 22, 2024
Except for classpath due to issue #30273.
asodja added a commit that referenced this issue Aug 26, 2024
Except for classpath due to issue #30273.
@asodja
Copy link
Member Author

asodja commented Aug 26, 2024

Tests:

def "only resolves source class path feeding into inferred Groovy class path if/when the latter is actually used (but not during autowiring)"() {
file("build.gradle") << """
plugins {
id("groovy-base")
}
sourceSets {
custom
}
${mavenCentralRepository()}
dependencies {
customImplementation "org.codehaus.groovy:groovy-all:2.4.10"
}
task groovydoc(type: Groovydoc) {
classpath = sourceSets.custom.runtimeClasspath
}
task verify {
def customCompileClasspathState = provider {
configurations.customCompileClasspath.state.toString()
}
def customRuntimeClasspathState = provider {
configurations.customRuntimeClasspath.state.toString()
}
doLast {
assert customCompileClasspathState.get() == "UNRESOLVED"
assert customRuntimeClasspathState.get() == "UNRESOLVED"
}
}
"""
expect:
succeeds("verify")
}

def "only resolves source class path feeding into inferred Scala class path if/when the latter is actually used (but not during autowiring)"() {
file("build.gradle") << """
apply plugin: "scala-base"
sourceSets {
custom
}
${mavenCentralRepository()}
dependencies {
customImplementation "${scalaDependency(version.toString())}"
}
task scaladoc(type: ScalaDoc) {
classpath = sourceSets.custom.runtimeClasspath
}
task verify {
def customCompileClasspathState = provider { configurations.customCompileClasspath.state.toString() }
def customRuntimeClasspathState = provider { configurations.customRuntimeClasspath.state.toString() }
doLast {
assert customCompileClasspathState.get() == "UNRESOLVED"
assert customRuntimeClasspathState.get() == "UNRESOLVED"
}
}
"""
expect:
succeeds("verify")
}

asodja added a commit that referenced this issue Aug 26, 2024
Except for classpath due to issue #30273.
asodja added a commit that referenced this issue Aug 26, 2024
Except for classpath due to issue #30273.
lptr pushed a commit that referenced this issue Aug 27, 2024
Except for classpath due to issue #30273.
asodja added a commit that referenced this issue Aug 28, 2024
Except for classpath due to issue #30273.
asodja added a commit that referenced this issue Aug 28, 2024
Except for classpath due to issue #30273.
asodja added a commit that referenced this issue Aug 28, 2024
Except for classpath due to issue #30273.
asodja added a commit that referenced this issue Sep 6, 2024
Except for classpath due to issue #30273.
asodja added a commit that referenced this issue Sep 6, 2024
Except for classpath due to issue #30273.
asodja added a commit that referenced this issue Sep 6, 2024
Except for classpath due to issue #30273.
asodja added a commit that referenced this issue Sep 6, 2024
Except for classpath due to issue #30273.
asodja added a commit that referenced this issue Sep 17, 2024
Except for classpath due to issue #30273.
asodja added a commit that referenced this issue Sep 17, 2024
Except for classpath due to issue #30273.
asodja added a commit that referenced this issue Sep 19, 2024
Except for classpath due to issue #30273.
asodja added a commit that referenced this issue Sep 19, 2024
Except for classpath due to issue #30273.
asodja added a commit that referenced this issue Sep 19, 2024
Except for classpath due to issue #30273.
asodja added a commit that referenced this issue Sep 19, 2024
Except for classpath due to issue #30273.
asodja added a commit that referenced this issue Sep 20, 2024
Except for classpath due to issue #30273.
asodja added a commit that referenced this issue Sep 20, 2024
Except for classpath due to issue #30273.
asodja added a commit that referenced this issue Sep 23, 2024
Except for classpath due to issue #30273.
asodja added a commit that referenced this issue Sep 23, 2024
Except for classpath due to issue #30273.
asodja added a commit that referenced this issue Sep 25, 2024
Except for classpath due to issue #30273.
asodja added a commit that referenced this issue Sep 25, 2024
Except for classpath due to issue #30273.
asodja added a commit that referenced this issue Oct 4, 2024
Except for classpath due to issue #30273.
asodja added a commit that referenced this issue Oct 4, 2024
Except for classpath due to issue #30273.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:bug in:provider-api property lazy provider MapProperty ListProperty DirectoryProperty p:lazy-migration Issues covered by migration to an all-lazy API
Projects
None yet
Development

No branches or pull requests

1 participant