Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reinstate and deprecate older methods to preserve binary backward compatibility with 1.0.4 #667

Merged
merged 2 commits into from
Sep 10, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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]]",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@huntc - is there a way to reference overloaded method in Scaladoc? This doesn't seem to come out right.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dunno

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