From 6346ad48ce5e9514d05e50bb829dd2e55332bccb Mon Sep 17 00:00:00 2001 From: Felix Satyaputra Date: Thu, 10 Sep 2015 14:46:41 +1000 Subject: [PATCH 1/2] Reinstate and deprecate older methods to preserve binary backward compatibility with 1.0.4 The methods in question are the methods used to create various kinds of archives (e.g. zip or tar) from `com.typesafe.sbt.packager.universal.Archives` --- .../sbt/packager/universal/Archives.scala | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/src/main/scala/com/typesafe/sbt/packager/universal/Archives.scala b/src/main/scala/com/typesafe/sbt/packager/universal/Archives.scala index f5339d6d0..2416c8486 100644 --- a/src/main/scala/com/typesafe/sbt/packager/universal/Archives.scala +++ b/src/main/scala/com/typesafe/sbt/packager/universal/Archives.scala @@ -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. * @@ -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. * @@ -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. * From ce7cc544d30bdf626e022103342412e0a531fe3a Mon Sep 17 00:00:00 2001 From: Felix Satyaputra Date: Thu, 10 Sep 2015 15:08:18 +1000 Subject: [PATCH 2/2] Reinstate older methods which creates tar archive to preserve binary backward compatibility with 1.0.4 --- .../sbt/packager/universal/Archives.scala | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/main/scala/com/typesafe/sbt/packager/universal/Archives.scala b/src/main/scala/com/typesafe/sbt/packager/universal/Archives.scala index 2416c8486..1fd992c36 100644 --- a/src/main/scala/com/typesafe/sbt/packager/universal/Archives.scala +++ b/src/main/scala/com/typesafe/sbt/packager/universal/Archives.scala @@ -192,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) @@ -205,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 =>