build-logic: introduce versions plugin
This commit is contained in:
parent
83fc3e6b87
commit
8a9ebf3f7e
6 changed files with 47 additions and 0 deletions
|
@ -50,6 +50,10 @@ gradlePlugin {
|
|||
id = "com.github.android-password-store.spotless"
|
||||
implementationClass = "dev.msfjarvis.aps.gradle.SpotlessPlugin"
|
||||
}
|
||||
register("versions") {
|
||||
id = "com.github.android-password-store.versions"
|
||||
implementationClass = "dev.msfjarvis.aps.gradle.DependencyUpdatesPlugin"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -58,4 +62,6 @@ dependencies {
|
|||
implementation(libs.build.binarycompat)
|
||||
implementation(libs.build.kotlin)
|
||||
implementation(libs.build.spotless)
|
||||
implementation(libs.build.vcu)
|
||||
implementation(libs.build.versions)
|
||||
}
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
package dev.msfjarvis.aps.gradle
|
||||
|
||||
import com.github.benmanes.gradle.versions.VersionsPlugin
|
||||
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
|
||||
import nl.littlerobots.vcu.plugin.VersionCatalogUpdateExtension
|
||||
import nl.littlerobots.vcu.plugin.VersionCatalogUpdatePlugin
|
||||
import org.gradle.api.Plugin
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.kotlin.dsl.apply
|
||||
import org.gradle.kotlin.dsl.getByType
|
||||
import org.gradle.kotlin.dsl.withType
|
||||
|
||||
@Suppress("Unused")
|
||||
class DependencyUpdatesPlugin : Plugin<Project> {
|
||||
override fun apply(project: Project) {
|
||||
project.pluginManager.apply(VersionsPlugin::class)
|
||||
project.pluginManager.apply(VersionCatalogUpdatePlugin::class)
|
||||
project.tasks.withType<DependencyUpdatesTask>().configureEach {
|
||||
rejectVersionIf {
|
||||
when (candidate.group) {
|
||||
"commons-codec",
|
||||
"com.android.tools.build",
|
||||
"org.eclipse.jgit" -> true
|
||||
else -> false
|
||||
}
|
||||
}
|
||||
checkForGradleUpdate = false
|
||||
}
|
||||
project.extensions.getByType<VersionCatalogUpdateExtension>().run {
|
||||
keep.keepUnusedLibraries.set(true)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -25,6 +25,10 @@ dependencyResolutionManagement {
|
|||
includeGroup("com.google.testing.platform")
|
||||
}
|
||||
}
|
||||
exclusiveContent {
|
||||
forRepository(::gradlePluginPortal)
|
||||
filter { includeModule("com.github.ben-manes", "gradle-versions-plugin") }
|
||||
}
|
||||
mavenCentral()
|
||||
}
|
||||
versionCatalogs {
|
||||
|
|
|
@ -9,5 +9,6 @@ plugins {
|
|||
id("com.github.android-password-store.binary-compatibility")
|
||||
id("com.github.android-password-store.git-hooks")
|
||||
id("com.github.android-password-store.spotless")
|
||||
id("com.github.android-password-store.versions")
|
||||
alias(libs.plugins.hilt) apply false
|
||||
}
|
||||
|
|
|
@ -47,6 +47,8 @@ build-okhttp = "com.squareup.okhttp3:okhttp:4.10.0"
|
|||
build-semver = "com.vdurmont:semver4j:3.1.0"
|
||||
build-sentry = "io.sentry.android.gradle:io.sentry.android.gradle.gradle.plugin:3.1.2"
|
||||
build-spotless = "com.diffplug.spotless:spotless-plugin-gradle:6.8.0"
|
||||
build-vcu = "nl.littlerobots.version-catalog-update:nl.littlerobots.version-catalog-update.gradle.plugin:0.5.1"
|
||||
build-versions = "com.github.ben-manes:gradle-versions-plugin:0.42.0"
|
||||
|
||||
dagger-hilt-android = { module = "com.google.dagger:hilt-android", version.ref = "hilt" }
|
||||
dagger-hilt-compiler = { module = "com.google.dagger:hilt-compiler", version.ref = "hilt" }
|
||||
|
|
|
@ -30,6 +30,7 @@ pluginManagement {
|
|||
exclusiveContent {
|
||||
forRepository(::gradlePluginPortal)
|
||||
filter {
|
||||
includeModule("com.github.ben-manes", "gradle-versions-plugin")
|
||||
includeModule("com.gradle", "gradle-enterprise-gradle-plugin")
|
||||
includeModule("com.gradle.enterprise", "com.gradle.enterprise.gradle.plugin")
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue