From 4773087c07a87b649d9b08ca48573b0f87a626c0 Mon Sep 17 00:00:00 2001 From: kyri-petrou <67301607+kyri-petrou@users.noreply.github.com> Date: Sun, 29 Dec 2024 19:41:55 +0200 Subject: [PATCH] Run caliban via JAR directly (#656) --- graphql/caliban/build.sbt | 6 ++++++ graphql/caliban/project/plugins.sbt | 1 + graphql/caliban/run.sh | 3 ++- graphql/caliban/setup.sh | 4 ++-- setup.sh | 2 +- 5 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 graphql/caliban/project/plugins.sbt diff --git a/graphql/caliban/build.sbt b/graphql/caliban/build.sbt index e94ddf1a..94e3bf82 100644 --- a/graphql/caliban/build.sbt +++ b/graphql/caliban/build.sbt @@ -8,6 +8,12 @@ lazy val root = (project in file(".")) name := "scala-caliban", run / fork := true, run / javaOptions ++= Seq("-Xms4G", "-Xmx4G"), + assembly / mainClass := Some("Main"), + assembly / assemblyMergeStrategy := { + case PathList("META-INF", "MANIFEST.MF") => MergeStrategy.discard + case PathList("META-INF", "io.netty.versions.properties") => MergeStrategy.first + case x => MergeStrategy.first + }, libraryDependencies ++= Seq( "com.github.ghostdogpr" %% "caliban-quick" % "2.9.0", "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-core" % "2.32.0", diff --git a/graphql/caliban/project/plugins.sbt b/graphql/caliban/project/plugins.sbt new file mode 100644 index 00000000..11fa359e --- /dev/null +++ b/graphql/caliban/project/plugins.sbt @@ -0,0 +1 @@ +addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "2.3.0") diff --git a/graphql/caliban/run.sh b/graphql/caliban/run.sh index 32286e7b..7f9e7977 100755 --- a/graphql/caliban/run.sh +++ b/graphql/caliban/run.sh @@ -4,4 +4,5 @@ set -e pwd cd graphql/caliban -./sbt run +JAR_FILE=$(find . -name "scala-caliban-assembly*") +java -Xms4G -Xmx4G -jar $JAR_FILE diff --git a/graphql/caliban/setup.sh b/graphql/caliban/setup.sh index 2c78ee45..381ee118 100644 --- a/graphql/caliban/setup.sh +++ b/graphql/caliban/setup.sh @@ -2,5 +2,5 @@ # For caliban cd graphql/caliban -./sbt compile -cd ../../ \ No newline at end of file +./sbt assembly +cd ../../ diff --git a/setup.sh b/setup.sh index 7f1f11d4..07066f0d 100755 --- a/setup.sh +++ b/setup.sh @@ -21,7 +21,7 @@ cd ../../ # For caliban cd graphql/caliban -./sbt compile +./sbt assembly cd ../../ # For async-graphql