diff options
author | Harsh Shandilya <me@msfjarvis.dev> | 2023-07-12 15:24:40 +0530 |
---|---|---|
committer | Harsh Shandilya <me@msfjarvis.dev> | 2023-07-12 16:22:27 +0530 |
commit | ae9f56e9657ca55ef6c1bc541950dc9b91495f79 (patch) | |
tree | 20583f0babcd3bd59470025bbc1680a5fc6ce24f /build-logic | |
parent | 79773dbd7ad2c7e6b3292fde1eb6471f0d98817c (diff) |
refactor(build): move dependency updates to a `Settings` plugin
Diffstat (limited to 'build-logic')
-rw-r--r-- | build-logic/src/main/kotlin/app/passwordstore/gradle/DependencyUpdatesPlugin.kt | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/build-logic/src/main/kotlin/app/passwordstore/gradle/DependencyUpdatesPlugin.kt b/build-logic/src/main/kotlin/app/passwordstore/gradle/DependencyUpdatesPlugin.kt index 50810938..2880ac1d 100644 --- a/build-logic/src/main/kotlin/app/passwordstore/gradle/DependencyUpdatesPlugin.kt +++ b/build-logic/src/main/kotlin/app/passwordstore/gradle/DependencyUpdatesPlugin.kt @@ -5,29 +5,31 @@ 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.api.initialization.Settings import org.gradle.kotlin.dsl.apply import org.gradle.kotlin.dsl.configure import org.gradle.kotlin.dsl.withType @Suppress("Unused") -class DependencyUpdatesPlugin : Plugin<Project> { +class DependencyUpdatesPlugin : Plugin<Settings> { - override fun apply(project: Project) { - project.pluginManager.apply(VersionsPlugin::class) - project.pluginManager.apply(VersionCatalogUpdatePlugin::class) - project.tasks.withType<DependencyUpdatesTask> { - rejectVersionIf { - when (candidate.group) { - "commons-codec", - "org.eclipse.jgit" -> true - else -> false + override fun apply(settings: Settings) { + settings.gradle.allprojects { + if (rootProject == this) { + pluginManager.apply(VersionCatalogUpdatePlugin::class) + extensions.configure<VersionCatalogUpdateExtension> { keep.keepUnusedLibraries.set(true) } + pluginManager.apply(VersionsPlugin::class) + tasks.withType<DependencyUpdatesTask> { + rejectVersionIf { + when (candidate.group) { + "commons-codec", + "org.eclipse.jgit" -> true + else -> false + } + } + checkForGradleUpdate = false } } - checkForGradleUpdate = false - } - project.extensions.configure<VersionCatalogUpdateExtension> { - keep.keepUnusedLibraries.set(true) } } } |