Skip to content

Commit 12d54f8

Browse files
authored
Merge pull request #648 from square/rick/libs_versions_toml
migrate dependency definitions to version catalogs
2 parents 76b488e + 7c8ac9c commit 12d54f8

File tree

42 files changed

+568
-483
lines changed

Some content is hidden

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

42 files changed

+568
-483
lines changed

.buildscript/android-sample-app.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ dependencies {
66
implementation(project(":workflow-core"))
77
implementation(project(":workflow-runtime"))
88

9-
implementation(Deps.get("androidx.appcompat"))
10-
implementation(Deps.get("timber"))
9+
implementation(libs.androidx.appcompat)
10+
implementation(libs.timber)
1111
}

.buildscript/android-ui-tests.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ android {
1111

1212
dependencies {
1313
androidTestImplementation project(":workflow-ui:internal-testing-android")
14-
androidTestImplementation Deps.get("test.androidx.espresso.core")
15-
androidTestImplementation Deps.get("test.androidx.junitExt")
16-
androidTestImplementation Deps.get("test.leakcanaryInstrumentation")
14+
androidTestImplementation(libs.androidx.test.espresso.core)
15+
androidTestImplementation(libs.androidx.test.junit)
16+
androidTestImplementation(libs.squareup.leakcanary.instrumentation)
1717
}

build.gradle.kts

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ import org.jlleitschuh.gradle.ktlint.reporter.ReporterType
55

66
buildscript {
77
dependencies {
8-
classpath(Dependencies.android_gradle_plugin)
9-
classpath(Dependencies.dokka)
10-
classpath(Dependencies.Jmh.gradlePlugin)
11-
classpath(Dependencies.Kotlin.binaryCompatibilityValidatorPlugin)
12-
classpath(Dependencies.Kotlin.gradlePlugin)
13-
classpath(Dependencies.Kotlin.Serialization.gradlePlugin)
14-
classpath(Dependencies.ksp)
15-
classpath(Dependencies.ktlint)
16-
classpath(Dependencies.mavenPublish)
8+
classpath(libs.android.gradle.plugin)
9+
classpath(libs.jmh.gradle.plugin)
10+
classpath(libs.dokka.gradle.plugin)
11+
classpath(libs.kotlin.serialization.gradle.plugin)
12+
classpath(libs.kotlinx.binaryCompatibility.gradle.plugin)
13+
classpath(libs.kotlin.gradle.plugin)
14+
classpath(libs.google.ksp)
15+
classpath(libs.ktlint.gradle)
16+
classpath(libs.vanniktech.publish)
1717
}
1818

1919
repositories {
@@ -29,17 +29,13 @@ buildscript {
2929
val isRunningFromIde get() = project.properties["android.injected.invoked.from.ide"] == "true"
3030

3131
subprojects {
32-
repositories {
33-
google()
34-
mavenCentral()
35-
}
3632

3733
apply(plugin = "org.jlleitschuh.gradle.ktlint")
3834
afterEvaluate {
3935
configurations.configureEach {
4036
// There could be transitive dependencies in tests with a lower version. This could cause
4137
// problems with a newer Kotlin version that we use.
42-
resolutionStrategy.force(Dependencies.Kotlin.reflect)
38+
resolutionStrategy.force(libs.kotlin.reflect)
4339
}
4440
}
4541

@@ -100,9 +96,6 @@ allprojects.filterNot { it.path.startsWith(":samples") }
10096
// This plugin needs to be applied to the root projects for the dokkaGfmCollector task we use to
10197
// generate the documentation site.
10298
apply(plugin = "org.jetbrains.dokka")
103-
repositories {
104-
mavenCentral()
105-
}
10699

107100
// Configuration that applies to all dokka tasks, both those used for generating javadoc artifacts
108101
// and the documentation site.
@@ -124,6 +117,20 @@ subprojects {
124117
}
125118
}
126119

120+
allprojects {
121+
122+
configurations.all {
123+
resolutionStrategy.eachDependency {
124+
// This ensures that any time a dependency has a transitive dependency upon androidx.lifecycle,
125+
// it uses the same version as the rest of the project. This is crucial, since Androidx
126+
// libraries are never in sync and lifecycle 2.4.0 introduced api-breaking changes.
127+
if (requested.group == "androidx.lifecycle") {
128+
useVersion(libs.versions.androidx.lifecycle.get())
129+
}
130+
}
131+
}
132+
}
133+
127134
// This task is invoked by the documentation site generator script in the main workflow project (not
128135
// in this repo), which also expects the generated files to be in a specific location. Both the task
129136
// name and destination directory are defined in this script:

buildSrc/settings.gradle.kts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
enableFeaturePreview("VERSION_CATALOGS")
2+
3+
dependencyResolutionManagement {
4+
5+
@Suppress("UnstableApiUsage")
6+
versionCatalogs {
7+
8+
create("libs") {
9+
// Re-use the version catalog file from the main project
10+
from(files("../gradle/libs.versions.toml"))
11+
}
12+
}
13+
}

buildSrc/src/main/java/Dependencies.kt

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

buildSrc/src/main/java/Versions.kt

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

0 commit comments

Comments
 (0)