Status Update
Comments
au...@google.com <au...@google.com> #2
Branch: androidx-master-dev
commit b90079595f33f58fece04026a97faa0d243acdb1
Author: Yuichi Araki <yaraki@google.com>
Date: Wed Sep 18 16:55:49 2019
Change the way to detect mismatch between POJO and query
This fixes cursor mismatch warnings with expandProjection.
Bug: 140759491
Test: QueryMethodProcessorTest
Change-Id: I7659002e5e0d1ef60fc1af2a625c0c36da0664d8
M room/compiler/src/main/kotlin/androidx/room/processor/QueryMethodProcessor.kt
M room/compiler/src/main/kotlin/androidx/room/solver/TypeAdapterStore.kt
M room/compiler/src/main/kotlin/androidx/room/solver/query/result/PojoRowAdapter.kt
M room/compiler/src/test/kotlin/androidx/room/processor/QueryMethodProcessorTest.kt
M room/compiler/src/test/kotlin/androidx/room/testing/TestProcessor.kt
da...@google.com <da...@google.com> #3
au...@google.com <au...@google.com> #4
Branch: androidx-master-dev
commit bdde5a1a970ddc9007b28de4aa29d60ffa588f08
Author: Yigit Boyar <yboyar@google.com>
Date: Thu Apr 16 16:47:05 2020
Re-factor how errors are dismissed when query is re-written
This CL changes how we handle errors/warnings if query is
re-written.
There was a bug in expandProjection where we would report warnings
for things that Room already fixes automatically (
The solution to that problem (I7659002e5e0d1ef60fc1af2a625c0c36da0664d8)
solved it by deferring validating of columns until after re-write
decision is made. Unfortunately, this required changing PojoRowAdapter
to have a dummy mapping until it is validating, make it hard to use
as it does have a non-null mapping which is not useful.
This CL partially reverts that change and instead rely on the log
deferring logic we have in Context. This way, we don't need to break
the stability of PojoRowAdapter while still having the ability to
drop warnings that room fixes. This will also play nicer when we
have different query re-writing options that can use more information
about the query results.
Bug: 153387066
Bug: 140759491
Test: existing tests pass
Change-Id: I2ec967c763d33d7a3ff02c1a13c6953b460d1e5f
M room/compiler/src/main/kotlin/androidx/room/log/RLog.kt
M room/compiler/src/main/kotlin/androidx/room/processor/QueryMethodProcessor.kt
M room/compiler/src/main/kotlin/androidx/room/solver/TypeAdapterStore.kt
M room/compiler/src/main/kotlin/androidx/room/solver/query/result/PojoRowAdapter.kt
da...@google.com <da...@google.com> #5
I've uploaded a sample project, to repro run: ./gradlew test
It is a simple Kotlin JVM project, it only uses plugins { kotlin("jvm") version "2.1.10" }
I was also able confirm that without AGP KMP (
da...@google.com <da...@google.com> #6
Looking at the Gradle metadata diff ("org.gradle.libraryelements": "jar"
? Should that be an aar
instead?
`
hm...@google.com <hm...@google.com> #7
yes, androidApiElements/runtimeElements variant publications should have aar value on the libraryelements attribute. What version of Gradle, AGP, KGP are you using in your library?
What's bizarre is that the compileClasspath is using the jvm vairant (in the test project you shared), it's only at runtime that it resolves the -android artifact of your library...
hm...@google.com <hm...@google.com> #8
It's very confusing, though why the android variant is chosen.
./gradlew dependencyInsight --configuration runtimeClasspath --dependency androidx.sqlite:sqlite:2.5.0-beta01
> Task :dependencyInsight
androidx.sqlite:sqlite:2.5.0-beta01
Variant androidRuntimeElements-published:
| Attribute Name | Provided | Requested |
|------------------------------------|--------------|--------------|
| org.gradle.status | release | |
| org.gradle.category | library | library |
| org.gradle.jvm.environment | android | standard-jvm |
| org.gradle.libraryelements | jar | jar |
| org.gradle.usage | java-runtime | java-runtime |
| org.jetbrains.kotlin.platform.type | jvm | jvm |
| org.gradle.dependency.bundling | | external |
| org.gradle.jvm.version | | 21 |
org.gradle.jvm.environment=standard-jvm is obviously requested and it doesn't match with the provided value for android. Looking at the jvmRuntimeElements from the diff you supplied of the gradle meta file, we see
{
"name": "jvmRuntimeElements-published",
"attributes": {
"org.gradle.category": "library",
"org.gradle.jvm.environment": "standard-jvm",
"org.gradle.usage": "java-runtime",
"org.jetbrains.kotlin.platform.type": "jvm"
},
"available-at": {
"url": "../../sqlite-jvm/2.5.0-beta01/sqlite-jvm-2.5.0-beta01.module",
"group": "androidx.sqlite",
"module": "sqlite-jvm",
"version": "2.5.0-beta01"
}
}
So every attribute in the jvmRuntimeElements matches the requested ones.
hm...@google.com <hm...@google.com> #9
Oh,i missed the libraryelements one from the list. Looks like jvmRuntimeElements does not publish that attribute and the android one does (and it's a wrong one as mentioned before). So it looks like that could the reason for the wrong variant resolution.
da...@google.com <da...@google.com> #10
The library is from androidx, we are using
I did also notice the compile classpath is fine, after all it compiles correctly and the APIs do resolve in the IDE, but at runtime it fails.
da...@google.com <da...@google.com> #11
So far we have found that from alpha12 (good version) to alpha13 (bad version) of androidx.sqlite, one change that affected the metadata was the upgrade from Gradle 8.11.1 to 8.12, this is a diff of the metadata:
Notice the removal of the org.gradle.libraryelements
attribute. The attribute is also missing with Gradle 8.13-rc1
ow...@google.com <ow...@google.com>
hm...@google.com <hm...@google.com> #12
Update on libraryelements attribute missing in jvm target publications with Gradle 8.12 - Jetbrain are saying it will be fixed after
By the way I have noticed a weird behaviour - if you do ./gradlew publish in your project libraryelements is not there for jvm publications but if you do ./gradlew publishJvmPublicationToMavenRepository it's there
Daniel, Owen, let me know if this is enough info to proceed further with a fix.
hm...@google.com <hm...@google.com> #13
For the issue of the android publications where "org.gradle.libraryelements" = "jar" instead of "aar" - that was fixed in AGP 8.10 canary 7. Please feel free to try it out and report back. Thank you
da...@google.com <da...@google.com>
au...@google.com <au...@google.com> #14
FYI danysantiago@ we have upgraded to 8.10.0-alpha07 in androidx.
Description
Applying the newer AGP KMP plugin to androidx.sqlite breaks the Gradle metadata such that a JVM project depending on the artifact will attempt (and fail) to use the android artifact instead of the JVM one.
This was originally reported in SQLite KMP b/396148592
Here is a diff on the metadata, left is before AGP KMP is used (i.e. after reverting the changes in this CL ) and right is with AGP KMP applied: https://diff.googleplex.com/#key=EY2FqaJWQbUQ
Let me know if you need a sample project, but if you create a new JVM or Kotlin project and depend on
androidx.sqlite:sqlite:2.5.0-beta01
and try to use classes from it, it will fail at runtime with a class not found exception. When inspecting the deps via:dependencies
you will notice it attempts to use the-android
artifact instead of the-jvm
one: