From 6019e623abe6b67f81bf36a2e5ef0beecdb59702 Mon Sep 17 00:00:00 2001 From: Albert Meltzer <7529386+kitbellew@users.noreply.github.com> Date: Wed, 20 Nov 2024 10:29:11 -0800 Subject: [PATCH] SBT: native settings/plugins for native platform --- bin/build-native-image.sh | 2 +- build.sbt | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/bin/build-native-image.sh b/bin/build-native-image.sh index deba9274ef..93a7f88182 100755 --- a/bin/build-native-image.sh +++ b/bin/build-native-image.sh @@ -1,2 +1,2 @@ set -eux -sbt "cli/nativeImageCopy scalafmt" +sbt "cliNative/nativeImageCopy scalafmt" diff --git a/build.sbt b/build.sbt index 4fa5dd8a58..44896ebe73 100644 --- a/build.sbt +++ b/build.sbt @@ -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/ @@ -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( @@ -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) }