Skip to content

Commit

Permalink
Add build-time check that we don't bump to slf4j 2.x
Browse files Browse the repository at this point in the history
  • Loading branch information
alexarchambault committed May 9, 2023
1 parent 63bf826 commit ae7c542
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,25 @@ class ScalaKernel(val crossScalaVersion: String) extends AlmondModule with Exter
)
}

def resolvedIvyDeps = T {
// Ensure we stay on slf4j 1.x
val value = super.resolvedIvyDeps()
val jarNames = value
.map(_.path.last)
.filter(_.endsWith(".jar"))
.map(_.stripSuffix(".jar"))
val slf4jJars = jarNames.filter(_.startsWith("slf4j-"))
assert(slf4jJars.nonEmpty, "No slf4j JARs found")
val wrongSlf4jVersionJars = slf4jJars.filter { name =>
val version = name.split('-').dropWhile(_.head.isLetter).mkString("-")
!version.startsWith("1.")
}
if (wrongSlf4jVersionJars.nonEmpty)
sys.error(s"Found some slf4j non-1.x JARs: ${wrongSlf4jVersionJars.mkString(", ")}")

value
}

def runClasspath =
super.runClasspath() ++
transitiveSources() ++
Expand Down

0 comments on commit ae7c542

Please sign in to comment.