samedi 1 octobre 2016

How do you specify additional Scala compiler arguments only when compiling and running tests?

I have been using the following pass parameters to the Scala compiler.

tasks.withType(ScalaCompile) {
    scalaCompileOptions.additionalParameters = [
            "-Xplugin:" + configurations.scalaCompilerPlugin.asPath
    ]
}

I am now faced with a new problem, which is how to pass parameters only when compiling and running tests.

E.g. I want something like (pseudo code):

tasks.withType(<ScalaTestCompile>) {
    scalaCompileOptions.additionalParameters = [
            "-cp scalameter_2.10-0.1.jar scalacheck.jar " + <way_to_find_benchmarks_and_tests>
    ]
}

and

tasks.withType(<ScalaTestRun>) {
    scalaCompileOptions.additionalParameters = [
            "-cp scalameter_2.10-0.1.jar scalacheck.jar " + <way_to_find_benchmarks_and_tests>
    ]
}

Aucun commentaire:

Enregistrer un commentaire