Skip to content

Commit aa2beef

Browse files
Reapply "Upgrade Kotlin to 2.3.10"
This reverts commit 39f06fd.
1 parent 39f06fd commit aa2beef

File tree

8 files changed

+43
-144
lines changed

8 files changed

+43
-144
lines changed

build.gradle.kts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@
1414
* limitations under the License.
1515
*/
1616
import com.vanniktech.maven.publish.AndroidSingleVariantLibrary
17+
import com.vanniktech.maven.publish.JavadocJar
1718
import com.vanniktech.maven.publish.MavenPublishBaseExtension
1819
import kotlinx.validation.ApiValidationExtension
20+
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
1921
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
2022
import org.jlleitschuh.gradle.ktlint.KtlintExtension
2123
import org.jlleitschuh.gradle.ktlint.reporter.ReporterType
@@ -35,6 +37,7 @@ buildscript {
3537
classpath(libs.build.android)
3638
classpath(libs.build.mavenPublish)
3739
classpath(libs.build.kotlin)
40+
classpath(libs.build.compose.compiler)
3841
classpath(libs.build.ktlint)
3942
classpath(libs.build.binaryCompatibility)
4043
// Required for the gradle-maven-publish-plugin plugin.
@@ -79,20 +82,21 @@ subprojects {
7982
signAllPublications()
8083
pomFromGradleProperties()
8184

85+
@Suppress("DEPRECATION")
8286
configure(
8387
AndroidSingleVariantLibrary(variant = "release", sourcesJar = true, publishJavadocJar = true),
8488
)
8589
}
8690
}
8791

