Skip to content

Contributing

Cleary, Paul edited this page Nov 9, 2015 · 1 revision

Pre-requisites

The stuff we use for development

  • Akka - for saneness in parallelism
  • SBT Scoverage Plugin - we use scoverage for doing our code coverage. Scoverage is optimized to handle the differences of a Scala project.
  • ScalaTest - yea, this thing is awesome. I learn something new almost every day
  • SBT AspectJ Plugin

AHH! SBT! What is this!?

Money uses SBT for doing its builds. SBT was chosen for a few reasons:

  1. It is the defacto build tool for Scala
  2. It provides a REPL, so you can experiment with your code in the REPL (awesomeness)
  3. It has the ability to detect code changes and re-run tasks automatically using the subtle but effective ~
  4. IntelliJ has progressed in support to the point that SBT is now entirely usable

How do I build this thing?

First, change your directory to the project root. From there, simply startup the sbt project by typing sbt at the command line. You will be taken into the wonderful land of SBT. You know you have arrived when you see something like

[info] Loading project definition from /Users/dude/dev/workspaces/cim/money/project
[info] Set current project to money (in build file:/Users/dude/dev/workspaces/cim/money/)
>

By default, you will be in the project root (or "parent" project for you maven geeks)


The following are useful commands for working with Money:

  • clean - cleans all of the modules in the project
  • compile - compiles the source code for all of the modules in the project
  • test - runs all of the unit tests for all of the modules in the project.
  • package - creates the distribution jars, including source and documentation jars, for all of the modules in the project
  • publishM2 - publishes all of the artifacts to the maven repository
  • publish - publishes all of the artifacts to all of the repositories, including maven and ivy
  • publish-local - publishes all of the artifacts to the local repositories, specifically ivy
  • scoverage:test - runs all of the unit tests for all of the modules in the project, and generates code coverage.

SBT also gets fancy by allowing you to combine tasks like so:

>;clean;compile;scoverage:test;+publishM2

Can I work with one module at a time?

Sure you can, simply specify the module name in the SBT console and change projects, like to change the project to money-core:

>project money-core

The other modules are:

  • money-aspectj
  • money-akka
  • money-concurrent
  • money-http-client
  • money-java-servlet
  • money-kafka

When you change projects, then any of the sbt targets you run are only applied to that module, instead of all of them.

Common SBT stuff

Building the project

> compile 

Running Test Coverage

> scoverage:test

This will compile the code (if necessary) and then run code coverage analysis. The report will be generated in target/scoverage-report/index.html

Running Tests

> test

Running a specific test

> test-only *HttpTraceAspectSpec

Continuously running a specific test as you work on it (tilta)

> ~test-only *HttpTraceAspectSpec

Running Functional (integration) tests

> it:test

Installing a project to your local repo so you might use it elsewhere

> +publishM2

Note: this will attempt to publish to a remote maven repo if the version is not a snapshot.