tindzk / seed

Build tool for Scala projects
https://tindzk.github.io/seed/
Apache License 2.0
238 stars 13 forks source link

Compile to GraalVM native image #57

Open jvican opened 4 years ago

jvican commented 4 years ago

I'd like to have seed compiled to native. We're already doing this in some of the projects in Bloop (for example, the next version of the CLI will be a Scala library compiled to native) and I think it would be really exciting if this project was native, which implies less resource usage and snappier UX.

Here's the list of current dependencies:

libraryDependencies ++= Seq(
  "com.lihaoyi"           %% "fansi"          % "0.2.7",
  "io.get-coursier"       %% "coursier"       % bloopCoursierVersion,
  "io.get-coursier"       %% "coursier-cache" % bloopCoursierVersion,
  "tech.sparse"           %% "toml-scala"     % "0.2.0",
  "tech.sparse"           %% "pine"           % "0.1.4",
  "ch.epfl.scala"         %% "bloop-config"   % bloopVersion,
  "com.joefkelley"        %% "argyle"         % "1.0.0",
  "org.scalaj"            %% "scalaj-http"    % "2.4.2",
  "dev.zio"               %% "zio"            % "1.0.0-RC10-1",
  "io.circe"              %% "circe-core"     % "0.11.1",
  "commons-io"            % "commons-io"      % "2.6",
  "com.zaxxer"            % "nuprocess"       % "1.2.4",
  "org.java-websocket"    % "Java-WebSocket"  % "1.4.0",
  "org.slf4j"             % "slf4j-simple"    % "2.0.0-alpha0",
  "io.monix"              %% "minitest"       % "2.5.0" % "test",
  scalaOrganization.value % "scala-reflect"   % scalaVersion.value
)

It looks like there are quite a lot of them and I'm not sure if they are GraalVM friendly. But compiling to native should in theory work for any dependency that doesn't depend on JNA. For example, nuprocess should probably be replaced by https://github.com/zeroturnaround/zt-exec.

This is not a blocker, but I think it would be cool :smile:

tindzk commented 4 years ago

Agreed. I would also like to support Scala Native further down the line, but for the time being a GraalVM build is more realistic.

jvican commented 4 years ago

Scala Native down the line sounds great too :smile: GraalVM Native works great in the meanwhile.