From 1a9d08073e80dbae097d96399cf28b18190e8281 Mon Sep 17 00:00:00 2001 From: Konstantin Tskhovrebov Date: Wed, 4 Sep 2024 13:37:04 +0200 Subject: [PATCH] Commonize ":compose:material3:material3-adaptive-navigation-suite" module. --- .../material3-adaptive-navigation-suite.api | 79 +++++++++++++++++++ .../build.gradle | 60 +++++++++----- .../NavigationSuiteScaffold.kt | 1 + .../NavigationSuiteScaffoldTest.kt | 7 +- mpp/build.gradle.kts | 1 + settings.gradle | 1 + 6 files changed, 123 insertions(+), 26 deletions(-) create mode 100644 compose/material3/material3-adaptive-navigation-suite/api/desktop/material3-adaptive-navigation-suite.api rename compose/material3/material3-adaptive-navigation-suite/src/{androidUnitTest => commonTest}/kotlin/androidx/compose/material3/adaptive/navigationsuite/NavigationSuiteScaffoldTest.kt (97%) diff --git a/compose/material3/material3-adaptive-navigation-suite/api/desktop/material3-adaptive-navigation-suite.api b/compose/material3/material3-adaptive-navigation-suite/api/desktop/material3-adaptive-navigation-suite.api new file mode 100644 index 0000000000000..17c4fd1490a3f --- /dev/null +++ b/compose/material3/material3-adaptive-navigation-suite/api/desktop/material3-adaptive-navigation-suite.api @@ -0,0 +1,79 @@ +public final class androidx/compose/material3/adaptive/navigationsuite/ComposableSingletons$NavigationSuiteScaffoldKt { + public static final field INSTANCE Landroidx/compose/material3/adaptive/navigationsuite/ComposableSingletons$NavigationSuiteScaffoldKt; + public static field lambda-1 Lkotlin/jvm/functions/Function2; + public static field lambda-2 Lkotlin/jvm/functions/Function2; + public fun ()V + public final fun getLambda-1$material3_adaptive_navigation_suite ()Lkotlin/jvm/functions/Function2; + public final fun getLambda-2$material3_adaptive_navigation_suite ()Lkotlin/jvm/functions/Function2; +} + +public abstract interface annotation class androidx/compose/material3/adaptive/navigationsuite/ExperimentalMaterial3AdaptiveNavigationSuiteApi : java/lang/annotation/Annotation { +} + +public final class androidx/compose/material3/adaptive/navigationsuite/NavigationSuiteColors { + public static final field $stable I + public final fun getNavigationBarContainerColor-0d7_KjU ()J + public final fun getNavigationBarContentColor-0d7_KjU ()J + public final fun getNavigationDrawerContainerColor-0d7_KjU ()J + public final fun getNavigationDrawerContentColor-0d7_KjU ()J + public final fun getNavigationRailContainerColor-0d7_KjU ()J + public final fun getNavigationRailContentColor-0d7_KjU ()J +} + +public final class androidx/compose/material3/adaptive/navigationsuite/NavigationSuiteDefaults { + public static final field $stable I + public static final field INSTANCE Landroidx/compose/material3/adaptive/navigationsuite/NavigationSuiteDefaults; + public final fun colors-5tl4gsc (JJJJJJLandroidx/compose/runtime/Composer;II)Landroidx/compose/material3/adaptive/navigationsuite/NavigationSuiteColors; + public final fun itemColors (Landroidx/compose/material3/NavigationBarItemColors;Landroidx/compose/material3/NavigationRailItemColors;Landroidx/compose/material3/NavigationDrawerItemColors;Landroidx/compose/runtime/Composer;II)Landroidx/compose/material3/adaptive/navigationsuite/NavigationSuiteItemColors; +} + +public final class androidx/compose/material3/adaptive/navigationsuite/NavigationSuiteItemColors { + public static final field $stable I + public fun (Landroidx/compose/material3/NavigationBarItemColors;Landroidx/compose/material3/NavigationRailItemColors;Landroidx/compose/material3/NavigationDrawerItemColors;)V + public final fun getNavigationBarItemColors ()Landroidx/compose/material3/NavigationBarItemColors; + public final fun getNavigationDrawerItemColors ()Landroidx/compose/material3/NavigationDrawerItemColors; + public final fun getNavigationRailItemColors ()Landroidx/compose/material3/NavigationRailItemColors; +} + +public final class androidx/compose/material3/adaptive/navigationsuite/NavigationSuiteScaffoldDefaults { + public static final field $stable I + public static final field INSTANCE Landroidx/compose/material3/adaptive/navigationsuite/NavigationSuiteScaffoldDefaults; + public final fun calculateFromAdaptiveInfo-JYfApLo (Landroidx/compose/material3/adaptive/WindowAdaptiveInfo;)Ljava/lang/String; + public final fun getContainerColor (Landroidx/compose/runtime/Composer;I)J + public final fun getContentColor (Landroidx/compose/runtime/Composer;I)J +} + +public final class androidx/compose/material3/adaptive/navigationsuite/NavigationSuiteScaffoldKt { + public static final synthetic fun NavigationSuite-Og0-EV8 (Landroidx/compose/ui/Modifier;Ljava/lang/String;Landroidx/compose/material3/adaptive/navigationsuite/NavigationSuiteColors;Lkotlin/jvm/functions/Function1;Landroidx/compose/runtime/Composer;II)V + public static final fun NavigationSuite-koyC03U (Landroidx/compose/ui/Modifier;Ljava/lang/String;Landroidx/compose/material3/adaptive/navigationsuite/NavigationSuiteColors;Lkotlin/jvm/functions/Function1;Landroidx/compose/runtime/Composer;II)V + public static final synthetic fun NavigationSuiteScaffold-Fin9vsw (Lkotlin/jvm/functions/Function1;Landroidx/compose/ui/Modifier;Ljava/lang/String;Landroidx/compose/material3/adaptive/navigationsuite/NavigationSuiteColors;JJLkotlin/jvm/functions/Function2;Landroidx/compose/runtime/Composer;II)V + public static final fun NavigationSuiteScaffold-thDv9LQ (Lkotlin/jvm/functions/Function1;Landroidx/compose/ui/Modifier;Ljava/lang/String;Landroidx/compose/material3/adaptive/navigationsuite/NavigationSuiteColors;JJLkotlin/jvm/functions/Function2;Landroidx/compose/runtime/Composer;II)V + public static final synthetic fun NavigationSuiteScaffoldLayout-Yk5QHw8 (Lkotlin/jvm/functions/Function2;Ljava/lang/String;Lkotlin/jvm/functions/Function2;Landroidx/compose/runtime/Composer;II)V + public static final fun NavigationSuiteScaffoldLayout-zTpdPhI (Lkotlin/jvm/functions/Function2;Ljava/lang/String;Lkotlin/jvm/functions/Function2;Landroidx/compose/runtime/Composer;II)V +} + +public abstract interface class androidx/compose/material3/adaptive/navigationsuite/NavigationSuiteScope { + public abstract fun item (ZLkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function2;Landroidx/compose/ui/Modifier;ZLkotlin/jvm/functions/Function2;ZLkotlin/jvm/functions/Function2;Landroidx/compose/material3/adaptive/navigationsuite/NavigationSuiteItemColors;Landroidx/compose/foundation/interaction/MutableInteractionSource;)V + public static synthetic fun item$default (Landroidx/compose/material3/adaptive/navigationsuite/NavigationSuiteScope;ZLkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function2;Landroidx/compose/ui/Modifier;ZLkotlin/jvm/functions/Function2;ZLkotlin/jvm/functions/Function2;Landroidx/compose/material3/adaptive/navigationsuite/NavigationSuiteItemColors;Landroidx/compose/foundation/interaction/MutableInteractionSource;ILjava/lang/Object;)V +} + +public final class androidx/compose/material3/adaptive/navigationsuite/NavigationSuiteType { + public static final field Companion Landroidx/compose/material3/adaptive/navigationsuite/NavigationSuiteType$Companion; + public static final synthetic fun box-impl (Ljava/lang/String;)Landroidx/compose/material3/adaptive/navigationsuite/NavigationSuiteType; + public fun equals (Ljava/lang/Object;)Z + public static fun equals-impl (Ljava/lang/String;Ljava/lang/Object;)Z + public static final fun equals-impl0 (Ljava/lang/String;Ljava/lang/String;)Z + public fun hashCode ()I + public static fun hashCode-impl (Ljava/lang/String;)I + public fun toString ()Ljava/lang/String; + public static fun toString-impl (Ljava/lang/String;)Ljava/lang/String; + public final synthetic fun unbox-impl ()Ljava/lang/String; +} + +public final class androidx/compose/material3/adaptive/navigationsuite/NavigationSuiteType$Companion { + public final fun getNavigationBar-QfFTkUs ()Ljava/lang/String; + public final fun getNavigationDrawer-QfFTkUs ()Ljava/lang/String; + public final fun getNavigationRail-QfFTkUs ()Ljava/lang/String; + public final fun getNone-QfFTkUs ()Ljava/lang/String; +} + diff --git a/compose/material3/material3-adaptive-navigation-suite/build.gradle b/compose/material3/material3-adaptive-navigation-suite/build.gradle index bac0af82acf03..b4d5dfffb86e4 100644 --- a/compose/material3/material3-adaptive-navigation-suite/build.gradle +++ b/compose/material3/material3-adaptive-navigation-suite/build.gradle @@ -22,34 +22,45 @@ * modifying its settings. */ +import androidx.build.AndroidXComposePlugin +import androidx.build.JetbrainsAndroidXPlugin import androidx.build.LibraryType -import androidx.build.PlatformIdentifier plugins { id("AndroidXPlugin") id("com.android.library") id("AndroidXComposePlugin") + id("JetbrainsAndroidXPlugin") } -androidXMultiplatform { +AndroidXComposePlugin.applyAndConfigureKotlinPlugin(project) +JetbrainsAndroidXPlugin.applyAndConfigure(project) + +androidXComposeMultiplatform { android() desktop() + darwin() + wasm() + js() +} - defaultPlatform(PlatformIdentifier.ANDROID) - +kotlin { sourceSets { commonMain { dependencies { implementation(libs.kotlinStdlibCommon) - implementation("androidx.compose.material3:material3:1.2.0") + implementation(project(":compose:material3:material3")) implementation(project(":compose:material3:adaptive:adaptive")) - implementation("androidx.compose.ui:ui-util:1.6.0") - implementation("androidx.window:window-core:1.3.0-alpha02") + implementation(project(":compose:ui:ui")) + implementation(project(":window:window-core")) } } commonTest { dependencies { + implementation(libs.kotlinTest) + api(project(":annotation:annotation")) + implementation(project(":kruth:kruth")) } } @@ -63,8 +74,9 @@ androidXMultiplatform { androidMain { dependsOn(jvmMain) dependencies { - api("androidx.annotation:annotation:1.1.0") - api("androidx.annotation:annotation-experimental:1.4.0") + //dependencies are not available in JB fork + //api(project(":annotation:annotation")) + //api(project(":annotation:annotation-experimental")) } } @@ -87,21 +99,28 @@ androidXMultiplatform { dependsOn(jvmTest) dependencies { implementation(project(":compose:test-utils")) - implementation(project(":window:window-testing")) + //implementation(project(":window:window-testing")) implementation(libs.junit) implementation(libs.testRunner) implementation(libs.truth) } } - androidUnitTest { - dependsOn(jvmTest) - dependencies { - implementation(libs.junit) - implementation(libs.testRunner) - implementation(libs.truth) - } - } + skikoMain.dependsOn(commonMain) + desktopMain.dependsOn(skikoMain) + nonJvmMain.dependsOn(skikoMain) + webMain.dependsOn(nonJvmMain) + jsMain.dependsOn(webMain) + wasmJsMain.dependsOn(webMain) + nativeMain.dependsOn(nonJvmMain) + + skikoTest.dependsOn(commonTest) + desktopTest.dependsOn(skikoTest) + nonJvmTest.dependsOn(skikoTest) + webTest.dependsOn(nonJvmTest) + jsTest.dependsOn(webTest) + wasmJsTest.dependsOn(webTest) + nativeTest.dependsOn(nonJvmTest) } } @@ -111,9 +130,8 @@ android { androidx { name = "Material Adaptive Navigation Suite" - mavenVersion = LibraryVersions.COMPOSE_MATERIAL3_ADAPTIVE_NAVIGATION_SUITE - type = LibraryType.PUBLISHED_LIBRARY_ONLY_USED_BY_KOTLIN_CONSUMERS + type = LibraryType.PUBLISHED_LIBRARY inceptionYear = "2023" description = "Compose Material Design Adaptive Navigation Suite Library" - samples(project(":compose:material3:material3-adaptive-navigation-suite:material3-adaptive-navigation-suite-samples")) + //samples(project(":compose:material3:material3-adaptive-navigation-suite:material3-adaptive-navigation-suite-samples")) } diff --git a/compose/material3/material3-adaptive-navigation-suite/src/commonMain/kotlin/androidx/compose/material3/adaptive/navigationsuite/NavigationSuiteScaffold.kt b/compose/material3/material3-adaptive-navigation-suite/src/commonMain/kotlin/androidx/compose/material3/adaptive/navigationsuite/NavigationSuiteScaffold.kt index b951ec3b924d7..cb20bdf90c14a 100644 --- a/compose/material3/material3-adaptive-navigation-suite/src/commonMain/kotlin/androidx/compose/material3/adaptive/navigationsuite/NavigationSuiteScaffold.kt +++ b/compose/material3/material3-adaptive-navigation-suite/src/commonMain/kotlin/androidx/compose/material3/adaptive/navigationsuite/NavigationSuiteScaffold.kt @@ -60,6 +60,7 @@ import androidx.compose.ui.layout.layoutId import androidx.compose.ui.util.fastFirst import androidx.window.core.layout.WindowHeightSizeClass import androidx.window.core.layout.WindowWidthSizeClass +import kotlin.jvm.JvmInline /** * The Navigation Suite Scaffold wraps the provided content and places the adequate provided diff --git a/compose/material3/material3-adaptive-navigation-suite/src/androidUnitTest/kotlin/androidx/compose/material3/adaptive/navigationsuite/NavigationSuiteScaffoldTest.kt b/compose/material3/material3-adaptive-navigation-suite/src/commonTest/kotlin/androidx/compose/material3/adaptive/navigationsuite/NavigationSuiteScaffoldTest.kt similarity index 97% rename from compose/material3/material3-adaptive-navigation-suite/src/androidUnitTest/kotlin/androidx/compose/material3/adaptive/navigationsuite/NavigationSuiteScaffoldTest.kt rename to compose/material3/material3-adaptive-navigation-suite/src/commonTest/kotlin/androidx/compose/material3/adaptive/navigationsuite/NavigationSuiteScaffoldTest.kt index 12ec173b130c1..09f84a78b01b2 100644 --- a/compose/material3/material3-adaptive-navigation-suite/src/androidUnitTest/kotlin/androidx/compose/material3/adaptive/navigationsuite/NavigationSuiteScaffoldTest.kt +++ b/compose/material3/material3-adaptive-navigation-suite/src/commonTest/kotlin/androidx/compose/material3/adaptive/navigationsuite/NavigationSuiteScaffoldTest.kt @@ -19,14 +19,11 @@ package androidx.compose.material3.adaptive.navigationsuite import androidx.compose.material3.adaptive.ExperimentalMaterial3AdaptiveApi import androidx.compose.material3.adaptive.Posture import androidx.compose.material3.adaptive.WindowAdaptiveInfo +import androidx.kruth.assertThat import androidx.window.core.layout.WindowSizeClass -import com.google.common.truth.Truth.assertThat -import org.junit.Test -import org.junit.runner.RunWith -import org.junit.runners.JUnit4 +import kotlin.test.Test @OptIn(ExperimentalMaterial3AdaptiveApi::class) -@RunWith(JUnit4::class) class NavigationSuiteScaffoldTest { @Test diff --git a/mpp/build.gradle.kts b/mpp/build.gradle.kts index 0bcc8d3e47d75..1813914b3207a 100644 --- a/mpp/build.gradle.kts +++ b/mpp/build.gradle.kts @@ -55,6 +55,7 @@ val libraryToComponents = mapOf( ComposeComponent(":compose:material:material-ripple"), ComposeComponent(":compose:material:material-navigation"), ComposeComponent(":compose:material3:material3-window-size-class"), + ComposeComponent(":compose:material3:material3-adaptive-navigation-suite"), ComposeComponent(":compose:runtime:runtime", supportedPlatforms = ComposePlatforms.ALL), ComposeComponent(":compose:runtime:runtime-saveable", supportedPlatforms = ComposePlatforms.ALL), ComposeComponent(":compose:ui:ui"), diff --git a/settings.gradle b/settings.gradle index 05bbe32fd7e2a..a3effec5e6f48 100644 --- a/settings.gradle +++ b/settings.gradle @@ -162,6 +162,7 @@ includeProject(":compose:material3:adaptive:adaptive-layout") includeProject(":compose:material3:adaptive:adaptive-navigation") includeProject(":compose:material3:material3-lint") includeProject(":compose:material3:material3-window-size-class") +includeProject(":compose:material3:material3-adaptive-navigation-suite") includeProject(":compose:material3:material3-window-size-class:material3-window-size-class-samples", "compose/material3/material3-window-size-class/samples") includeProject(":compose:material:material") includeProject(":compose:material:material-lint")