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