diff --git a/main-actions/src/main/scala/sbt/Package.scala b/main-actions/src/main/scala/sbt/Package.scala index e5ba47012..168e7f9de 100644 --- a/main-actions/src/main/scala/sbt/Package.scala +++ b/main-actions/src/main/scala/sbt/Package.scala @@ -70,13 +70,23 @@ object Package { val options: Seq[PackageOption] ) + @deprecated("Please specify whether to use a static timestamp", "1.3.4") + def apply(conf: Configuration, cacheStoreFactory: CacheStoreFactory, log: Logger): Unit = + apply(conf, cacheStoreFactory, log, None) + /** * * @param conf the package configuration that should be build * @param cacheStoreFactory used for jar caching. We try to avoid rebuilds as much as possible * @param log feedback for the user + * @param time static timestamp to use for all entries, if any. */ - def apply(conf: Configuration, cacheStoreFactory: CacheStoreFactory, log: Logger): Unit = { + def apply( + conf: Configuration, + cacheStoreFactory: CacheStoreFactory, + log: Logger, + time: Option[Long] + ): Unit = { val manifest = new Manifest val main = manifest.getMainAttributes for (option <- conf.options) { @@ -96,7 +106,7 @@ object Package { val sources :+: _ :+: manifest :+: HNil = inputs outputChanged(cacheStoreFactory make "output") { (outChanged, jar: PlainFileInfo) => if (inChanged || outChanged) { - makeJar(sources, jar.file, manifest, log) + makeJar(sources, jar.file, manifest, log, time) jar.file () } else @@ -153,7 +163,17 @@ object Package { homepage map (h => (IMPLEMENTATION_URL, h.toString)) }: _*) } - def makeJar(sources: Seq[(File, String)], jar: File, manifest: Manifest, log: Logger): Unit = { + @deprecated("Please specify whether to use a static timestamp", "1.3.4") + def makeJar(sources: Seq[(File, String)], jar: File, manifest: Manifest, log: Logger): Unit = + makeJar(sources, jar, manifest, log, None) + + def makeJar( + sources: Seq[(File, String)], + jar: File, + manifest: Manifest, + log: Logger, + time: Option[Long] + ): Unit = { val path = jar.getAbsolutePath log.debug("Packaging " + path + " ...") if (jar.exists) @@ -162,7 +182,7 @@ object Package { else sys.error(path + " exists, but is not a regular file") log.debug(sourcesDebugString(sources)) - IO.jar(sources, jar, manifest) + IO.jar(sources, jar, manifest, time) log.debug("Done packaging.") } def sourcesDebugString(sources: Seq[(File, String)]): String = diff --git a/main/src/main/scala/sbt/Defaults.scala b/main/src/main/scala/sbt/Defaults.scala index 3cfbcd75c..7e6ac251b 100755 --- a/main/src/main/scala/sbt/Defaults.scala +++ b/main/src/main/scala/sbt/Defaults.scala @@ -1409,7 +1409,7 @@ object Defaults extends BuildCommon { Def.task { val config = packageConfiguration.value val s = streams.value - Package(config, s.cacheStoreFactory, s.log) + Package(config, s.cacheStoreFactory, s.log, Some(0)) config.jar }