8892
tasks.withType<KotlinCompile> {
89-
kotlinOptions {
93+
compilerOptions {
9094
// Allow warnings when running from IDE, makes it easier to experiment.
9195
if (!isRunningFromIde) {
92-
allWarningsAsErrors = true
96+
allWarningsAsErrors.set(true)
9397
}
9498

95-
jvmTarget = "1.8"
99+
jvmTarget.set(JvmTarget.JVM_1_8)
96100
}
97101
}
98102

@@ -108,6 +112,7 @@ subprojects {
108112
reporter(ReporterType.JSON)
109113
}
110114

115+
@Suppress("DEPRECATION")
111116
disabledRules.set(
112117
setOf(
113118
// IntelliJ refuses to sort imports correctly.

compose-tests/build.gradle.kts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
12
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
23

34
plugins {
45
id("com.android.library")
56
kotlin("android")
7+
id("org.jetbrains.kotlin.plugin.compose")
68
}
79

810
android {
@@ -24,10 +26,6 @@ android {
2426
compose = true
2527
}
2628

27-
composeOptions {
28-
kotlinCompilerExtensionVersion = libs.versions.compose.compiler.get()
29-
}
30-
3129
packaging {
3230
resources.excludes += listOf(
3331
"META-INF/AL2.0",
@@ -39,10 +37,10 @@ android {
3937
}
4038

4139
tasks.withType<KotlinCompile> {
42-
kotlinOptions {
43-
jvmTarget = "1.8"
44-
freeCompilerArgs += listOf(
45-
"-Xopt-in=kotlin.RequiresOptIn"
40+
compilerOptions {
41+
jvmTarget.set(JvmTarget.JVM_1_8)
42+
freeCompilerArgs.addAll(
43+
"-opt-in=kotlin.RequiresOptIn"
4644
)
4745
}
4846
}

compose-unsupported-tests/build.gradle.kts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
12
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
23

34
plugins {
45
id("com.android.library")
56
kotlin("android")
7+
id("org.jetbrains.kotlin.plugin.compose")
68
}
79

810
android {
@@ -24,10 +26,6 @@ android {
2426
compose = true
2527
}
2628

27-
composeOptions {
28-
kotlinCompilerExtensionVersion = libs.versions.compose.compiler.get()
29-
}
30-
3129
packaging {
3230
resources.excludes += listOf(
3331
"META-INF/AL2.0",
@@ -39,10 +37,10 @@ android {
3937
}
4038

4139
tasks.withType<KotlinCompile> {
42-
kotlinOptions {
43-
jvmTarget = "1.8"
44-
freeCompilerArgs += listOf(
45-
"-Xopt-in=kotlin.RequiresOptIn"
40+
compilerOptions {
41+
jvmTarget.set(JvmTarget.JVM_1_8)
42+
freeCompilerArgs.addAll(
43+
"-opt-in=kotlin.RequiresOptIn"
4644
)
4745
}
4846
}

gradle/libs.versions.toml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
[versions]
22

3-
kotlin = "1.9.10"
3+
kotlin = "2.3.10"
44
androidx-test = "1.5.0"
5-
compose-compiler = "1.5.3"
6-
75
# We compile against an older version of Compose intentionally to support consumers that aren't on
86
# the latest.
97
#noinspection GradleDependency
@@ -14,16 +12,16 @@ compose = "1.10.1"
1412
compose-old = "1.3.0"
1513
# Use a separate property for the sample so we can test with different versions easily.
1614
compose-sample = "1.6.8"
17-
compose-sample-compiler = "1.5.3"
1815

1916
[libraries]
2017

2118
build-android = "com.android.tools.build:gradle:8.13.2"
2219
build-mavenPublish = "com.vanniktech:gradle-maven-publish-plugin:0.36.0"
2320
build-kotlin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
21+
build-compose-compiler = { module = "org.jetbrains.kotlin:compose-compiler-gradle-plugin", version.ref = "kotlin" }
2422
build-ktlint = "org.jlleitschuh.gradle:ktlint-gradle:11.6.1"
25-
build-binaryCompatibility = "org.jetbrains.kotlinx:binary-compatibility-validator:0.6.0"
26-
build-dokka = "org.jetbrains.dokka:dokka-gradle-plugin:1.9.10"
23+
build-binaryCompatibility = "org.jetbrains.kotlinx:binary-compatibility-validator:0.16.3"
24+
build-dokka = "org.jetbrains.dokka:dokka-gradle-plugin:2.1.0"
2725

2826
appCompat = "androidx.appcompat:appcompat:1.3.1"
2927
constraintLayout = "androidx.constraintlayout:constraintlayout:2.1.0"

radiography/api/radiography.api

Lines changed: 0 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ public abstract interface annotation class radiography/ExperimentalRadiographyCo
88

99
public final class radiography/Radiography {
1010
public static final field INSTANCE Lradiography/Radiography;
11-
public final synthetic fun renderScannableViewTree$radiography_release (Ljava/lang/StringBuilder;Lradiography/ScannableView;Ljava/util/List;Lradiography/ViewFilter;)V
1211
public static final fun scan ()Ljava/lang/String;
1312
public static final fun scan (Lradiography/ScanScope;)Ljava/lang/String;
1413
public static final fun scan (Lradiography/ScanScope;Ljava/util/List;)Ljava/lang/String;
@@ -22,7 +21,6 @@ public abstract interface class radiography/ScanScope {
2221

2322
public final class radiography/ScanScopes {
2423
public static final field AllWindowsScope Lradiography/ScanScope;
25-
public static final field EmptyScope Lradiography/ScanScope;
2624
public static final field FocusedWindowScope Lradiography/ScanScope;
2725
public static final field INSTANCE Lradiography/ScanScopes;
2826
public static final fun composeTestTagScope (Ljava/lang/String;)Lradiography/ScanScope;
@@ -78,10 +76,6 @@ public final class radiography/ScannableView$ComposeView : radiography/Scannable
7876
public fun toString ()Ljava/lang/String;
7977
}
8078

81-
public final class radiography/ScannableViewKt {
82-
public static final fun toScannableView (Lradiography/internal/ComposeLayoutInfo;)Lradiography/ScannableView;
83-
}
84-
8579
public abstract interface class radiography/ViewFilter {
8680
public abstract fun matches (Lradiography/ScannableView;)Z
8781
}
@@ -91,7 +85,6 @@ public final class radiography/ViewFilters {
9185
public static final field NoFilter Lradiography/ViewFilter;
9286
public static final fun and (Lradiography/ViewFilter;Lradiography/ViewFilter;)Lradiography/ViewFilter;
9387
public static final fun androidViewFilterFor (Ljava/lang/Class;Lkotlin/jvm/functions/Function1;)Lradiography/ViewFilter;
94-
public final synthetic fun androidViewFilterFor (Lkotlin/jvm/functions/Function1;)Lradiography/ViewFilter;
9588
public static final fun skipComposeTestTagsFilter ([Ljava/lang/String;)Lradiography/ViewFilter;
9689
public static final fun skipIdsViewFilter ([I)Lradiography/ViewFilter;
9790
}
@@ -107,10 +100,6 @@ public final class radiography/ViewStateRenderers {
107100
public static final field INSTANCE Lradiography/ViewStateRenderers;
108101
public static final field ViewRenderer Lradiography/ViewStateRenderer;
109102
public static final fun androidViewStateRendererFor (Ljava/lang/Class;Lkotlin/jvm/functions/Function2;)Lradiography/ViewStateRenderer;
110-
public final synthetic fun androidViewStateRendererFor (Lkotlin/jvm/functions/Function2;)Lradiography/ViewStateRenderer;
111-
public final fun appendTextValue$radiography_release (Lradiography/AttributeAppendable;Ljava/lang/String;Ljava/lang/CharSequence;ZI)V
112-
public static final synthetic fun composeTextRenderer$radiography_release (ZI)Lradiography/ViewStateRenderer;
113-
public static synthetic fun composeTextRenderer$radiography_release$default (ZIILjava/lang/Object;)Lradiography/ViewStateRenderer;
114103
public static final fun textViewRenderer ()Lradiography/ViewStateRenderer;
115104
public static final fun textViewRenderer (Z)Lradiography/ViewStateRenderer;
116105
public static final fun textViewRenderer (ZI)Lradiography/ViewStateRenderer;
@@ -122,91 +111,3 @@ public final class radiography/ViewsKt {
122111
public static synthetic fun scan$default (Landroid/view/View;Ljava/util/List;Lradiography/ViewFilter;ILjava/lang/Object;)Ljava/lang/String;
123112
}
124113

125-
public abstract class radiography/internal/ComposeLayoutInfo {
126-
}
127-
128-
public final class radiography/internal/ComposeLayoutInfo$AndroidViewInfo : radiography/internal/ComposeLayoutInfo {
129-
public fun <init> (Landroid/view/View;)V
130-
public final fun component1 ()Landroid/view/View;
131-
public final fun copy (Landroid/view/View;)Lradiography/internal/ComposeLayoutInfo$AndroidViewInfo;
132-
public static synthetic fun copy$default (Lradiography/internal/ComposeLayoutInfo$AndroidViewInfo;Landroid/view/View;ILjava/lang/Object;)Lradiography/internal/ComposeLayoutInfo$AndroidViewInfo;
133-
public fun equals (Ljava/lang/Object;)Z
134-
public final fun getView ()Landroid/view/View;
135-
public fun hashCode ()I
136-
public fun toString ()Ljava/lang/String;
137-
}
138-
139-
public final class radiography/internal/ComposeLayoutInfo$LayoutNodeInfo : radiography/internal/ComposeLayoutInfo {
140-
public fun <init> (Ljava/lang/String;Ljava/util/List;Landroidx/compose/ui/unit/IntRect;Ljava/util/List;Lkotlin/sequences/Sequence;Ljava/util/List;)V
141-
public final fun component1 ()Ljava/lang/String;
142-
public final fun component2 ()Ljava/util/List;
143-
public final fun component3 ()Landroidx/compose/ui/unit/IntRect;
144-
public final fun component4 ()Ljava/util/List;
145-
public final fun component5 ()Lkotlin/sequences/Sequence;
146-
public final fun component6 ()Ljava/util/List;
147-
public final fun copy (Ljava/lang/String;Ljava/util/List;Landroidx/compose/ui/unit/IntRect;Ljava/util/List;Lkotlin/sequences/Sequence;Ljava/util/List;)Lradiography/internal/ComposeLayoutInfo$LayoutNodeInfo;
148-
public static synthetic fun copy$default (Lradiography/internal/ComposeLayoutInfo$LayoutNodeInfo;Ljava/lang/String;Ljava/util/List;Landroidx/compose/ui/unit/IntRect;Ljava/util/List;Lkotlin/sequences/Sequence;Ljava/util/List;ILjava/lang/Object;)Lradiography/internal/ComposeLayoutInfo$LayoutNodeInfo;
149-
public fun equals (Ljava/lang/Object;)Z
150-
public final fun getBounds ()Landroidx/compose/ui/unit/IntRect;
151-
public final fun getCallChain ()Ljava/util/List;
152-
public final fun getChildren ()Lkotlin/sequences/Sequence;
153-
public final fun getModifiers ()Ljava/util/List;
154-
public final fun getName ()Ljava/lang/String;
155-
public final fun getSemanticsNodes ()Ljava/util/List;
156-
public fun hashCode ()I
157-
public fun toString ()Ljava/lang/String;
158-
}
159-
160-
public final class radiography/internal/ComposeLayoutInfo$SubcompositionInfo : radiography/internal/ComposeLayoutInfo {
161-
public fun <init> (Ljava/lang/String;Ljava/util/List;Landroidx/compose/ui/unit/IntRect;Lkotlin/sequences/Sequence;)V
162-
public final fun component1 ()Ljava/lang/String;
163-
public final fun component2 ()Ljava/util/List;
164-
public final fun component3 ()Landroidx/compose/ui/unit/IntRect;
165-
public final fun component4 ()Lkotlin/sequences/Sequence;
166-
public final fun copy (Ljava/lang/String;Ljava/util/List;Landroidx/compose/ui/unit/IntRect;Lkotlin/sequences/Sequence;)Lradiography/internal/ComposeLayoutInfo$SubcompositionInfo;
167-
public static synthetic fun copy$default (Lradiography/internal/ComposeLayoutInfo$SubcompositionInfo;Ljava/lang/String;Ljava/util/List;Landroidx/compose/ui/unit/IntRect;Lkotlin/sequences/Sequence;ILjava/lang/Object;)Lradiography/internal/ComposeLayoutInfo$SubcompositionInfo;
168-
public fun equals (Ljava/lang/Object;)Z
169-
public final fun getBounds ()Landroidx/compose/ui/unit/IntRect;
170-
public final fun getCallChain ()Ljava/util/List;
171-
public final fun getChildren ()Lkotlin/sequences/Sequence;
172-
public final fun getName ()Ljava/lang/String;
173-
public fun hashCode ()I
174-
public fun toString ()Ljava/lang/String;
175-
}
176-
177-
public final class radiography/internal/ComposeLayoutInfoKt {
178-
public static final fun computeLayoutInfos (Landroidx/compose/ui/tooling/data/Group;Ljava/util/List;Landroidx/compose/ui/semantics/SemanticsOwner;)Lkotlin/sequences/Sequence;
179-
public static synthetic fun computeLayoutInfos$default (Landroidx/compose/ui/tooling/data/Group;Ljava/util/List;Landroidx/compose/ui/semantics/SemanticsOwner;ILjava/lang/Object;)Lkotlin/sequences/Sequence;
180-
}
181-
182-
public final class radiography/internal/ComposeViewsKt {
183-
public static final field COMPOSE_UNSUPPORTED_MESSAGE Ljava/lang/String;
184-
public static final fun composeRenderingError (Ljava/lang/LinkageError;)Lradiography/ScannableView;
185-
public static final fun getComposeScannableViews (Landroid/view/View;)Lkotlin/Pair;
186-
public static final fun getMightBeComposeView (Landroid/view/View;)Z
187-
public static final fun isComposeAvailable ()Z
188-
}
189-
190-
public final class radiography/internal/CompositionContextsKt {
191-
public static final fun getCompositionContexts (Landroidx/compose/ui/tooling/data/Group;)Lkotlin/sequences/Sequence;
192-
public static final fun tryGetComposers (Landroidx/compose/runtime/CompositionContext;)Ljava/lang/Iterable;
193-
}
194-
195-
public final class radiography/internal/RenderTreeStringKt {
196-
public static final fun renderTreeString (Ljava/lang/StringBuilder;Ljava/lang/Object;Lkotlin/jvm/functions/Function2;)V
197-
}
198-
199-
public final class radiography/internal/SemanticsKt {
200-
public static final fun findTestTags (Lradiography/ScannableView$ComposeView;)Lkotlin/sequences/Sequence;
201-
}
202-
203-
public final class radiography/internal/SemanticsPropertiesHelpers {
204-
public static final field INSTANCE Lradiography/internal/SemanticsPropertiesHelpers;
205-
public final fun getHideFromAccessibility ()Landroidx/compose/ui/semantics/SemanticsPropertyKey;
206-
}
207-
208-
public final class radiography/internal/StringsKt {
209-
public static final fun ellipsize (Ljava/lang/CharSequence;I)Ljava/lang/CharSequence;
210-
public static final fun formatPixelDimensions (II)Ljava/lang/String;
211-
}
212-

radiography/build.gradle.kts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,19 @@ android {
4747
}
4848

4949
tasks.withType<KotlinCompile> {
50-
kotlinOptions {
51-
freeCompilerArgs += listOfNotNull(
52-
"-Xopt-in=kotlin.RequiresOptIn",
50+
compilerOptions {
51+
freeCompilerArgs.addAll(
52+
listOfNotNull(
53+
"-opt-in=kotlin.RequiresOptIn",
5354

54-
// Require explicit public modifiers and types.
55-
// TODO this should be moved to a top-level `kotlin { explicitApi() }` once that's working
56-
// for android projects, see https://youtrack.jetbrains.com/issue/KT-37652.
57-
"-Xexplicit-api=strict".takeUnless {
58-
// Tests aren't part of the public API, don't turn explicit API mode on for them.
59-
name.contains("test", ignoreCase = true)
60-
}
55+
// Require explicit public modifiers and types.
56+
// TODO this should be moved to a top-level `kotlin { explicitApi() }` once that's working
57+
// for android projects, see https://youtrack.jetbrains.com/issue/KT-37652.
58+
"-Xexplicit-api=strict".takeUnless {
59+
// Tests aren't part of the public API, don't turn explicit API mode on for them.
60+
name.contains("test", ignoreCase = true)
61+
}
62+
)
6163
)
6264
}
6365
}

radiography/src/main/java/radiography/internal/RenderTreeString.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ private fun <N> renderRecursively(
3030

3131
nodeDescription.lineSequence().forEachIndexed { index, line ->
3232
builder.appendLinePrefix(depth, continuePreviousLine = index > 0, lastChildMask = lastChildMask)
33-
@Suppress("DEPRECATION")
34-
(builder.appendln(line))
33+
builder.appendLine(line)
3534
}
3635

3736
val lastChildIndex = children.size - 1

sample-compose/build.gradle.kts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
12
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
23

34
plugins {
45
id("com.android.application")
56
kotlin("android")
7+
id("org.jetbrains.kotlin.plugin.compose")
68
}
79

810
android {
@@ -24,10 +26,6 @@ android {
2426
compose = true
2527
}
2628

27-
composeOptions {
28-
kotlinCompilerExtensionVersion = libs.versions.compose.sample.compiler.get()
29-
}
30-
3129
packaging {
3230
resources.excludes += listOf(
3331
"META-INF/AL2.0",
@@ -39,10 +37,10 @@ android {
3937
}
4038

4139
tasks.withType<KotlinCompile> {
42-
kotlinOptions {
43-
jvmTarget = "1.8"
44-
freeCompilerArgs += listOf(
45-
"-Xopt-in=kotlin.RequiresOptIn"
40+
compilerOptions {
41+
jvmTarget.set(JvmTarget.JVM_1_8)
42+
freeCompilerArgs.addAll(
43+
"-opt-in=kotlin.RequiresOptIn"
4644
)
4745
}
4846
}

0 commit comments

Comments
 (0)