diff options
Diffstat (limited to 'build-logic/kotlin-plugins')
-rw-r--r-- | build-logic/kotlin-plugins/build.gradle.kts | 6 | ||||
-rw-r--r-- | build-logic/kotlin-plugins/src/main/kotlin/dev/msfjarvis/aps/gradle/DependencyUpdatesPlugin.kt | 33 |
2 files changed, 39 insertions, 0 deletions
diff --git a/build-logic/kotlin-plugins/build.gradle.kts b/build-logic/kotlin-plugins/build.gradle.kts index bfd54dc0..78359ea6 100644 --- a/build-logic/kotlin-plugins/build.gradle.kts +++ b/build-logic/kotlin-plugins/build.gradle.kts @@ -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) } 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<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) + } + } +} |