Status Update
Comments
sp...@google.com <sp...@google.com> #2
au...@google.com <au...@google.com> #4
for all who are looking for a solution use this:
au...@google.com <au...@google.com> #5
Assume the following kotlin jvm project
def writeTestPropsTask = tasks.register("prepareTestConfiguration", WriteProperties.class) {
description = "Generates a properties file with the current environment for compilation tests"
setOutputFile(project.layout.buildDirectory.dir("test-config").map {
it.file(
"androidx.room.compiler.processing.util.CompilationTestCapabilities.Config.properties"
)
})
property("kotlinVersion", libs.versions.kotlin.get())
property("kspVersion", libs.versions.ksp.get())
}
java {
sourceSets {
main {
resources.srcDir(writeTestPropsTask.map { it.outputFile.parentFile })
}
}
}
When running ./gradlew room:room-compiler-processing-testing:lintDebug --dry-run
with Gradle 7.5:
(note :room:room-compiler-processing-testing:prepareTestConfiguration
is there)
with Gradle 7.6-20221014231703+0000:
(note there is no :room:room-compiler-processing-testing:prepareTestConfiguration
, in fact is it also missing
:room:room-compiler-processing-testing:processResources SKIPPED
:room:room-compiler-processing-testing:classes SKIPPED
:room:room-compiler-processing-testing:jar SKIPPED
:room:room-compiler-processing-testing:inspectClassesForKotlinIC SKIPPED
)
So it seems like there was a change in behavior in Gradle.
au...@google.com <au...@google.com> #6
- 7.6-20221014231703 - broken
- 7.6-20220930142900 - broken
- 7.6-20220928231907 - broken
https://ge.androidx.dev/s/lse6ktizibap4 - 7.6-20220927231720 - broken
https://ge.androidx.dev/s/eihmtfgd6yt3k - 7.6-20220926232440 - works
https://ge.androidx.dev/s/zlz43x2t5nrmc - 7.6-20220922003959 - works
https://ge.androidx.dev/s/pevaqkp37bkmk - 7.6-20220912152258 - works
https://ge.androidx.dev/s/zkr4wemnvbmx2
It seems that Gradle regressed between 7.6-20220926232440 (working) and 7.6-20220927231720 (broken)
au...@google.com <au...@google.com> #7
Good state
:room:room-compiler-processing-testing:compileKotlin SKIPPED
:room:room-compiler-processing-testing:compileJava SKIPPED
:room:room-compiler-processing-testing:prepareTestConfiguration SKIPPED
:room:room-compiler-processing-testing:processResources SKIPPED
:room:room-compiler-processing-testing:classes SKIPPED
:room:room-compiler-processing-testing:jar SKIPPED
:room:room-compiler-processing-testing:inspectClassesForKotlinIC SKIPPED
:room:room-compiler-processing-testing:lintAnalyze SKIPPED
:room:room-compiler-processing-testing:lintReport SKIPPED
:room:room-compiler-processing-testing:lint SKIPPED
:room:room-compiler-processing-testing:lintDebug SKIPPED
Bad state
:room:room-compiler-processing-testing:compileKotlin SKIPPED
:room:room-compiler-processing-testing:compileJava SKIPPED
:room:room-compiler-processing-testing:lintAnalyze SKIPPED
:room:room-compiler-processing-testing:lintReport SKIPPED
:room:room-compiler-processing-testing:lint SKIPPED
:room:room-compiler-processing-testing:lintDebug SKIPPED
au...@google.com <au...@google.com> #8
Based on ./gradlew -v
- good build is sha bc01957e03b6ee2f2c7163390eda0295db8430df
- bad build is sha 96a78dfc1ee9fc8146b73197ff37a787e3e0450a
comparison between the two commits
here are the commits involved
This commit
sp...@google.com <sp...@google.com> #9
Thanks for investigating, Aurimas.
Seems like we should file a bug with Gradle for this. I can try to use #5 to create a repro project that doesn't use AGP.
sp...@google.com <sp...@google.com> #10
I've tried to create a repro project without AGP, but I'm unable to make something that breaks in the same way with Gradle 7.6-20221014231703+0000.
I've attached a project with the following build.gradle
:
plugins {
id 'java'
}
// ...
def fooTask = tasks.register("foo", com.example.FooTask.class) {
getOutputDir().set(project.layout.buildDirectory.dir("fooOut"))
}
tasks.register("bar", com.example.BarTask.class) {
getSourceDirs().from(java.sourceSets.getByName("main").allSource.sourceDirectories)
}
java {
sourceSets {
main {
resources.srcDir(fooTask.map { it.getOutputDir().get().getAsFile() })
}
}
}
When I run ./gradlew bar --dry-run
I see :foo
show up as a dependency whether I use Gradle 7.4 or 7.6-20221014231703+0000.
Aurimas, do you see how this toy project can be tweaked to repro the issue?
au...@google.com <au...@google.com> #11
Here is the updated repo.
change gradle-wrapper.properties
run ./gradlew lint see different tasks.
Compare:
https://scans.gradle.com/s/7xx6s2uad3suu/timeline?details=7nuher4nqr4hk https://scans.gradle.com/s/eplsswioxlex6/timeline?details=askzbw7rbup2s&show=predecessors
Note that dependency to classes
and processResources
is gone
sp...@google.com <sp...@google.com> #12
Ok, I see what's going on now, and I have a repro project (attached).
In the attached project, running ./gradlew bar --dry-run
has the following output with Gradle 7.4:
:compileJava SKIPPED
:foo SKIPPED
:processResources SKIPPED
:classes SKIPPED
:bar SKIPPED
But with Gradle 7.6-20221014231703+0000 it has the following output:
:compileJava SKIPPED
:bar SKIPPED
The issue is that the bar
task adds java.sourceSets.main.output.classesDirs
to its input, which has a dependency on the classes
task in Gradle 7.4, but has a dependency on only the javaCompile
task starting with Gradle 7.6-20221014231703+0000.
The Lint plugin is hitting this because it
xa...@google.com <xa...@google.com> #13
Scott, are we fixing this for 7.4?
au...@google.com <au...@google.com> #15
In the gradle slack, they noted that we should be using a different API for this if we want java resources + classes. It might be best if you chat with jvandort@ about it.
na...@google.com <na...@google.com> #17
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.emoji2:emoji2-emojipicker:1.4.0-rc01
Description
Lint access source set information in a way that does not capture dependency information. Androidx is hitting this with:
The issue seems to be usage of non-provider based APIs here .
We should switch to
SourceSet.getAllSource().getSourceDirectories()
.