diff --git a/build.sbt b/build.sbt index 5ff6fbe8..0bf72cc6 100644 --- a/build.sbt +++ b/build.sbt @@ -188,6 +188,7 @@ lazy val unit = project Seq[BuildInfoKey]( version, scalaVersion, + "temporaryDirectory" -> target.value / "tmpdir", "sourceroot" -> baseDirectory.in(ThisBuild).value, "minimizedJavaSourceDirectory" -> sourceDirectory.in(minimized, Compile).value / "java", diff --git a/tests/buildTools/src/test/scala/tests/BaseBuildToolSuite.scala b/tests/buildTools/src/test/scala/tests/BaseBuildToolSuite.scala index d2a35422..9827770c 100644 --- a/tests/buildTools/src/test/scala/tests/BaseBuildToolSuite.scala +++ b/tests/buildTools/src/test/scala/tests/BaseBuildToolSuite.scala @@ -2,28 +2,29 @@ package tests import java.nio.file.FileSystems import java.nio.file.Path -import java.nio.file.Paths - -import scala.util.Properties import scala.meta.internal.io.FileIO import scala.meta.io.AbsolutePath import com.sourcegraph.lsif_java.LsifJava +import moped.testkit.DeleteVisitor import moped.testkit.FileLayout import moped.testkit.MopedSuite import munit.TestOptions abstract class BaseBuildToolSuite extends MopedSuite(LsifJava.app) { override def environmentVariables: Map[String, String] = sys.env - override def workingDirectory: Path = { - val dir = super.workingDirectory - if (Properties.isMac && dir.toString.startsWith("/var")) { - Paths.get(s"/private/$dir") - } else { - dir + + // NOTE(olafur): workaround for https://github.com/scalameta/moped/issues/18 + override val temporaryDirectory: DirectoryFixture = + new DirectoryFixture { + private val path = BuildInfo.temporaryDirectory.toPath + override def apply(): Path = path + override def beforeAll(): Unit = {} + override def afterEach(context: AfterEach): Unit = { + DeleteVisitor.deleteRecursively(path) + } } - } private val semanticdbPattern = FileSystems .getDefault diff --git a/tests/buildTools/src/test/scala/tests/MissingBuildToolSuite.scala b/tests/buildTools/src/test/scala/tests/MissingBuildToolSuite.scala index 59d9c861..1e25ab2f 100644 --- a/tests/buildTools/src/test/scala/tests/MissingBuildToolSuite.scala +++ b/tests/buildTools/src/test/scala/tests/MissingBuildToolSuite.scala @@ -5,7 +5,7 @@ class MissingBuildToolSuite extends BaseBuildToolSuite { "basic", List(), expectedOutput = - """|error: No build tool detected in workspace '/private/workingDirectory'. At the moment, the only supported build tools are: Gradle, Maven. + """|error: No build tool detected in workspace '/workingDirectory'. At the moment, the only supported build tools are: Gradle, Maven. |""".stripMargin, workingDirectoryLayout = "" )