Fix native-image: create target/bin before building sbtw

This commit is contained in:
bitloi 2026-02-15 03:32:01 +01:00
parent 40a1cfd6d3
commit 3924567ee1
1 changed files with 11 additions and 1 deletions

View File

@ -967,6 +967,7 @@ def scriptedTask(launch: Boolean): Def.Initialize[InputTask[Unit]] = Def.inputTa
}
lazy val publishLauncher = TaskKey[Unit]("publish-launcher")
val createSbtwBinDir = taskKey[Unit]("Create sbtw target/bin before native-image")
lazy val sbtwProj = (project in file("sbtw"))
.enablePlugins(NativeImagePlugin)
@ -980,7 +981,16 @@ lazy val sbtwProj = (project in file("sbtw"))
libraryDependencies += "com.github.scopt" %% "scopt" % "4.1.0",
nativeImageVersion := "23.0",
nativeImageJvm := "graalvm-java23",
nativeImageOutput := (target.value / "bin" / "sbtw").toPath.toFile,
createSbtwBinDir := {
val d = (target.value / "bin").toPath
if (!Files.exists(d)) Files.createDirectories(d)
},
Compile / nativeImage := (Compile / nativeImage).dependsOn(createSbtwBinDir).value,
nativeImageOutput := {
val outputDir = (target.value / "bin").toPath
if (!Files.exists(outputDir)) Files.createDirectories(outputDir)
outputDir.resolve("sbtw").toFile
},
nativeImageOptions ++= Seq(
"--no-fallback",
s"--initialize-at-run-time=sbtw",