On Thu, May 26, 2011 at 6:18 PM, Alexis Midon <[email protected]> wrote:
> It works fine except that you have to explicitly add scalatest to your test
> classpath.
>
>
> define 'scala-sample', :layout => server_layout do
> package :jar
> test.using :junit
> test.with
> "org.scalatest:scalatest_#{Scala.version}:jar:#{Scala::ScalaTest.version}"
> end
>
>
> I tried to have this done by the JUnit TestFramework but I don't see how to
> get access to the project language from the "dependencies" method.
> TestFramework don't know what project they are associated with.
>
> It looks that this information should be pass from outside.
> I gave a stab at a quick patch. Needs some polishing.
>
> https://github.com/alexism/buildr/commit/a40964f3e10198fadd9b6ab089010dee007d6e6a
Perhaps an after_define hook run in the ScalaTest module would be
easier/cleaner?
after_define(:scalatest => :test) do |project|
if (project.test.compile.language == :scala) && (project.test.framework
== :junit)
project.test.compile.dependencies += ScalaTest.dependencies
end
end
(just a sketch, untested)
alex