Introduce CreationExtras
It also passes key associated with ViewModel
as an extra.
Metalava incorrectly says that this is a breaking change: b/188691010
Relnote: "ViewModelProvider.CreationExtras were introduced.
This API will simplify passing an additional information to ViewModelProvider.Factory"
bug: 188541057
Test: ViewModelProviderTest
Change-Id: Ia73439cb2282609a9a1eaebf8ba79b9cc93feb7c
diff --git a/lifecycle/lifecycle-viewmodel-compose/build.gradle b/lifecycle/lifecycle-viewmodel-compose/build.gradle
index d389e76..30a05a0 100644
--- a/lifecycle/lifecycle-viewmodel-compose/build.gradle
+++ b/lifecycle/lifecycle-viewmodel-compose/build.gradle
@@ -17,6 +17,7 @@
import androidx.build.LibraryGroups
import androidx.build.Publish
import androidx.build.RunApiTasks
+import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id("AndroidXPlugin")
@@ -53,3 +54,15 @@
description = "Compose integration with Lifecycle ViewModel"
runApiTasks = new RunApiTasks.Yes()
}
+
+// needed only while https://youtrack.jetbrains.com/issue/KT-47000 isn't resolved which is
+// targeted to 1.6
+if (project.hasProperty("androidx.useMaxDepVersions")){
+ tasks.withType(KotlinCompile).configureEach {
+ kotlinOptions {
+ freeCompilerArgs += [
+ "-Xjvm-default=enable",
+ ]
+ }
+ }
+}
\ No newline at end of file