Skip to content

make test resilient to scala upgrades beyond 0.14.3 #2233

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

Merged
merged 1 commit into from
Apr 15, 2025
Merged
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
9 changes: 7 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -382,13 +382,18 @@ lazy val integration = projectMatrix
)
.value,
// Mimic sbt-scalafix usage of interfaces (without properties per default)
// to exercise dynamic loading of latest scalafix-properties artifact
// to exercise dynamic loading of scalafix-properties artifact
Test / internalDependencyClasspath := {
val prev = (Test / internalDependencyClasspath).value
val propertiesClassDirectory =
(properties / Compile / classDirectory).value
prev.filter(_.data != propertiesClassDirectory)
}
},
// Since tests may depend on new values, we use a system property to ScalafixCoursier
// to whitelist a specific SNAPSHOT version from the list of available ones
Test / javaOptions += s"-Dscalafix-properties.version=${version.value}",
Test / fork := true,
Test / baseDirectory := (ThisBuild / baseDirectory).value
)
.defaultAxes(VirtualAxis.jvm)
.jvmPlatformFull(cliScalaVersions)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,12 @@ public static List<URL> latestScalafixPropertiesJars(
List<Repository> repositories
) throws ScalafixException {
Module module = Module.of("ch.epfl.scala", "scalafix-properties");
String allowedVersion = System.getProperty("scalafix-properties.version");
String version = versions(repositories, module)
.getAvailable()
.stream()
// Ignore RC & SNAPSHOT versions
.filter(v -> v.startsWith("0.14.2+") || !v.contains("-"))
// Ignore RC & SNAPSHOT versions, except if explicitly requested
.filter(v -> !v.contains("-") || v.equals(allowedVersion))
.reduce((older, newer) -> newer)
.orElseThrow(() -> new ScalafixException("Could not find any stable version for " + module));

Expand Down