Skip to content

Commit 8c46b4f

Browse files
committed
Fix MissingBuildToolSuite on Ubuntu
1 parent 4ac79f4 commit 8c46b4f

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

build.sbt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ lazy val unit = project
188188
Seq[BuildInfoKey](
189189
version,
190190
scalaVersion,
191+
"temporaryDirectory" -> target.value / "tmpdir",
191192
"sourceroot" -> baseDirectory.in(ThisBuild).value,
192193
"minimizedJavaSourceDirectory" ->
193194
sourceDirectory.in(minimized, Compile).value / "java",

tests/buildTools/src/test/scala/tests/BaseBuildToolSuite.scala

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,29 @@ package tests
22

33
import java.nio.file.FileSystems
44
import java.nio.file.Path
5-
import java.nio.file.Paths
6-
7-
import scala.util.Properties
85

96
import scala.meta.internal.io.FileIO
107
import scala.meta.io.AbsolutePath
118

129
import com.sourcegraph.lsif_java.LsifJava
10+
import moped.testkit.DeleteVisitor
1311
import moped.testkit.FileLayout
1412
import moped.testkit.MopedSuite
1513
import munit.TestOptions
1614

1715
abstract class BaseBuildToolSuite extends MopedSuite(LsifJava.app) {
1816
override def environmentVariables: Map[String, String] = sys.env
19-
override def workingDirectory: Path = {
20-
val dir = super.workingDirectory
21-
if (Properties.isMac && dir.toString.startsWith("/var")) {
22-
Paths.get(s"/private/$dir")
23-
} else {
24-
dir
17+
18+
// NOTE(olafur): workaround for https://github.com/scalameta/moped/issues/18
19+
override val temporaryDirectory: DirectoryFixture =
20+
new DirectoryFixture {
21+
private val path = BuildInfo.temporaryDirectory.toPath
22+
override def apply(): Path = path
23+
override def beforeAll(): Unit = {}
24+
override def afterEach(context: AfterEach): Unit = {
25+
DeleteVisitor.deleteRecursively(path)
26+
}
2527
}
26-
}
2728

2829
private val semanticdbPattern = FileSystems
2930
.getDefault

tests/buildTools/src/test/scala/tests/MissingBuildToolSuite.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class MissingBuildToolSuite extends BaseBuildToolSuite {
55
"basic",
66
List(),
77
expectedOutput =
8-
"""|error: No build tool detected in workspace '/private/workingDirectory'. At the moment, the only supported build tools are: Gradle, Maven.
8+
"""|error: No build tool detected in workspace '/workingDirectory'. At the moment, the only supported build tools are: Gradle, Maven.
99
|""".stripMargin,
1010
workingDirectoryLayout = ""
1111
)

0 commit comments

Comments
 (0)