Skip to content

Commit 748b94b

Browse files
authored
Sample navbar follow up (#2004)
Follow up to #2001 Main change is moving all the KMP parceling into a new internal module. Didn't want to use the `internal-test` one to avoid a testing dependency in non test source sets.
1 parent 28cb2ac commit 748b94b

36 files changed

Lines changed: 168 additions & 128 deletions

File tree

build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,7 @@ apiValidation {
496496
"circuit-codegen",
497497
"coil-rule",
498498
"counter",
499+
"internal-runtime",
499500
"internal-test-utils",
500501
"interop",
501502
"kotlin-inject",

circuit-foundation/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ tasks
140140
) {
141141
freeCompilerArgs.addAll(
142142
"-P",
143-
"plugin:org.jetbrains.kotlin.parcelize:additionalAnnotation=com.slack.circuit.internal.test.Parcelize",
143+
"plugin:org.jetbrains.kotlin.parcelize:additionalAnnotation=com.slack.circuit.internal.runtime.Parcelize",
144144
)
145145
}
146146
}

circuit-foundation/src/commonJvmTest/kotlin/com/slack/circuit/foundation/CircuitContentTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import androidx.compose.ui.test.assertTextEquals
1616
import androidx.compose.ui.test.junit4.createComposeRule
1717
import androidx.compose.ui.test.onNodeWithTag
1818
import androidx.compose.ui.test.performClick
19-
import com.slack.circuit.internal.test.Parcelize
19+
import com.slack.circuit.internal.runtime.Parcelize
2020
import com.slack.circuit.internal.test.TestContentTags.TAG_COUNT
2121
import com.slack.circuit.internal.test.TestContentTags.TAG_INCREASE_COUNT
2222
import com.slack.circuit.runtime.CircuitUiState

circuit-foundation/src/commonTest/kotlin/com/slack/circuit/foundation/TestScreens.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// SPDX-License-Identifier: Apache-2.0
33
package com.slack.circuit.foundation
44

5-
import com.slack.circuit.internal.test.Parcelize
5+
import com.slack.circuit.internal.runtime.Parcelize
66
import com.slack.circuit.runtime.screen.PopResult
77
import com.slack.circuit.runtime.screen.Screen
88

internal-runtime/build.gradle.kts

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
// Copyright (C) 2025 Slack Technologies, LLC
2+
// SPDX-License-Identifier: Apache-2.0
3+
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
4+
import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl
5+
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
6+
7+
plugins {
8+
alias(libs.plugins.agp.library)
9+
alias(libs.plugins.kotlin.multiplatform)
10+
alias(libs.plugins.kotlin.plugin.parcelize)
11+
}
12+
13+
kotlin {
14+
// region KMP Targets
15+
androidTarget { publishLibraryVariants("release") }
16+
jvm()
17+
iosX64()
18+
iosArm64()
19+
iosSimulatorArm64()
20+
macosX64()
21+
macosArm64()
22+
js(IR) {
23+
moduleName = "internal-runtime"
24+
browser()
25+
}
26+
@OptIn(ExperimentalWasmDsl::class)
27+
wasmJs {
28+
moduleName = "internal-runtime"
29+
browser()
30+
}
31+
// endregion
32+
33+
@OptIn(ExperimentalKotlinGradlePluginApi::class)
34+
applyDefaultHierarchyTemplate {
35+
group("browserCommon") {
36+
withJs()
37+
withWasmJs()
38+
}
39+
}
40+
41+
sourceSets {
42+
get("browserCommonMain").dependsOn(commonMain.get())
43+
get("browserCommonTest").dependsOn(commonTest.get())
44+
configureEach { compilerOptions { freeCompilerArgs.add("-Xexpect-actual-classes") } }
45+
}
46+
47+
targets.configureEach {
48+
if (platformType == KotlinPlatformType.androidJvm) {
49+
compilations.configureEach {
50+
compileTaskProvider.configure {
51+
compilerOptions {
52+
freeCompilerArgs.addAll(
53+
"-P",
54+
"plugin:org.jetbrains.kotlin.parcelize:additionalAnnotation=com.slack.circuit.internal.runtime.Parcelize",
55+
)
56+
}
57+
}
58+
}
59+
}
60+
}
61+
}
62+
63+
android { namespace = "com.slack.circuit.internal.runtime" }
64+
65+
androidComponents { beforeVariants { variant -> variant.androidTest.enable = false } }

internal-runtime/gradle.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
circuit.noCompose=true
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Copyright (C) 2025 Slack Technologies, LLC
2+
// SPDX-License-Identifier: Apache-2.0
3+
package com.slack.circuit.internal.runtime
4+
5+
// For Android Parcelable
6+
actual typealias Parcelable = android.os.Parcelable
7+
8+
// For Android @IgnoreOnParcel
9+
actual typealias IgnoreOnParcel = kotlinx.parcelize.IgnoredOnParcel
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Copyright (C) 2025 Slack Technologies, LLC
2+
// SPDX-License-Identifier: Apache-2.0
3+
package com.slack.circuit.internal.runtime
4+
5+
// For Android Parcelable
6+
actual interface Parcelable
7+
8+
// For Android @IgnoreOnParcel
9+
@Target(AnnotationTarget.PROPERTY)
10+
@Retention(AnnotationRetention.SOURCE)
11+
actual annotation class IgnoreOnParcel actual constructor()
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright (C) 2025 Slack Technologies, LLC
2+
// SPDX-License-Identifier: Apache-2.0
3+
package com.slack.circuit.internal.runtime
4+
5+
// For Android @Parcelize
6+
@Target(AnnotationTarget.CLASS) @Retention(AnnotationRetention.BINARY) annotation class Parcelize
7+
8+
// For Android @IgnoreOnParcel
9+
@Target(AnnotationTarget.PROPERTY)
10+
@Retention(AnnotationRetention.SOURCE)
11+
expect annotation class IgnoreOnParcel()
12+
13+
// For Android Parcelable
14+
expect interface Parcelable
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Copyright (C) 2025 Slack Technologies, LLC
2+
// SPDX-License-Identifier: Apache-2.0
3+
package com.slack.circuit.internal.runtime
4+
5+
// For Android Parcelable
6+
actual interface Parcelable
7+
8+
// For Android @IgnoreOnParcel
9+
@Target(AnnotationTarget.PROPERTY)
10+
@Retention(AnnotationRetention.SOURCE)
11+
actual annotation class IgnoreOnParcel actual constructor()

0 commit comments

Comments
 (0)