cbt icon indicating copy to clipboard operation
cbt copied to clipboard

Compile CBT itself with Scala Native

Open frgomes opened this issue 9 years ago • 9 comments

Porting CBT to Scala Native would potentially allow an entire tool chain independent of the JVM, including the build tool, which is a very important component of a tool chain. At the moment, Scala Native still needs the JVM, since it is built by SBT.

Update by @cvogt: @densh and I expect Scala Native support might make CBT's permanently running background process unnecessary and further reduce the 100-200ms runtime overhead.

frgomes avatar May 23 '16 18:05 frgomes

current dependencies, that would need to be made optional or ported to Scala Native:

dependencies:

  • scala.xml
  • "org.eclipse.jgit", "org.eclipse.jgit", "4.2.0.201601211800-r" on OSX for native file change watching
  • jna

from JDK io, nio, nio.charset, reflection, security, util.jar, net, util.concurrent.HashMap, javax.xml.bind.annotation.adapters.HexBinaryAdapter

cvogt avatar May 23 '16 18:05 cvogt

for git, we may be able to just drop in the command line tool instead of jgit

cvogt avatar May 23 '16 18:05 cvogt

FWIW, nio.Buffer & Co, and nio.charset.*, can be copy-pasted from Scala.js. There's nothing JS-specific in their implementation. There's also already a lot of the abstract and in-memory Streams and Reader/Writers of java.io.*.

sjrd avatar May 23 '16 20:05 sjrd

https://facebook.github.io/watchman/docs/install.html may allow replacing barbary watch service by combining cbt with an external tool rather than letting it be aware of file watching see https://gitter.im/cvogt/cbt?at=579787637c9324e20effd586

cvogt avatar Jul 26 '16 16:07 cvogt

Porting CBT to Scala Native would potentially allow an entire tool chain independent of the JVM, including the build tool, which is a very important component of a tool chain. At the moment, Scala Native still needs the JVM, since it is built by SBT.

Can scala native compile itself? Otherwise a tool chain independent of the JVM is long way away, I think.

Jasper-M avatar Apr 25 '17 12:04 Jasper-M

@Jasper-M We can compile pretty much anything, but we can't always link what was compiled due to missing symbols in java.* namespace.

densh avatar Apr 25 '17 12:04 densh

@densh so a native Scala Native compiler will (relatively) soon be possible?

Jasper-M avatar Apr 25 '17 12:04 Jasper-M

@Jasper-M Yep, that's not a blocker. We've just merged initial File I/O (java.io.*) and there is ongoing effort to support java.nio.*and Zip/Jar I/O in the works.

densh avatar Apr 25 '17 12:04 densh

Regarding scala-xml, it was somewhat recently ported to scala.js, so I imagine a native port wouldn't be difficult. But in order to get it in a release, it may be good to get things started sooner rather than later.

On the other hand, I don't know the progress of the dotty effort, but it sounds like XML string interpolation may be added as a library in favor of supporting XML literals (I don't know how much of an issue this is for CBT, and maybe the rest of Scala-XML will still be useful in CBT). If this library were possible to backport to Scala 2.11+ without much effort, that might be the more forward-facing route.

bbarker avatar Feb 25 '18 20:02 bbarker