Skip to content

Commit

Permalink
Switch Glide's dependencies to a version catalog.
Browse files Browse the repository at this point in the history
Version catalogs are officially supported by Gradle as a way to manage
dependencies. They're also supported by tools like Renovate.

Unfortunately it's only kind of supported by Android Studio, which seems
to prefer toml files over settings.gradle. Since Gradle's docs seem to
be recommending settings.gradle and are usually ahead of Android, I've
chosen to follow Gradle's guidance in the hopes of avoiding a toml ->
settings.gradle migration in the future.
  • Loading branch information
sjudd committed Jul 2, 2023
1 parent 993e59d commit a9a7772
Show file tree
Hide file tree
Showing 35 changed files with 382 additions and 342 deletions.
8 changes: 4 additions & 4 deletions annotation/compiler/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ configurations {
dependencies {
jarjar "com.googlecode.jarjar:jarjar:1.3"

compileOnly "com.squareup:javapoet:${JAVAPOET_VERSION}"
compileOnly "com.google.auto.service:auto-service:${AUTO_SERVICE_VERSION}"
compileOnly "com.google.code.findbugs:jsr305:${JSR_305_VERSION}"
compileOnly libs.javapoet
compileOnly libs.autoservice
compileOnly libs.findbugs.jsr305
implementation project(':annotation')
annotationProcessor "com.google.auto.service:auto-service:${AUTO_SERVICE_VERSION}"
annotationProcessor libs.autoservice
}

javadoc {
Expand Down
18 changes: 9 additions & 9 deletions annotation/compiler/test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ afterEvaluate {
}

android {
compileSdk COMPILE_SDK_VERSION as int
compileSdk libs.versions.compile.sdk.version.get()

defaultConfig {
minSdk MIN_SDK_VERSION as int
targetSdk TARGET_SDK_VERSION as int
minSdk libs.versions.min.sdk.version.get() as int
targetSdk libs.versions.target.sdk.version.get() as int
versionName VERSION_NAME as String
}

Expand All @@ -56,9 +56,9 @@ android {
dependencies {
testImplementation project(':glide')
testImplementation project(':annotation:compiler')
testImplementation "junit:junit:${JUNIT_VERSION}"
testImplementation "com.squareup:javapoet:${JAVAPOET_VERSION}"
testImplementation "com.google.code.findbugs:jsr305:${JSR_305_VERSION}"
testImplementation libs.junit
testImplementation libs.javapoet
testImplementation libs.findbugs.jsr305
// Using 0.10 of compile-testing is required for Android Studio to function, but not for the
// gradle build. Not yet clear why, but it looks like some kind of version conflict between
// javapoet, guava and/or truth.
Expand All @@ -68,13 +68,13 @@ dependencies {
// confusing.
exclude group: "com.google.auto.value", module: "auto-value"
}
testImplementation "androidx.annotation:annotation:${ANDROID_X_ANNOTATION_VERSION}"
testImplementation "androidx.fragment:fragment:${ANDROID_X_FRAGMENT_VERSION}"
testImplementation libs.androidx.annotation
testImplementation libs.androidx.fragment
// TODO: Find some way to include a similar dependency on java 9+ and re-enable these tests in gradle.
// testImplementation files(Jvm.current().getJre().homeDir.getAbsolutePath()+'/lib/rt.jar')

testAnnotationProcessor project(':annotation:compiler')
testAnnotationProcessor "com.google.auto.service:auto-service:${AUTO_SERVICE_VERSION}"
testAnnotationProcessor libs.autoservice
}

task regenerateTestResources {
Expand Down
8 changes: 4 additions & 4 deletions annotation/ksp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ plugins {
}

dependencies {
implementation("com.squareup:kotlinpoet:1.12.0")
implementation libs.kotlinpoet
implementation project(":annotation")
implementation 'com.google.devtools.ksp:symbol-processing-api:1.7.0-1.0.6'
ksp("dev.zacsweers.autoservice:auto-service-ksp:1.0.0")
implementation("com.google.auto.service:auto-service-annotations:1.0.1")
implementation libs.ksp
implementation libs.autoservice.annotations
ksp libs.ksp.autoservice
}

apply from: "${rootProject.projectDir}/scripts/upload.gradle"
14 changes: 7 additions & 7 deletions annotation/ksp/integrationtest/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,24 @@ plugins {
}

android {
compileSdkVersion COMPILE_SDK_VERSION as int
compileSdkVersion libs.versions.compile.sdk.version.get()

defaultConfig {
minSdkVersion MIN_SDK_VERSION as int
targetSdkVersion TARGET_SDK_VERSION as int
minSdk libs.versions.min.sdk.version.get() as int
targetSdk libs.versions.target.sdk.version.get() as int
versionName VERSION_NAME as String
}
}

dependencies {
implementation "junit:junit:$JUNIT_VERSION"
implementation libs.junit
testImplementation project(":annotation:ksp:test")
testImplementation project(":annotation:ksp")
testImplementation project(":annotation")
testImplementation project(":glide")
testImplementation project(":integration:okhttp3")
testImplementation "com.github.tschuchortdev:kotlin-compile-testing-ksp:${KOTLIN_COMPILE_TESTING_VERSION}"
testImplementation "com.google.truth:truth:${TRUTH_VERSION}"
testImplementation "org.jetbrains.kotlin:kotlin-test:${JETBRAINS_KOTLIN_TEST_VERSION}"
testImplementation libs.ksp.compiletesting
testImplementation libs.truth
testImplementation libs.kotlin.test
testImplementation project(path: ':annotation:ksp:test')
}
14 changes: 7 additions & 7 deletions annotation/ksp/test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@ plugins {
}

android {
compileSdkVersion COMPILE_SDK_VERSION as int
compileSdkVersion libs.versions.compile.sdk.version.get()

defaultConfig {
minSdkVersion MIN_SDK_VERSION as int
targetSdkVersion TARGET_SDK_VERSION as int
minSdk libs.versions.min.sdk.version.get() as int
targetSdk libs.versions.target.sdk.version.get() as int
versionName VERSION_NAME as String
}
}

dependencies {
implementation "junit:junit:$JUNIT_VERSION"
implementation libs.junit
implementation project(":annotation:ksp")
implementation "com.github.tschuchortdev:kotlin-compile-testing-ksp:${KOTLIN_COMPILE_TESTING_VERSION}"
implementation "com.google.truth:truth:${TRUTH_VERSION}"
implementation libs.ksp.compiletesting
implementation libs.truth
testImplementation project(":annotation:ksp")
testImplementation project(":annotation")
testImplementation project(":glide")
testImplementation "org.jetbrains.kotlin:kotlin-test:${JETBRAINS_KOTLIN_TEST_VERSION}"
testImplementation libs.kotlin.test
}
15 changes: 8 additions & 7 deletions benchmark/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ plugins {
}

android {
compileSdk COMPILE_SDK_VERSION as int
compileSdkVersion libs.versions.compile.sdk.version.get()

buildToolsVersion "30.0.3"

compileOptions {
Expand All @@ -14,7 +15,7 @@ android {

defaultConfig {
minSdk 19
targetSdk TARGET_SDK_VERSION as int
targetSdk libs.versions.target.sdk.version.get() as int
versionCode 1
versionName "1.0"

Expand All @@ -32,12 +33,12 @@ android {
}

dependencies {
androidTestImplementation "androidx.test:runner:${ANDROID_X_TEST_RUNNER_VERSION}"
androidTestImplementation "androidx.test.ext:junit:${ANDROID_X_TEST_JUNIT_VERSION}"
androidTestImplementation "junit:junit:{$JUNIT_VERSION}"
androidTestImplementation libs.androidx.test.runner
androidTestImplementation libs.androidx.junit
androidTestImplementation libs.junit

androidTestImplementation project(':library')
androidTestImplementation project(':testutil')
androidTestImplementation "androidx.benchmark:benchmark-junit4:${ANDROID_X_BENCHMARK_VERSION}"
androidTestImplementation "com.google.guava:guava:${GUAVA_VERSION}"
androidTestImplementation libs.androidx.benchmark.junit
androidTestImplementation libs.guava
}
18 changes: 9 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ buildscript {
}

dependencies {
classpath "com.android.tools.build:gradle:$ANDROID_GRADLE_VERSION"
classpath libs.android.gradle
if (!hasProperty('DISABLE_ERROR_PRONE')) {
classpath "net.ltgt.gradle:gradle-errorprone-plugin:$ERROR_PRONE_PLUGIN_VERSION"
classpath libs.errorprone.gradle
}
classpath 'com.guardsquare:proguard-gradle:7.1.0'
classpath "se.bjurr.violations:violations-gradle-plugin:$VIOLATIONS_PLUGIN_VERSION"
classpath "androidx.benchmark:benchmark-gradle-plugin:$ANDROID_X_BENCHMARK_VERSION"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$JETBRAINS_KOTLIN_VERSION"
classpath "com.google.devtools.ksp:com.google.devtools.ksp.gradle.plugin:$KSP_GRADLE_PLUGIN_VERSION"
classpath "org.jetbrains.kotlinx:binary-compatibility-validator:$JETBRAINS_KOTLINX_BINARY_COMPATIBILITY_VALIDATOR_VERSION"
classpath "org.jetbrains.dokka:dokka-gradle-plugin:$JETBRAINS_DOKKA_VERSION"
classpath libs.proguard.gradle
classpath libs.violations
classpath libs.androidx.benchmark.gradle
classpath libs.kotlin.gradle
classpath libs.ksp.gradle
classpath libs.coroutines.binarycompat.gradle
classpath libs.dokka.gradle
}
}

Expand Down
72 changes: 2 additions & 70 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -40,76 +40,8 @@ org.gradle.daemon=true
org.gradle.jvmargs=-Xmx4096M
TEST_JVM_MEMORY_SIZE=4096M

## Glide versioning
## Glide versioning - these may be overwritten in lower level gradle.properties files
VERSION_MAJOR=4
VERSION_MINOR=16
VERSION_PATCH=0
VERSION_NAME=4.16.0-SNAPSHOT

## SDK versioning
COMPILE_SDK_VERSION=33
MIN_SDK_VERSION=14
OK_HTTP_4_MIN_SDK_VERSION=21
TARGET_SDK_VERSION=32

## AndroidX versions
ANDROID_X_ANNOTATION_VERSION=1.3.0
ANDROID_X_APPCOMPAT_VERSION=1.3.1
ANDROID_X_BENCHMARK_VERSION=1.1.0
ANDROID_X_CARDVIEW_VERSION=1.0.0
ANDROID_X_COMPOSE_VERSION=1.3.2
ANDROID_X_COMPOSE_FOUNDATION_VERSION=1.3.1
ANDROID_X_COMPOSE_MATERIAL_VERSION=1.3.1
ANDROID_X_CONCURRENT_FUTURES_VERSION=1.1.0
ANDROID_X_CORE_VERSION=1.6.0
ANDROID_X_EXIF_INTERFACE_VERSION=1.3.3
# At least versions 1.5 and later require java 8 desugaring, which Glide can't
# currently use, so we're stuck on an older version.
ANDROID_X_FRAGMENT_VERSION=1.3.6
ANDROID_X_RECYCLERVIEW_VERSION=1.2.1
ANDROID_X_TEST_CORE_VERSION=1.4.0
ANDROID_X_TEST_ESPRESSO_VERSION=3.4.0
ANDROID_X_TEST_JUNIT_VERSION=1.1.3
ANDROID_X_TEST_RULES_VERSION=1.4.0
ANDROID_X_TEST_RUNNER_VERSION=1.4.0
ANDROID_X_TEST_CORE_KTX_VERSION=1.4.0
ANDROID_X_TEST_JUNIT_KTX_VERSION=1.1.3
ANDROID_X_TRACING_VERSION=1.0.0
ANDROID_X_VECTOR_DRAWABLE_ANIMATED_VERSION=1.1.0
ANDROID_X_CORE_KTX_VERSION=1.8.0
ANDROID_X_LIFECYCLE_KTX_VERSION=2.4.1

ANDROID_SUPPORT_MULTIDEX_VERSION=1.0.3

# org.jetbrains versions
JETBRAINS_KOTLINX_COROUTINES_VERSION=1.6.4
JETBRAINS_KOTLINX_COROUTINES_TEST_VERSION=1.6.4
JETBRAINS_KOTLIN_VERSION=1.7.0
JETBRAINS_KOTLIN_TEST_VERSION=1.7.0
JETBRAINS_KOTLINX_BINARY_COMPATIBILITY_VALIDATOR_VERSION=0.11.0
JETBRAINS_DOKKA_VERSION=1.7.10

## Other dependency versions
ACCOMPANIEST_VERSION=0.25.1
ANDROID_GRADLE_VERSION=7.3.0
AUTO_SERVICE_VERSION=1.0-rc3
KOTLIN_COMPILE_TESTING_VERSION=1.4.9
DAGGER_VERSION=2.15
ERROR_PRONE_PLUGIN_VERSION=2.0.2
ERROR_PRONE_VERSION=2.18.0
GUAVA_TESTLIB_VERSION=18.0
GUAVA_VERSION=28.1-android
JAVAPOET_VERSION=1.9.0
JSR_305_VERSION=3.0.2
JUNIT_VERSION=4.13.2
KSP_GRADLE_PLUGIN_VERSION=1.7.0-1.0.6
MOCKITO_ANDROID_VERSION=5.3.1
MOCKITO_VERSION=5.3.1
MOCKWEBSERVER_VERSION=3.0.0-RC1
OK_HTTP_VERSION=3.10.0
OK_HTTP_4_VERSION=4.10.0
PMD_VERSION=6.0.0
ROBOLECTRIC_VERSION=4.8.1
TRUTH_VERSION=1.1.3
VIOLATIONS_PLUGIN_VERSION=1.8
VOLLEY_VERSION=1.2.0
VERSION_NAME=4.16.0-SNAPSHOT
30 changes: 15 additions & 15 deletions instrumentation/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,34 @@ apply plugin: 'com.android.application'
dependencies {
annotationProcessor project(":annotation:compiler")
implementation project(":library")
implementation "com.android.support:multidex:$ANDROID_SUPPORT_MULTIDEX_VERSION"
implementation "androidx.appcompat:appcompat:$ANDROID_X_APPCOMPAT_VERSION"
implementation libs.android.support.multidex
implementation libs.androidx.appcompat

androidTestImplementation project(':library')
androidTestImplementation project(':mocks')
androidTestImplementation project(':testutil')
androidTestImplementation "org.mockito:mockito-android:$MOCKITO_ANDROID_VERSION"
androidTestImplementation "androidx.test.ext:junit:$ANDROID_X_TEST_JUNIT_VERSION"
androidTestImplementation "androidx.test:rules:$ANDROID_X_TEST_RULES_VERSION"
androidTestImplementation "androidx.test:core:$ANDROID_X_TEST_CORE_VERSION"
androidTestImplementation "androidx.test.espresso.idling:idling-concurrent:$ANDROID_X_TEST_ESPRESSO_VERSION"
androidTestImplementation "androidx.test.espresso:espresso-core:$ANDROID_X_TEST_ESPRESSO_VERSION"
androidTestImplementation "com.google.truth:truth:$TRUTH_VERSION"
androidTestImplementation "junit:junit:$JUNIT_VERSION"
androidTestImplementation "androidx.exifinterface:exifinterface:$ANDROID_X_EXIF_INTERFACE_VERSION"
androidTestImplementation libs.mockito.android
androidTestImplementation libs.androidx.junit
androidTestImplementation libs.androidx.test.rules
androidTestImplementation libs.androidx.test.core
androidTestImplementation libs.androidx.espresso.idling
androidTestImplementation libs.androidx.espresso
androidTestImplementation libs.truth
androidTestImplementation libs.junit
androidTestImplementation libs.androidx.exifinterface

// Not totally clear why this is required, but it seems to be missing when tests are run on
// 4.1.2 and 4.2.0 emulators.
androidTestImplementation "com.google.code.findbugs:jsr305:$JSR_305_VERSION"
androidTestImplementation libs.findbugs.jsr305
}

android {
compileSdk COMPILE_SDK_VERSION as int
compileSdkVersion libs.versions.compile.sdk.version.get()

defaultConfig {
applicationId 'com.bumptech.glide.instrumentation'
minSdk MIN_SDK_VERSION as int
targetSdk TARGET_SDK_VERSION as int
minSdk libs.versions.min.sdk.version.get() as int
targetSdk libs.versions.target.sdk.version.get() as int
versionCode 1
versionName '1.0'
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand Down
8 changes: 4 additions & 4 deletions integration/avif/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ apply plugin: 'com.android.library'
dependencies {
implementation project(':library')
implementation 'org.aomedia.avif.android:avif:0.11.1.3c786d2'
implementation "com.google.guava:guava:${GUAVA_VERSION}"
implementation libs.guava

annotationProcessor project(':annotation:compiler')
}

android {
compileSdk COMPILE_SDK_VERSION as int
compileSdkVersion libs.versions.compile.sdk.version.get()

defaultConfig {
minSdk MIN_SDK_VERSION as int
targetSdk TARGET_SDK_VERSION as int
minSdk libs.versions.min.sdk.version.get() as int
targetSdk libs.versions.target.sdk.version.get() as int

versionName VERSION_NAME as String
}
Expand Down
24 changes: 12 additions & 12 deletions integration/compose/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,19 @@ dependencies {
implementation(project(':integration:recyclerview')) {
transitive = false
}
implementation "androidx.compose.foundation:foundation:$ANDROID_X_COMPOSE_FOUNDATION_VERSION"
implementation "androidx.compose.ui:ui:$ANDROID_X_COMPOSE_VERSION"
implementation "com.google.accompanist:accompanist-drawablepainter:$ACCOMPANIEST_VERSION"
implementation "androidx.core:core-ktx:$ANDROID_X_CORE_KTX_VERSION"
debugImplementation "androidx.compose.ui:ui-test-manifest:$ANDROID_X_COMPOSE_VERSION"
androidTestImplementation "junit:junit:$JUNIT_VERSION"
androidTestImplementation "androidx.compose.ui:ui-test-junit4:$ANDROID_X_COMPOSE_VERSION"
androidTestImplementation "androidx.test.espresso:espresso-core:$ANDROID_X_TEST_ESPRESSO_VERSION"
androidTestImplementation "androidx.test.espresso.idling:idling-concurrent:$ANDROID_X_TEST_ESPRESSO_VERSION"
androidTestImplementation "androidx.test.ext:junit:$ANDROID_X_TEST_JUNIT_VERSION"
androidTestImplementation "androidx.compose.material:material:$ANDROID_X_COMPOSE_MATERIAL_VERSION"
implementation libs.compose.foundation
implementation libs.compose.ui
implementation libs.drawablepainter
implementation libs.androidx.core.ktx
debugImplementation libs.compose.ui.testmanifest
androidTestImplementation libs.junit
androidTestImplementation libs.compose.ui.testjunit4
androidTestImplementation libs.androidx.espresso
androidTestImplementation libs.androidx.espresso.idling
androidTestImplementation libs.androidx.junit
androidTestImplementation libs.compose.material
androidTestImplementation libs.truth
androidTestImplementation project(':testutil')
androidTestImplementation "com.google.truth:truth:${TRUTH_VERSION}"
}

apply from: "${rootProject.projectDir}/scripts/upload.gradle"
Loading

0 comments on commit a9a7772

Please sign in to comment.