From bb3fc4ff01d3025cc3252194187ede57d3b4a09a Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Fri, 13 Dec 2024 01:02:48 -0500 Subject: [PATCH 1/2] Reproduce slf4j issue --- launcher/src/test/scala/LauncherTest.scala | 32 +++++++++++++++++----- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/launcher/src/test/scala/LauncherTest.scala b/launcher/src/test/scala/LauncherTest.scala index 66f393d3..a8fb41b7 100644 --- a/launcher/src/test/scala/LauncherTest.scala +++ b/launcher/src/test/scala/LauncherTest.scala @@ -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 { @@ -22,12 +22,30 @@ object LauncherTest extends BasicTestSuite { } } - /* - test("runs git@github.com:scala/scala-seed.g8.git") { - IO.withTemporaryDirectory { dir => - launcher.run(Array("git@github.com: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) + } + } From c81b185d4c5cd4bb9e9471a6eb9346772fb1bb55 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Fri, 13 Dec 2024 01:29:05 -0500 Subject: [PATCH 2/2] Add slf4j-simple 1.7 --- .scala-steward.conf | 5 ++++- build.sbt | 10 +++++++--- project/Dependencies.scala | 1 + 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.scala-steward.conf b/.scala-steward.conf index a13fbc8b..d8b601da 100644 --- a/.scala-steward.conf +++ b/.scala-steward.conf @@ -1,3 +1,5 @@ +pullRequests.frequency = "14 days" + updates.limit = 3 updates.pin = [ @@ -5,7 +7,8 @@ updates.pin = [ // jgit 6.x require JDK 11 groupId = "org.eclipse.jgit" version = "5." - } + }, + { groupId = "org.slf4j", artifactId = "slf4j-simple", version = "1." } ] updates.ignore = [ diff --git a/build.sbt b/build.sbt index aa101595..c50de740 100644 --- a/build.sbt +++ b/build.sbt @@ -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( @@ -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") ) @@ -179,6 +182,7 @@ lazy val launcher = (project in file("launcher")) crossScalaVersions := List(scala212, scala213, scala3), libraryDependencies ++= Seq( coursier, + slf4jsimple, verify % Test, sbtIo % Test ), diff --git a/project/Dependencies.scala b/project/Dependencies.scala index e16a7279..c7bff5a5 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -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"