Skip to content

Commit c386dde

Browse files
Migrate to version catalogs.
1 parent 6f06c06 commit c386dde

File tree

9 files changed

+120
-117
lines changed

9 files changed

+120
-117
lines changed

build.gradle.kts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
2121
import org.jlleitschuh.gradle.ktlint.KtlintExtension
2222
import org.jlleitschuh.gradle.ktlint.reporter.ReporterType
2323

24-
println("Building with Kotlin compiler version ${Versions.KotlinCompiler}")
24+
println("Building with Kotlin compiler version ${libs.versions.kotlin.get()}")
2525

2626
buildscript {
2727
repositories {
@@ -33,14 +33,14 @@ buildscript {
3333
}
3434

3535
dependencies {
36-
classpath(Dependencies.Build.Android)
37-
classpath(Dependencies.Build.MavenPublish)
38-
classpath(Dependencies.Build.Kotlin)
39-
classpath(Dependencies.Build.Ktlint)
40-
classpath(Dependencies.Build.BinaryCompatibility)
36+
classpath(libs.build.android)
37+
classpath(libs.build.mavenPublish)
38+
classpath(libs.build.kotlin)
39+
classpath(libs.build.ktlint)
40+
classpath(libs.build.binaryCompatibility)
4141
// Required for the gradle-maven-publish-plugin plugin.
4242
// See https://github.com/vanniktech/gradle-maven-publish-plugin/issues/205.
43-
classpath(Dependencies.Build.Dokka)
43+
classpath(libs.build.dokka)
4444
}
4545
}
4646

buildSrc/build.gradle.kts

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

buildSrc/src/main/java/Dependencies.kt

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

compose-tests/build.gradle.kts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ android {
2525
}
2626

2727
composeOptions {
28-
kotlinCompilerExtensionVersion = Versions.ComposeCompiler
28+
kotlinCompilerExtensionVersion = libs.versions.compose.compiler.get()
2929
}
3030

3131
packaging {
@@ -49,11 +49,11 @@ tasks.withType<KotlinCompile> {
4949

5050
dependencies {
5151
androidTestImplementation(project(":radiography"))
52-
androidTestImplementation(Dependencies.AppCompat)
53-
androidTestImplementation(Dependencies.Compose().Material)
54-
androidTestImplementation(Dependencies.Compose().Testing)
55-
androidTestImplementation(Dependencies.Compose().Tooling)
56-
androidTestImplementation(Dependencies.InstrumentationTests.Rules)
57-
androidTestImplementation(Dependencies.InstrumentationTests.Runner)
58-
androidTestImplementation(Dependencies.Truth)
52+
androidTestImplementation(libs.appCompat)
53+
androidTestImplementation(libs.compose.material)
54+
androidTestImplementation(libs.compose.testing)
55+
androidTestImplementation(libs.compose.tooling)
56+
androidTestImplementation(libs.test.androidx.rules)
57+
androidTestImplementation(libs.test.androidx.runner)
58+
androidTestImplementation(libs.test.truth)
5959
}

compose-unsupported-tests/build.gradle.kts

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,6 @@ plugins {
55
kotlin("android")
66
}
77

8-
/**
9-
* Allows using a different version of Compose to validate that we degrade gracefully on apps
10-
* built with unsupported Compose versions.
11-
*/
12-
val oldComposeVersion = "1.3.0"
13-
148
android {
159
compileSdk = 34
1610

@@ -31,7 +25,7 @@ android {
3125
}
3226

3327
composeOptions {
34-
kotlinCompilerExtensionVersion = Versions.ComposeCompiler
28+
kotlinCompilerExtensionVersion = libs.versions.compose.compiler.get()
3529
}
3630

3731
packaging {
@@ -55,12 +49,12 @@ tasks.withType<KotlinCompile> {
5549

5650
dependencies {
5751
androidTestImplementation(project(":radiography"))
58-
androidTestImplementation(Dependencies.AppCompat)
59-
androidTestImplementation(Dependencies.Compose().Activity("1.3.0-alpha02"))
60-
androidTestImplementation(Dependencies.Compose(oldComposeVersion).Material)
61-
androidTestImplementation(Dependencies.Compose(oldComposeVersion).Testing)
62-
androidTestImplementation(Dependencies.InstrumentationTests.Rules)
63-
androidTestImplementation(Dependencies.InstrumentationTests.JUnit)
64-
androidTestImplementation(Dependencies.InstrumentationTests.Runner)
65-
androidTestImplementation(Dependencies.Truth)
52+
androidTestImplementation(libs.appCompat)
53+
androidTestImplementation(libs.compose.old.activity)
54+
androidTestImplementation(libs.compose.old.material)
55+
androidTestImplementation(libs.compose.old.testing)
56+
androidTestImplementation(libs.test.androidx.rules)
57+
androidTestImplementation(libs.test.junit)
58+
androidTestImplementation(libs.test.androidx.runner)
59+
androidTestImplementation(libs.test.truth)
6660
}

gradle/libs.versions.toml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
[versions]
2+
3+
agp = "8.1.2"
4+
kotlin = "1.9.10"
5+
androidx-test = "1.5.0"
6+
compose-compiler = "1.5.3"
7+
8+
# We compile against an older version of Compose intentionally to support consumers that aren't on
9+
# the latest.
10+
#noinspection GradleDependency
11+
compose = "1.7.0-beta05"
12+
# Allows using a different version of Compose to validate that we degrade gracefully on apps
13+
# built with unsupported Compose versions.
14+
#noinspection GradleDependency
15+
compose-old = "1.3.0"
16+
# Use a separate property for the sample so we can test with different versions easily.
17+
compose-sample = "1.6.8"
18+
compose-sample-compiler = "1.5.3"
19+
20+
[libraries]
21+
22+
build-android = "com.android.tools.build:gradle:8.1.2"
23+
build-mavenPublish = "com.vanniktech:gradle-maven-publish-plugin:0.25.3"
24+
build-kotlin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
25+
build-ktlint = "org.jlleitschuh.gradle:ktlint-gradle:11.6.1"
26+
build-binaryCompatibility = "org.jetbrains.kotlinx:binary-compatibility-validator:0.6.0"
27+
build-dokka = "org.jetbrains.dokka:dokka-gradle-plugin:1.9.10"
28+
29+
appCompat = "androidx.appcompat:appcompat:1.3.1"
30+
constraintLayout = "androidx.constraintlayout:constraintlayout:2.1.0"
31+
curtains = "com.squareup.curtains:curtains:1.2.2"
32+
33+
compose-activity = "androidx.activity:activity-compose:1.3.1"
34+
#noinspection SimilarGradleDependency
35+
compose-material = { module = "androidx.compose.material:material", version.ref = "compose" }
36+
#noinspection SimilarGradleDependency
37+
compose-testing = { module = "androidx.compose.ui:ui-test-junit4", version.ref = "compose" }
38+
#noinspection SimilarGradleDependency
39+
compose-tooling = { module = "androidx.compose.ui:ui-tooling", version.ref = "compose" }
40+
compose-toolingData = { module = "androidx.compose.ui:ui-tooling-data", version.ref = "compose" }
41+
42+
#noinspection SimilarGradleDependency
43+
compose-sample-activity = "androidx.activity:activity-compose:1.3.1"
44+
#noinspection SimilarGradleDependency
45+
compose-sample-material = { module = "androidx.compose.material:material", version.ref = "compose-sample" }
46+
#noinspection SimilarGradleDependency
47+
compose-sample-testing = { module = "androidx.compose.ui:ui-test-junit4", version.ref = "compose-sample" }
48+
#noinspection SimilarGradleDependency
49+
compose-sample-tooling = { module = "androidx.compose.ui:ui-tooling", version.ref = "compose-sample" }
50+
51+
#noinspection SimilarGradleDependency
52+
compose-old-activity = "androidx.activity:activity-compose:1.3.0-alpha02"
53+
#noinspection SimilarGradleDependency
54+
compose-old-material = { module = "androidx.compose.material:material", version.ref = "compose-old" }
55+
#noinspection SimilarGradleDependency
56+
compose-old-testing = { module = "androidx.compose.ui:ui-test-junit4", version.ref = "compose-old" }
57+
58+
test-junit = "junit:junit:4.13"
59+
test-mockito = "org.mockito:mockito-core:3.11.2"
60+
test-robolectric = "org.robolectric:robolectric:4.10.3"
61+
test-truth = "com.google.truth:truth:1.1.3"
62+
test-androidx-core = { module = "androidx.test:core", version.ref = "androidx-test" }
63+
test-androidx-espresso = "androidx.test.espresso:espresso-core:3.5.1"
64+
test-androidx-junit = "androidx.test.ext:junit:1.1.5"
65+
test-androidx-orchestrator = "androidx.test:orchestrator:1.4.2"
66+
test-androidx-rules = { module = "androidx.test:rules", version.ref = "androidx-test" }
67+
test-androidx-runner = { module = "androidx.test:runner", version.ref = "androidx-test" }

radiography/build.gradle.kts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -63,20 +63,20 @@ tasks.withType<KotlinCompile> {
6363
}
6464

6565
dependencies {
66-
implementation(Dependencies.Curtains)
66+
implementation(libs.curtains)
6767
// We don't want to bring any Compose dependencies in unless the consumer of this library is
6868
// bringing them in itself.
69-
compileOnly(Dependencies.Compose().ToolingData)
69+
compileOnly(libs.compose.toolingData)
7070

71-
testImplementation(Dependencies.JUnit)
72-
testImplementation(Dependencies.Mockito)
73-
testImplementation(Dependencies.Robolectric)
74-
testImplementation(Dependencies.Truth)
71+
testImplementation(libs.test.junit)
72+
testImplementation(libs.test.mockito)
73+
testImplementation(libs.test.robolectric)
74+
testImplementation(libs.test.truth)
7575

76-
androidTestImplementation(Dependencies.InstrumentationTests.Core)
77-
androidTestImplementation(Dependencies.InstrumentationTests.Espresso)
78-
androidTestImplementation(Dependencies.InstrumentationTests.Rules)
79-
androidTestImplementation(Dependencies.InstrumentationTests.Runner)
80-
androidTestImplementation(Dependencies.Truth)
81-
androidTestUtil(Dependencies.InstrumentationTests.Orchestrator)
76+
androidTestImplementation(libs.test.androidx.core)
77+
androidTestImplementation(libs.test.androidx.espresso)
78+
androidTestImplementation(libs.test.androidx.rules)
79+
androidTestImplementation(libs.test.androidx.runner)
80+
androidTestImplementation(libs.test.truth)
81+
androidTestUtil(libs.test.androidx.orchestrator)
8282
}

sample-compose/build.gradle.kts

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ plugins {
55
kotlin("android")
66
}
77

8-
/** Use a separate property for the sample so we can test with different versions easily. */
9-
val sampleComposeVersion = "1.6.8"
10-
val sampleComposeCompilerVersion = "1.5.3"
11-
128
android {
139
compileSdk = 34
1410

@@ -29,7 +25,7 @@ android {
2925
}
3026

3127
composeOptions {
32-
kotlinCompilerExtensionVersion = sampleComposeCompilerVersion
28+
kotlinCompilerExtensionVersion = libs.versions.compose.sample.compiler.get()
3329
}
3430

3531
packaging {
@@ -53,12 +49,12 @@ tasks.withType<KotlinCompile> {
5349

5450
dependencies {
5551
implementation(project(":radiography"))
56-
implementation(Dependencies.AppCompat)
57-
implementation(Dependencies.Compose(sampleComposeVersion).Activity())
58-
implementation(Dependencies.Compose(sampleComposeVersion).Material)
59-
implementation(Dependencies.Compose(sampleComposeVersion).Tooling)
60-
61-
androidTestImplementation(Dependencies.Compose(sampleComposeVersion).Testing)
62-
androidTestImplementation(Dependencies.InstrumentationTests.Rules)
63-
androidTestImplementation(Dependencies.InstrumentationTests.Runner)
52+
implementation(libs.appCompat)
53+
implementation(libs.compose.sample.activity)
54+
implementation(libs.compose.sample.material)
55+
implementation(libs.compose.sample.tooling)
56+
57+
androidTestImplementation(libs.compose.sample.testing)
58+
androidTestImplementation(libs.test.androidx.rules)
59+
androidTestImplementation(libs.test.androidx.runner)
6460
}

sample/build.gradle.kts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ android {
3939

4040
dependencies {
4141
implementation(project(":radiography"))
42-
implementation(Dependencies.AppCompat)
43-
implementation(Dependencies.ConstraintLayout)
42+
implementation(libs.appCompat)
43+
implementation(libs.constraintLayout)
4444

45-
androidTestImplementation(Dependencies.InstrumentationTests.Core)
46-
androidTestImplementation(Dependencies.InstrumentationTests.Espresso)
47-
androidTestImplementation(Dependencies.InstrumentationTests.Rules)
48-
androidTestImplementation(Dependencies.InstrumentationTests.JUnit)
49-
androidTestImplementation(Dependencies.InstrumentationTests.Runner)
50-
androidTestImplementation(Dependencies.Truth)
45+
androidTestImplementation(libs.test.androidx.core)
46+
androidTestImplementation(libs.test.androidx.espresso)
47+
androidTestImplementation(libs.test.androidx.rules)
48+
androidTestImplementation(libs.test.androidx.junit)
49+
androidTestImplementation(libs.test.androidx.runner)
50+
androidTestImplementation(libs.test.truth)
5151
}

0 commit comments

Comments
 (0)