Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Build-automation - sbt: Compile/Test against multiple dependencies

We just published parts of our library (Mango) which is a Scala wrapper around Google Guava common libraries for Java.

The library currently depends on Google Gauva 14.0, but we would like to add support for other versions as well.

Is there a way in sbt, a build-automation tool for Scala and Java projects, to create maven like profiles, where each profile compiles against a different version of the respective Guava dependency, so we can include it in the continuous integration test matrix?

Ideally, it should be possible to call sbt with something like:

sbt test guava:14.0
sbt test guava:13.0
...
like image 888
Markus Avatar asked Jul 29 '13 11:07

Markus


1 Answers

You should check this link: Custom test configuration

I know you don't want to do tests but as you can see, we can create different SBT configuration. You will probably be able to take inspiration of the following, and be able to create configurations and tasks so that you can run:

  • guava13:compile
  • guava14:compile
  • guava13:test
  • guava14:test

And you can perhaps try to add the dependencies as follow:

libraryDependencies += "com.google.guava" % "guava" % "13.0" % "guava13"
libraryDependencies += "com.google.guava" % "guava" % "14.0" % "guava14"

So that the dependency is scoped to the guava version configuration you use.

Never done this, can't be sure :)

You can also add cross-build

Nice library idea by the way.

like image 84
Sebastien Lorber Avatar answered Nov 11 '22 05:11

Sebastien Lorber