Pergunta

I want to add some files to test a library that I am writing.

The tests are available in a compressed file in a URI and I just want to download that file and uncompress its contents to a folder before testing.

I was reading the documentation on SBT and there is a Generate sources/resources task.

Also, it seems easy to uncompress a zip file in Scala (see this question).

So I think, I could glue those 2 pieces together, but I wonder if there is some simpler solution.

Foi útil?

Solução

How about this (syntax for Sbt 0.13.2), in your build.sbt:

resourceGenerators in Test += Def.task {
  val location = url("http://path/to/your/zip-file.zip")
  IO.unzipURL(location, resourceManaged.value / "my-custom-files").toSeq
}.taskValue
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top