Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add generate-graalvm-launcher.sh script #1162

Merged
merged 2 commits into from
May 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion project/CrossDeps.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@

import sbt._
import sbt.Keys._

import org.portablescala.sbtplatformdeps.PlatformDepsPlugin.autoImport._

Expand Down
26 changes: 3 additions & 23 deletions project/Deps.scala
Original file line number Diff line number Diff line change
@@ -1,31 +1,22 @@

import sbt._
import sbt.Def.setting
import sbt.Defaults.sbtPluginExtra
import sbt.Keys._

object Deps {

def catsCore = "org.typelevel" %% "cats-core" % "1.6.0"
def quasiQuotes = "org.scalamacros" %% "quasiquotes" % "2.1.0"
def fastParse = "com.lihaoyi" %% "fastparse" % SharedVersions.fastParse
def jsoup = "org.jsoup" % "jsoup" % "1.11.3"
def scalaXml = "org.scala-lang.modules" %% "scala-xml" % "1.2.0"
def scalazConcurrent = "org.scalaz" %% "scalaz-concurrent" % SharedVersions.scalaz
def caseApp = "com.github.alexarchambault" %% "case-app" % "2.0.0-M7"
def caseApp = "com.github.alexarchambault" %% "case-app" % "2.0.0-M8"
def okhttpUrlConnection = "com.squareup.okhttp" % "okhttp-urlconnection" % "2.7.5"
def argonautShapeless = "com.github.alexarchambault" %% "argonaut-shapeless_6.2" % SharedVersions.argonautShapeless
def scalatest = "org.scalatest" %% "scalatest" % "3.0.7"
def junit = "junit" % "junit" % "4.12"
def dockerClient = "com.spotify" % "docker-client" % "8.15.2"

def sbtPgp = Def.setting {
val sbtv = CrossVersion.binarySbtVersion(sbtVersion.in(pluginCrossBuild).value)
val sv = scalaBinaryVersion.value
val ver = "1.1.1"
sbtPluginExtra("com.jsuereth" % "sbt-pgp" % ver, sbtv, sv)
}

def scalaAsync = Def.setting {
val sv = scalaVersion.value
val ver =
Expand All @@ -34,20 +25,9 @@ object Deps {
"org.scala-lang.modules" %% "scala-async" % ver
}

def jarjar = "io.get-coursier.jarjar" % "jarjar-core" % "1.0.1-coursier-1"

def jarjarTransitiveDeps = Seq(
"com.google.code.findbugs" % "jsr305" % "2.0.2",
"org.ow2.asm" % "asm-commons" % SharedVersions.asm,
"org.ow2.asm" % "asm-util" % SharedVersions.asm,
"org.slf4j" % "slf4j-api" % "1.7.25"
)

def scalaNativeNir = "org.scala-native" %% "nir" % SharedVersions.scalaNative
def scalaNativeTools = "org.scala-native" %% "tools" % SharedVersions.scalaNative
def scalaNativeUtil = "org.scala-native" %% "util" % SharedVersions.scalaNative
def scalaNativeTools = "org.scala-native" %% "tools" % "0.3.9"

def slf4JNop = "org.slf4j" % "slf4j-nop" % "1.7.26"

def scalaReflect = setting("org.scala-lang" % "scala-reflect" % scalaVersion.value)
}
1 change: 1 addition & 0 deletions project/Settings.scala
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ object Settings {
}

lazy val javaScalaPluginShared = Seq(
test.in(sbtassembly.AssemblyPlugin.autoImport.assembly) := {},
scalazBintrayRepository,
sonatypeRepository("releases"),
crossScalaVersions := ScalaVersion.versions, // defined for all projects to trump sbt-doge
Expand Down
2 changes: 0 additions & 2 deletions project/SharedVersions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@
object SharedVersions {

def argonautShapeless = "1.2.0-M11"
def asm = "5.2"
def fastParse = "2.1.2"
def proguard = "6.0.3"
def scalaNative = "0.3.9"
def scalaz = "7.2.27"

}
1 change: 1 addition & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

plugins_(
"com.eed3si9n" % "sbt-assembly" % "0.14.9",
"com.geirsson" % "sbt-ci-release" % "1.2.1",
"org.scala-sbt" % "sbt-contraband" % "0.4.3",
"io.get-coursier" % "sbt-coursier" % sbtCoursierVersion,
Expand Down
30 changes: 30 additions & 0 deletions scripts/generate-graalvm-launcher.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env bash
set -eu

BASE="$(dirname "${BASH_SOURCE[0]}")"

ASSEMBLY="coursier-assembly"

cleanup() {
rm -f "$ASSEMBLY"
}

trap cleanup EXIT INT TERM


OUTPUT="$ASSEMBLY" "$BASE/generate-launcher.sh" --assembly

OUTPUT="coursier-graalvm"

"$GRAALVM_HOME/bin/native-image" \
--enable-http \
--enable-https \
-H:ReflectionConfigurationFiles="$BASE/reflection.json" \
--no-fallback \
--no-server \
-jar "$ASSEMBLY" \
"$OUTPUT"

echo "Generate graalvm native image $OUTPUT."
echo "Run like"
echo " coursier-graalvm -Djava.library.path=\$GRAALVM_HOME/jre/lib …args…"
11 changes: 11 additions & 0 deletions scripts/reflection.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[
{
"name" : "com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl",
"allDeclaredConstructors" : true,
"allPublicConstructors" : true,
"allDeclaredMethods" : true,
"allPublicMethods" : true,
"allDeclaredClasses" : true,
"allPublicClasses" : true
}
]