Skip to content

Commit

Permalink
Fix Scala 3 check
Browse files Browse the repository at this point in the history
the artifact contains a cross version, so only comparing the artifact name leads to the correct result
adapt lowest Scala 3 NEXT version
  • Loading branch information
mzuehlke committed May 8, 2024
1 parent 5642ead commit 767fcfe
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
Expand Up @@ -37,5 +37,5 @@ package object data {
val scalaLangModules: List[(GroupId, ArtifactId)] =
scala2LangModules ++ scala3LangModules

val scalaNextMinVersion: Version = Version("3.4.0")
val scalaNextMinVersion: Version = Version("3.4.0-NIGHTLY")
}
Expand Up @@ -79,13 +79,14 @@ object FilterAlg {
val filteredVersions = update.newerVersions.filterNot(_ >= scalaNextMinVersion)
if (filteredVersions.nonEmpty)
Right(update.copy(newerVersions = Nel.fromListUnsafe(filteredVersions)))
else Left(IgnoreScalaNext(update))
else
Left(IgnoreScalaNext(update))
}
}

def isScala3Lang(update: Update.ForArtifactId): Boolean =
scala3LangModules.exists { case (g, a) =>
update.groupId == g && update.artifactIds.exists(_ == a)
update.groupId == g && update.artifactIds.exists(_.name == a.name)
}

private def globalFilter(update: Update.ForArtifactId, repoConfig: RepoConfig): FilterResult =
Expand Down
Expand Up @@ -254,17 +254,26 @@ class FilterAlgTest extends FunSuite {

test("scalaLTSFilter: LTS, filter versions") {
val update =
("org.scala-lang".g % "scala3-compiler".a % "3.3.2" %> Nel.of("3.3.3", "3.4.0")).single
("org.scala-lang".g % ("scala3-compiler", "scala3-compiler_3").a % "3.3.2" %> Nel.of(
"3.3.3",
"3.4.0"
)).single
assertEquals(scalaLTSFilter(update), Right(update.copy(newerVersions = Nel.of("3.3.3".v))))
}

test("scalaLTSFilter: Next") {
val update = ("org.scala-lang".g % "scala3-compiler".a % "3.4.0" %> Nel.of("3.4.1")).single
val update =
("org.scala-lang".g % ("scala3-compiler", "scala3-compiler_3").a % "3.4.0" %> Nel.of(
"3.4.1"
)).single
assertEquals(scalaLTSFilter(update), Right(update))
}

test("isScala3Lang: true") {
val update = ("org.scala-lang".g % "scala3-compiler".a % "3.3.3" %> Nel.of("3.4.0")).single
val update =
("org.scala-lang".g % ("scala3-compiler", "scala3-compiler_3").a % "3.3.3" %> Nel.of(
"3.4.0"
)).single
assert(isScala3Lang(update))
}

Expand Down

0 comments on commit 767fcfe

Please sign in to comment.