Skip to content

Commit

Permalink
Use sbt-native-image plugin (#741)
Browse files Browse the repository at this point in the history
* Use sbt-native-image plugin

* fix build
  • Loading branch information
johnynek authored Jun 5, 2021
1 parent 2820905 commit 7ae857a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
8 changes: 2 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,10 @@ jobs:
uses: "olafurpg/setup-scala@v10"
with:
java-version: "[email protected]"
- name: "install native-image"
run: |
java -version
gu install native-image
- name: "build assembly jar and native image"
run: |
sbt "++${{matrix.scala}} cli/assembly"
./build_native.sh
sbt "++${{matrix.scala}} cli/assembly; cli/nativeImage"
cp cli/target/native-image/bosatsu-cli bosatsu
- name: "run bosatsu tests"
run: |
./bosatsu test --input_dir test_workspace/ --package_root test_workspace/
Expand Down
7 changes: 5 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ lazy val cli = (project in file("cli")).
commonSettings,
name := "bosatsu-cli",
test in assembly := {},
mainClass in assembly := Some("org.bykn.bosatsu.Main"),
assembly / mainClass := Some("org.bykn.bosatsu.Main"),
Compile / mainClass := Some("org.bykn.bosatsu.Main"),
libraryDependencies ++=
Seq(
catsEffect.value,
Expand All @@ -130,9 +131,11 @@ lazy val cli = (project in file("cli")).
),
PB.targets in Compile := Seq(
scalapb.gen() -> (sourceManaged in Compile).value
),
nativeImageOptions ++= Seq("--static", "--no-fallback", "--verbose", "--initialize-at-build-time")
)
)
.dependsOn(coreJVM % "compile->compile;test->test")
.enablePlugins(NativeImagePlugin)

lazy val core = (crossProject(JSPlatform, JVMPlatform).crossType(CrossType.Pure) in file("core")).
settings(
Expand Down
1 change: 1 addition & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ addSbtPlugin("com.thesamet" % "sbt-protoc" % "0.99.34")
addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.1")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.5.1")
addSbtPlugin("org.scalameta" % "sbt-native-image" % "0.3.0")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.8.2")
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.3")

Expand Down

0 comments on commit 7ae857a

Please sign in to comment.