Add gradle versions plugin

This commit is contained in:
Adolfo Santiago 2022-02-19 07:02:00 +01:00
parent bd11774e92
commit ff56c2d78b
No known key found for this signature in database
GPG key ID: 244D6F9A317B4A65
3 changed files with 22 additions and 1 deletions

View file

@ -123,7 +123,7 @@ android {
} }
dependencies { dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"]) implementation fileTree(dir: "libs", include: ["*.jar", "*.aar"])
implementation deps.androidx.appCompat implementation deps.androidx.appCompat
implementation deps.androidx.browser implementation deps.androidx.browser

View file

@ -1,3 +1,5 @@
apply plugin: "com.github.ben-manes.versions"
buildscript { buildscript {
apply from: "versions.gradle" apply from: "versions.gradle"
apply from: "dependencies.gradle" apply from: "dependencies.gradle"
@ -9,6 +11,8 @@ buildscript {
dependencies { dependencies {
classpath deps.androidGradlePlugin classpath deps.androidGradlePlugin
classpath deps.kotlinGradlePlugin classpath deps.kotlinGradlePlugin
classpath "com.github.ben-manes:gradle-versions-plugin:0.42.0"
} }
} }
@ -23,6 +27,16 @@ allprojects {
"-Xlint:-deprecation", "-Xlint:-deprecation",
] ]
} }
apply plugin: com.github.benmanes.gradle.versions.VersionsPlugin
tasks.named("dependencyUpdates").configure {
gradleReleaseChannel = "current"
rejectVersionIf {
isNonStable(it.candidate.version)
}
}
} }
task clean(type: Delete) { task clean(type: Delete) {

View file

@ -129,9 +129,16 @@ deps.timber = "com.jakewharton.timber:timber:${versions.timber}"
// Repository handler // Repository handler
static def addRepos(RepositoryHandler handler) { static def addRepos(RepositoryHandler handler) {
handler.google() handler.google()
handler.gradlePluginPortal()
handler.mavenCentral() handler.mavenCentral()
handler.maven { url "https://jitpack.io" } handler.maven { url "https://jitpack.io" }
handler.maven { url "https://plugins.gradle.org/m2/" } handler.maven { url "https://plugins.gradle.org/m2/" }
} }
static def isNonStable(String version) {
def stableKeyword = ["a", "alpha", "beta", "final", "ga", "m", "release", "rc"].any { it -> version.toLowerCase().contains(it) }
return stableKeyword
}
ext.isNonStable = this.&isNonStable
ext.addRepos = this.&addRepos ext.addRepos = this.&addRepos