Build independent distributions on CI (#835)

This commit is contained in:
Radosław Waśko 2020-06-16 11:00:47 +02:00 committed by GitHub
parent dd0f93c328
commit 3b326f0988
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 75 additions and 41 deletions

View File

@ -134,14 +134,20 @@ jobs:
restore-keys: ${{ runner.os }}-sbt-
# Build Artifacts
- name: Build the Uberjar
- name: Build the Runtime Uberjar
run: sbt --no-colors runtime/assembly
- name: Build the Runner Uberjar
run: sbt --no-colors runner/assembly
- name: Include CLI in Distribution
- name: Build the Project Manager Uberjar
run: sbt --no-colors project-manager/assembly
- name: Prepare Distribution
run: |
DIST_DIR=enso-$(./enso.jar --version --json | jq -r '.version')
mkdir $DIST_DIR
mkdir $DIST_DIR/component
cp runtime.jar $DIST_DIR/component
mv enso.jar $DIST_DIR/component
mv project-manager.jar $DIST_DIR/component
cp -r distribution/std-lib $DIST_DIR/std-lib
cp -r distribution/bin $DIST_DIR/bin
chmod +x $DIST_DIR/bin/enso
@ -149,15 +155,6 @@ jobs:
echo ::set-env name=DIST_DIR::$DIST_DIR
- name: Build the Parser JS Bundle
run: sbt -no-colors syntaxJS/fullOptJS
- name: Build the Project Manager Uberjar
run: |
sbt --no-colors runtime/assembly
sbt --no-colors project-manager/assembly
- name: Include Project Manager in Distribution
run: |
DIST_DIR=${{ env.DIST_DIR }}
mv ./runtime.jar $DIST_DIR/component
mv ./project-manager.jar $DIST_DIR/component
# Publish
- name: Publish the Distribution Artifact

2
.gitignore vendored
View File

@ -90,7 +90,7 @@ bench-report.xml
##############
/enso
/enso.jar
*.jar
#########
## IDE ##

View File

@ -436,15 +436,14 @@ lazy val `project-manager` = (project in file("lib/project-manager"))
(Compile / run / fork) := true,
(Test / fork) := true,
(Compile / run / connectInput) := true,
javaOptions ++= Seq(
// Puts the language runtime on the truffle classpath, rather than the
// standard classpath. This is the recommended way of handling this and
// we should strive to use such structure everywhere. See
// https://www.graalvm.org/docs/graalvm-as-a-platform/implement-language#graalvm
s"-Dtruffle.class.path.append=${(runtime / Compile / fullClasspath).value
javaOptions ++= {
// Note [Classpath Separation]
val runtimeClasspath =
(runtime / Compile / fullClasspath).value
.map(_.data)
.mkString(File.pathSeparator)}"
),
.mkString(File.pathSeparator)
Seq(s"-Dtruffle.class.path.append=$runtimeClasspath")
},
libraryDependencies ++= akka,
libraryDependencies ++= circe,
libraryDependencies ++= Seq(
@ -486,13 +485,38 @@ lazy val `project-manager` = (project in file("lib/project-manager"))
javaOpts = Seq("-Dtruffle.class.path.append=runtime.jar")
)
)
)
),
assembly := assembly
.dependsOn(runtime / assembly)
.value
)
.dependsOn(pkg)
.dependsOn(`language-server`)
.dependsOn(`json-rpc-server`)
.dependsOn(`json-rpc-server-test` % Test)
/* Note [Classpath Separation]
* ~~~~~~~~~~~~~~~~~~~~~~~~~~
* Projects using the language runtime do not depend on it directly, but instead
* the language runtime is put on the Truffle classpath, rather than the
* standard classpath. This is the recommended way of handling this and we
* strive to use such structure everywhere.
* See
* https://www.graalvm.org/docs/graalvm-as-a-platform/implement-language#graalvm
*
* Currently the only exception to this are the tests of the runtime project
* which have classpath separation disabled, because they need direct access to
* the runtime's instruments.
*
* To ensure correct handling of dependencies by sbt, the classpath appended to
* Java options, should be based on `(runtime / Compile / fullClasspath).value`
* wherever possible. Using a key from the runtime project enables sbt to see
* the dependency.
*
* Assembly tasks that build JAR files which need `runtime.jar` to run should
* also add a dependency on `runtime / assembly`.
*/
lazy val `json-rpc-server` = project
.in(file("lib/json-rpc-server"))
.settings(
@ -552,9 +576,7 @@ lazy val `core-definition` = (project in file("lib/core-definition"))
val truffleRunOptions = Seq(
"-Dpolyglot.engine.IterativePartialEscape=true",
"-XX:-UseJVMCIClassLoader",
"-Dpolyglot.engine.BackgroundCompilation=false",
"-Dgraalvm.locatorDisabled=true"
"-Dpolyglot.engine.BackgroundCompilation=false"
)
val truffleRunOptionsSettings = Seq(
@ -566,15 +588,14 @@ lazy val `polyglot-api` = project
.in(file("engine/polyglot-api"))
.settings(
Test / fork := true,
Test / javaOptions ++= Seq(
// Puts the language runtime on the truffle classpath, rather than the
// standard classpath. This is the recommended way of handling this and
// we should strive to use such structure everywhere. See
// https://www.graalvm.org/docs/graalvm-as-a-platform/implement-language#graalvm
s"-Dtruffle.class.path.append=${(LocalProject("runtime") / Compile / fullClasspath).value
Test / javaOptions ++= {
// Note [Classpath Separation]
val runtimeClasspath =
(LocalProject("runtime") / Compile / fullClasspath).value
.map(_.data)
.mkString(File.pathSeparator)}"
),
.mkString(File.pathSeparator)
Seq(s"-Dtruffle.class.path.append=$runtimeClasspath")
},
libraryDependencies ++= Seq(
"org.graalvm.sdk" % "polyglot-tck" % graalVersion % "provided",
"com.google.flatbuffers" % "flatbuffers-java" % flatbuffersVersion,
@ -666,7 +687,12 @@ lazy val runtime = (project in file("engine/runtime"))
Compile / compile := FixInstrumentsGeneration.patchedCompile
.dependsOn(`core-definition` / Compile / packageBin)
.dependsOn(FixInstrumentsGeneration.preCompileTask)
.value
.value,
// Note [Classpath Separation]
Test / javaOptions ++= Seq(
"-XX:-UseJVMCIClassLoader",
"-Dgraalvm.locatorDisabled=true"
)
)
.settings(
(Compile / javacOptions) ++= Seq(
@ -738,6 +764,14 @@ lazy val runtime = (project in file("engine/runtime"))
lazy val runner = project
.in(file("engine/runner"))
.settings(
javaOptions ++= {
// Note [Classpath Separation]
val runtimeClasspath =
(runtime / Compile / fullClasspath).value
.map(_.data)
.mkString(File.pathSeparator)
Seq(s"-Dtruffle.class.path.append=$runtimeClasspath")
},
mainClass in (Compile, run) := Some("org.enso.runner.Main"),
mainClass in assembly := (Compile / run / mainClass).value,
assemblyJarName in assembly := "enso.jar",
@ -762,7 +796,8 @@ lazy val runner = project
prependShellScript = Some(
defaultUniversalScript(
shebang = false,
javaOpts = truffleRunOptions
javaOpts = truffleRunOptions ++
Seq("-Dtruffle.class.path.append=runtime.jar")
)
)
),
@ -798,9 +833,11 @@ lazy val runner = project
val file = (Compile / sourceManaged).value / "buildinfo" / "Info.scala"
BuildInfo
.writeBuildInfoFile(file, ensoVersion, scalacVersion, graalVersion)
}.taskValue
}.taskValue,
assembly := assembly
.dependsOn(runtime / assembly)
.value
)
.dependsOn(runtime)
.dependsOn(pkg)
.dependsOn(`language-server`)
.dependsOn(`polyglot-api`)

View File

@ -1,3 +1,3 @@
COMP_PATH=$(dirname "$0")/../component
exec java -jar -Dpolyglot.engine.IterativePartialEscape=true -XX:-UseJVMCIClassLoader -Dpolyglot.engine.BackgroundCompilation=false -Dgraalvm.locatorDisabled=true $JAVA_OPTS $COMP_PATH/enso.jar "$@"
exec java -jar -Dtruffle.class.path.append="$COMP_PATH/runtime.jar" -Dpolyglot.engine.IterativePartialEscape=true $JAVA_OPTS $COMP_PATH/enso.jar "$@"
exit

View File

@ -1,3 +1,3 @@
set comp-dir=%~dp0\..\component
java -jar -Dpolyglot.engine.IterativePartialEscape=true -XX:-UseJVMCIClassLoader -Dpolyglot.engine.BackgroundCompilation=false -Dgraalvm.locatorDisabled=true %JAVA_OPTS% %comp-dir%\enso.jar %*
java -jar -Dtruffle.class.path.append=%comp-dir%\runtime.jar -Dpolyglot.engine.IterativePartialEscape=true %JAVA_OPTS% %comp-dir%\enso.jar %*
exit /B %errorlevel%