Add Bloop config, documentation (#412)

This commit is contained in:
Torkel Rogstad 2019-04-15 20:08:51 +02:00 committed by Chris Stewart
parent 4572a9e9c2
commit db15731b93
3 changed files with 78 additions and 13 deletions

View File

@ -10,6 +10,62 @@ It's possible to communicate with other developers through a variety of communic
- [Bitcoin-S Gitter](https://gitter.im/bitcoin-s-core/) - [Bitcoin-S Gitter](https://gitter.im/bitcoin-s-core/)
- [#bitcoin-scala](https://webchat.freenode.net/?channels=bitcoin-scala) on IRC Freenode - [#bitcoin-scala](https://webchat.freenode.net/?channels=bitcoin-scala) on IRC Freenode
## Developer productivity
### Bloop
If you're tired of waiting around for sbt all day, there's a new,
cool kid on the block. It is called [Bloop](https://scalacenter.github.io/bloop/),
and it makes compilations in general faster, and in particular
incremental, small compilation units (which greatly help editor
performance). Bloop is a server that runs in the background of
your computer, and keeps several "hot" JVMs running at all
times. These JVMs serve compilation requests. Because the JVMs
are running in the background you avoid the startup lag, and you
also get code that's already [JIT compiled](https://en.wikipedia.org/wiki/Just-in-time_compilation)
for you.
The documentation on Bloops [site](https://scalacenter.github.io/bloop/) is good, but here is the highlights:
1. Install Bloop by doing step 1 & 2 in the [official guide](https://scalacenter.github.io/bloop/setup#universal)
2. Enable the Bloop background daemon
1. macOS:
```bash
$ brew services start bloop
```
2. Ubuntu:
```bash
$ systemctl --user enable $HOME/.bloop/systemd/bloop.service
$ systemctl --user daemon-reload
$ systemctl --user start bloop
```
3. Enable shell completion for the Bloop CLI
1. Bash:
```bash
$ echo '. $HOME/.bloop/bash/bloop' >> $HOME/.bash_profile
```
2. Zsh:
```bash
$ echo 'autoload -U compinit' >> $HOME/.zshrc
$ echo 'fpath=($HOME/.bloop/zsh $fpath)' >> $HOME/.bashrc
$ echo 'compinit' >> $HOME/.bashrc
```
3. Fish:
```bash
$ ln -s $HOME/.bloop/fish/bloop.fish ~/.config/fish/completions/bloop.fish
```
4. Generate configuration files
```bash
$ sbt bloopInstall
```
5. Import Bitcoin-S into IntelliJ again, as a bsp (Build Server Protocol) project (instead of a sbt project). Make sure you're running on the most recent IntelliJ and Scala plugin. See [official docs](https://scalacenter.github.io/bloop/docs/ides/intellij) for details.
6. _(Bonus step):_ Lightning fast recompilations on file save:
```bash
$ bloop compile --project <name of module your're working on> --watch
```
Your editor should now be much faster and require less resources :tada:
## Documentation ## Documentation
One of the goals of Bitcoin-S is having useful and well-formatted Scaladoc comments on classes, One of the goals of Bitcoin-S is having useful and well-formatted Scaladoc comments on classes,

View File

@ -111,6 +111,14 @@ lazy val commonSettings = List(
.isDefined) .isDefined)
) )
lazy val commonTestSettings = Seq(
publish / skip := true,
) ++ commonSettings
lazy val commonProdSettings = Seq(
Test / bloopGenerate := None
) ++ commonSettings
lazy val root = project lazy val root = project
.in(file(".")) .in(file("."))
.aggregate( .aggregate(
@ -152,16 +160,15 @@ lazy val secp256k1jni = project
lazy val core = project lazy val core = project
.in(file("core")) .in(file("core"))
.settings(commonSettings: _*) .settings(commonProdSettings: _*)
.dependsOn( .dependsOn(
secp256k1jni secp256k1jni
).enablePlugins() ).enablePlugins()
lazy val coreTest = project lazy val coreTest = project
.in(file("core-test")) .in(file("core-test"))
.settings(commonSettings: _*) .settings(commonTestSettings: _*)
.settings( .settings(
skip in publish := true,
name := "bitcoin-s-core-test" name := "bitcoin-s-core-test"
).dependsOn( ).dependsOn(
core, core,
@ -180,7 +187,7 @@ lazy val zmq = project
lazy val bitcoindRpc = project lazy val bitcoindRpc = project
.in(file("bitcoind-rpc")) .in(file("bitcoind-rpc"))
.settings(commonSettings: _*) .settings(commonProdSettings: _*)
.settings( .settings(
name := "bitcoin-s-bitcoind-rpc", name := "bitcoin-s-bitcoind-rpc",
libraryDependencies ++= Deps.bitcoindRpc) libraryDependencies ++= Deps.bitcoindRpc)
@ -189,10 +196,10 @@ lazy val bitcoindRpc = project
lazy val bitcoindRpcTest = project lazy val bitcoindRpcTest = project
.in(file("bitcoind-rpc-test")) .in(file("bitcoind-rpc-test"))
.settings(commonSettings: _*) .settings(commonTestSettings: _*)
.settings(libraryDependencies ++= Deps.bitcoindRpcTest, .settings(
name := "bitcoin-s-bitcoind-rpc-test", libraryDependencies ++= Deps.bitcoindRpcTest,
skip in publish := true) name := "bitcoin-s-bitcoind-rpc-test")
.dependsOn(testkit) .dependsOn(testkit)
.enablePlugins() .enablePlugins()
@ -212,7 +219,7 @@ lazy val bench = project
lazy val eclairRpc = project lazy val eclairRpc = project
.in(file("eclair-rpc")) .in(file("eclair-rpc"))
.settings(commonSettings: _*) .settings(commonProdSettings: _*)
.settings( .settings(
name := "bitcoin-s-eclair-rpc", name := "bitcoin-s-eclair-rpc",
libraryDependencies ++= Deps.eclairRpc) libraryDependencies ++= Deps.eclairRpc)
@ -223,17 +230,16 @@ lazy val eclairRpc = project
lazy val eclairRpcTest = project lazy val eclairRpcTest = project
.in(file("eclair-rpc-test")) .in(file("eclair-rpc-test"))
.settings(commonSettings: _*) .settings(commonTestSettings: _*)
.settings(libraryDependencies ++= Deps.eclairRpcTest, .settings(libraryDependencies ++= Deps.eclairRpcTest,
name := "bitcoin-s-eclair-rpc-test", name := "bitcoin-s-eclair-rpc-test",
skip in publish := true
) )
.dependsOn(testkit) .dependsOn(testkit)
.enablePlugins() .enablePlugins()
lazy val testkit = project lazy val testkit = project
.in(file("testkit")) .in(file("testkit"))
.settings(commonSettings: _*) .settings(commonProdSettings: _*)
.dependsOn( .dependsOn(
core, core,
bitcoindRpc, bitcoindRpc,
@ -243,10 +249,10 @@ lazy val testkit = project
lazy val doc = project lazy val doc = project
.in(file("doc")) .in(file("doc"))
.settings(commonTestSettings: _*)
.settings( .settings(
name := "bitcoin-s-doc", name := "bitcoin-s-doc",
libraryDependencies ++= Deps.doc, libraryDependencies ++= Deps.doc,
skip in publish := true
) )
.dependsOn( .dependsOn(
secp256k1jni, secp256k1jni,

View File

@ -28,3 +28,6 @@ addSbtPlugin(
"com.thoughtworks.sbt-api-mappings" % "sbt-api-mappings" % "latest.release") "com.thoughtworks.sbt-api-mappings" % "sbt-api-mappings" % "latest.release")
addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "0.9.3") addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "0.9.3")
// bloop is a build server, enabling faster builds and more rapid dev feedback
addSbtPlugin("ch.epfl.scala" % "sbt-bloop" % "1.2.5")