Skip to content

Commit 992f530

Browse files
Move workflow-runtime-android into android source set in workflow-runtime module. (2nd attempt)
First attempt was #1370, but got reverted in #1378 due to it having broken something. I need this in order to correctly consume Compose Multiplatform for the work migrating the runtime to compose (#1442). This reverts commit 58c1d40.
1 parent d45a070 commit 992f530

File tree

40 files changed

+624
-165
lines changed

40 files changed

+624
-165
lines changed

.github/workflows/kotlin.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,7 @@ jobs:
658658
tests-name: core-tests-results-${{matrix.shardNum}}
659659
api-level: ${{ matrix.api-level }}
660660
prepare-task: prepareConnectedCheckShard${{matrix.shardNum}}
661-
test-task: connectedCheckShard${{matrix.shardNum}} -x :benchmarks:dungeon-benchmark:connectedCheck -x :benchmarks:performance-poetry:complex-benchmark:connectedCheck -x :benchmarks:performance-poetry:complex-poetry:connectedCheck
661+
test-task: connectedCheckShard${{matrix.shardNum}} -x :benchmarks:dungeon-benchmark:connectedAndroidTest -x :benchmarks:performance-poetry:complex-benchmark:connectedAndroidTest -x :benchmarks:performance-poetry:complex-poetry:connectedAndroidTest
662662
write-cache-key: androidTest-build-artifacts-${{matrix.shardNum}}
663663
restore-cache-key: main-build-artifacts
664664
failure-path-upload: '**/build/reports/androidTests/connected'
@@ -688,7 +688,7 @@ jobs:
688688
tests-name: alt-runtime-tests-results-${{matrix.runtime}}-${{matrix.shardNum}}
689689
api-level: ${{ matrix.api-level }}
690690
prepare-task: prepareConnectedCheckShard${{matrix.shardNum}} -Pworkflow.runtime=${{matrix.runtime}}
691-
test-task: connectedCheckShard${{matrix.shardNum}} -Pworkflow.runtime=${{matrix.runtime}} -x :benchmarks:dungeon-benchmark:connectedCheck -x :benchmarks:performance-poetry:complex-benchmark:connectedCheck -x :benchmarks:performance-poetry:complex-poetry:connectedCheck
691+
test-task: connectedCheckShard${{matrix.shardNum}} -Pworkflow.runtime=${{matrix.runtime}} -x :benchmarks:dungeon-benchmark:connectedAndroidTest -x :benchmarks:performance-poetry:complex-benchmark:connectedAndroidTest -x :benchmarks:performance-poetry:complex-poetry:connectedAndroidTest
692692
write-cache-key: androidTest-build-artifacts-${{matrix.shardNum}}-${{matrix.runtime}}
693693
restore-cache-key: main-build-artifacts
694694
failure-path-upload: '**/build/reports/androidTests/connected'

