Skip to content

Commit

Permalink
SBT: native settings/plugins for native platform
Browse files Browse the repository at this point in the history
  • Loading branch information
kitbellew committed Nov 20, 2024
1 parent 8b1faed commit 6019e62
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion bin/build-native-image.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
set -eux
sbt "cli/nativeImageCopy scalafmt"
sbt "cliNative/nativeImageCopy scalafmt"
7 changes: 3 additions & 4 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@ lazy val cli = crossProject(JVMPlatform, NativePlatform)
),
scalacOptions ++= scalacJvmOptions.value,
Compile / mainClass := Some("org.scalafmt.cli.Cli"),
).nativeSettings(
nativeConfig ~= { _.withMode(Mode.releaseFull) },
nativeImageInstalled := isCI,
nativeImageOptions ++= {
// https://www.graalvm.org/22.3/reference-manual/native-image/guides/build-static-executables/
Expand All @@ -210,8 +212,7 @@ lazy val cli = crossProject(JVMPlatform, NativePlatform)
case _ => Nil
}
},
).nativeSettings(scalaNativeConfig).dependsOn(core, dynamic)
.enablePlugins(NativeImagePlugin)
).nativeEnablePlugins(NativeImagePlugin).dependsOn(core, dynamic)

lazy val tests = crossProject(JVMPlatform, NativePlatform)
.withoutSuffixFor(JVMPlatform).in(file("scalafmt-tests")).settings(
Expand Down Expand Up @@ -327,5 +328,3 @@ lazy val communityTestsSettings: Seq[Def.Setting[_]] = Seq(
javaOptions += "-Dfile.encoding=UTF8",
buildInfoPackage := "org.scalafmt.tests",
)

lazy val scalaNativeConfig = nativeConfig ~= { _.withMode(Mode.releaseFull) }

0 comments on commit 6019e62

Please sign in to comment.