Convert compose projects without cyclic dependencies to collections kmp structure
This is part of a multi-part effort to reland aosp/2532999 in parts.
Change-Id: I66941bf4a21c605992da0f24bf57c5af1068205e
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