Status Update
Comments
an...@gmail.com <an...@gmail.com> #2
Branch: androidx-master-dev
commit 8739fcde521e3f7f92111b7424ab924fb22eed16
Author: rohitsat13 <rohitsat@google.com>
Date: Fri Nov 20 10:29:57 2020
RxDataStore.kt, the RxJava wrapper for the core API.
Future cls: 1) RxDataBuilder 2) RxDataMigration
Test: RxDataStoreTest.java
Relnote: There is now a RxJava Wrapper for the core DataStore API. Future updates will include a Builder and RxDataMigrations.
Bug: 170311106
Change-Id: I3e7e099488035cca906b5f6e6de0a387acb5b964
A datastore/datastore-rxjava2/api/current.txt
A datastore/datastore-rxjava2/api/public_plus_experimental_current.txt
A datastore/datastore-rxjava2/api/res-current.txt
A datastore/datastore-rxjava2/api/restricted_current.txt
A datastore/datastore-rxjava2/build.gradle
A datastore/datastore-rxjava2/src/main/AndroidManifest.xml
A datastore/datastore-rxjava2/src/main/java/androidx/datastore/rxjava2/RxDataStore.kt
A datastore/datastore-rxjava2/src/test-common/java/androidx/datastore/rxjava2/TestingSerializer.kt
A datastore/datastore-rxjava2/src/test/java/androidx/datastore/rxjava2/RxDataStoreTest.java
M docs-tip-of-tree/build.gradle
M settings.gradle
ra...@google.com <ra...@google.com>
[Deleted User] <[Deleted User]> #3
Branch: androidx-master-dev
commit a65952abc062e0b8cde3b291cde64c804b70701c
Author: rohitsat13 <rohitsat@google.com>
Date: Fri Nov 20 10:39:49 2020
RxDataStoreBuilder.kt to make constructing DataStores from java easier.
Relnote: Added a builder to make constructing Datastores from java easier.
Test: RxDataStoreBuilderTest
Bug: 170311106
Change-Id: Id2b5a4fdcd166cab45aea92db6e76f9e7814e24f
M datastore/datastore-rxjava2/api/current.txt
M datastore/datastore-rxjava2/api/public_plus_experimental_current.txt
M datastore/datastore-rxjava2/api/restricted_current.txt
A datastore/datastore-rxjava2/src/androidTest/java/androidx/datastore/rxjava2/AssertThrows.kt
A datastore/datastore-rxjava2/src/androidTest/java/androidx/datastore/rxjava2/RxDataStoreBuilderTest.java
A datastore/datastore-rxjava2/src/main/java/androidx/datastore/rxjava2/RxDataStoreBuilder.kt
gh...@google.com <gh...@google.com> #4
Branch: androidx-master-dev
commit 0e34cf4861bfffcd328a07d59fdeb78f7211019c
Author: rohitsat13 <rohitsat@google.com>
Date: Mon Nov 30 14:06:48 2020
Modify RxDataStoreBuilder constructors to accept required params.
Test: Modified existing tests.
Bug: 170311106
Relnote: N/A
Change-Id: I7f4190dec2f4f62500818c97f2beb55034774c35
M datastore/datastore-rxjava2/api/current.txt
M datastore/datastore-rxjava2/api/public_plus_experimental_current.txt
M datastore/datastore-rxjava2/api/restricted_current.txt
M datastore/datastore-rxjava2/src/androidTest/java/androidx/datastore/rxjava2/RxDataStoreBuilderTest.java
M datastore/datastore-rxjava2/src/main/java/androidx/datastore/rxjava2/RxDataStoreBuilder.kt
an...@gmail.com <an...@gmail.com> #5
Branch: androidx-master-dev
commit aba42ee317b69068fb6da49575dca03671ec547f
Author: rohitsat13 <rohitsat@google.com>
Date: Fri Nov 20 10:40:14 2020
RxDataMigration and RxSharedPreferencesMigration.
Add a wrapper for the RxDataMigration interface so that people can define migrations using RxJava
Relnote: """Added support for migrations written using RxJava with the RxDataMigration interface. The RxDataMigration interface is like the DataMigration interface, except using reactivex.Single's instead of suspend functions. You can implement this interface to define a custom migration.
This change also adds support for SharedPreferencesMigrationBuilder which allows easier construction of SharedPreferencesMigrations from java.
"""
Test: RxSharedPreferencesMigrationTest.kt
Bug: 170311106
Change-Id: If929664956cd1434eee5178432958b58722cd76c
M datastore/datastore-rxjava2/api/current.txt
M datastore/datastore-rxjava2/api/public_plus_experimental_current.txt
M datastore/datastore-rxjava2/api/restricted_current.txt
M datastore/datastore-rxjava2/build.gradle
M datastore/datastore-rxjava2/src/androidTest/java/androidx/datastore/rxjava2/RxDataStoreBuilderTest.java
A datastore/datastore-rxjava2/src/androidTest/java/androidx/datastore/rxjava2/RxSharedPreferencesMigrationTest.java
A datastore/datastore-rxjava2/src/main/java/androidx/datastore/rxjava2/RxDataMigration.java
M datastore/datastore-rxjava2/src/main/java/androidx/datastore/rxjava2/RxDataStoreBuilder.kt
A datastore/datastore-rxjava2/src/main/java/androidx/datastore/rxjava2/RxSharedPreferencesMigration.kt
M testutils/testutils-truth/src/main/java/androidx/testutils/assertions.kt
A testutils/testutils-truth/src/test/java/androidx/testutils/AssertionsTest.kt
tn...@google.com <tn...@google.com> #6
Branch: androidx-master-dev
commit 842f0818490cd3f31806c13bd2c0db681ac67e46
Author: rohitsat13 <rohitsat@google.com>
Date: Fri Dec 11 11:30:24 2020
Split preferencesKey<T> into individual types, e.g. intPreferencesKey, longPreferencesKey, etc.
Test: PreferencesFromJavaTest
Relnote: """ The preferencesKey<T>(name: String): Key<T> method has been removed and replaced with methods specific to each supported type, for example preferencesKey<Int>("int") is now preferencesIntKey("int") """
Bug: 170311106
Change-Id: Ibcfac9cca7c8a3dbf2eaae17bdb8c22a8ce5a9f7
M datastore/datastore-preferences-core/api/current.txt
M datastore/datastore-preferences-core/api/public_plus_experimental_current.txt
M datastore/datastore-preferences-core/api/restricted_current.txt
M datastore/datastore-preferences-core/src/main/java/androidx/datastore/preferences/core/Preferences.kt
A datastore/datastore-preferences-core/src/main/java/androidx/datastore/preferences/core/PreferencesFactory.kt
A datastore/datastore-preferences-core/src/main/java/androidx/datastore/preferences/core/PreferencesKeys.kt
M datastore/datastore-preferences-core/src/main/java/androidx/datastore/preferences/core/PreferencesSerializer.kt
M datastore/datastore-preferences-core/src/test/java/androidx/datastore/preferences/core/PreferenceDataStoreFactoryTest.kt
A datastore/datastore-preferences-core/src/test/java/androidx/datastore/preferences/core/PreferencesFromJavaTest.java
M datastore/datastore-preferences-core/src/test/java/androidx/datastore/preferences/core/PreferencesSerializerTest.kt
M datastore/datastore-preferences-core/src/test/java/androidx/datastore/preferences/core/PreferencesTest.kt
M datastore/datastore-preferences/src/androidTest/java/androidx/datastore/preferences/PreferenceDataStoreFactoryTest.kt
M datastore/datastore-preferences/src/androidTest/java/androidx/datastore/preferences/SharedPreferencesToPreferencesTest.kt
M datastore/datastore-preferences/src/main/java/androidx/datastore/preferences/SharedPreferencesMigration.kt
M datastore/datastore-sampleapp/src/main/java/com/example/datastoresampleapp/PreferencesDataStoreActivity.kt
an...@gmail.com <an...@gmail.com> #7
Branch: androidx-main
commit 431cd63a24c2b35a543f5b6fda6ec5e088d06b3c
Author: rohitsat13 <rohitsat@google.com>
Date: Mon Dec 21 11:42:56 2020
Added datastore-rxjava3 and datastore-preferences-rxjava3.
I just copied the rxjava2 modules and replaced the imports with rxjava3 imports.
Test: Copied over tests from rxjava2 modules.
Relnote: This change adds the datastore-preferences-rxjava2 and datastore-preferences-rxjava3 modules
Bug: 170311106
Change-Id: If253fe05877f22b956cda2e2be27387ae76c9b33
A datastore/datastore-preferences-rxjava3/api/current.txt
A datastore/datastore-preferences-rxjava3/api/public_plus_experimental_current.txt
A datastore/datastore-preferences-rxjava3/api/res-current.txt
A datastore/datastore-preferences-rxjava3/api/restricted_current.txt
A datastore/datastore-preferences-rxjava3/build.gradle
A datastore/datastore-preferences-rxjava3/src/androidTest/java/androidx/datastore/preferences/rxjava3/RxPreferencesDataStoreBuilderTest.java
A datastore/datastore-preferences-rxjava3/src/main/AndroidManifest.xml
A datastore/datastore-preferences-rxjava3/src/main/java/androidx/datastore/preferences/rxjava3/RxPreferenceDataStoreBuilder.kt
A datastore/datastore-rxjava3/api/current.txt
A datastore/datastore-rxjava3/api/public_plus_experimental_current.txt
A datastore/datastore-rxjava3/api/res-current.txt
A datastore/datastore-rxjava3/api/restricted_current.txt
A datastore/datastore-rxjava3/build.gradle
A datastore/datastore-rxjava3/src/androidTest/AndroidManifest.xml
A datastore/datastore-rxjava3/src/androidTest/java/androidx/datastore/rxjava3/RxDataStoreBuilderTest.java
A datastore/datastore-rxjava3/src/androidTest/java/androidx/datastore/rxjava3/RxSharedPreferencesMigrationTest.java
A datastore/datastore-rxjava3/src/main/AndroidManifest.xml
A datastore/datastore-rxjava3/src/main/java/androidx/datastore/rxjava3/RxDataMigration.java
A datastore/datastore-rxjava3/src/main/java/androidx/datastore/rxjava3/RxDataStore.kt
A datastore/datastore-rxjava3/src/main/java/androidx/datastore/rxjava3/RxDataStoreBuilder.kt
A datastore/datastore-rxjava3/src/main/java/androidx/datastore/rxjava3/RxSharedPreferencesMigration.kt
A datastore/datastore-rxjava3/src/test-common/java/androidx/datastore/rxjava3/TestingSerializer.kt
A datastore/datastore-rxjava3/src/test/java/androidx/datastore/rxjava3/RxDataStoreTest.java
M settings.gradle
an...@gmail.com <an...@gmail.com> #8
Branch: androidx-main
commit 4767533679a08261b7f5db398ea9b8cab13f4257
Author: rohitsat13 <rohitsat@google.com>
Date: Mon Nov 23 15:53:12 2020
Add datastore-preferences-rxjava2 module so people can build and use Preferences DataStore from java.
Test: Added tests for builder and RxPreferences
RelNote: Added RxPreferences so people can create Preferences keys from java and added RxPreferenceDataStoreBuilder so people can easily construct DataStore<Preferences>.
Bug: 170311106
Change-Id: I6b46555d67bf6bb61800b3fad0a7c27b72183ade
A datastore/datastore-preferences-rxjava2/api/current.txt
A datastore/datastore-preferences-rxjava2/api/public_plus_experimental_current.txt
A datastore/datastore-preferences-rxjava2/api/res-current.txt
A datastore/datastore-preferences-rxjava2/api/restricted_current.txt
A datastore/datastore-preferences-rxjava2/build.gradle
A datastore/datastore-preferences-rxjava2/src/androidTest/java/androidx/datastore/preferences/rxjava2/RxPreferencesDataStoreBuilderTest.java
A datastore/datastore-preferences-rxjava2/src/main/AndroidManifest.xml
A datastore/datastore-preferences-rxjava2/src/main/java/androidx/datastore/preferences/rxjava2/RxPreferenceDataStoreBuilder.kt
D datastore/datastore-rxjava2/src/androidTest/java/androidx/datastore/rxjava2/AssertThrows.kt
M settings.gradle
wo...@gmail.com <wo...@gmail.com> #10
could you clarify exactly what you mean in these?
have a custom lint rule using lintChecks on your app module have a custom lint rule using lintChecks on your library module
By this I mean a declaration in your modules dependency block:
lintChecks project(":features:language_lint")
di...@gmail.com <di...@gmail.com> #11
As opposed to lintPublish
? Or is that not relevant?
wo...@gmail.com <wo...@gmail.com> #12
For me this is for local checks so I'm using lintChecks. Removing lintChecks from the library module and only applying it on the app module fixed the lint crash. However that's not optimal as I want to run the lint checks individually on the library module as well. It would not be interesting if this is really the cause of the issue or if it doesn't fix it for others.
[Deleted User] <[Deleted User]> #13
I do not have any custom lint checks declared but there might be a transient lint check pulled in.
[Deleted User] <[Deleted User]> #14
We have checkDependencies=true
on our app module and apply there custom lint checks. Disabling custom lint checks has not solved the issue, though we have more custom lint checks via external dependencies (for example, timber).
an...@gmail.com <an...@gmail.com> #15
#14, could you check with checkDependencies=false
? It fixes problem on my project. Would be nice to hear more proves.
[Deleted User] <[Deleted User]> #16
#15, I've set checkDependencies = false
, but left our custom lint checks enabled. So far lint finished successfully without issue errors.
an...@gmail.com <an...@gmail.com> #17
In my case, all builds of the >50 were a success after checkDependencies = false
. However, disabling checkDependencies
is not a solution as well. Since all our code is split in small logical modules, there is no point in lint. Too many false-positives and true-negatives.
gh...@google.com <gh...@google.com> #18
I cherry-picked a change to 4.1 Beta 4 which essentially changes this error into a logged warning rather than a hard failure. That does not "fix" the problem, but it at least gets us back to the behavior of 3.6. Can someone confirm that this workaround has worked for them?
Also, I think I know what the root cause is (see notes below). However, it's hard to be sure without a repro scenario. Would anyone be willing to share an open-source project that reproduces this bug? (You can also send the project to
Notes:
-
My current theory is that this bug is related to
.https://issuetracker.google.com/159733104#comment6
I.e., I think Lint should not be reusing the same Kotlin compiler environment to analyze multiple modules, which is what we do whencheckDependencies=true
. -
It is still strange that the failure is nondeterministic. However, one potential reason is that the Kotlin compiler caches many things via
SoftReference
.
an...@gmail.com <an...@gmail.com> #19
Sorry for my long delay. I was tried with 4.1.0-beta05
(newest version to date), and the problem is still here. I added new log in case lines were changed.
Would anyone be willing to share an open-source project that reproduces this bug?
I have only closed source project with this problem. Maybe someone knows some quite large multimodule opensource project I could try setup AGP with lint and try reproduction?
an...@gmail.com <an...@gmail.com> #20
I tried to reproduce with two small multimodule projects, but all builds works flawlessly. Also, I tried to reproduce using checkDependencies
, and 6 other helper modules. 145k CLOC without tests. I suppose there is a good chance problem happen due to the cache.
It is still strange that the failure is nondeterministic.
It is even non-deterministic in CI/docker builds using the same fresh environment and exactly the same code each time. Build cache and daemon is disabled there. Multithreading should be involved as well.
In addition, I found in most cases failed due to the same file
br...@google.com <br...@google.com> #21
gh...@google.com <gh...@google.com> #22
There are some architectural changes coming in Lint that will fix this properly, but they will not make it into 4.2.
However, there is another workaround you can try that will be available starting in AGP 4.2 Beta 4.
Essentially you can tell Lint to "reset" the Kotlin compiler between each module analysis, thereby clearing all caches. I did not make this the default behavior because the effect on performance is unknown/risky.
To enable this behavior, either set the environment variable LINT_DO_NOT_REUSE_UAST_ENV
to "true", or set the JVM system property lint.do.not.reuse.uast.env
to "true". For example, you can do this from the command line:
./gradlew -Dlint.do.not.reuse.uast.env=true :app:lintDebug
Or by putting this in your gradle.properties
file:
systemProp.lint.do.not.reuse.uast.env=true
gh...@google.com <gh...@google.com> #23
Status updates:
-
I'm still hoping someone can confirm whether the workaround in
worked for them in AGP 4.2.comment#22 -
Starting with AGP 7.0-alpha13 the root cause of this issue should be fixed completely due to the new "partial analysis" mode (enabled by default) in which Lint analyzes modules independently and merges results along the way. It fixes the issue because Lint will no longer use the same Kotlin compiler environment to analyze multiple modules (and so the risk of stale caches is gone).
ws...@gmail.com <ws...@gmail.com> #24
I'm still hoping someone can confirm whether the workaround in
worked for them in AGP 4.2. comment#22
This unfortunately did not work for us. We actually see lint crashes after enabling via systemProp.lint.do.not.reuse.uast.env=true
. See the attached log. It's also much slower, as expected.
AGP 4.2 seems to make this error much more frequent compared to 4.1, for some reason.
gh...@google.com <gh...@google.com> #25
Can you file a new bug? You can add a comment here linking to it.
ws...@gmail.com <ws...@gmail.com> #26
Sure. Without that workaround, we get the same
ERROR: package fragment is not found for module:<lint-module> is a module[ModuleDescriptorImpl@5e5e6c61] file:KtFile: LiveViewerViewData.kt
error in this ticket occasionally (1-2% of the time?).
gh...@google.com <gh...@google.com> #27
Oh, I misunderstood. So, using lint.do.not.reuse.uast.env
is what causes the new crash? That is unfortunate, and I will investigate. Let me know if there is a sample project you can share that reproduces the issue.
ws...@gmail.com <ws...@gmail.com> #28
Not sure if you still wanted the new bug, but here it is:
gh...@google.com <gh...@google.com> #29
FYI the issue in
And to confirm, lint.do.not.reuse.uast.env
should no longer be needed at all in AGP 7.0+.
ku...@gmail.com <ku...@gmail.com> #30
Thanks #29 . I am noticing that when this happens, after the error log for
package fragment is not found for module:<lintWithKotlin> is a module
There is another error
java.lang.IllegalArgumentException: Argument for @NotNull parameter 'descriptor' of org/jetbrains/kotlin/codegen/context/CodegenContext.intoPackagePart must not be null
at org.jetbrains.kotlin.codegen.context.CodegenContext.$$$reportNull$$$0(CodegenContext.java)
at org.jetbrains.kotlin.codegen.context.CodegenContext.intoPackagePart(CodegenContext.java)
at org.jetbrains.kotlin.asJava.builder.LightClassDataProviderForClassOrObject$computeLightClassData$1$1.invoke(LightClassDataProvider.kt:51)
at org.jetbrains.kotlin.asJava.builder.LightClassDataProviderForClassOrObject$computeLightClassData$1$1.invoke(LightClassDataProvider.kt:38)
at org.jetbrains.kotlin.asJava.builder.LightClassBuilderKt.buildLightClass(LightClassBuilder.kt:64)
at org.jetbrains.kotlin.asJava.builder.LightClassDataProviderForClassOrObject$computeLightClassData$1.invoke(LightClassDataProvider.kt:47)
at org.jetbrains.kotlin.asJava.builder.LightClassDataProviderForClassOrObject$computeLightClassData$1.invoke(LightClassDataProvider.kt:38)
at org.jetbrains.kotlin.cli.jvm.compiler.CliLightClassGenerationSupport.createDataHolderForClass(CliLightClassGenerationSupport.kt:64)
at org.jetbrains.kotlin.asJava.builder.LightClassDataProviderForClassOrObject.computeLightClassData(LightClassDataProvider.kt:45)
at org.jetbrains.kotlin.asJava.builder.LightClassDataProviderForClassOrObject.compute(LightClassDataProvider.kt:61)
at com.intellij.psi.impl.PsiCachedValueImpl.doCompute(PsiCachedValueImpl.java:54)
at com.intellij.util.CachedValueBase.lambda$getValueWithLock$1(CachedValueBase.java:235)
at com.intellij.openapi.util.RecursionManager$1.doPreventingRecursion(RecursionManager.java:113)
at com.intellij.openapi.util.RecursionManager.doPreventingRecursion(RecursionManager.java:72)
at com.intellij.util.CachedValueBase.getValueWithLock(CachedValueBase.java:236)
at com.intellij.psi.impl.PsiCachedValueImpl.getValue(PsiCachedValueImpl.java:43)
at
Does the fix address both of these?
gh...@google.com <gh...@google.com> #31
package fragment is not found
and Argument for @NotNull parameter...
), the workaround in 4.2 is to put
systemProp.lint.do.not.reuse.uast.env=true
in your gradle.properties
file as described in
gh...@google.com <gh...@google.com> #32
Marking fixed in AGP 7.0.
That is, the lint.do.not.reuse.uast.env
workaround should no longer be needed in AGP 7.0+. And, you should no longer see the following warnings/errors while running Lint:
ERROR: package fragment is not found for module:<lintWithKotlin>...
ERROR: Could not generate LightClass for...
java.lang.IllegalArgumentException: Argument for @NotNull parameter 'descriptor' of org/jetbrains/kotlin/codegen/context/CodegenContext.intoPackagePart must not be null
The issue is fixed due to the new "Lint partial analysis" mode (enabled by default) which creates a standalone UastEnvironment
instance for each module, thereby avoiding stale caches in the Kotlin compiler frontend.
Please comment on the bug if you see any similar errors in AGP 7.0+.
Description
AGP: 4.0.0 Kotlin: 1.3.72 JVM: from docker image: 8u252-jdk-slim
Failure happens in CI builds, which always are clean. Failures are random. Sometimes builds are a success, but more often it is not. Each time random classes failed. For example, in this case, failed this little data class:
I included full stacktrace as file