Merge "Convert compose projects without cyclic dependencies to collections kmp structure" into androidx-main
diff --git a/compose/runtime/runtime-saveable/build.gradle b/compose/runtime/runtime-saveable/build.gradle
index b4d8073..d23376d 100644
--- a/compose/runtime/runtime-saveable/build.gradle
+++ b/compose/runtime/runtime-saveable/build.gradle
@@ -15,9 +15,8 @@
*/
-import androidx.build.AndroidXComposePlugin
+import androidx.build.KmpPlatformsKt
import androidx.build.LibraryType
-import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id("AndroidXPlugin")
@@ -25,77 +24,54 @@
id("com.android.library")
}
-AndroidXComposePlugin.applyAndConfigureKotlinPlugin(project)
+def desktopEnabled = KmpPlatformsKt.enableDesktop(project)
-dependencies {
+androidXMultiplatform {
+ android()
+ if (desktopEnabled) desktop()
- if(!AndroidXComposePlugin.isMultiplatformEnabled(project)) {
- /* When updating dependencies, make sure to make the an an analogous update in the
- corresponding block below */
- api project(":compose:runtime:runtime")
- api "androidx.annotation:annotation:1.1.0"
-
- implementation(libs.kotlinStdlib)
-
- testImplementation(libs.junit)
- testImplementation(libs.truth)
- testImplementation(libs.testCore)
- testImplementation(libs.testRules)
-
- androidTestImplementation projectOrArtifact(':compose:ui:ui')
- androidTestImplementation projectOrArtifact(":compose:ui:ui-test-junit4")
- androidTestImplementation projectOrArtifact(":compose:test-utils")
- androidTestImplementation "androidx.fragment:fragment:1.3.0"
- androidTestImplementation projectOrArtifact(":activity:activity-compose")
- androidTestImplementation(libs.testUiautomator)
- androidTestImplementation(libs.testCore)
- androidTestImplementation(libs.testRules)
- androidTestImplementation(libs.testRunner)
- androidTestImplementation(libs.espressoCore)
- androidTestImplementation(libs.junit)
- androidTestImplementation(libs.truth)
- androidTestImplementation(libs.dexmakerMockito)
- androidTestImplementation(libs.mockitoCore)
-
- lintPublish(project(":compose:runtime:runtime-saveable-lint"))
-
- samples(projectOrArtifact(":compose:runtime:runtime-saveable:runtime-saveable-samples"))
- }
-}
-
-if(AndroidXComposePlugin.isMultiplatformEnabled(project)) {
- androidXComposeMultiplatform {
- android()
- desktop()
- }
-
- kotlin {
- /* When updating dependencies, make sure to make the an an analogous update in the
- corresponding block above */
- sourceSets {
- commonMain.dependencies {
+ sourceSets {
+ commonMain {
+ dependencies {
implementation(libs.kotlinStdlibCommon)
api project(":compose:runtime:runtime")
}
+ }
- androidMain.dependencies {
+ commonTest {
+ dependencies {
+ }
+ }
+
+ jvmMain {
+ dependencies {
+ }
+ }
+
+
+ androidMain {
+ dependsOn(jvmMain)
+ dependencies {
implementation(libs.kotlinStdlib)
api "androidx.annotation:annotation:1.1.0"
}
+ }
- // TODO(b/214407011): These dependencies leak into instrumented tests as well. If you
- // need to add Robolectric (which must be kept out of androidAndroidTest), use a top
- // level dependencies block instead:
- // `dependencies { testImplementation(libs.robolectric) }`
- androidTest.dependencies {
- implementation(libs.testRules)
- implementation(libs.testRunner)
- implementation(libs.junit)
- implementation(libs.truth)
+ if (desktopEnabled) {
+ desktopMain {
+ dependsOn(jvmMain)
}
+ }
- androidAndroidTest.dependencies {
+ jvmTest {
+ dependencies {
+ }
+ }
+
+ androidAndroidTest {
+ dependsOn(jvmTest)
+ dependencies {
implementation project(':compose:ui:ui')
implementation project(":compose:ui:ui-test-junit4")
implementation project(":compose:test-utils")
@@ -112,10 +88,32 @@
implementation(libs.mockitoCore)
}
}
+
+ // TODO(b/214407011): These dependencies leak into instrumented tests as well. If you
+ // need to add Robolectric (which must be kept out of androidAndroidTest), use a top
+ // level dependencies block instead:
+ // `dependencies { testImplementation(libs.robolectric) }`
+ androidTest {
+ dependsOn(jvmTest)
+ dependencies {
+ implementation(libs.testRules)
+ implementation(libs.testRunner)
+ implementation(libs.junit)
+ implementation(libs.truth)
+ }
+ }
+
+ if (desktopEnabled) {
+ desktopTest {
+ dependsOn(jvmTest)
+ }
+ }
}
- dependencies {
- samples(projectOrArtifact(":compose:runtime:runtime-saveable:runtime-saveable-samples"))
- }
+}
+
+dependencies {
+ samples(projectOrArtifact(":compose:runtime:runtime-saveable:runtime-saveable-samples"))
+ lintPublish(project(":compose:runtime:runtime-saveable-lint"))
}
androidx {
diff --git a/compose/test-utils/build.gradle b/compose/test-utils/build.gradle
index 5b5d26c..46eecc3 100644
--- a/compose/test-utils/build.gradle
+++ b/compose/test-utils/build.gradle
@@ -14,10 +14,8 @@
* limitations under the License.
*/
-import androidx.build.AndroidXComposePlugin
import androidx.build.LibraryType
import androidx.build.Publish
-import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id("AndroidXPlugin")
@@ -25,89 +23,93 @@
id("AndroidXComposePlugin")
}
-AndroidXComposePlugin.applyAndConfigureKotlinPlugin(project)
+def desktopEnabled = false // b/276387374 TODO: KmpPlatformsKt.enableDesktop(project)
-dependencies {
+androidXMultiplatform {
+ android()
+ if (desktopEnabled) desktop()
- if(!AndroidXComposePlugin.isMultiplatformEnabled(project)) {
- /*
- * When updating dependencies, make sure to make the an an analogous update in the
- * corresponding block below
- */
-
- api("androidx.activity:activity:1.2.0")
- api(projectOrArtifact(":compose:ui:ui-test-junit4"))
- api(project(":test:screenshot:screenshot"))
-
- implementation(libs.kotlinStdlibCommon)
- implementation(projectOrArtifact(":compose:runtime:runtime"))
- implementation(projectOrArtifact(":compose:ui:ui-unit"))
- implementation(projectOrArtifact(":compose:ui:ui-graphics"))
- implementation("androidx.activity:activity-compose:1.3.1")
- // old version of common-java8 conflicts with newer version, because both have
- // DefaultLifecycleEventObserver.
- // Outside of androidx this is resolved via constraint added to lifecycle-common,
- // but it doesn't work in androidx.
- // See aosp/1804059
- implementation("androidx.lifecycle:lifecycle-common-java8:2.5.1")
- implementation(libs.testCore)
- implementation(libs.testRules)
-
- // This has stub APIs for access to legacy Android APIs, so we don't want
- // any dependency on this module.
- compileOnly(projectOrArtifact(":compose:ui:ui-android-stubs"))
-
- testImplementation(libs.truth)
-
- androidTestImplementation(libs.truth)
- androidTestImplementation(projectOrArtifact(":compose:material:material"))
- }
-}
-
-if (AndroidXComposePlugin.isMultiplatformEnabled(project)) {
- androidXComposeMultiplatform {
- android()
- }
-
- kotlin {
- /*
- * When updating dependencies, make sure to make the an an analogous update in the
- * corresponding block above
- */
- sourceSets {
- commonMain.dependencies {
+ sourceSets {
+ commonMain {
+ dependencies {
implementation(libs.kotlinStdlibCommon)
implementation(projectOrArtifact(":compose:runtime:runtime"))
implementation(projectOrArtifact(":compose:ui:ui-unit"))
implementation(projectOrArtifact(":compose:ui:ui-graphics"))
implementation(projectOrArtifact(":compose:ui:ui-test-junit4"))
}
+ }
+ androidMain.dependencies {
+ api("androidx.activity:activity:1.2.0")
+ implementation "androidx.activity:activity-compose:1.3.1"
+ api(projectOrArtifact(":compose:ui:ui-test-junit4"))
+ api(project(":test:screenshot:screenshot"))
+ // This has stub APIs for access to legacy Android APIs, so we don't want
+ // any dependency on this module.
+ compileOnly(projectOrArtifact(":compose:ui:ui-android-stubs"))
+ implementation(libs.testCore)
+ implementation(libs.testRules)
+ }
- androidMain.dependencies {
- api("androidx.activity:activity:1.2.0")
- implementation "androidx.activity:activity-compose:1.3.1"
- api(projectOrArtifact(":compose:ui:ui-test-junit4"))
- api(project(":test:screenshot:screenshot"))
- // This has stub APIs for access to legacy Android APIs, so we don't want
- // any dependency on this module.
- compileOnly(projectOrArtifact(":compose:ui:ui-android-stubs"))
- implementation(libs.testCore)
- implementation(libs.testRules)
+ commonTest {
+ dependencies {
}
+ }
- // TODO(b/214407011): These dependencies leak into instrumented tests as well. If you
- // need to add Robolectric (which must be kept out of androidAndroidTest), use a top
- // level dependencies block instead:
- // `dependencies { testImplementation(libs.robolectric) }`
- androidTest.dependencies {
- implementation(libs.truth)
+ jvmMain {
+ dependsOn(commonMain)
+ dependencies {
}
+ }
- androidAndroidTest.dependencies {
+
+ androidMain {
+ dependsOn(jvmMain)
+ dependencies {
+ }
+ }
+
+ if (desktopEnabled) {
+ desktopMain {
+ dependsOn(jvmMain)
+ dependencies {
+ }
+ }
+ }
+
+ jvmTest {
+ dependsOn(commonTest)
+ dependencies {
+ }
+ }
+
+ androidAndroidTest {
+ dependsOn(jvmTest)
+ dependencies {
implementation(libs.truth)
implementation(projectOrArtifact(":compose:material:material"))
}
}
+
+ // TODO(b/214407011): These dependencies leak into instrumented tests as well. If you
+ // need to add Robolectric (which must be kept out of androidAndroidTest), use a top
+ // level dependencies block instead:
+ // `dependencies { testImplementation(libs.robolectric) }`
+ androidTest {
+ dependsOn(jvmTest)
+ dependencies {
+ implementation(libs.truth)
+ }
+ }
+
+ if (desktopEnabled) {
+ desktopTest {
+ dependsOn(jvmTest)
+ dependsOn(desktopMain)
+ dependencies {
+ }
+ }
+ }
}
}
diff --git a/compose/ui/ui-geometry/build.gradle b/compose/ui/ui-geometry/build.gradle
index 1a05daf..15e6e16 100644
--- a/compose/ui/ui-geometry/build.gradle
+++ b/compose/ui/ui-geometry/build.gradle
@@ -14,9 +14,8 @@
* limitations under the License.
*/
-import androidx.build.AndroidXComposePlugin
+import androidx.build.KmpPlatformsKt
import androidx.build.LibraryType
-import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id("AndroidXPlugin")
@@ -24,53 +23,69 @@
id("AndroidXComposePlugin")
}
-AndroidXComposePlugin.applyAndConfigureKotlinPlugin(project)
+def desktopEnabled = KmpPlatformsKt.enableDesktop(project)
-if(!AndroidXComposePlugin.isMultiplatformEnabled(project)) {
- dependencies {
- /*
- * When updating dependencies, make sure to make the an an analogous update in the
- * corresponding block below
- */
+androidXMultiplatform {
+ android()
+ if (desktopEnabled) desktop()
- api("androidx.annotation:annotation:1.1.0")
-
- implementation("androidx.compose.runtime:runtime:1.2.1")
- implementation(project(":compose:ui:ui-util"))
- implementation(libs.kotlinStdlib)
-
- testImplementation(libs.junit)
- testImplementation(libs.truth)
- testImplementation(libs.kotlinTest)
- }
-}
-
-if(AndroidXComposePlugin.isMultiplatformEnabled(project)) {
- androidXComposeMultiplatform {
- android()
- desktop()
- }
-
- kotlin {
- /*
- * When updating dependencies, make sure to make the an an analogous update in the
- * corresponding block above
- */
- sourceSets {
- commonMain.dependencies {
+ sourceSets {
+ commonMain {
+ dependencies {
implementation(libs.kotlinStdlibCommon)
- implementation(project(":compose:runtime:runtime"))
+ implementation("androidx.compose.runtime:runtime:1.2.1")
implementation(project(":compose:ui:ui-util"))
}
- jvmMain.dependencies {
+ }
+
+ commonTest {
+ dependencies {
+ implementation(kotlin("test-junit"))
+ }
+ }
+
+ jvmMain {
+ dependencies {
implementation(libs.kotlinStdlib)
}
- androidMain.dependencies {
+ }
+
+
+ androidMain {
+ dependsOn(jvmMain)
+ dependencies {
api("androidx.annotation:annotation:1.1.0")
}
- commonTest.dependencies {
- implementation(kotlin("test-junit"))
+ }
+
+ if (desktopEnabled) {
+ desktopMain {
+ dependsOn(jvmMain)
+ dependencies {
+ implementation(project(":compose:runtime:runtime"))
+ }
+ }
+ }
+
+ jvmTest {
+ dependencies {
+ }
+ }
+
+ androidAndroidTest {
+ dependsOn(jvmTest)
+ dependencies {
+ }
+ }
+
+ androidTest {
+ dependsOn(jvmTest)
+ }
+
+ if (desktopEnabled) {
+ desktopTest {
+ dependsOn(jvmTest)
}
}
}
diff --git a/compose/ui/ui-tooling-preview/build.gradle b/compose/ui/ui-tooling-preview/build.gradle
index a9f9236..d6d3a42 100644
--- a/compose/ui/ui-tooling-preview/build.gradle
+++ b/compose/ui/ui-tooling-preview/build.gradle
@@ -14,10 +14,8 @@
* limitations under the License.
*/
-
-import androidx.build.AndroidXComposePlugin
+import androidx.build.KmpPlatformsKt
import androidx.build.LibraryType
-import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id("AndroidXPlugin")
@@ -25,47 +23,91 @@
id("com.android.library")
}
-AndroidXComposePlugin.applyAndConfigureKotlinPlugin(project)
+def desktopEnabled = KmpPlatformsKt.enableDesktop(project)
-dependencies {
- if(!AndroidXComposePlugin.isMultiplatformEnabled(project)) {
- implementation(libs.kotlinStdlib)
- api("androidx.annotation:annotation:1.2.0")
- api("androidx.compose.runtime:runtime:1.2.1")
- testImplementation(libs.junit)
- }
-}
+androidXMultiplatform {
+ android()
+ if (desktopEnabled) desktop()
-if(AndroidXComposePlugin.isMultiplatformEnabled(project)) {
- androidXComposeMultiplatform {
- android()
- desktop()
- }
- kotlin {
- /*
- * When updating dependencies, make sure to make the an an analogous update in the
- * corresponding block above
- */
- sourceSets {
- commonMain.dependencies {
+ sourceSets {
+ commonMain {
+ dependencies {
implementation(libs.kotlinStdlibCommon)
api(project(":compose:runtime:runtime"))
}
+ }
- androidMain.dependencies {
+ commonTest {
+ dependencies {
+
+ }
+ }
+
+ jvmMain {
+ dependsOn(commonMain)
+ dependencies {
+ }
+ }
+
+ if (desktopEnabled) {
+ skikoMain {
+ dependsOn(commonMain)
+ dependencies {
+ api(project(":compose:runtime:runtime"))
+ }
+ }
+ }
+
+ androidMain {
+ dependsOn(jvmMain)
+ dependencies {
api("androidx.annotation:annotation:1.2.0")
}
+ }
- androidTest.dependencies {
+ if (desktopEnabled) {
+ desktopMain {
+ dependsOn(skikoMain)
+ dependsOn(jvmMain)
+ dependencies {
+
+ }
+ }
+ }
+
+ jvmTest {
+ dependsOn(commonTest)
+ dependencies {
+ }
+ }
+
+ androidAndroidTest {
+ dependsOn(jvmTest)
+ dependencies {
+ }
+ }
+
+ androidTest {
+ dependsOn(jvmTest)
+ dependencies {
implementation(libs.junit)
}
}
+
+ if (desktopEnabled) {
+ desktopTest {
+ dependsOn(jvmTest)
+ dependsOn(desktopMain)
+ dependencies {
+
+ }
+ }
+ }
}
}
-
androidx {
name = "Compose Tooling API"
type = LibraryType.PUBLISHED_LIBRARY
diff --git a/compose/ui/ui-unit/build.gradle b/compose/ui/ui-unit/build.gradle
index bfbfed7..627cd87 100644
--- a/compose/ui/ui-unit/build.gradle
+++ b/compose/ui/ui-unit/build.gradle
@@ -14,9 +14,8 @@
* limitations under the License.
*/
-import androidx.build.AndroidXComposePlugin
+import androidx.build.KmpPlatformsKt
import androidx.build.LibraryType
-import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id("AndroidXPlugin")
@@ -24,85 +23,88 @@
id("AndroidXComposePlugin")
}
-AndroidXComposePlugin.applyAndConfigureKotlinPlugin(project)
+def desktopEnabled = KmpPlatformsKt.enableDesktop(project)
-if(!AndroidXComposePlugin.isMultiplatformEnabled(project)) {
- dependencies {
- /*
- * When updating dependencies, make sure to make the an an analogous update in the
- * corresponding block below
- */
+androidXMultiplatform {
+ android()
+ if (desktopEnabled) desktop()
- api(project(":compose:ui:ui-geometry"))
- api("androidx.annotation:annotation:1.1.0")
-
- implementation(libs.kotlinStdlib)
- implementation("androidx.compose.runtime:runtime:1.2.1")
- implementation(project(":compose:ui:ui-util"))
-
- testImplementation(libs.junit)
- testImplementation(libs.truth)
-
- androidTestImplementation(libs.testRules)
- androidTestImplementation(libs.testRunner)
- androidTestImplementation(libs.testExtJunit)
- androidTestImplementation(libs.espressoCore)
- androidTestImplementation(libs.truth)
- androidTestImplementation(libs.kotlinTest)
-
- samples(projectOrArtifact(":compose:ui:ui-unit:ui-unit-samples"))
- }
-}
-
-if(AndroidXComposePlugin.isMultiplatformEnabled(project)) {
- androidXComposeMultiplatform {
- android()
- desktop()
- }
-
- kotlin {
-
- /*
- * When updating dependencies, make sure to make the an an analogous update in the
- * corresponding block above
- */
- sourceSets {
- commonMain.dependencies {
+ sourceSets {
+ commonMain {
+ dependencies {
implementation(libs.kotlinStdlibCommon)
api(project(":compose:ui:ui-geometry"))
implementation(project(":compose:runtime:runtime"))
implementation(project(":compose:ui:ui-util"))
}
- jvmMain.dependencies {
- implementation(libs.kotlinStdlib)
- }
- androidMain.dependencies {
- api("androidx.annotation:annotation:1.1.0")
- }
+ }
- commonTest.dependencies {
+ commonTest {
+ dependencies {
implementation(kotlin("test-junit"))
}
+ }
- // TODO(b/214407011): These dependencies leak into instrumented tests as well. If you
- // need to add Robolectric (which must be kept out of androidAndroidTest), use a top
- // level dependencies block instead:
- // `dependencies { testImplementation(libs.robolectric) }`
- androidTest.dependencies {
- implementation(libs.truth)
+ jvmMain {
+ dependencies {
+ implementation(libs.kotlinStdlib)
}
- androidAndroidTest.dependencies {
+ }
+
+
+ androidMain {
+ dependsOn(jvmMain)
+ dependencies {
+ api("androidx.annotation:annotation:1.1.0")
+ }
+ }
+
+ if (desktopEnabled) {
+ desktopMain {
+ dependsOn(jvmMain)
+ dependencies {
+ implementation(project(":compose:runtime:runtime"))
+ }
+ }
+ }
+
+ jvmTest {
+ dependencies {
+ }
+ }
+
+ androidAndroidTest {
+ dependsOn(jvmTest)
+ dependencies {
implementation(libs.testRules)
implementation(libs.testRunner)
implementation(libs.testExtJunit)
implementation(libs.espressoCore)
}
}
+
+ // TODO(b/214407011): These dependencies leak into instrumented tests as well. If you
+ // need to add Robolectric (which must be kept out of androidAndroidTest), use a top
+ // level dependencies block instead:
+ // `dependencies { testImplementation(libs.robolectric) }`
+ androidTest {
+ dependsOn(jvmTest)
+ dependencies {
+ implementation(libs.truth)
+ }
+ }
+
+ if (desktopEnabled) {
+ desktopTest {
+ dependsOn(jvmTest)
+ }
+ }
}
- dependencies {
- samples(projectOrArtifact(":compose:ui:ui-unit:ui-unit-samples"))
- }
+}
+
+dependencies {
+ samples(projectOrArtifact(":compose:ui:ui-unit:ui-unit-samples"))
}
androidx {
diff --git a/compose/ui/ui-util/build.gradle b/compose/ui/ui-util/build.gradle
index 8eeb75e..4c19723 100644
--- a/compose/ui/ui-util/build.gradle
+++ b/compose/ui/ui-util/build.gradle
@@ -14,9 +14,8 @@
* limitations under the License.
*/
-import androidx.build.AndroidXComposePlugin
+import androidx.build.KmpPlatformsKt
import androidx.build.LibraryType
-import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id("AndroidXPlugin")
@@ -24,59 +23,72 @@
id("AndroidXComposePlugin")
}
-AndroidXComposePlugin.applyAndConfigureKotlinPlugin(project)
+def desktopEnabled = KmpPlatformsKt.enableDesktop(project)
-if(!AndroidXComposePlugin.isMultiplatformEnabled(project)) {
- dependencies {
- /*
- * When updating dependencies, make sure to make the an an analogous update in the
- * corresponding block below
- */
+androidXMultiplatform {
+ android()
+ if (desktopEnabled) desktop()
- implementation(libs.kotlinStdlib)
-
- testImplementation(libs.junit)
- testImplementation(libs.truth)
- testImplementation(libs.kotlinTest)
- }
-}
-
-if(AndroidXComposePlugin.isMultiplatformEnabled(project)) {
- androidXComposeMultiplatform {
- android()
- desktop()
- }
-
- kotlin {
- /*
- * When updating dependencies, make sure to make the an an analogous update in the
- * corresponding block above
- */
- sourceSets {
- commonMain.dependencies {
+ sourceSets {
+ commonMain {
+ dependencies {
implementation(libs.kotlinStdlibCommon)
}
+ }
- jvmMain.dependencies {
- implementation(libs.kotlinStdlib)
- }
-
- androidMain.dependencies {
- implementation(libs.kotlinStdlib)
- }
-
- commonTest.dependencies {
+ commonTest {
+ dependencies {
implementation(kotlin("test-junit"))
}
+ }
- // TODO(b/214407011): These dependencies leak into instrumented tests as well. If you
- // need to add Robolectric (which must be kept out of androidAndroidTest), use a top
- // level dependencies block instead:
- // `dependencies { testImplementation(libs.robolectric) }`
- androidTest.dependencies {
+ jvmMain {
+ dependencies {
+ implementation(libs.kotlinStdlib)
+ }
+ }
+
+
+ androidMain {
+ dependsOn(jvmMain)
+ dependencies {
+ implementation(libs.kotlinStdlib)
+ }
+ }
+
+ if (desktopEnabled) {
+ desktopMain {
+ dependsOn(jvmMain)
+ }
+ }
+
+ jvmTest {
+ dependencies {
+ }
+ }
+
+ androidAndroidTest {
+ dependsOn(jvmTest)
+ dependencies {
+ }
+ }
+
+ // TODO(b/214407011): These dependencies leak into instrumented tests as well. If you
+ // need to add Robolectric (which must be kept out of androidAndroidTest), use a top
+ // level dependencies block instead:
+ // `dependencies { testImplementation(libs.robolectric) }`
+ androidTest {
+ dependsOn(jvmTest)
+ dependencies {
implementation(libs.truth)
}
}
+
+ if (desktopEnabled) {
+ desktopTest {
+ dependsOn(jvmTest)
+ }
+ }
}
}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/input/pointer/PointerInteropFilterTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/input/pointer/PointerInteropFilterTest.kt
index 32fd60c..f761c28 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/input/pointer/PointerInteropFilterTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/input/pointer/PointerInteropFilterTest.kt
@@ -4405,38 +4405,3 @@
)
internal typealias PointerEventHandler = (PointerEvent, PointerEventPass, IntSize) -> Unit
-
-private fun PointerEventHandler.invokeOverAllPasses(
- pointerEvent: PointerEvent,
- size: IntSize = IntSize(Int.MAX_VALUE, Int.MAX_VALUE)
-) {
- invokeOverPasses(
- pointerEvent,
- listOf(
- PointerEventPass.Initial,
- PointerEventPass.Main,
- PointerEventPass.Final
- ),
- size = size
- )
-}
-
-private fun PointerEventHandler.invokeOverPasses(
- pointerEvent: PointerEvent,
- vararg pointerEventPasses: PointerEventPass,
- size: IntSize = IntSize(Int.MAX_VALUE, Int.MAX_VALUE)
-) {
- invokeOverPasses(pointerEvent, pointerEventPasses.toList(), size)
-}
-
-private fun PointerEventHandler.invokeOverPasses(
- pointerEvent: PointerEvent,
- pointerEventPasses: List<PointerEventPass>,
- size: IntSize = IntSize(Int.MAX_VALUE, Int.MAX_VALUE)
-) {
- require(pointerEvent.changes.isNotEmpty())
- require(pointerEventPasses.isNotEmpty())
- pointerEventPasses.forEach {
- this.invoke(pointerEvent, it, size)
- }
-}
\ No newline at end of file
diff --git a/constraintlayout/constraintlayout-compose/build.gradle b/constraintlayout/constraintlayout-compose/build.gradle
index 639aa60..51a3271 100644
--- a/constraintlayout/constraintlayout-compose/build.gradle
+++ b/constraintlayout/constraintlayout-compose/build.gradle
@@ -14,9 +14,7 @@
* limitations under the License.
*/
-import androidx.build.AndroidXComposePlugin
import androidx.build.LibraryType
-import androidx.build.Publish
plugins {
id("AndroidXPlugin")
@@ -24,77 +22,49 @@
id("AndroidXComposePlugin")
}
-AndroidXComposePlugin.applyAndConfigureKotlinPlugin(project)
+androidXMultiplatform {
+ android()
-dependencies {
- if(!AndroidXComposePlugin.isMultiplatformEnabled(project)) {
- implementation(project(":compose:ui:ui"))
- implementation(project(":compose:ui:ui-unit"))
- implementation(project(":compose:ui:ui-util"))
- implementation(project(":compose:foundation:foundation"))
- implementation(project(":compose:foundation:foundation-layout"))
-
- implementation(project(":constraintlayout:constraintlayout-core"))
-
- androidTestImplementation(project(":compose:material:material"))
- androidTestImplementation(project(":compose:ui:ui-test"))
- androidTestImplementation(project(":compose:ui:ui-test-junit4"))
- androidTestImplementation(project(":compose:ui:ui-test-manifest"))
- androidTestImplementation(project(":activity:activity"))
-
- androidTestImplementation(libs.kotlinTest)
- androidTestImplementation(libs.testRules)
- androidTestImplementation(libs.testRunner)
- androidTestImplementation(libs.junit)
-
- lintPublish(project(":constraintlayout:constraintlayout-compose-lint"))
- }
-}
-
-if(AndroidXComposePlugin.isMultiplatformEnabled(project)) {
- androidXComposeMultiplatform {
- android()
- desktop()
- }
-
- kotlin {
- /*
- * When updating dependencies, make sure to make the an an analogous update in the
- * corresponding block above
- */
- sourceSets {
- commonMain.dependencies {
-// implementation(libs.kotlinStdlibCommon)
-
+ sourceSets {
+ commonMain {
+ dependencies {
implementation(project(":compose:ui:ui"))
- implementation("androidx.compose.ui:ui-unit:1.4.0-beta02")
- implementation("androidx.compose.ui:ui-util:1.4.0-beta02")
- implementation("androidx.compose.foundation:foundation:1.4.0-beta02")
- implementation("androidx.compose.foundation:foundation-layout:1.4.0-beta02")
+ implementation(project(":compose:ui:ui-unit"))
+ implementation(project(":compose:ui:ui-util"))
+ implementation(project(":compose:foundation:foundation"))
+ implementation(project(":compose:foundation:foundation-layout"))
implementation(project(":constraintlayout:constraintlayout-core"))
-
}
+ }
- androidMain.dependencies {
+ commonTest {
+ dependencies {
+ }
+ }
+
+ jvmMain {
+ dependencies {
+ }
+ }
+
+
+ androidMain {
+ dependsOn(commonMain)
+ dependsOn(jvmMain)
+ dependencies {
api("androidx.annotation:annotation:1.1.0")
implementation("androidx.core:core-ktx:1.5.0")
}
+ }
- desktopMain.dependencies {
- implementation(libs.kotlinStdlib)
+ jvmTest {
+ dependencies {
}
+ }
- // TODO(b/214407011): These dependencies leak into instrumented tests as well. If you
- // need to add Robolectric (which must be kept out of androidAndroidTest), use a top
- // level dependencies block instead:
- // `dependencies { testImplementation(libs.robolectric) }`
- androidTest.dependencies {
- implementation(libs.testRules)
- implementation(libs.testRunner)
- implementation(libs.junit)
- }
-
- androidAndroidTest.dependencies {
+ androidAndroidTest {
+ dependsOn(jvmTest)
+ dependencies {
implementation(libs.kotlinTest)
implementation(libs.testRules)
implementation(libs.testRunner)
@@ -107,9 +77,27 @@
implementation(project(":compose:test-utils"))
}
}
+
+
+ // TODO(b/214407011): These dependencies leak into instrumented tests as well. If you
+ // need to add Robolectric (which must be kept out of androidAndroidTest), use a top
+ // level dependencies block instead:
+ // `dependencies { testImplementation(libs.robolectric) }`
+ androidTest {
+ dependsOn(jvmTest)
+ dependencies {
+ implementation(libs.testRules)
+ implementation(libs.testRunner)
+ implementation(libs.junit)
+ }
+ }
}
}
+dependencies {
+ lintPublish(project(":constraintlayout:constraintlayout-compose-lint"))
+}
+
androidx {
name = "Android ConstraintLayout Compose Library"
type = LibraryType.PUBLISHED_LIBRARY
diff --git a/testutils/testutils-fonts/build.gradle b/testutils/testutils-fonts/build.gradle
index dffd039..911cf9b 100644
--- a/testutils/testutils-fonts/build.gradle
+++ b/testutils/testutils-fonts/build.gradle
@@ -14,12 +14,20 @@
* limitations under the License.
*/
+
+import androidx.build.KmpPlatformsKt
import androidx.build.LibraryType
plugins {
id("AndroidXPlugin")
id("com.android.library")
- id("kotlin-android")
+}
+
+def desktopEnabled = KmpPlatformsKt.enableDesktop(project)
+
+androidXMultiplatform {
+ android()
+ if (desktopEnabled) desktop()
}
dependencies {