Created
August 29, 2019 16:50
-
-
Save jvican/e2780408292996c938372149253f1d51 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lazy val bloopgunNative: Project = project | |
.dependsOn(bloopgun) | |
.disablePlugins(ScriptedPlugin) | |
.enablePlugins(SbtProguard) | |
.enablePlugins(GraalVMNativeImagePlugin) | |
.settings(testSuiteSettings) | |
.settings( | |
name := "bloopgun-native", | |
proguardOptions in Proguard ++= | |
Seq("-dontnote", "-dontwarn", "-ignorewarnings", "-dontoptimize"), | |
proguardOptions in Proguard ++= List( | |
ProguardOptions.keepMain("bloop.bloopgun.Bloopgun"), | |
ProguardOptions.keepMain("bloop.bloopgun.Bloopgun$"), | |
"""-keepclassmembers class * extends com.sun.jna.** { | |
| <fields>; | |
| <methods>; | |
|}""".stripMargin | |
), | |
proguardInputs in Proguard := List((assembly in Compile).value), | |
proguardInputs in Proguard += file("/usr/lib/jvm/java-8-graal/jre/lib/rt.jar"), | |
javaOptions in (Proguard, proguard) := Seq("-Xmx4G"), | |
scriptClasspathOrdering in GraalVMNativeImage := | |
(Seq( | |
(proguard in Proguard).value.head -> s"lib/${file((assemblyJarName in assembly in Compile).value).getName()}" | |
)), | |
mainClass in GraalVMNativeImage := Some("bloop.bloopgun.Bloopgun"), | |
assemblyMergeStrategy in assembly := { | |
case PathList(ps @ _*) if ps.last endsWith ".md" => MergeStrategy.concat | |
case x => | |
val oldStrategy = (assemblyMergeStrategy in assembly).value | |
oldStrategy(x) | |
}, | |
graalVMNativeImageOptions ++= { | |
val reflectionFile = | |
Keys.sourceDirectory.in(Compile).in(bloopgun).value./("graal")./("reflection.json") | |
assert(reflectionFile.exists) | |
List( | |
"--no-server", | |
//"--enable-http", | |
//"--enable-https", | |
"--no-fallback", | |
s"-H:ReflectionConfigurationFiles=$reflectionFile", | |
//"--allow-incomplete-classpath", | |
"-H:+ReportExceptionStackTraces" | |
//"--initialize-at-build-time=scala.Function1" | |
) | |
} | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment