Skip to content

Commit

Permalink
Merge pull request #1117 from alexarchambault/coursier-interface-1.0.16
Browse files Browse the repository at this point in the history
Update coursier-interface to 1.0.16
  • Loading branch information
alexarchambault authored May 9, 2023
2 parents e35c7ae + 392baa0 commit c8dd8cb
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 6 deletions.
53 changes: 49 additions & 4 deletions build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,28 @@ class ScalaKernelApi(val crossScalaVersion: String) extends AlmondModule with De
scala.`jupyter-api`()
)
def ivyDeps = Agg(
Deps.ammoniteCompiler(crossScalaVersion),
Deps.ammoniteReplApi(crossScalaVersion),
Deps.ammoniteCompiler(crossScalaVersion)
.exclude(("org.slf4j", "slf4j-api")),
Deps.ammoniteReplApi(crossScalaVersion)
.exclude(("org.slf4j", "slf4j-api")),
Deps.jvmRepr
)

def resolvedIvyDeps = T {
// Ensure we don't depend on slf4j-api
// As no logger implem would be loaded alongside it by default, slf4j would fail to initialize,
// complain in stderr, and default to NOP logging.
val value = super.resolvedIvyDeps()
val jarNames = value
.map(_.path.last)
.filter(_.endsWith(".jar"))
.map(_.stripSuffix(".jar"))
val slf4jJars = jarNames.filter(_.startsWith("slf4j-"))
if (slf4jJars.nonEmpty)
sys.error(s"Found slf4j JARs: ${slf4jJars.mkString(", ")}")
value
}

def propertyFilePath = "almond/almond.properties"
def propertyExtra = Seq(
"default-scalafmt-version" -> Deps.scalafmtDynamic.dep.version,
Expand All @@ -174,8 +192,14 @@ class ScalaInterpreter(val crossScalaVersion: String) extends AlmondModule with
)
def ivyDeps = T {
val metabrowse =
if (crossScalaVersion.startsWith("2.")) Agg(Deps.metabrowseServer)
else Agg.empty
if (crossScalaVersion.startsWith("2."))
Agg(
Deps.metabrowseServer
// don't let metabrowse bump our slf4j version (switching to v2 can be quite sensitive when Spark is involved)
.exclude(("org.slf4j", "slf4j-api"))
)
else
Agg.empty
metabrowse ++ Agg(
Deps.coursier.withDottyCompat(crossScalaVersion),
Deps.coursierApi,
Expand Down Expand Up @@ -245,6 +269,27 @@ class ScalaKernel(val crossScalaVersion: String) extends AlmondModule with Exter
)
}

def resolvedIvyDeps = T {
// Ensure we stay on slf4j 1.x
// Kind of unnecessary now that scala-kernel-api doesn't bring slf4j-api any more,
// but keeping that just in case…
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
4 changes: 2 additions & 2 deletions project/deps.sc
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ object Deps {
def classPathUtil = ivy"io.get-coursier::class-path-util:0.1.2"
def collectionCompat = ivy"org.scala-lang.modules::scala-collection-compat:2.9.0"
def coursier = ivy"io.get-coursier::coursier:2.1.3"
def coursierApi = ivy"io.get-coursier:interface:1.0.15"
def coursierApi = ivy"io.get-coursier:interface:1.0.16"
def expecty = ivy"com.eed3si9n.expecty::expecty:0.16.0"
def fs2 = ivy"co.fs2::fs2-core:2.5.11"
def jansi = ivy"org.fusesource.jansi:jansi:2.4.0"
Expand All @@ -66,7 +66,7 @@ object Deps {
def scalaReflect(sv: String) = ivy"org.scala-lang:scala-reflect:$sv"
def scalaRx = ivy"com.lihaoyi::scalarx:0.4.3"
def scalatags = ivy"com.lihaoyi::scalatags:0.12.0"
def slf4jNop = ivy"org.slf4j:slf4j-nop:2.0.7"
def slf4jNop = ivy"org.slf4j:slf4j-nop:1.7.36"
def utest = ivy"com.lihaoyi::utest:0.8.1"
}

Expand Down

0 comments on commit c8dd8cb

Please sign in to comment.