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

Refine excluded dependency versions #1400

Merged
merged 1 commit into from
May 27, 2024
Merged
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
33 changes: 30 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,36 @@ tasks.withType<DependencyUpdatesTask>().configureEach {
gradleReleaseChannel = "current"
rejectVersionIf {
candidate.run {
// Apache Commons IO snapshot releases have timestamped versions like `20030203.000550`. We
// don't want these. We only want stable releases, which have versions like `2.11.0`.
group == "commons-io" && module == "commons-io" && version.matches("\\d+\\.\\d+".toRegex())

// Determine what an unwanted version looks like, if any, based on the dependency group.
val unwantedVersionPattern =
when (group) {

// Apache Commons IO snapshot releases have timestamped versions like `20030203.000550`.
// We only want stable releases, which have versions like `2.11.0`.
"commons-io" -> "\\d+\\.\\d+"

// JUnit milestone releases have versions with milestone numbers like `5.11.0-M2`. We
// only want stable releases, which have versions like `5.10.2`.
"org.junit",
"org.junit.jupiter",
"org.junit.platform",
"org.junit.vintage" -> ".*-M\\d+"

// SLF4J alpha releases have versions with alpha numbers like `2.1.0-alpha1`. We only
// want stable releases, which have versions like `2.0.13`.
"org.slf4j" -> ".*-alpha\\d+"

// Assume that anything not excluded above is OK.
else -> null
}

// Reject certain versions, if a rejection pattern was provided. Otherwise assume that any
// version is OK.
when (unwantedVersionPattern) {
null -> false
else -> version.matches(unwantedVersionPattern.toRegex())
}
}
}
}
Loading