Skip to content

Commit

Permalink
Merge pull request #935 from eed3si9n/wip/slf4j
Browse files Browse the repository at this point in the history
fix: Fix "SLF4J: Failed to load ..." issue by adding slf4j-simple
  • Loading branch information
eed3si9n authored Dec 13, 2024
2 parents 7019344 + c81b185 commit 9f67dc6
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 11 deletions.
5 changes: 4 additions & 1 deletion .scala-steward.conf
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
pullRequests.frequency = "14 days"

updates.limit = 3

updates.pin = [
{
// jgit 6.x require JDK 11
groupId = "org.eclipse.jgit"
version = "5."
}
},
{ groupId = "org.slf4j", artifactId = "slf4j-simple", version = "1." }
]

updates.ignore = [
Expand Down
10 changes: 7 additions & 3 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,10 @@ lazy val app = (project in file("app"))
csRun / sourceDirectory := {
(baseDirectory).value.getParentFile / "src" / "main" / "conscript"
},
libraryDependencies += launcherIntf
libraryDependencies ++= List(
launcherIntf,
slf4jsimple
)
)

lazy val crossSbt = Seq(
Expand Down Expand Up @@ -157,14 +160,14 @@ lazy val lib = (project in file("library"))
libraryDependencies ++= Seq(
stringTemplate,
jgit,
slf4jsimple,
commonsIo,
plexusArchiver,
scalaXml,
parserCombinator(scalaVersion.value),
scalacheck % Test,
sbtIo % Test,
scalamock % Test,
"org.slf4j" % "slf4j-simple" % "1.7.36" % Test
scalamock % Test
),
Test / testOptions += Tests.Argument(TestFrameworks.ScalaCheck, "-minSuccessfulTests", "1000", "-workers", "10")
)
Expand All @@ -179,6 +182,7 @@ lazy val launcher = (project in file("launcher"))
crossScalaVersions := List(scala212, scala213, scala3),
libraryDependencies ++= Seq(
coursier,
slf4jsimple,
verify % Test,
sbtIo % Test
),
Expand Down
32 changes: 25 additions & 7 deletions launcher/src/test/scala/LauncherTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package testpkg

import giter8._
import verify._
import java.io.File
import java.io.{ByteArrayOutputStream, File, PrintStream}
import sbt.io.IO

object LauncherTest extends BasicTestSuite {
Expand All @@ -22,12 +22,30 @@ object LauncherTest extends BasicTestSuite {
}
}

/*
test("runs [email protected]:scala/scala-seed.g8.git") {
IO.withTemporaryDirectory { dir =>
launcher.run(Array("[email protected]:scala/scala-seed.g8.git", "--name=hello"), dir)
assert((dir / "hello" / "build.sbt").exists)
test("log scala/scala-seed.g8") {
val (r, err) = withErr {
IO.withTemporaryDirectory { dir =>
launcher.run(Array("scala/scala-seed.g8", "--name=hello"), dir)
assert((dir / "hello" / "build.sbt").exists)
}
}
assert(!err.contains("SLF4J"))
}
*/

def withErr[A1](f: => A1): (A1, String) = {
val originalErr = System.err
val byteArrayOutputStream = new ByteArrayOutputStream()
val inMemoryPrintStream = new PrintStream(byteArrayOutputStream)
val result =
try {
System.setErr(inMemoryPrintStream)
val r = f
inMemoryPrintStream.flush()
r
} finally {
System.setErr(originalErr)
}
(result, byteArrayOutputStream.toString)
}

}
1 change: 1 addition & 0 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ object Dependencies {
case _ => "2.2.0"
}
}
val slf4jsimple = "org.slf4j" % "slf4j-simple" % "1.7.36"
val logback = "ch.qos.logback" % "logback-classic" % "1.2.3"
val coursier = "io.get-coursier" %% "coursier" % "2.1.13"
val launcherIntf = "org.scala-sbt" % "launcher-interface" % "1.4.4"
Expand Down

0 comments on commit 9f67dc6

Please sign in to comment.