Skip to content

Instantly share code, notes, and snippets.

@jmfayard
Last active September 22, 2019 05:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmfayard/4db385d27b41cf2e14b57067cc825df2 to your computer and use it in GitHub Desktop.
Save jmfayard/4db385d27b41cf2e14b57067cc825df2 to your computer and use it in GitHub Desktop.
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