mirror of
https://github.com/fluencelabs/aqua.git
synced 2024-12-04 14:40:17 +00:00
Use sbt-native-image
This commit is contained in:
parent
e56f5df835
commit
eebb35fa55
@ -214,18 +214,20 @@ lazy val compiler = crossProject(JVMPlatform, JSPlatform)
|
|||||||
|
|
||||||
lazy val `compiler-native-lib` = project
|
lazy val `compiler-native-lib` = project
|
||||||
.in(file("compiler-native-lib"))
|
.in(file("compiler-native-lib"))
|
||||||
.enablePlugins(GraalVMNativeImagePlugin)
|
.enablePlugins(NativeImagePlugin)
|
||||||
.settings(commons: _*)
|
.settings(commons: _*)
|
||||||
.settings(
|
.settings(
|
||||||
Compile / mainClass := Some("aqua.compiler.Library"),
|
Compile / mainClass := Some("aqua.compiler.Library"),
|
||||||
graalVMNativeImageOptions ++= Seq(
|
nativeImageVersion := "22.1.0",
|
||||||
|
nativeImageOptions ++= Seq(
|
||||||
"--verbose",
|
"--verbose",
|
||||||
"--no-fallback",
|
"--no-fallback",
|
||||||
|
"--shared", // Produce shared library
|
||||||
|
"--initialize-at-run-time=aqua.logging.LogFormatter$"
|
||||||
// Uncomment next lines to use llvm backend
|
// Uncomment next lines to use llvm backend
|
||||||
// and obtain bitcode files
|
// and obtain bitcode files
|
||||||
// "-H:CompilerBackend=llvm",
|
// "-H:CompilerBackend=llvm",
|
||||||
// "-H:TempDirectory=temp", // Directory with bc files
|
// "-H:TempDirectory=temp", // Directory with bc files
|
||||||
"--shared" // Produce shared library
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.dependsOn(`aqua-api`.jvm)
|
.dependsOn(`aqua-api`.jvm)
|
||||||
|
@ -10,6 +10,7 @@ import cats.effect.unsafe.implicits.global
|
|||||||
|
|
||||||
import aqua.api.{APICompilation, AquaAPIConfig}
|
import aqua.api.{APICompilation, AquaAPIConfig}
|
||||||
import aqua.backend.api.APIBackend
|
import aqua.backend.api.APIBackend
|
||||||
|
import aqua.logging.LogFormatter
|
||||||
|
|
||||||
// This is neede for @static to work in object
|
// This is neede for @static to work in object
|
||||||
class Library {}
|
class Library {}
|
||||||
@ -26,6 +27,8 @@ object Library {
|
|||||||
): Int = {
|
): Int = {
|
||||||
val code = CTypeConversion.toJavaString(codePointer)
|
val code = CTypeConversion.toJavaString(codePointer)
|
||||||
|
|
||||||
|
LogFormatter.initLogger(Some(scribe.Level.Info))
|
||||||
|
|
||||||
val result = APICompilation
|
val result = APICompilation
|
||||||
.compileString(
|
.compileString(
|
||||||
code,
|
code,
|
||||||
|
@ -2,4 +2,5 @@ addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "2.1.5")
|
|||||||
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.15.0")
|
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.15.0")
|
||||||
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.2")
|
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.2")
|
||||||
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.11.0")
|
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.11.0")
|
||||||
|
addSbtPlugin("org.scalameta" % "sbt-native-image" % "0.3.4")
|
||||||
addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.10.0")
|
addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.10.0")
|
||||||
|
Loading…
Reference in New Issue
Block a user