Skip to content

Commit

Permalink
Merge pull request #3522 from scala-steward-org/topic/fmt-InitialComm…
Browse files Browse the repository at this point in the history
…andsTest

Properly indent `InitialCommandsTest`
  • Loading branch information
fthomas authored Jan 6, 2025
2 parents 573924a + 34e9155 commit 575b416
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import scala.util.Properties
import scala.reflect.io.Path
import com.typesafe.sbt.packager.docker.*
import sbtcrossproject.{CrossProject, CrossType, Platform}
import org.typelevel.sbt.gha.JavaSpec.Distribution.Temurin
Expand Down Expand Up @@ -196,24 +194,23 @@ lazy val core = myCrossProject("core")
BuildInfoKey("millPluginVersion" -> Dependencies.scalaStewardMillPlugin.revision)
),
buildInfoPackage := moduleRootPkg.value,
initialCommands += s"""
import ${moduleRootPkg.value}._
import ${moduleRootPkg.value}.data._
import ${moduleRootPkg.value}.util._
import better.files.File
import cats.effect.IO
import org.http4s.client.Client
import org.typelevel.log4cats.Logger
import org.typelevel.log4cats.slf4j.Slf4jLogger

implicit val logger: Logger[IO] = Slf4jLogger.getLogger[IO]
""",
initialCommands +=
s"""import ${moduleRootPkg.value}._
|import ${moduleRootPkg.value}.data._
|import ${moduleRootPkg.value}.util._
|import better.files.File
|import cats.effect.IO
|import org.http4s.client.Client
|import org.typelevel.log4cats.Logger
|import org.typelevel.log4cats.slf4j.Slf4jLogger
|implicit val logger: Logger[IO] = Slf4jLogger.getLogger[IO]
|""".stripMargin,
// Inspired by https://stackoverflow.com/a/41978937/460387
Test / sourceGenerators += Def.task {
val file = (Test / sourceManaged).value / "InitialCommandsTest.scala"
val content =
s"""object InitialCommandsTest {
| ${initialCommands.value}
| ${initialCommands.value.linesIterator.mkString("\n ")}
| // prevent warnings
| intellijThisImportIsUsed(Client); intellijThisImportIsUsed(File);
| intellijThisImportIsUsed(Nel); intellijThisImportIsUsed(Repo);
Expand Down

0 comments on commit 575b416

Please sign in to comment.