artifacts.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,15 @@
5353
"javaVersion": 8,
5454
"publicationName": "kotlinMultiplatform"
5555
},
56+
{
57+
"gradlePath": ":workflow-runtime",
58+
"group": "com.squareup.workflow1",
59+
"artifactId": "workflow-runtime-android",
60+
"description": "Workflow Runtime",
61+
"packaging": "aar",
62+
"javaVersion": 8,
63+
"publicationName": "android"
64+
},
5665
{
5766
"gradlePath": ":workflow-runtime",
5867
"group": "com.squareup.workflow1",
@@ -107,15 +116,6 @@
107116
"javaVersion": 8,
108117
"publicationName": "kotlinMultiplatform"
109118
},
110-
{
111-
"gradlePath": ":workflow-runtime-android",
112-
"group": "com.squareup.workflow1",
113-
"artifactId": "workflow-runtime-android",
114-
"description": "Workflow Runtime Android",
115-
"packaging": "aar",
116-
"javaVersion": 8,
117-
"publicationName": "maven"
118-
},
119119
{
120120
"gradlePath": ":workflow-rx2",
121121
"group": "com.squareup.workflow1",

build-logic/src/main/java/com/squareup/workflow1/buildsrc/shardConnectedChecks.kt

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,12 @@ fun shardConnectedCheckTasks(target: Project) {
4747
// Calculate the cost of each project's tests
4848
val projectsWithTestCount = lazy(NONE) {
4949
target.subprojects
50-
// Only Android projects can have these tasks.
51-
// Use the KGP Android plugin instead of AGP since KGP has only one ID to look for.
52-
.filter { it.plugins.hasPlugin("org.jetbrains.kotlin.android") }
50+
.filter {
51+
// Only Android projects can have these tasks.
52+
// Use the KGP Android plugin instead of AGP since KGP has only one ID to look for.
53+
it.plugins.hasPlugin("org.jetbrains.kotlin.android") ||
54+
it.plugins.hasPlugin("com.android.kotlin.multiplatform.library")
55+
}
5356
.map { it to it.androidTestCost() }
5457
}
5558

@@ -58,7 +61,9 @@ fun shardConnectedCheckTasks(target: Project) {
5861
// outside the task configuration block so that it only happens once.
5962
val shardAssignments = projectsWithTestCount.shards()
6063

61-
val connectedTestName = "connectedCheck"
64+
// We use connectedAndroidTest instead of connectedCheck since Android instrumented tests in KMP
65+
// modules aren't included the latter, but they are in the former.
66+
val connectedTestName = "connectedAndroidTest"
6267

6368
shardAssignments.forEach { shard ->
6469

@@ -215,13 +220,16 @@ private val testAnnotationRegex = """@(?:org\.junit\.)?Test\s+""".toRegex()
215220
*
216221
* Each test function has a cost of 1. A project with 20 tests has a cost of 20.
217222
*/
218-
private fun Project.androidTestCost(): Int {
219-
220-
val androidTestSrc = file("src/androidTest/java")
221-
222-
if (!androidTestSrc.exists()) return 0
223-
224-
return androidTestSrc
223+
private fun Project.androidTestCost(): Int =
224+
listOf(
225+
// Android-only, non-KMP modules.
226+
file("src/androidTest/java"),
227+
// KMP modules with android targets.
228+
file("src/androidDeviceTest/kotlin"),
229+
).sumOf { androidTestSrc ->
230+
if (!androidTestSrc.exists()) return@sumOf 0
231+
232+
androidTestSrc
225233
.walkTopDown()
226234
.filter { it.isFile && it.extension == "kt" }
227235
.sumOf { file ->

build.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ apply(from = rootProject.file(".buildscript/binary-validation.gradle"))
3737
dependencies {
3838
dokka(project(":workflow-core"))
3939
dokka(project(":workflow-runtime"))
40-
dokka(project(":workflow-runtime-android"))
4140
dokka(project(":workflow-rx2"))
4241
dokka(project(":workflow-testing"))
4342
dokka(project(":workflow-ui:compose"))

gradle/libs.versions.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ androidx-transition = { module = "androidx.transition:transition", version.ref =
192192

193193
androidx-viewbinding = { module = "androidx.databinding:viewbinding", version.ref = "androidx-viewbinding" }
194194

195+
burst = { module = "app.cash.burst:burst", version.ref = "burst" }
195196
burst-plugin = { module = "app.cash.burst:burst-gradle-plugin", version.ref = "burst" }
196197

197198
dokka-gradle-plugin = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version.ref = "dokka" }

settings.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ include(
6262
":workflow-config:config-jvm",
6363
":workflow-core",
6464
":workflow-runtime",
65-
":workflow-runtime-android",
6665
":workflow-rx2",
6766
":workflow-testing",
6867
":workflow-tracing",

workflow-config/config-android/dependencies/releaseRuntimeClasspath.txt

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,66 @@
1+
androidx.activity:activity-ktx:1.7.0
2+
androidx.activity:activity:1.7.0
3+
androidx.annotation:annotation-experimental:1.4.1
4+
androidx.annotation:annotation-jvm:1.8.1
5+
androidx.annotation:annotation:1.8.1
6+
androidx.arch.core:core-common:2.2.0
7+
androidx.arch.core:core-runtime:2.2.0
8+
androidx.autofill:autofill:1.0.0
9+
androidx.collection:collection-jvm:1.4.4
10+
androidx.collection:collection-ktx:1.4.4
11+
androidx.collection:collection:1.4.4
12+
androidx.compose.runtime:runtime-android:1.7.8
13+
androidx.compose.runtime:runtime-saveable-android:1.7.8
14+
androidx.compose.runtime:runtime-saveable:1.7.8
15+
androidx.compose.runtime:runtime:1.7.8
16+
androidx.compose.ui:ui-android:1.7.8
17+
androidx.compose.ui:ui-geometry-android:1.7.8
18+
androidx.compose.ui:ui-geometry:1.7.8
19+
androidx.compose.ui:ui-graphics-android:1.7.8
20+
androidx.compose.ui:ui-graphics:1.7.8
21+
androidx.compose.ui:ui-text-android:1.7.8
22+
androidx.compose.ui:ui-text:1.7.8
23+
androidx.compose.ui:ui-unit-android:1.7.8
24+
androidx.compose.ui:ui-unit:1.7.8
25+
androidx.compose.ui:ui-util-android:1.7.8
26+
androidx.compose.ui:ui-util:1.7.8
27+
androidx.compose:compose-bom:2025.03.01
28+
androidx.concurrent:concurrent-futures:1.1.0
29+
androidx.core:core-ktx:1.12.0
30+
androidx.core:core:1.12.0
31+
androidx.customview:customview-poolingcontainer:1.0.0
32+
androidx.emoji2:emoji2:1.2.0
33+
androidx.graphics:graphics-path:1.0.1
34+
androidx.interpolator:interpolator:1.0.0
35+
androidx.lifecycle:lifecycle-common-jvm:2.8.7
36+
androidx.lifecycle:lifecycle-common:2.8.7
37+
androidx.lifecycle:lifecycle-livedata-core:2.8.7
38+
androidx.lifecycle:lifecycle-process:2.8.7
39+
androidx.lifecycle:lifecycle-runtime-android:2.8.7
40+
androidx.lifecycle:lifecycle-runtime-compose-android:2.8.7
41+
androidx.lifecycle:lifecycle-runtime-compose:2.8.7
42+
androidx.lifecycle:lifecycle-runtime-ktx-android:2.8.7
43+
androidx.lifecycle:lifecycle-runtime-ktx:2.8.7
44+
androidx.lifecycle:lifecycle-runtime:2.8.7
45+
androidx.lifecycle:lifecycle-viewmodel-android:2.8.7
46+
androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.7
47+
androidx.lifecycle:lifecycle-viewmodel-savedstate:2.8.7
48+
androidx.lifecycle:lifecycle-viewmodel:2.8.7
49+
androidx.profileinstaller:profileinstaller:1.3.1
50+
androidx.savedstate:savedstate-ktx:1.2.1
51+
androidx.savedstate:savedstate:1.2.1
52+
androidx.startup:startup-runtime:1.1.1
53+
androidx.tracing:tracing:1.0.0
54+
androidx.versionedparcelable:versionedparcelable:1.1.1
55+
com.google.guava:listenablefuture:1.0
156
com.squareup.okio:okio-jvm:3.3.0
257
com.squareup.okio:okio:3.3.0
358
org.jetbrains.kotlin:kotlin-bom:2.1.21
459
org.jetbrains.kotlin:kotlin-stdlib-common:2.1.21
560
org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.1.21
661
org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.1.21
762
org.jetbrains.kotlin:kotlin-stdlib:2.1.21
63+
org.jetbrains.kotlinx:kotlinx-coroutines-android:1.9.0
864
org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.9.0
965
org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.9.0
1066
org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0

workflow-runtime-android/README.md

Lines changed: 0 additions & 11 deletions
This file was deleted.

workflow-runtime-android/api/workflow-runtime-android.api

Lines changed: 0 additions & 10 deletions
This file was deleted.

workflow-runtime-android/build.gradle.kts

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)