Skip to content

Instantly share code, notes, and snippets.

@jmfayard
Last active Sep 22, 2019
Embed
What would you like to do?
Gradle buildSrcVersions
/** buildSrc/src/main/kotlin/Libs.kt **/
object Libs {
const val okhttp = "com.squareup.okhttp3:okhttp:" + Versions.okhttp
const val okio = "com.squareup.okio:okio:" + Versions.okio
//... all others
}
/** buildSrc/src/main/kotlin/Versions.kt **/
object Versions {
const val okhttp = "3.12.1"
const val okio = "2.0.0"
// ...
}
buildscript {
//...
}
plugins {
id("de.fayard.buildSrcVersions") version "0.6.1"
}
// Don't put any code before the buildscript {} and plugins {} block
$ ./gradlew buildSrcVersions
> Task :dependencyUpdates
> Task :buildSrcVersions
new file: buildSrc/build.gradle.kts
new file: buildSrc/.gitignore
new file: buildSrc/src/main/kotlin/Libs.kt
new file: buildSrc/src/main/kotlin/Versions.kt
$ ./gradlew buildSrcVersions
> Task :dependencyUpdates
> Task :buildSrcVersions
modified: buildSrc/src/main/kotlin/Libs.kt
modified: buildSrc/src/main/kotlin/Versions.kt
object Versions {
val moshi = "1.8.0"
val com_squareup_okhttp3 = "3.11.0" // available: "3.12.0"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment