Skip to content

Commit 787fa0e

Browse files
compileSdkVersion 33; androidx.activity/appcompat upgrades; transitives
Fix RenderAsState which was exposed by test as state was not set initially always.
1 parent 1a7f4c5 commit 787fa0e

File tree

92 files changed

+452
-319
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+452
-319
lines changed

benchmarks/dungeon-benchmark/build.gradle.kts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
import com.squareup.workflow1.libsCatalog
2+
import com.squareup.workflow1.version
3+
14
plugins {
25
id("com.android.test")
36
id("org.jetbrains.kotlin.android")
@@ -7,7 +10,7 @@ plugins {
710
// dependencies that those include.
811

912
android {
10-
compileSdk = 32
13+
compileSdk = libsCatalog.version("compileSdk").toInt()
1114

1215
compileOptions {
1316
sourceCompatibility = JavaVersion.VERSION_1_8
@@ -21,7 +24,7 @@ android {
2124

2225
defaultConfig {
2326
minSdk = 23
24-
targetSdk = 32
27+
targetSdk = libsCatalog.version("targetSdk").toInt()
2528

2629
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
2730
}

benchmarks/performance-poetry/complex-benchmark/build.gradle.kts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
import com.squareup.workflow1.libsCatalog
2+
import com.squareup.workflow1.version
3+
14
plugins {
25
id("com.android.test")
36
id("org.jetbrains.kotlin.android")
@@ -7,7 +10,7 @@ plugins {
710
// dependencies that those include.
811

912
android {
10-
compileSdk = 32
13+
compileSdk = libsCatalog.version("compileSdk").toInt()
1114

1215
compileOptions {
1316
sourceCompatibility = JavaVersion.VERSION_1_8
@@ -21,7 +24,7 @@ android {
2124

2225
defaultConfig {
2326
minSdk = 26
24-
targetSdk = 32
27+
targetSdk = libsCatalog.version("targetSdk").toInt()
2528

2629
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
2730
}

benchmarks/performance-poetry/complex-poetry/build.gradle.kts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1+
import com.squareup.workflow1.libsCatalog
2+
import com.squareup.workflow1.version
3+
14
plugins {
25
id("com.android.application")
36
`kotlin-android`
47
id("kotlin-parcelize")
58
}
69
android {
7-
compileSdk = 32
10+
compileSdk = libsCatalog.version("compileSdk").toInt()
811

912
compileOptions {
1013
sourceCompatibility = JavaVersion.VERSION_1_8
@@ -16,7 +19,7 @@ android {
1619
}
1720

1821
defaultConfig {
19-
targetSdk = 32
22+
targetSdk = libsCatalog.version("targetSdk").toInt()
2023
minSdk = 29
2124
applicationId = "com.squareup.benchmarks.performance.complex.poetry"
2225

benchmarks/performance-poetry/complex-poetry/src/main/AndroidManifest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<uses-permission
66
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
77
tools:ignore="ScopedStorage" />
8+
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
89

910
<application
1011
android:allowBackup="false"

buildSrc/src/main/java/Versions.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@Suppress("UNUSED") // used in Groovy convention scripts
22
object Versions {
3-
const val compileSdk = 31
4-
const val targetSdk = 30
3+
const val compileSdk = 33
4+
const val targetSdk = 33
55
}

buildSrc/src/main/java/android-defaults.gradle.kts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
import com.android.build.gradle.TestedExtension
2+
import com.squareup.workflow1.libsCatalog
3+
import com.squareup.workflow1.version
24

35
configure<TestedExtension> {
4-
compileSdkVersion(31)
6+
compileSdkVersion(libsCatalog.version("compileSdk").toInt())
57

68
compileOptions {
79
sourceCompatibility = JavaVersion.VERSION_1_8
810
targetCompatibility = JavaVersion.VERSION_1_8
911
}
1012

1113
defaultConfig {
12-
minSdk = 21
13-
targetSdk = 30
14+
minSdk = libsCatalog.version("minSdk").toInt()
15+
targetSdk = libsCatalog.version("targetSdk").toInt()
1416
versionCode = 1
1517
versionName = "1.0"
1618
}

buildSrc/src/main/java/android-ui-tests.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ plugins {
99
configure<TestedExtension> {
1010
defaultConfig {
1111
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
12-
testInstrumentationRunnerArguments["listener"] = "leakcanary.FailTestOnLeakRunListener"
1312
}
1413

1514
testOptions {

gradle/libs.versions.toml

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,33 @@
22

33
androidTools = "7.4.1"
44

5-
compileSdk = "31"
6-
minSdkVersion = "21"
7-
targetSdk = "30"
5+
compileSdk = "33"
6+
minSdk = "21"
7+
targetSdk = "33"
88

9-
androidx-activity = "1.3.0"
10-
androidx-appcompat = "1.3.1"
9+
androidx-activity = "1.6.1"
10+
androidx-appcompat = "1.6.1"
1111
androidx-benchmark = "1.1.1"
1212
androidx-cardview = "1.0.0"
13-
androidx-compose = "1.1.0-rc01"
1413
androidx-compose-compiler = "1.3.2"
14+
# see https://developer.android.com/jetpack/compose/bom/bom-mapping
15+
androidx-compose-bom = "2023.01.00"
1516
androidx-constraintlayout = "2.1.4"
1617
androidx-core = "1.6.0"
1718
androidx-fragment = "1.3.6"
1819
androidx-gridlayout = "1.0.0"
19-
androidx-lifecycle = "2.4.0"
20+
androidx-lifecycle = "2.5.1"
2021
androidx-navigation = "2.4.0-alpha09"
2122
androidx-paging = "3.0.1"
2223
androidx-profileinstaller = "1.2.0-alpha02"
2324
androidx-recyclerview = "1.2.1"
2425
androidx-room = "2.4.0-alpha04"
2526
androidx-savedstate = "1.1.0"
2627
androidx-startup = "1.1.0"
27-
androidx-test = "1.3.0"
28+
androidx-test = "1.5.0"
2829
androidx-test-espresso = "3.3.0"
2930
androidx-test-junit-ext = "1.1.3"
31+
androidx-test-runner = "1.5.2"
3032
androidx-test-truth-ext = "1.4.0"
3133
androidx-tracing = "1.1.0"
3234
androidx-transition = "1.4.1"
@@ -64,14 +66,14 @@ mockito-core = "3.3.3"
6466
mockito-kotlin = "3.2.0"
6567

6668
mockk = "1.11.0"
67-
robolectric = "4.6.1"
69+
robolectric = "4.9.2"
6870

6971
rxjava2-android = "2.1.1"
7072
rxjava2-core = "2.2.21"
7173

7274
squareup-curtains = "1.2.2"
7375
squareup-cycler = "0.1.9"
74-
squareup-leakcanary = "2.8.1"
76+
squareup-leakcanary = "2.10"
7577
squareup-moshi = "1.13.0"
7678
squareup-okhttp = "4.9.1"
7779
squareup-okio = "3.0.0"
@@ -115,20 +117,22 @@ androidx-cardview = { module = "androidx.cardview:cardview", version.ref = "andr
115117

116118
androidx-compose-compiler = { module = "androidx.compose.compiler:compiler", version.ref = "androidx-compose-compiler" }
117119

118-
androidx-compose-foundation = { module = "androidx.compose.foundation:foundation", version.ref = "androidx-compose" }
119-
androidx-compose-foundation-layout = { module = "androidx.compose.foundation:foundation-layout", version.ref = "androidx-compose" }
120+
androidx-compose-bom = { module = "androidx.compose:compose-bom", version.ref = "androidx-compose-bom" }
120121

121-
androidx-compose-material = { module = "androidx.compose.material:material", version.ref = "androidx-compose" }
122+
androidx-compose-foundation = { module = "androidx.compose.foundation:foundation"}
123+
androidx-compose-foundation-layout = { module = "androidx.compose.foundation:foundation-layout"}
122124

123-
androidx-compose-runtime = { module = "androidx.compose.runtime:runtime", version.ref = "androidx-compose" }
124-
androidx-compose-runtime-saveable = { module = "androidx.compose.runtime:runtime-saveable", version.ref = "androidx-compose" }
125+
androidx-compose-material = { module = "androidx.compose.material:material"}
125126

126-
androidx-compose-ui = { module = "androidx.compose.ui:ui", version.ref = "androidx-compose" }
127-
androidx-compose-ui-geometry = { module = "androidx.compose.ui:ui-geometry", version.ref = "androidx-compose" }
128-
androidx-compose-ui-graphics = { module = "androidx.compose.ui:ui-graphics", version.ref = "androidx-compose" }
129-
androidx-compose-ui-test-junit4 = { module = "androidx.compose.ui:ui-test-junit4", version.ref = "androidx-compose" }
130-
androidx-compose-ui-tooling = { module = "androidx.compose.ui:ui-tooling", version.ref = "androidx-compose" }
131-
androidx-compose-ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview", version.ref = "androidx-compose" }
127+
androidx-compose-runtime = { module = "androidx.compose.runtime:runtime"}
128+
androidx-compose-runtime-saveable = { module = "androidx.compose.runtime:runtime-saveable"}
129+
130+
androidx-compose-ui = { module = "androidx.compose.ui:ui"}
131+
androidx-compose-ui-geometry = { module = "androidx.compose.ui:ui-geometry"}
132+
androidx-compose-ui-graphics = { module = "androidx.compose.ui:ui-graphics"}
133+
androidx-compose-ui-test-junit4 = { module = "androidx.compose.ui:ui-test-junit4"}
134+
androidx-compose-ui-tooling = { module = "androidx.compose.ui:ui-tooling"}
135+
androidx-compose-ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview"}
132136

133137
androidx-constraintlayout = { module = "androidx.constraintlayout:constraintlayout", version.ref = "androidx-constraintlayout" }
134138

@@ -160,7 +164,7 @@ androidx-test-espresso-core = { module = "androidx.test.espresso:espresso-core",
160164
androidx-test-espresso-idlingResource = { module = "androidx.test.espresso:espresso-idling-resource", version.ref = "androidx-test-espresso" }
161165
androidx-test-espresso-intents = { module = "androidx.test.espresso:espresso-intents", version.ref = "androidx-test-espresso" }
162166
androidx-test-junit = { module = "androidx.test.ext:junit", version.ref = "androidx-test-junit-ext" }
163-
androidx-test-runner = { module = "androidx.test:runner", version.ref = "androidx-test" }
167+
androidx-test-runner = { module = "androidx.test:runner", version.ref = "androidx-test-runner" }
164168
androidx-test-truth = { module = "androidx.test.ext:truth", version.ref = "androidx-test-truth-ext" }
165169

166170
androidx-test-uiautomator = "androidx.test.uiautomator:uiautomator:2.2.0"

samples/compose-samples/build.gradle.kts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ android {
2020
}
2121

2222
dependencies {
23+
val composeBom = platform(libs.androidx.compose.bom)
24+
2325
androidTestImplementation(libs.androidx.activity.core)
26+
androidTestImplementation(composeBom)
2427
androidTestImplementation(libs.androidx.compose.ui)
2528
androidTestImplementation(libs.androidx.compose.ui.test.junit4)
2629
androidTestImplementation(libs.androidx.test.core)
@@ -33,6 +36,7 @@ dependencies {
3336

3437
implementation(libs.androidx.activity.compose)
3538
implementation(libs.androidx.activity.core)
39+
implementation(composeBom)
3640
implementation(libs.androidx.compose.foundation)
3741
implementation(libs.androidx.compose.foundation.layout)
3842
implementation(libs.androidx.compose.material)

samples/compose-samples/src/androidTest/java/com/squareup/sample/compose/hellocompose/HelloComposeTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ import androidx.compose.ui.test.onNodeWithText
66
import androidx.compose.ui.test.performClick
77
import androidx.test.ext.junit.runners.AndroidJUnit4
88
import com.squareup.workflow1.ui.WorkflowUiExperimentalApi
9-
import com.squareup.workflow1.ui.internal.test.DetectLeaksAfterTestSuccess
109
import com.squareup.workflow1.ui.internal.test.IdleAfterTestRule
1110
import com.squareup.workflow1.ui.internal.test.IdlingDispatcherRule
1211
import com.squareup.workflow1.ui.internal.test.compose.settleForNextRendering
1312
import com.squareup.workflow1.ui.internal.test.retry
1413
import kotlinx.coroutines.runBlocking
14+
import leakcanary.DetectLeaksAfterTestSuccess
1515
import org.junit.Rule
1616
import org.junit.Test
1717
import org.junit.rules.RuleChain

samples/compose-samples/src/androidTest/java/com/squareup/sample/compose/hellocomposebinding/HelloBindingTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import androidx.compose.ui.test.onNodeWithText
66
import androidx.compose.ui.test.performClick
77
import androidx.test.ext.junit.runners.AndroidJUnit4
88
import com.squareup.workflow1.ui.WorkflowUiExperimentalApi
9-
import com.squareup.workflow1.ui.internal.test.DetectLeaksAfterTestSuccess
109
import com.squareup.workflow1.ui.internal.test.IdleAfterTestRule
1110
import com.squareup.workflow1.ui.internal.test.IdlingDispatcherRule
11+
import leakcanary.DetectLeaksAfterTestSuccess
1212
import org.junit.Rule
1313
import org.junit.Test
1414
import org.junit.rules.RuleChain

samples/compose-samples/src/androidTest/java/com/squareup/sample/compose/hellocomposeworkflow/HelloComposeWorkflowTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import androidx.compose.ui.test.onNodeWithText
66
import androidx.compose.ui.test.performClick
77
import androidx.test.ext.junit.runners.AndroidJUnit4
88
import com.squareup.workflow1.ui.WorkflowUiExperimentalApi
9-
import com.squareup.workflow1.ui.internal.test.DetectLeaksAfterTestSuccess
109
import com.squareup.workflow1.ui.internal.test.IdleAfterTestRule
1110
import com.squareup.workflow1.ui.internal.test.IdlingDispatcherRule
11+
import leakcanary.DetectLeaksAfterTestSuccess
1212
import org.junit.Rule
1313
import org.junit.Test
1414
import org.junit.rules.RuleChain

samples/compose-samples/src/androidTest/java/com/squareup/sample/compose/inlinerendering/InlineRenderingTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ import androidx.compose.ui.test.junit4.createAndroidComposeRule
77
import androidx.compose.ui.test.performClick
88
import androidx.test.ext.junit.runners.AndroidJUnit4
99
import com.squareup.workflow1.ui.WorkflowUiExperimentalApi
10-
import com.squareup.workflow1.ui.internal.test.DetectLeaksAfterTestSuccess
1110
import com.squareup.workflow1.ui.internal.test.IdleAfterTestRule
1211
import com.squareup.workflow1.ui.internal.test.IdlingDispatcherRule
1312
import com.squareup.workflow1.ui.internal.test.compose.settleForNextRendering
1413
import com.squareup.workflow1.ui.internal.test.retry
1514
import kotlinx.coroutines.runBlocking
15+
import leakcanary.DetectLeaksAfterTestSuccess
1616
import org.junit.Rule
1717
import org.junit.Test
1818
import org.junit.rules.RuleChain

samples/compose-samples/src/androidTest/java/com/squareup/sample/compose/launcher/SampleLauncherTest.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.squareup.sample.compose.launcher
22

3-
import androidx.compose.ui.test.ExperimentalTestApi
43
import androidx.compose.ui.test.assertIsDisplayed
54
import androidx.compose.ui.test.hasScrollToIndexAction
65
import androidx.compose.ui.test.junit4.createAndroidComposeRule
@@ -12,9 +11,9 @@ import androidx.test.ext.junit.runners.AndroidJUnit4
1211
import androidx.test.platform.app.InstrumentationRegistry
1312
import com.squareup.sample.compose.R
1413
import com.squareup.workflow1.ui.WorkflowUiExperimentalApi
15-
import com.squareup.workflow1.ui.internal.test.DetectLeaksAfterTestSuccess
1614
import com.squareup.workflow1.ui.internal.test.IdleAfterTestRule
1715
import com.squareup.workflow1.ui.internal.test.IdlingDispatcherRule
16+
import leakcanary.DetectLeaksAfterTestSuccess
1817
import org.junit.Rule
1918
import org.junit.Test
2019
import org.junit.rules.RuleChain
@@ -31,7 +30,6 @@ class SampleLauncherTest {
3130
.around(composeRule)
3231
.around(IdlingDispatcherRule)
3332

34-
@OptIn(ExperimentalTestApi::class)
3533
@Test
3634
fun allSamplesLaunch() {
3735
val appName =

samples/compose-samples/src/androidTest/java/com/squareup/sample/compose/nestedrenderings/NestedRenderingsTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import androidx.compose.ui.test.onNodeWithText
1010
import androidx.compose.ui.test.performClick
1111
import androidx.test.ext.junit.runners.AndroidJUnit4
1212
import com.squareup.workflow1.ui.WorkflowUiExperimentalApi
13-
import com.squareup.workflow1.ui.internal.test.DetectLeaksAfterTestSuccess
1413
import com.squareup.workflow1.ui.internal.test.IdleAfterTestRule
1514
import com.squareup.workflow1.ui.internal.test.IdlingDispatcherRule
15+
import leakcanary.DetectLeaksAfterTestSuccess
1616
import org.junit.Rule
1717
import org.junit.Test
1818
import org.junit.rules.RuleChain

samples/compose-samples/src/androidTest/java/com/squareup/sample/compose/preview/PreviewTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import androidx.compose.ui.test.junit4.createAndroidComposeRule
66
import androidx.compose.ui.test.onNodeWithText
77
import androidx.test.ext.junit.runners.AndroidJUnit4
88
import com.squareup.workflow1.ui.WorkflowUiExperimentalApi
9-
import com.squareup.workflow1.ui.internal.test.DetectLeaksAfterTestSuccess
109
import com.squareup.workflow1.ui.internal.test.IdleAfterTestRule
1110
import com.squareup.workflow1.ui.internal.test.IdlingDispatcherRule
11+
import leakcanary.DetectLeaksAfterTestSuccess
1212
import org.junit.Rule
1313
import org.junit.Test
1414
import org.junit.rules.RuleChain

samples/compose-samples/src/androidTest/java/com/squareup/sample/compose/textinput/TextInputTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ import androidx.compose.ui.test.performTextInput
1010
import androidx.compose.ui.test.performTextReplacement
1111
import androidx.test.ext.junit.runners.AndroidJUnit4
1212
import com.squareup.workflow1.ui.WorkflowUiExperimentalApi
13-
import com.squareup.workflow1.ui.internal.test.DetectLeaksAfterTestSuccess
1413
import com.squareup.workflow1.ui.internal.test.IdleAfterTestRule
1514
import com.squareup.workflow1.ui.internal.test.IdlingDispatcherRule
1615
import com.squareup.workflow1.ui.internal.test.compose.settleForNextRendering
1716
import com.squareup.workflow1.ui.internal.test.retry
1817
import kotlinx.coroutines.runBlocking
18+
import leakcanary.DetectLeaksAfterTestSuccess
1919
import org.junit.Rule
2020
import org.junit.Test
2121
import org.junit.rules.RuleChain

samples/compose-samples/src/main/AndroidManifest.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
33
xmlns:tools="http://schemas.android.com/tools">
44

5+
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
56
<application
67
android:allowBackup="false"
78
android:label="@string/app_name"
89
android:theme="@style/AppTheme"
910
tools:ignore="GoogleAppIndexingWarning,MissingApplicationIcon"
1011
>
1112

12-
<activity android:name=".launcher.SampleLauncherActivity">
13+
<activity android:name=".launcher.SampleLauncherActivity"
14+
android:exported="true">
1315
<intent-filter>
1416
<action android:name="android.intent.action.MAIN"/>
1517
<category android:name="android.intent.category.LAUNCHER"/>

samples/compose-samples/src/main/java/com/squareup/sample/compose/inlinerendering/InlineRenderingWorkflow.kt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,8 @@ object InlineRenderingWorkflow : StatefulWorkflow<Unit, Int, Nothing, AndroidScr
5353
override fun snapshotState(state: Int): Snapshot = Snapshot.of(state)
5454
}
5555

56-
@Preview
5756
@Composable
58-
fun InlineRenderingWorkflowPreview() {
57+
fun InlineRenderingWorkflowRendering() {
5958
val rendering by InlineRenderingWorkflow.renderAsState(
6059
props = Unit,
6160
onOutput = {},
@@ -64,6 +63,12 @@ fun InlineRenderingWorkflowPreview() {
6463
WorkflowRendering(rendering, ViewEnvironment.EMPTY)
6564
}
6665

66+
@Preview(showBackground = true)
67+
@Composable
68+
internal fun InlineRenderingWorkflowPreview() {
69+
InlineRenderingWorkflowRendering()
70+
}
71+
6772
@OptIn(ExperimentalAnimationApi::class)
6873
@Composable
6974
private fun AnimatedCounter(

0 commit comments

Comments
 (0)