Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simpler API for configuring simple rules #581

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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<FeatureFlagExtension>) {
extension.execute(FeatureFlagExtension())
}
Expand All @@ -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 ""
}
}
7 changes: 7 additions & 0 deletions sample-kotlin/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import de.fayard.refreshVersions.PrefixRule
import de.fayard.refreshVersions.core.FeatureFlag.*
import de.fayard.refreshVersions.core.StabilityLevel

Expand Down Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion sample-kotlin/versions.properties
Original file line number Diff line number Diff line change
@@ -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.
Expand Down