Skip to content

Instantly share code, notes, and snippets.

@laithnurie
Created September 16, 2022 15:59
Show Gist options
  • Save laithnurie/fa3b9493ee937c6d35de6b8118dc3ca2 to your computer and use it in GitHub Desktop.
Save laithnurie/fa3b9493ee937c6d35de6b8118dc3ca2 to your computer and use it in GitHub Desktop.
Version catalog android
def isNonStable = { String version ->
def stableKeyword = ['RELEASE', 'FINAL', 'GA'].any { it -> version.toUpperCase().contains(it) }
def regex = /^[0-9,.v-]+$/
return !stableKeyword && !(version ==~ regex)
}
dependencyUpdates {
resolutionStrategy {
componentSelection {
all {
if (isNonStable(it.candidate.version) && !isNonStable(it.currentVersion)) {
reject('Release candidate')
}
}
}
}
}
versionCatalogUpdate {
// https://github.com/littlerobots/version-catalog-update-plugin
sortByKey = true
pin {
groups = [
"org.jetbrains.kotlin", // Compose requires a specific version of kotlin, so we need to update both of them together
// "androidx.compose.ui", // See the first
]
versions = ["kotlin-version"]
}
keep {
keepUnusedVersions = true
// keepUnusedLibraries = true
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment