Skip to content
This repository was archived by the owner on Oct 15, 2024. It is now read-only.

Commit b05c71f

Browse files
committed
feat(build): add back dependency updates plugin
1 parent 93ee16d commit b05c71f

File tree

5 files changed

+47
-0
lines changed

5 files changed

+47
-0
lines changed

build-logic/build.gradle.kts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ gradlePlugin {
6565
id = "com.github.android-password-store.versioning-plugin"
6666
implementationClass = "app.passwordstore.gradle.versioning.VersioningPlugin"
6767
}
68+
register("versions") {
69+
id = "com.github.android-password-store.versions"
70+
implementationClass = "app.passwordstore.gradle.DependencyUpdatesPlugin"
71+
}
6872
}
6973
}
7074

@@ -84,6 +88,7 @@ dependencies {
8488
implementation(libs.build.r8)
8589
implementation(libs.build.semver)
8690
implementation(libs.build.sentry)
91+
implementation(libs.build.vcu)
8792
implementation(libs.kotlinx.coroutines.core)
8893

8994
// Expose the generated version catalog API to the plugin.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* Copyright © 2014-2021 The Android Password Store Authors. All Rights Reserved.
3+
* SPDX-License-Identifier: GPL-3.0-only
4+
*/
5+
package app.passwordstore.gradle
6+
7+
import com.github.zafarkhaja.semver.Version
8+
import kotlin.jvm.optionals.getOrNull
9+
import nl.littlerobots.vcu.plugin.VersionCatalogUpdateExtension
10+
import nl.littlerobots.vcu.plugin.VersionCatalogUpdatePlugin
11+
import nl.littlerobots.vcu.plugin.versionSelector
12+
import org.gradle.api.Plugin
13+
import org.gradle.api.Project
14+
import org.gradle.kotlin.dsl.apply
15+
import org.gradle.kotlin.dsl.configure
16+
17+
@Suppress("Unused")
18+
class DependencyUpdatesPlugin : Plugin<Project> {
19+
override fun apply(project: Project) {
20+
project.pluginManager.apply(VersionCatalogUpdatePlugin::class)
21+
project.extensions.configure<VersionCatalogUpdateExtension> {
22+
keep.keepUnusedLibraries.set(true)
23+
versionSelector {
24+
val currentVersion = Version.tryParse(it.currentVersion).getOrNull()
25+
val newVersion = Version.tryParse(it.candidate.version).getOrNull()
26+
if (currentVersion == null || newVersion == null) {
27+
false
28+
} else {
29+
newVersion.isHigherThan(currentVersion)
30+
}
31+
}
32+
}
33+
}
34+
}

build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ plugins {
66
id("com.github.android-password-store.git-hooks")
77
id("com.github.android-password-store.kotlin-common")
88
id("com.github.android-password-store.ktfmt")
9+
id("com.github.android-password-store.versions")
910
}

gradle.properties

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,9 @@ SONATYPE_CONNECT_TIMEOUT_SECONDS=120
5858
SONATYPE_CLOSE_TIMEOUT_SECONDS=1800
5959

6060
org.gradle.jvmargs=-Xmx4096m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
61+
62+
# Version Catalog Update Plugin workarounds and fixes
63+
systemProp.javax.xml.parsers.SAXParserFactory=com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl
64+
systemProp.javax.xml.transform.TransformerFactory=com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl
65+
systemProp.javax.xml.parsers.DocumentBuilderFactory=com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl
66+
nl.littlerobots.vcu.resolver=true

gradle/libs.versions.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ build-okhttp = "com.squareup.okhttp3:okhttp:4.12.0"
5050
build-r8 = "com.android.tools:r8:8.3.37"
5151
build-semver = "com.github.zafarkhaja:java-semver:0.10.2"
5252
build-sentry = "io.sentry.android.gradle:io.sentry.android.gradle.gradle.plugin:4.3.1"
53+
build-vcu = "nl.littlerobots.version-catalog-update:nl.littlerobots.version-catalog-update.gradle.plugin:0.8.4"
5354
compose-bom = "androidx.compose:compose-bom:2024.03.00"
5455
compose-foundation-core = { module = "androidx.compose.foundation:foundation" }
5556
compose-foundation-layout = { module = "androidx.compose.foundation:foundation-layout" }

0 commit comments

Comments
 (0)