1212
1313plugins {
1414 id(" dokka" )
15- id(" library" )
15+ // id("library")
1616 id(" paparazzi" )
17- id(libs.plugins.kotlin.parcelize.get().pluginId) // https://github.com/gradle/gradle/issues/20084#issuecomment-1060822638
17+
1818 alias(libs.plugins.compose.compiler)
19- alias(libs.plugins.paparazzi)
19+ alias(libs.plugins.compose.multiplatform)
20+ id(libs.plugins.kotlin.multiplatform.get().pluginId)
21+ id(libs.plugins.android.kotlin.multiplatform.library.get().pluginId)
2022}
2123
22- // Temporary workaround for https://issuetracker.google.com/issues/476936389
23- val dokkaKotlinAdapter = objects.newInstance(org.jetbrains.dokka.gradle.adapters.KotlinAdapter ::class )
24- dokkaKotlinAdapter.apply (project)
24+ kotlin {
25+ jvmToolchain(17 )
2526
26- android {
27- namespace = " com.orange.ouds.core"
27+ compilerOptions {
28+ freeCompilerArgs.addAll(
29+ " -opt-in=com.orange.ouds.foundation.RestrictedOudsApi" ,
30+ " -opt-in=com.orange.ouds.foundation.ExperimentalOudsApi" ,
31+ " -opt-in=com.orange.ouds.foundation.InternalOudsApi"
32+ )
33+ }
2834
29- buildFeatures {
30- buildConfig = true
31- compose = true
35+ // Target declarations - add or remove as needed below. These define
36+ // which platforms this KMP module supports.
37+ // See: https://kotlinlang.org/docs/multiplatform-discover-project.html#targets
38+ android {
39+ namespace = " com.orange.ouds.core"
40+ compileSdk = libs.versions.androidCompileSdk.get().toInt()
41+ minSdk = libs.versions.androidMinSdk.get().toInt()
42+
43+ androidResources.enable = true
44+
45+ withHostTestBuilder {
46+ }
47+
48+ withDeviceTestBuilder {
49+ sourceSetTreeName = " test"
50+ }.configure {
51+ instrumentationRunner = " androidx.test.runner.AndroidJUnitRunner"
52+ }
3253 }
3354
34- kotlin {
35- compilerOptions {
36- freeCompilerArgs.addAll(
37- " -opt-in=com.orange.ouds.foundation.RestrictedOudsApi" ,
38- " -opt-in=com.orange.ouds.foundation.ExperimentalOudsApi" ,
39- " -opt-in=com.orange.ouds.foundation.InternalOudsApi"
40- )
55+ // For iOS targets, this is also where you should
56+ // configure native binary output. For more information, see:
57+ // https://kotlinlang.org/docs/multiplatform-build-native-binaries.html#build-xcframeworks
58+
59+ // A step-by-step guide on how to include this library in an XCode
60+ // project can be found here:
61+ // https://developer.android.com/kotlin/multiplatform/migrate
62+ val xcfName = " oudsCore"
63+
64+ // iosX64 {
65+ // binaries.framework {
66+ // baseName = xcfName
67+ // }
68+ // }
69+
70+ iosArm64 {
71+ binaries.framework {
72+ baseName = xcfName
4173 }
4274 }
43- }
4475
45- dependencies {
46- dokkaPlugin(project(" :dokka-plugin" ))
47- implementation(project(" :foundation" ))
48- api(project(" :theme-contract" ))
49- // compileOnly dependencies on themes are needed for previews
50- // compileOnly(project(":theme-orange"))
51- // compileOnly(project(":theme-orange-compact"))
52- // compileOnly(project(":theme-sosh"))
53- compileOnly(project(" :theme-wireframe" ))
54-
55- implementation(platform(libs.androidx.compose.bom))
56- implementation(libs.androidx.compose.material.icons.core)
57- implementation(libs.androidx.compose.material3)
58- implementation(libs.androidx.compose.material3.adaptive)
59- debugImplementation(libs.androidx.compose.ui.tooling)
60- implementation(libs.androidx.compose.ui.tooling.preview)
61- implementation(libs.androidx.constraintlayout.compose)
62- implementation(libs.material)
63-
64- implementation(libs.compose.components.resources)
65-
66- testImplementation(project(" :core-test" ))
67- // testImplementation(project(":theme-orange"))
68- // androidTestImplementation(project(":theme-orange"))
69- androidTestImplementation(libs.androidx.compose.ui.test.junit4)
70- androidTestImplementation(libs.kotlin.reflect)
71- androidTestImplementation(libs.mockito.android)
72- androidTestImplementation(libs.mockito.kotlin)
73- // Needed for createComposeRule(), but not for createAndroidComposeRule<YourActivity>():
74- debugImplementation(libs.androidx.compose.ui.test.manifest)
76+ iosSimulatorArm64 {
77+ binaries.framework {
78+ baseName = xcfName
79+ }
80+ }
81+
82+ // Source set declarations.
83+ // Declaring a target automatically creates a source set with the same name. By default, the
84+ // Kotlin Gradle Plugin creates additional source sets that depend on each other, since it is
85+ // common to share sources between related targets.
86+ // See: https://kotlinlang.org/docs/multiplatform-hierarchy.html
87+ sourceSets {
88+ commonMain {
89+ dependencies {
90+ implementation(libs.kotlin.stdlib)
91+ // Add KMP dependencies here
92+ implementation(libs.compose.ui)
93+ api(libs.compose.ui.tooling.preview)
94+
95+
96+ // dokkaPlugin(project(":dokka-plugin"))
97+ implementation(project(" :foundation" ))
98+ api(project(" :theme-contract" ))
99+ // compileOnly dependencies on themes are needed for previews
100+ // compileOnly(project(":theme-orange"))
101+ // compileOnly(project(":theme-orange-compact"))
102+ // compileOnly(project(":theme-sosh"))
103+ compileOnly(project(" :theme-wireframe" ))
104+
105+ // implementation(platform(libs.androidx.compose.bom))
106+ // implementation(libs.androidx.compose.material.icons.core)
107+ implementation(" org.jetbrains.compose.material:material-icons-core:1.7.3" )
108+ implementation(libs.compose.material3)
109+ implementation(libs.compose.ui.tooling.preview)
110+ // implementation(libs.androidx.constraintlayout.compose)
111+ implementation(" org.jetbrains.compose.foundation:foundation-layout" )
112+ implementation(libs.material)
113+
114+ implementation(libs.compose.components.resources)
115+ }
116+ }
117+
118+ commonTest {
119+ dependencies {
120+ implementation(libs.kotlin.test)
121+ }
122+ }
123+
124+ androidMain {
125+ dependencies {
126+ // Add Android-specific dependencies here. Note that this source set depends on
127+ // commonMain by default and will correctly pull the Android artifacts of any KMP
128+ // dependencies declared in commonMain.
129+ implementation(libs.androidx.core)
130+ }
131+ }
132+
133+ androidUnitTest {
134+ dependencies {
135+ implementation(project(" :core-test" ))
136+ // testImplementation(project(":theme-orange"))
137+ }
138+ }
139+
140+ getByName(" androidDeviceTest" ) {
141+ dependencies {
142+ // implementation(libs.androidx.junit)
143+ // implementation(libs.androidx.runner)
144+ // implementation(libs.core)
145+
146+ // androidTestImplementation(project(":theme-orange"))
147+ implementation(libs.androidx.compose.ui.test.junit4)
148+ implementation(libs.kotlin.reflect)
149+ implementation(libs.mockito.android)
150+ implementation(libs.mockito.kotlin)
151+ // Needed for createComposeRule(), but not for createAndroidComposeRule<YourActivity>():
152+ // debugImplementation(libs.androidx.compose.ui.test.manifest)
153+ }
154+ }
155+
156+ iosMain {
157+ dependencies {
158+ // Add iOS-specific dependencies here. This a source set created by Kotlin Gradle
159+ // Plugin (KGP) that each specific iOS target (e.g., iosX64) depends on as
160+ // part of KMP’s default source set hierarchy. Note that this source set depends
161+ // on common by default and will correctly pull the iOS artifacts of any
162+ // KMP dependencies declared in commonMain.
163+ }
164+ }
165+ }
75166}
76167
77168// TODO Remove when https://github.com/google/guava/issues/6567 is fixed.
78169// See also: https://github.com/google/guava/issues/6801.
79- dependencies.constraints {
80- testImplementation(" com.google.guava:guava" ) {
81- attributes {
82- attribute(
83- TargetJvmEnvironment .TARGET_JVM_ENVIRONMENT_ATTRIBUTE ,
84- objects.named(TargetJvmEnvironment ::class .java, TargetJvmEnvironment .STANDARD_JVM )
85- )
86- }
87- because(
88- " Paparazzi's layoutlib and sdk-common depend on Guava's -jre published variant." +
89- " See https://github.com/cashapp/paparazzi/issues/906."
90- )
91- }
92- }
170+ // dependencies.constraints {
171+ // testImplementation("com.google.guava:guava") {
172+ // attributes {
173+ // attribute(
174+ // TargetJvmEnvironment.TARGET_JVM_ENVIRONMENT_ATTRIBUTE,
175+ // objects.named(TargetJvmEnvironment::class.java, TargetJvmEnvironment.STANDARD_JVM)
176+ // )
177+ // }
178+ // because(
179+ // "Paparazzi's layoutlib and sdk-common depend on Guava's -jre published variant." +
180+ // "See https://github.com/cashapp/paparazzi/issues/906."
181+ // )
182+ // }
183+ // }
0 commit comments