Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SBT: refactor tests, move those for cli and sysops #4740

Merged
merged 1 commit into from
Jan 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ commands += Command.command("ci-test-jvm") { s =>
case _ => scala213
}
val docsTest = if (scalaVersion == scala212) "docs/run" else "version"
s"++$scalaVersion" :: "tests/test" :: "dynamic/test" :: "publishLocal" ::
s"++$scalaVersion" :: "tests/test" :: "cli/test" :: "publishLocal" ::
docsTest :: s
}

Expand All @@ -62,7 +62,7 @@ commands += Command.command("ci-test-native") { s =>
case Some("2.12") => scala212
case _ => scala213
}
s"++$scalaVersion" :: "testsNative/test" :: s
s"++$scalaVersion" :: "testsNative/test" :: "cliNative/test" :: s
}

lazy val dynamic = crossProject(JVMPlatform) // don't build for NativePlatform
Expand Down Expand Up @@ -113,6 +113,7 @@ lazy val sysops = crossProject(JVMPlatform, NativePlatform)
case _ => Seq()
}
},
sharedTestSettings,
)

lazy val config = crossProject(JVMPlatform, NativePlatform)
Expand Down Expand Up @@ -200,6 +201,7 @@ lazy val cli = crossProject(JVMPlatform, NativePlatform)
),
scalacOptions ++= scalacJvmOptions.value,
Compile / mainClass := Some("org.scalafmt.cli.Cli"),
sharedTestSettings,
).jvmSettings(
nativeImageInstalled := isCI,
nativeImageOptions += "-march=compatibility",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.scalafmt.util
package org.scalafmt.sysops

import java.io.IOException
import java.nio.file.FileVisitResult
Expand All @@ -8,7 +8,7 @@ import java.nio.file.Path
import java.nio.file.attribute.BasicFileAttributes

object DeleteTree {
def deleteTree(path: Path): Unit = {
def apply(path: Path): Unit = {
Files.walkFileTree(path, new DeleteTree)
()
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package org.scalafmt.sysops

import org.scalafmt.util.DeleteTree.deleteTree

import java.nio.charset.StandardCharsets
import java.nio.file.Files
import java.nio.file.Path
Expand All @@ -18,7 +16,7 @@ class FileOpsTest extends munit.FunSuite {
path = Files.createTempDirectory("FileOpsTestDir")

override def afterEach(context: AfterEach): Unit =
try deleteTree(path)
try DeleteTree(path)
catch {
case e: Throwable =>
println("Unable to delete test files")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package org.scalafmt.sysops

import org.scalafmt.util.DeleteTree.deleteTree

import java.io.File
import java.nio.charset.StandardCharsets
import java.nio.file.Files
Expand Down Expand Up @@ -36,7 +34,7 @@ class GitOpsTest extends FunSuite {
}

override def afterEach(context: AfterEach): Unit =
try deleteTree(path.path)
try DeleteTree(path.path)
catch {
case e: Throwable =>
println("Unable to delete test files")
Expand Down
Loading