Last active
April 6, 2020 10:47
-
-
Save olafurpg/0cfa29af87c8a80a82a2281c456213c3 to your computer and use it in GitHub Desktop.
Fast edit/run feedback loop for Scala using Nailgun
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Step 1: install coursier and nailgun | |
brew install nailgun coursier/formulas/coursier | |
# Step 2: start nailgun server with the Scala compiler on the classpath | |
cs launch com.martiansoftware:nailgun-server:0.9.1 org.scala-lang:scala-compiler:2.13.1 --main com.martiansoftware.nailgun.NGServer -- 2113 & | |
# Step 3: create basic Scala hello world | |
echo 'println("Hello world!")' > Main.scala | |
# Step 4: assemble the classpath. | |
# You need at least the standard library, but you can add more libraries (for example JSON). | |
CLASSPATH=$(cs fetch --classpath org.scala-lang:scala-library:2.13.1) | |
# Step 5: evaluate the Scala hello world program with the nailgun server | |
for i in {1..1000}; do | |
time ng --nailgun-port 2113 scala.tools.nsc.MainGenericRunner -classpath $CLASSPATH -usejavacp Main.scala | |
done | |
# Once the nailgun process becomes hot, the compile+run feedback loop eventually becomes around ~200ms | |
# > Hello world! | |
# > real 0m0.199s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment