feat(build): add back dependency updates plugin

This commit is contained in:
Harsh Shandilya 2024-03-22 00:08:20 +05:30
parent 93ee16df38
commit b05c71fc35
5 changed files with 47 additions and 0 deletions

View file

@ -65,6 +65,10 @@ gradlePlugin {
id = "com.github.android-password-store.versioning-plugin" id = "com.github.android-password-store.versioning-plugin"
implementationClass = "app.passwordstore.gradle.versioning.VersioningPlugin" implementationClass = "app.passwordstore.gradle.versioning.VersioningPlugin"
} }
register("versions") {
id = "com.github.android-password-store.versions"
implementationClass = "app.passwordstore.gradle.DependencyUpdatesPlugin"
}
} }
} }
@ -84,6 +88,7 @@ dependencies {
implementation(libs.build.r8) implementation(libs.build.r8)
implementation(libs.build.semver) implementation(libs.build.semver)
implementation(libs.build.sentry) implementation(libs.build.sentry)
implementation(libs.build.vcu)
implementation(libs.kotlinx.coroutines.core) implementation(libs.kotlinx.coroutines.core)
// Expose the generated version catalog API to the plugin. // Expose the generated version catalog API to the plugin.

View file

@ -0,0 +1,34 @@
/*
* Copyright © 2014-2021 The Android Password Store Authors. All Rights Reserved.
* SPDX-License-Identifier: GPL-3.0-only
*/
package app.passwordstore.gradle
import com.github.zafarkhaja.semver.Version
import kotlin.jvm.optionals.getOrNull
import nl.littlerobots.vcu.plugin.VersionCatalogUpdateExtension
import nl.littlerobots.vcu.plugin.VersionCatalogUpdatePlugin
import nl.littlerobots.vcu.plugin.versionSelector
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.apply
import org.gradle.kotlin.dsl.configure
@Suppress("Unused")
class DependencyUpdatesPlugin : Plugin<Project> {
override fun apply(project: Project) {
project.pluginManager.apply(VersionCatalogUpdatePlugin::class)
project.extensions.configure<VersionCatalogUpdateExtension> {
keep.keepUnusedLibraries.set(true)
versionSelector {
val currentVersion = Version.tryParse(it.currentVersion).getOrNull()
val newVersion = Version.tryParse(it.candidate.version).getOrNull()
if (currentVersion == null || newVersion == null) {
false
} else {
newVersion.isHigherThan(currentVersion)
}
}
}
}
}

View file

@ -6,4 +6,5 @@ plugins {
id("com.github.android-password-store.git-hooks") id("com.github.android-password-store.git-hooks")
id("com.github.android-password-store.kotlin-common") id("com.github.android-password-store.kotlin-common")
id("com.github.android-password-store.ktfmt") id("com.github.android-password-store.ktfmt")
id("com.github.android-password-store.versions")
} }

View file

@ -58,3 +58,9 @@ SONATYPE_CONNECT_TIMEOUT_SECONDS=120
SONATYPE_CLOSE_TIMEOUT_SECONDS=1800 SONATYPE_CLOSE_TIMEOUT_SECONDS=1800
org.gradle.jvmargs=-Xmx4096m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 org.gradle.jvmargs=-Xmx4096m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
# Version Catalog Update Plugin workarounds and fixes
systemProp.javax.xml.parsers.SAXParserFactory=com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl
systemProp.javax.xml.transform.TransformerFactory=com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl
systemProp.javax.xml.parsers.DocumentBuilderFactory=com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl
nl.littlerobots.vcu.resolver=true

View file

@ -50,6 +50,7 @@ build-okhttp = "com.squareup.okhttp3:okhttp:4.12.0"
build-r8 = "com.android.tools:r8:8.3.37" build-r8 = "com.android.tools:r8:8.3.37"
build-semver = "com.github.zafarkhaja:java-semver:0.10.2" build-semver = "com.github.zafarkhaja:java-semver:0.10.2"
build-sentry = "io.sentry.android.gradle:io.sentry.android.gradle.gradle.plugin:4.3.1" build-sentry = "io.sentry.android.gradle:io.sentry.android.gradle.gradle.plugin:4.3.1"
build-vcu = "nl.littlerobots.version-catalog-update:nl.littlerobots.version-catalog-update.gradle.plugin:0.8.4"
compose-bom = "androidx.compose:compose-bom:2024.03.00" compose-bom = "androidx.compose:compose-bom:2024.03.00"
compose-foundation-core = { module = "androidx.compose.foundation:foundation" } compose-foundation-core = { module = "androidx.compose.foundation:foundation" }
compose-foundation-layout = { module = "androidx.compose.foundation:foundation-layout" } compose-foundation-layout = { module = "androidx.compose.foundation:foundation-layout" }