Thursday, September 1, 2011

Having a good build system is like living in the heaven, and having a bad.....

Having a good build system is like living in the heaven, and having a bad build system is like living in the hell. I am just tired of dealing with all kind of build system. In short, all build systems are either suck or sucks more.

Yesterday, I spent 4 hours to help a coworker to deal with library projects in Android. It wasn't a pleasure experience. Today, I spent another 4 hours to figure out how to configure an integration-test phase in SBT.

Just to save you some time, here is how to do it with SBT's quick configuration DSL, build.sbt.

import sbt._

{
    lazy val IntegrationTest = config("it") extend(Test) extend(Provided) extend(Optional)
    lazy val itSettings: Seq[Project.Setting[_]] =
        inConfig(IntegrationTest)(Defaults.testSettings) ++
        Seq(
             ivyConfigurations += IntegrationTest
        )
    seq(itSettings : _*)
}

That is all you need. The first line in the block defines a new configuration, it. The 'it' configuration extends all the dependencies from 'Test'. And the fifth line exposes this configuration to ivy and sbt.

No comments:

Post a Comment