Skip to content

Commit b6bd159

Browse files
committed
feat: allow scip-java index --output to work for Mill
This ensures that when a user uses `scip-java` with the output flag like: ``` scip-java index --output dump.lsif ``` Then this gets forwarded to Mill to ensure it creates an lsif file not a scip one. refs: #482
1 parent 229e429 commit b6bd159

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed

scip-java/src/main/scala/com/sourcegraph/scip_java/buildtools/MillBuildTool.scala

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ class MillBuildTool(index: IndexCommand) extends BuildTool("mill", index) {
3535
1
3636
}
3737

38+
private val rawOutput = index.output.toString
39+
3840
private def unconditionallyGenerateScip(): Int = {
3941
val localMill = Files.isRegularFile(millFile)
4042
val command =
@@ -48,7 +50,9 @@ class MillBuildTool(index: IndexCommand) extends BuildTool("mill", index) {
4850
command,
4951
"--import",
5052
s"ivy:io.chris-kipp::mill-scip::${BuildInfo.millScipVersion}",
51-
"io.kipp.mill.scip.Scip/generate"
53+
"io.kipp.mill.scip.Scip/generate",
54+
"--output",
55+
rawOutput
5256
)
5357
)
5458
val scipFile = index
@@ -60,10 +64,10 @@ class MillBuildTool(index: IndexCommand) extends BuildTool("mill", index) {
6064
.resolve("scip")
6165
.resolve("Scip")
6266
.resolve("generate.dest")
63-
.resolve("index.scip")
67+
.resolve(rawOutput)
6468

6569
if (millProcess.exitCode == 0 && Files.isRegularFile(scipFile)) {
66-
val output = index.workingDirectory.resolve("index.scip")
70+
val output = index.workingDirectory.resolve(rawOutput)
6771
Files.copy(scipFile, output, StandardCopyOption.REPLACE_EXISTING)
6872
index.app.info(output.toString)
6973
}

tests/buildTools/src/test/scala/tests/MillBuildToolSuite.scala

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,4 +118,23 @@ class MillBuildToolSuite extends BaseBuildToolSuite {
118118
initCommand = setupMill("0.10.7"),
119119
targetRoot = Some("out/io/kipp/mill/scip/Scip/generate.dest")
120120
)
121+
122+
checkBuild(
123+
"lsif-output",
124+
s"""|/.mill-version
125+
|0.10.7
126+
|/build.sc
127+
|import mill._, scalalib._
128+
|object minimal extends ScalaModule {
129+
| def scalaVersion = "3.1.3"
130+
|}
131+
|/minimal/src/Main.scala
132+
|package minimal
133+
|@main def hello = ()
134+
|""".stripMargin,
135+
expectedSemanticdbFiles = 1,
136+
initCommand = setupMill("0.10.7"),
137+
targetRoot = Some("out/io/kipp/mill/scip/Scip/generate.dest"),
138+
extraArguments = List("--output", "dump.lsif")
139+
)
121140
}

0 commit comments

Comments
 (0)