From 8a9ebf3f7e0af5f7a7ccd67b6902a94b0d8c687b Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Thu, 30 Jun 2022 21:33:59 +0530 Subject: build-logic: introduce versions plugin --- .../aps/gradle/DependencyUpdatesPlugin.kt | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 build-logic/kotlin-plugins/src/main/kotlin/dev/msfjarvis/aps/gradle/DependencyUpdatesPlugin.kt (limited to 'build-logic/kotlin-plugins/src/main') diff --git a/build-logic/kotlin-plugins/src/main/kotlin/dev/msfjarvis/aps/gradle/DependencyUpdatesPlugin.kt b/build-logic/kotlin-plugins/src/main/kotlin/dev/msfjarvis/aps/gradle/DependencyUpdatesPlugin.kt new file mode 100644 index 00000000..e3d6e761 --- /dev/null +++ b/build-logic/kotlin-plugins/src/main/kotlin/dev/msfjarvis/aps/gradle/DependencyUpdatesPlugin.kt @@ -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 { + override fun apply(project: Project) { + project.pluginManager.apply(VersionsPlugin::class) + project.pluginManager.apply(VersionCatalogUpdatePlugin::class) + project.tasks.withType().configureEach { + rejectVersionIf { + when (candidate.group) { + "commons-codec", + "com.android.tools.build", + "org.eclipse.jgit" -> true + else -> false + } + } + checkForGradleUpdate = false + } + project.extensions.getByType().run { + keep.keepUnusedLibraries.set(true) + } + } +} -- cgit v1.2.3