diff --git a/plugins/dependencies/src/main/kotlin/de/fayard/refreshVersions/RefreshVersionsExtension.kt b/plugins/dependencies/src/main/kotlin/de/fayard/refreshVersions/RefreshVersionsExtension.kt index b6d3e884a..f09862466 100644 --- a/plugins/dependencies/src/main/kotlin/de/fayard/refreshVersions/RefreshVersionsExtension.kt +++ b/plugins/dependencies/src/main/kotlin/de/fayard/refreshVersions/RefreshVersionsExtension.kt @@ -27,6 +27,10 @@ open class RefreshVersionsExtension { extraArtifactVersionKeyRules = extraArtifactVersionKeyRules + rawRules } + fun extraVersionRules(vararg rules: PrefixRule) { + extraArtifactVersionKeyRules(rules.joinToString("\n\n") { it.toRawRules() }) + } + fun featureFlags(extension: Action) { extension.execute(FeatureFlagExtension()) } @@ -51,3 +55,14 @@ open class FeatureFlagExtension { FeatureFlag.userSettings[flag] = false } } + +data class PrefixRule( + val versionName: String, + val mavenGroup: String, + val prefix: String? = null +) { + fun toRawRules(): String { + println("TODO: refreshVersions.extraVersionRules(PrefixRule(...)) not implemented. See https://github.com/jmfayard/refreshVersions/issues/580") + return "" + } +} diff --git a/sample-kotlin/settings.gradle.kts b/sample-kotlin/settings.gradle.kts index d35d6dbc9..a34bbd635 100644 --- a/sample-kotlin/settings.gradle.kts +++ b/sample-kotlin/settings.gradle.kts @@ -1,3 +1,4 @@ +import de.fayard.refreshVersions.PrefixRule import de.fayard.refreshVersions.core.FeatureFlag.* import de.fayard.refreshVersions.core.StabilityLevel @@ -30,6 +31,12 @@ refreshVersions { extraArtifactVersionKeyRules(file("refreshVersions-extra-rules.txt")) + + extraVersionRules( + PrefixRule("koin", "io.insert-koin", "koin"), + PrefixRule("ktor", "io.ktor", null), + ) + // ignore dependencies among a blacklist of version keys rejectVersionIf { val blacklist = listOf("version.retrofit", "version.okhttp3") diff --git a/sample-kotlin/versions.properties b/sample-kotlin/versions.properties index bb4b18e92..a4c4984ec 100644 --- a/sample-kotlin/versions.properties +++ b/sample-kotlin/versions.properties @@ -1,6 +1,6 @@ #### Dependencies and Plugin versions with their available updates. #### Generated by `./gradlew refreshVersions` version 0.41.0-SNAPSHOT -#### Revision of dependency notations removals: 11 +#### Revision of dependency notations removals: 14 #### #### Don't manually edit or split the comments that start with four hashtags (####), #### they will be overwritten by refreshVersions.