Skip to content

Commit

Permalink
Merge pull request #667 from fsat/deprecate-old-archives-methods
Browse files Browse the repository at this point in the history
WIP - DON'T MERGE - Reinstate and deprecate older methods to preserve binary backward compatibility with 1.0.4
  • Loading branch information
muuki88 committed Sep 10, 2015
2 parents a16c9ec + ce7cc54 commit 1305e89
Showing 1 changed file with 66 additions and 3 deletions.
69 changes: 66 additions & 3 deletions src/main/scala/com/typesafe/sbt/packager/universal/Archives.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,21 @@ import sbt._
/** Helper methods to package up files into compressed archives. */
object Archives {

/**
* Makes a zip file in the given target directory using the given name.
* @param target folder to build package in
* @param name of output (without extension)
* @param mappings included in the output
* @param top level directory
* @return zip file
*/
@deprecated(
"Use [[com.typesafe.sbt.packager.universal.Archives.makeZip(File, String, Seq[(File, String)], Option[String], Seq[String]): File]]",
since = "1.0.5"
)
def makeZip(target: File, name: String, mappings: Seq[(File, String)], top: Option[String]): File =
makeZip(target, name, mappings, top, options = Seq.empty)

/**
* Makes a zip file in the given target directory using the given name.
*
Expand All @@ -29,6 +44,22 @@ object Archives {
zip
}

/**
* Makes a zip file in the given target directory using the given name.
*
* @param target folder to build package in
* @param name of output (without extension)
* @param mappings included in the output
* @param top level directory
* @return zip file
*/
@deprecated(
"Use [[com.typesafe.sbt.packager.universal.Archives.makeNativeZip(File, String, Seq[(File, String)], Option[String], Seq[String]): File]]",
since = "1.0.5"
)
def makeNativeZip(target: File, name: String, mappings: Seq[(File, String)], top: Option[String]): File =
makeNativeZip(target, name, mappings, top, options = Seq.empty)

/**
* Makes a zip file in the given target directory using the given name.
*
Expand All @@ -51,6 +82,24 @@ object Archives {
zip
}

/**
* Makes a dmg file in the given target directory using the given name.
*
* Note: Only works on OSX
*
* @param target folder to build package in
* @param name of output (without extension)
* @param mappings included in the output
* @param top level directory : NOT USED
* @return dmg file
*/
@deprecated(
"Use [[com.typesafe.sbt.packager.universal.Archives.makeDmg(target: File, name: String, mappings: Seq[(File, String)], top: Option[String], options: Seq[String]): File]]",
since = "1.0.5"
)
def makeDmg(target: File, name: String, mappings: Seq[(File, String)], top: Option[String]): File =
makeDmg(target, name, mappings, top, options = Seq.empty)

/**
* Makes a dmg file in the given target directory using the given name.
*
Expand Down Expand Up @@ -143,10 +192,24 @@ object Archives {
file(f.getAbsolutePath + ".xz")
}

val makeTxz = makeTarball(xz, ".txz") _
val makeTgz = makeTarball(gzip, ".tgz") _
val makeTxz = makeTarballWithOptions(xz, ".txz") _
val makeTgz = makeTarballWithOptions(gzip, ".tgz") _

/**
* Helper method used to construct tar-related compression functions with `--force-local` and `-pvcf` option specified
* as default.
* @param target folder to build package in
* @param name of output (without extension)
* @param mappings included in the output
* @param top level directory
* @return tar file
*
*/
def makeTarball(compressor: File => File, ext: String)(target: File, name: String, mappings: Seq[(File, String)], top: Option[String]): File =
makeTarballWithOptions(compressor, ext)(target, name, mappings, top, options = Seq("--force-local", "-pcvf"))


/**
* Helper method used to construct tar-related compression functions.
* @param target folder to build package in
* @param name of output (without extension)
Expand All @@ -156,7 +219,7 @@ object Archives {
* @return tar file
*
*/
def makeTarball(compressor: File => File, ext: String)(target: File, name: String, mappings: Seq[(File, String)], top: Option[String], options: Seq[String]): File = {
def makeTarballWithOptions(compressor: File => File, ext: String)(target: File, name: String, mappings: Seq[(File, String)], top: Option[String], options: Seq[String]): File = {
val relname = name
val tarball = target / (name + ext)
IO.withTemporaryDirectory { f =>
Expand Down

0 comments on commit 1305e89

Please sign in to comment.