Fat Jar distribution (#271)

This commit is contained in:
Marcin Kostrzewa 2019-11-05 15:12:33 +01:00 committed by GitHub
parent 7f242e2327
commit cc389fd8e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 47 additions and 14 deletions

3
.gitignore vendored
View File

@ -84,9 +84,10 @@ bench-report.xml
##############
/enso
/enso.jar
#########
## IDE ##
#########
.editorconfig
.editorconfig

View File

@ -133,6 +133,21 @@ shell will execute the appropriate thing. Furthermore we have `testOnly` and
`benchOnly` that accept a glob pattern that delineates some subset of the tests
or benchmarks to run (e.g. `testOnly *FunctionArguments*`).
#### Building the Interpreter CLI Fat Jar
In order to build a fat jar with the CLI component, run the `assembly` task
inside the `interpreter` subproject:
```
sbt "interpreter/assembly"
```
This will produce an executable `enso.jar` fat jar in the repository root.
It's self contained, with its only dependencies being available inside
a vanilla GraalVM distribution. To run it, use:
```
JAVA_HOME=<PATH_TO_GRAAL_HOME> ./enso.jar <CLI_ARGS>
```
If you decide not to use the default launcher script, make sure to pass
the `-XX:-UseJVMCIClassLoader` option to the `java` command.
#### Passing Debug Options
GraalVM provides some useful debugging options, including the ability to output
the compilation graph during JIT optimisation, and the ASM generated by the JIT.

View File

@ -2,6 +2,7 @@ import sbt.Keys.scalacOptions
import scala.sys.process._
import org.enso.build.BenchTasks._
import org.enso.build.WithDebugCommand
import sbtassembly.AssemblyPlugin.defaultUniversalScript
//////////////////////////////
//// Global Configuration ////
@ -211,31 +212,47 @@ lazy val pkg = (project in file("Pkg"))
)
val truffleRunOptions = Seq(
"-Dgraal.TruffleIterativePartialEscape=true",
"-XX:-UseJVMCIClassLoader",
"-Dgraal.TruffleBackgroundCompilation=false"
)
val truffleRunOptionsSettings = Seq(
fork := true,
javaOptions += s"-Dgraal.TruffleIterativePartialEscape=true",
javaOptions += s"-XX:-UseJVMCIClassLoader",
javaOptions += s"-Dgraal.TruffleBackgroundCompilation=false"
javaOptions ++= truffleRunOptions
)
lazy val interpreter = (project in file("Interpreter"))
.settings(
mainClass in (Compile, run) := Some("org.enso.interpreter.Main"),
mainClass in assembly := (Compile / run / mainClass).value,
assemblyJarName in assembly := "enso.jar",
test in assembly := {},
assemblyOutputPath in assembly := file("enso.jar"),
assemblyOption in assembly := (assemblyOption in assembly).value.copy(
prependShellScript = Some(
defaultUniversalScript(
shebang = false,
javaOpts = truffleRunOptions
)
)
),
version := "0.1",
commands += WithDebugCommand.withDebug,
inConfig(Compile)(truffleRunOptions),
inConfig(Test)(truffleRunOptions),
inConfig(Compile)(truffleRunOptionsSettings),
inConfig(Test)(truffleRunOptionsSettings),
parallelExecution in Test := false,
logBuffered in Test := false,
libraryDependencies ++= jmh ++ Seq(
"com.chuusai" %% "shapeless" % "2.3.3",
"org.apache.commons" % "commons-lang3" % "3.9",
"org.apache.tika" % "tika-core" % "1.21",
"org.graalvm.sdk" % "graal-sdk" % graalVersion,
"org.graalvm.sdk" % "polyglot-tck" % graalVersion,
"org.graalvm.truffle" % "truffle-api" % graalVersion,
"org.graalvm.truffle" % "truffle-dsl-processor" % graalVersion,
"org.graalvm.truffle" % "truffle-tck" % graalVersion,
"org.graalvm.truffle" % "truffle-tck-common" % graalVersion,
"org.graalvm.sdk" % "graal-sdk" % graalVersion % "provided",
"org.graalvm.sdk" % "polyglot-tck" % graalVersion % "provided",
"org.graalvm.truffle" % "truffle-api" % graalVersion % "provided",
"org.graalvm.truffle" % "truffle-dsl-processor" % graalVersion % "provided",
"org.graalvm.truffle" % "truffle-tck" % graalVersion % "provided",
"org.graalvm.truffle" % "truffle-tck-common" % graalVersion % "provided",
"org.scala-lang.modules" %% "scala-parser-combinators" % "1.0.4",
"org.scalacheck" %% "scalacheck" % "1.14.0" % Test,
"org.scalactic" %% "scalactic" % "3.0.8" % Test,
@ -274,7 +291,7 @@ lazy val interpreter = (project in file("Interpreter"))
.settings(
logBuffered := false,
inConfig(Benchmark)(Defaults.testSettings),
inConfig(Benchmark)(truffleRunOptions),
inConfig(Benchmark)(truffleRunOptionsSettings),
bench := (test in Benchmark).tag(Exclusive).value,
benchOnly := Def.inputTaskDyn {
import complete.Parsers.spaceDelimited

View File

@ -1 +1 @@
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.10")