Skip to content
Open
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
3 changes: 2 additions & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
version = "2.7.5"
version = "3.11.0"
runner.dialect = scala212source3
assumeStandardLibraryStripMargin = true
docstrings.style = Asterisk
docstrings.wrap = "yes"
Expand Down
52 changes: 25 additions & 27 deletions plugin/src/main/scala/sbtnativeimage/NativeImagePlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -172,35 +172,32 @@ object NativeImagePlugin extends AutoPlugin {
Def
.settingDyn {
val installed =
"true"
.equalsIgnoreCase(System.getProperty("native-image-installed")) ||
"true"
.equalsIgnoreCase(System.getenv("NATIVE_IMAGE_INSTALLED")) ||
"true"
.equalsIgnoreCase(System.getProperty("graalvm-installed")) ||
"true".equalsIgnoreCase(System.getenv("GRAALVM_INSTALLED"))
"true".equalsIgnoreCase(
System.getProperty("native-image-installed")
) ||
"true".equalsIgnoreCase(
System.getenv("NATIVE_IMAGE_INSTALLED")
) ||
"true".equalsIgnoreCase(
System.getProperty("graalvm-installed")
) || "true".equalsIgnoreCase(System.getenv("GRAALVM_INSTALLED"))
Def.setting(installed)
}
.value
)

override lazy val projectSettings: Seq[Def.Setting[?]] = List(
libraryDependencies += "org.scalameta" % "svm-subs" % "101.0.0",
NativeImage / target :=
(Compile / target).value / "native-image",
NativeImageTest / target :=
(Test / target).value / "native-image-test",
NativeImage / target := (Compile / target).value / "native-image",
NativeImageTest / target := (Test / target).value / "native-image-test",
NativeImageInternal / target :=
(Compile / target).value / "native-image-internal",
NativeImageTestInternal / target :=
(Test / target).value / "native-image-test-internal",
NativeImage / name := name.value,
NativeImageTest / name :=
(Test / name).value,
NativeImage / mainClass :=
(Compile / mainClass).value,
NativeImageTest / mainClass :=
(Test / mainClass).value,
NativeImageTest / name := (Test / name).value,
NativeImage / mainClass := (Compile / mainClass).value,
NativeImageTest / mainClass := (Test / mainClass).value,
nativeImageOptions := List(),
nativeImageTestOptions := nativeImageOptions.value,
nativeImageTestRunOptions := List(),
Expand Down Expand Up @@ -298,7 +295,8 @@ object NativeImagePlugin extends AutoPlugin {
else
"config-output-dir"
val agentOption =
s"-agentlib:native-image-agent=$agentConfig=${nativeImageAgentOutputDir.value}"
s"-agentlib:native-image-agent=$agentConfig=${nativeImageAgentOutputDir
.value}"
val tpr = thisProjectRef.value
val settings = Seq(
tpr / Compile / run / fork := true,
Expand Down Expand Up @@ -328,7 +326,8 @@ object NativeImagePlugin extends AutoPlugin {
else
"config-output-dir"
val agentOption =
s"-agentlib:native-image-agent=$agentConfig=${nativeImageTestAgentOutputDir.value}"
s"-agentlib:native-image-agent=$agentConfig=${nativeImageTestAgentOutputDir
.value}"

val options = (Test / run / javaOptions).value ++ Seq(agentOption)
val conv0 = fileConverter.value
Expand Down Expand Up @@ -422,11 +421,10 @@ object NativeImagePlugin extends AutoPlugin {
},
nativeImage :=
Def.uncached {
val _ =
(
(Compile / products).value,
(Compile / compile / compileInputs2).value
)
val _ = (
(Compile / products).value,
(Compile / compile / compileInputs2).value
)
val main = (NativeImage / mainClass).value
val binaryName: ArtifactPath = nativeImageOutput.value
val cp = (Compile / fullClasspath).value.map(_.data)
Expand Down Expand Up @@ -569,9 +567,9 @@ object NativeImagePlugin extends AutoPlugin {
try {
manifestPath.relativize(path).toString
} catch {
//java.lang.IllegalArgumentException: 'other' has different root
//this happens if the dependency jar resides on a different drive then the manifest, i.e. C:\Coursier\Cache and D:\myapp\target
//copy dependency next to manifest as fallback
// java.lang.IllegalArgumentException: 'other' has different root
// this happens if the dependency jar resides on a different drive then the manifest, i.e. C:\Coursier\Cache and D:\myapp\target
// copy dependency next to manifest as fallback
case _: IllegalArgumentException =>
import java.nio.file.Files
import java.nio.file.StandardCopyOption
Expand Down