For sbt 0.7.x:
By default, as far as I know, nothing is implemented. However, you can use the SBT FileUtilities utilities.
Try playing with the following example, which will copy your artifact jar into the tmp directory, zip up the directory and delete it. It should be simple to extend it to dependent libraries.
class project(info: ProjectInfo) extends DefaultProject(info) { def distPath = { ((outputPath ##) / defaultJarName) +++ mainDependencies.scalaJars } private def str2path(str: String): Path = str lazy val dist = task { FileUtilities.copyFile((outputPath ##) / defaultJarName, "tmp" / "lib" / defaultJarName, log) FileUtilities.zip(List(str2path("tmp")), "dist.zip", true, log) FileUtilities.clean("tmp", log) None } }
The following functions from FileUtilities were used above:
def zip(sources: Iterable[Path], outputZip: Path, recursive: Boolean, log: Logger) def copyFile(sourceFile: Path, targetFile: Path, log: Logger): Option[String] def clean(file: Path, log: Logger): Option[String]
Their declarations should be clear.
source share