Status Update
Comments
se...@google.com <se...@google.com> #2
For Kotlin 2.0 and KSP 2.0 the Cannot change attributes of configuration ':composeApp:debugFrameworkIosX64' after it has been locked for mutation
really seems like a KSP issue. You should file a bug in their repository with a sample app if possible.
If you downgrade to Kotlin 1.9 then things 'should' work, there are example apps out there with such configuration, like the following one:
ya...@google.com <ya...@google.com> #3
Will try to use the example provided by you to check if it fixes the issue.
ya...@google.com <ya...@google.com> #4
Note that this issue happens when applying the Compose, KSP and Room Plugin together in Kotlin 2.0.x, the workaround for now is to not use the Room Gradle Plugin and instead specify the schema location vis KSP arguments:
// In the build.gradle
ksp {
arg("room.schemaLocation", "${projectDir}/schemas")
}
yb...@google.com <yb...@google.com> #5
Hi, I encountered a similar problem and was able to resolve it by updating the dependencies
room = "2.7.0-alpha08"
ksp = "2.0.20-1.0.25"
compose-plugin = "1.6.11"
kotlin = "2.0.20"
ya...@google.com <ya...@google.com> #6
ap...@google.com <ap...@google.com> #7
Branch: androidx-master-dev
commit 4f917f20e63afc653a6092ad87cfbb10bcc1552c
Author: Yuichi Araki <yaraki@google.com>
Date: Tue Nov 13 17:19:00 2018
Support column default value
Adds a new method @ColumnInfo#defaultValue() to allow declaring the
schema default value of a column. The method allows for SQL literal
values and expressions. Room will also interpret the default value as
a string literal (surrounding it with single quotess) when the affinity
of the column in TEXT.
Bug: 64088772
Test: FieldProcessorTest, DefaultValueTest
Change-Id: I4219eaec34deae618c1b119287fd949a18315936
M room/common/api/2.2.0-alpha01.ignore
M room/common/api/2.2.0-alpha01.txt
M room/common/api/current.txt
M room/common/src/main/java/androidx/room/ColumnInfo.java
M room/compiler/src/main/kotlin/androidx/room/processor/FieldProcessor.kt
M room/compiler/src/main/kotlin/androidx/room/processor/ProcessorErrors.kt
M room/compiler/src/main/kotlin/androidx/room/verifier/DatabaseVerifier.kt
M room/compiler/src/main/kotlin/androidx/room/vo/Field.kt
M room/compiler/src/main/kotlin/androidx/room/writer/TableInfoValidationWriter.kt
M room/compiler/src/main/kotlin/androidx/room/writer/ValidationWriter.kt
M room/compiler/src/test/data/databasewriter/output/ComplexDatabase.java
M room/compiler/src/test/kotlin/androidx/room/processor/FieldProcessorTest.kt
M room/compiler/src/test/kotlin/androidx/room/verifier/DatabaseVerifierTest.kt
M room/integration-tests/incremental-annotation-processing/build.gradle
A room/integration-tests/testapp/schemas/androidx.room.integration.testapp.migration.MigrationDb/9.json
M room/integration-tests/testapp/src/androidTest/java/androidx/room/integration/testapp/migration/JournalDbPostMigrationTest.java
M room/integration-tests/testapp/src/androidTest/java/androidx/room/integration/testapp/migration/MigrationDb.java
M room/integration-tests/testapp/src/androidTest/java/androidx/room/integration/testapp/migration/MigrationTest.java
A room/integration-tests/testapp/src/androidTest/java/androidx/room/integration/testapp/test/DefaultValueTest.java
M room/migration/api/restricted_2.2.0-alpha01.txt
M room/migration/api/restricted_current.txt
M room/migration/src/main/java/androidx/room/migration/bundle/FieldBundle.java
M room/migration/src/test/java/androidx/room/migration/bundle/DatabaseBundleTest.java
M room/migration/src/test/java/androidx/room/migration/bundle/EntityBundleTest.java
M room/migration/src/test/java/androidx/room/migration/bundle/FieldBundleTest.java
M room/runtime/api/restricted_2.2.0-alpha01.txt
M room/runtime/api/restricted_current.txt
M room/runtime/src/androidTest/java/androidx/room/migration/TableInfoTest.java
M room/runtime/src/main/java/androidx/room/util/TableInfo.java
M room/testing/src/main/java/androidx/room/testing/MigrationTestHelper.java
da...@google.com <da...@google.com>
ap...@google.com <ap...@google.com> #8
Branch: androidx-master-dev
commit 9ad96403444f1f199af41946e6548c5cfc834ce1
Author: Daniel Santiago Rivera <danysantiago@google.com>
Date: Wed Jun 26 13:55:46 2019
Conditionally use column default value in equality check.
Based on the constructor called, which can be used to distinguish
between old generated code vs new generated code, don't take into
consideration column default value in equality check. This makes it
so that compatibility is maintained with old generated code using new
runtime that haven't had the chance to migrate their unaccounted for
default value migrations.
Bug: 64088772
Test: Manual - App with Room 2.1.0 & WM 1.0.0-alpha11, then upgarde both
Room to 2.2.0-alpha01 and WM to 1.0.0. Forcing WM to run migration
with new runtime, observed no crash.
Change-Id: I6649c05d39dee2e7a03e46ff01310042ac2a61f2
M room/runtime/src/androidTest/java/androidx/room/migration/TableInfoTest.java
M room/runtime/src/main/java/androidx/room/util/TableInfo.java
ap...@google.com <ap...@google.com> #9
Branch: androidx-master-dev
commit 23e7e21de3f2438aa6d8676c371f2db8bd444495
Author: Daniel Santiago Rivera <danysantiago@google.com>
Date: Mon Jul 08 13:09:30 2019
Conditionally use column default value in equality check part 2.
Instead of using constructor to determine if default value should be
ignored on equality check, simply ignore it if the table info has
a null default value. In practice, this means don't validate database
read default values (those read using PRAGMA table_info) if the
generated code (and the entity class) does not define a default value.
This eases migration to Room 2.2.0 for those apps who had accidentally
added default values with migrations using 'ALTER TABLE x ADD COLUMN y
TEXT NOT NULL DEFAULT z'. It won't cause their incremental migration
test to suddenly start failing and it won't cause a runtime validation
crash with 2.2.0 generated code for users whose database was migrated vs
those who recently had a fresh install. Similarly for library users of
Room such as WorkManager, their generated code using the old constructor
will still create table info objects whose default value are null,
causing them to not be validated because they weren't originally defined
in the entity.
There is also little to no value in prohibiting a default value in the
schema that is not define in Room's entity. However, if a default value
is defined in the entity class, then Room will validate its presence and
content.
Bug: 64088772
Bug: 136019383
Test: MigrationTest & TableInfoTest
Change-Id: I1f3f34a2139b2505a2bf73b88f917252496df930
M room/compiler/src/main/kotlin/androidx/room/writer/TableInfoValidationWriter.kt
M room/compiler/src/test/data/databasewriter/output/ComplexDatabase.java
M room/integration-tests/testapp/schemas/androidx.room.integration.testapp.migration.MigrationDb/10.json
A room/integration-tests/testapp/schemas/androidx.room.integration.testapp.migration.MigrationDb/11.json
M room/integration-tests/testapp/schemas/androidx.room.integration.testapp.migration.MigrationDb/9.json
M room/integration-tests/testapp/src/androidTest/java/androidx/room/integration/testapp/migration/MigrationDb.java
M room/integration-tests/testapp/src/androidTest/java/androidx/room/integration/testapp/migration/MigrationTest.java
M room/runtime/api/restricted_2.2.0-alpha02.txt
M room/runtime/api/restricted_current.txt
M room/runtime/src/androidTest/java/androidx/room/migration/TableInfoTest.java
M room/runtime/src/main/java/androidx/room/util/TableInfo.java
M room/testing/src/main/java/androidx/room/testing/MigrationTestHelper.java
Description
Version used:
Devices/Android versions reproduced on:
- Sample project to trigger the issue.
- A screenrecord or screenshots showing the issue (if UI related).