mirror of
https://github.com/enso-org/enso.git
synced 2024-11-22 22:10:15 +03:00
parent
bc4ed96d71
commit
fe0c8fd9a3
@ -1,7 +1,7 @@
|
||||
import java.io.File
|
||||
import java.nio.file.Path
|
||||
|
||||
import sbt.{Def, File, _}
|
||||
import sbt._
|
||||
import sbt.Keys._
|
||||
import sbt.internal.util.ManagedLogger
|
||||
import sbtassembly.AssemblyKeys.assembly
|
||||
@ -32,10 +32,13 @@ object NativeImage {
|
||||
* on Linux)
|
||||
* @param additionalOptions additional options for the Native Image build
|
||||
* tool
|
||||
* @param memoryLimitMegabytes a memory limit for the build tool, in
|
||||
* @param buildMemoryLimitMegabytes a memory limit for the build tool, in
|
||||
* megabytes; it is good to set this limit to
|
||||
* make GC more aggressive thus allowing it to
|
||||
* build successfully even with limited memory
|
||||
* @param runtimeThreadStackMegabytes the runtime thread stack size; the
|
||||
* minimum for ZIO to work is higher than the
|
||||
* default value on some systems
|
||||
* @param initializeAtRuntime a list of classes that should be initialized at
|
||||
* run time - useful to set exceptions if build
|
||||
* time initialization is set to default
|
||||
@ -43,11 +46,12 @@ object NativeImage {
|
||||
def buildNativeImage(
|
||||
artifactName: String,
|
||||
staticOnLinux: Boolean,
|
||||
additionalOptions: Seq[String] = Seq.empty,
|
||||
memoryLimitMegabytes: Option[Int] = Some(15608),
|
||||
initializeAtRuntime: Seq[String] = Seq.empty,
|
||||
mainClass: Option[String] = None,
|
||||
cp: Option[String] = None
|
||||
additionalOptions: Seq[String] = Seq.empty,
|
||||
buildMemoryLimitMegabytes: Option[Int] = Some(15608),
|
||||
runtimeThreadStackMegabytes: Option[Int] = Some(2),
|
||||
initializeAtRuntime: Seq[String] = Seq.empty,
|
||||
mainClass: Option[String] = None,
|
||||
cp: Option[String] = None
|
||||
): Def.Initialize[Task[Unit]] = Def
|
||||
.task {
|
||||
val log = state.value.log
|
||||
@ -100,8 +104,11 @@ object NativeImage {
|
||||
val quickBuildOption =
|
||||
if (BuildInfo.isReleaseMode) Seq() else Seq("-Ob")
|
||||
|
||||
val memoryLimitOptions =
|
||||
memoryLimitMegabytes.map(megs => s"-J-Xmx${megs}M").toSeq
|
||||
val buildMemoryLimitOptions =
|
||||
buildMemoryLimitMegabytes.map(megs => s"-J-Xmx${megs}M").toSeq
|
||||
|
||||
val runtimeMemoryOptions =
|
||||
runtimeThreadStackMegabytes.map(megs => s"-R:StackSize=${megs}M").toSeq
|
||||
|
||||
val initializeAtRuntimeOptions =
|
||||
if (initializeAtRuntime.isEmpty) Seq()
|
||||
@ -117,8 +124,9 @@ object NativeImage {
|
||||
Seq("--no-fallback", "--no-server") ++
|
||||
Seq("--initialize-at-build-time=") ++
|
||||
initializeAtRuntimeOptions ++
|
||||
memoryLimitOptions ++
|
||||
additionalOptions;
|
||||
buildMemoryLimitOptions ++
|
||||
runtimeMemoryOptions ++
|
||||
additionalOptions
|
||||
|
||||
if (mainClass.isEmpty) {
|
||||
cmd = cmd ++
|
||||
|
Loading…
Reference in New Issue
Block a user