Scala with Bloop and Metals

Sbt

Has SBT become faster these days ?

Bloop

Bloop Installation

curl -L https://github.com/scalacenter/bloop/releases/download/v1.4.0-RC1/install.py | python
brew install scalacenter/bloop/bloop
$ nix-channel --add https://nixos.org/channels/nixos-unstable 
$ nixos-unstable
$ nix-channel --update nix-env -iA nixos-unstable.bloop
$ systemctl --user start bloop

Let’s start the bloop server

bloop server

Configure sbt project to work with Bloop

- build.sbt
- src/main/scala
- project/build.properties
addSbtPlugin("ch.epfl.scala" % "sbt-bloop" % "1.4.0-RC1")
$ cd myProject
$ sbt bloopInstall

Test sbt-bloop configuration

$ cd myProject
$ bloop projects

Let’s compile

$ cd myProject
$ bloop compile myProject
$ git clone https://github.com/zio/zio-config
$ cd zio-config
$ bloop projects
docs
docs-test
root
root-test
zio-config
zio-config-examples
zio-config-examples-test
zio-config-magnolia
zio-config-magnolia-test
zio-config-propertyTree
zio-config-propertyTree-test
zio-config-refined
zio-config-refined-test
zio-config-test
zio-config-typesafe
zio-config-typesafe-test
$ bloop compile zio-config

Let’s try other commands

$ bloop compile myProject
$ bloop run myProject //runs the only main class
$ bloop run -m com.thaj.MyMain //similar to sbt runMain command
$ bloop test myProject

Why this set up ?

Metals: IDE integration with Bloop

1. Open your vs code2. Go to marketplace, and search for Metals and then install3. Open a scala project with a proper build.sbt

Metals & Bloop

Trying bloop commands from terminal

Why not Intellij + Bloop ?

Summary

Keep a note:

--

--

A software engineer and a functional programming enthusiast at Simple-machines, Sydney, and a hardcore hiking fan. https://twitter.com/afsalt2

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Afsal Thaj

A software engineer and a functional programming enthusiast at Simple-machines, Sydney, and a hardcore hiking fan. https://twitter.com/afsalt2