diff --git a/main/src/main/contraband-scala/sbt/internal/remotecache/CompileRemoteCacheArtifact.scala b/main/src/main/contraband-scala/sbt/internal/remotecache/CompileRemoteCacheArtifact.scala index 9dfa76af8d..9593bb77b4 100644 --- a/main/src/main/contraband-scala/sbt/internal/remotecache/CompileRemoteCacheArtifact.scala +++ b/main/src/main/contraband-scala/sbt/internal/remotecache/CompileRemoteCacheArtifact.scala @@ -6,7 +6,7 @@ package sbt.internal.remotecache final class CompileRemoteCacheArtifact private ( artifact: sbt.librarymanagement.Artifact, - packaged: sbt.TaskKey[xsbti.VirtualFileRef], + packaged: sbt.TaskKey[xsbti.HashedVirtualFileRef], val extractDirectory: java.io.File, val analysisFile: java.io.File) extends sbt.internal.remotecache.RemoteCacheArtifact(artifact, packaged) with Serializable { @@ -22,13 +22,13 @@ final class CompileRemoteCacheArtifact private ( override def toString: String = { "CompileRemoteCacheArtifact(" + artifact + ", " + packaged + ", " + extractDirectory + ", " + analysisFile + ")" } - private[this] def copy(artifact: sbt.librarymanagement.Artifact = artifact, packaged: sbt.TaskKey[xsbti.VirtualFileRef] = packaged, extractDirectory: java.io.File = extractDirectory, analysisFile: java.io.File = analysisFile): CompileRemoteCacheArtifact = { + private[this] def copy(artifact: sbt.librarymanagement.Artifact = artifact, packaged: sbt.TaskKey[xsbti.HashedVirtualFileRef] = packaged, extractDirectory: java.io.File = extractDirectory, analysisFile: java.io.File = analysisFile): CompileRemoteCacheArtifact = { new CompileRemoteCacheArtifact(artifact, packaged, extractDirectory, analysisFile) } def withArtifact(artifact: sbt.librarymanagement.Artifact): CompileRemoteCacheArtifact = { copy(artifact = artifact) } - def withPackaged(packaged: sbt.TaskKey[xsbti.VirtualFileRef]): CompileRemoteCacheArtifact = { + def withPackaged(packaged: sbt.TaskKey[xsbti.HashedVirtualFileRef]): CompileRemoteCacheArtifact = { copy(packaged = packaged) } def withExtractDirectory(extractDirectory: java.io.File): CompileRemoteCacheArtifact = { @@ -40,5 +40,5 @@ final class CompileRemoteCacheArtifact private ( } object CompileRemoteCacheArtifact { - def apply(artifact: sbt.librarymanagement.Artifact, packaged: sbt.TaskKey[xsbti.VirtualFileRef], extractDirectory: java.io.File, analysisFile: java.io.File): CompileRemoteCacheArtifact = new CompileRemoteCacheArtifact(artifact, packaged, extractDirectory, analysisFile) + def apply(artifact: sbt.librarymanagement.Artifact, packaged: sbt.TaskKey[xsbti.HashedVirtualFileRef], extractDirectory: java.io.File, analysisFile: java.io.File): CompileRemoteCacheArtifact = new CompileRemoteCacheArtifact(artifact, packaged, extractDirectory, analysisFile) } diff --git a/main/src/main/contraband-scala/sbt/internal/remotecache/CustomRemoteCacheArtifact.scala b/main/src/main/contraband-scala/sbt/internal/remotecache/CustomRemoteCacheArtifact.scala index 8b7431b5a9..86007ebb9d 100644 --- a/main/src/main/contraband-scala/sbt/internal/remotecache/CustomRemoteCacheArtifact.scala +++ b/main/src/main/contraband-scala/sbt/internal/remotecache/CustomRemoteCacheArtifact.scala @@ -6,7 +6,7 @@ package sbt.internal.remotecache final class CustomRemoteCacheArtifact private ( artifact: sbt.librarymanagement.Artifact, - packaged: sbt.TaskKey[xsbti.VirtualFileRef], + packaged: sbt.TaskKey[xsbti.HashedVirtualFileRef], val extractDirectory: java.io.File, val preserveLastModified: Boolean) extends sbt.internal.remotecache.RemoteCacheArtifact(artifact, packaged) with Serializable { @@ -22,13 +22,13 @@ final class CustomRemoteCacheArtifact private ( override def toString: String = { "CustomRemoteCacheArtifact(" + artifact + ", " + packaged + ", " + extractDirectory + ", " + preserveLastModified + ")" } - private[this] def copy(artifact: sbt.librarymanagement.Artifact = artifact, packaged: sbt.TaskKey[xsbti.VirtualFileRef] = packaged, extractDirectory: java.io.File = extractDirectory, preserveLastModified: Boolean = preserveLastModified): CustomRemoteCacheArtifact = { + private[this] def copy(artifact: sbt.librarymanagement.Artifact = artifact, packaged: sbt.TaskKey[xsbti.HashedVirtualFileRef] = packaged, extractDirectory: java.io.File = extractDirectory, preserveLastModified: Boolean = preserveLastModified): CustomRemoteCacheArtifact = { new CustomRemoteCacheArtifact(artifact, packaged, extractDirectory, preserveLastModified) } def withArtifact(artifact: sbt.librarymanagement.Artifact): CustomRemoteCacheArtifact = { copy(artifact = artifact) } - def withPackaged(packaged: sbt.TaskKey[xsbti.VirtualFileRef]): CustomRemoteCacheArtifact = { + def withPackaged(packaged: sbt.TaskKey[xsbti.HashedVirtualFileRef]): CustomRemoteCacheArtifact = { copy(packaged = packaged) } def withExtractDirectory(extractDirectory: java.io.File): CustomRemoteCacheArtifact = { @@ -40,5 +40,5 @@ final class CustomRemoteCacheArtifact private ( } object CustomRemoteCacheArtifact { - def apply(artifact: sbt.librarymanagement.Artifact, packaged: sbt.TaskKey[xsbti.VirtualFileRef], extractDirectory: java.io.File, preserveLastModified: Boolean): CustomRemoteCacheArtifact = new CustomRemoteCacheArtifact(artifact, packaged, extractDirectory, preserveLastModified) + def apply(artifact: sbt.librarymanagement.Artifact, packaged: sbt.TaskKey[xsbti.HashedVirtualFileRef], extractDirectory: java.io.File, preserveLastModified: Boolean): CustomRemoteCacheArtifact = new CustomRemoteCacheArtifact(artifact, packaged, extractDirectory, preserveLastModified) } diff --git a/main/src/main/contraband-scala/sbt/internal/remotecache/PomRemoteCacheArtifact.scala b/main/src/main/contraband-scala/sbt/internal/remotecache/PomRemoteCacheArtifact.scala index b89b5099ee..ff6f097e45 100644 --- a/main/src/main/contraband-scala/sbt/internal/remotecache/PomRemoteCacheArtifact.scala +++ b/main/src/main/contraband-scala/sbt/internal/remotecache/PomRemoteCacheArtifact.scala @@ -6,7 +6,7 @@ package sbt.internal.remotecache final class PomRemoteCacheArtifact private ( artifact: sbt.librarymanagement.Artifact, - packaged: sbt.TaskKey[xsbti.VirtualFileRef]) extends sbt.internal.remotecache.RemoteCacheArtifact(artifact, packaged) with Serializable { + packaged: sbt.TaskKey[xsbti.HashedVirtualFileRef]) extends sbt.internal.remotecache.RemoteCacheArtifact(artifact, packaged) with Serializable { @@ -20,17 +20,17 @@ final class PomRemoteCacheArtifact private ( override def toString: String = { "PomRemoteCacheArtifact(" + artifact + ", " + packaged + ")" } - private[this] def copy(artifact: sbt.librarymanagement.Artifact = artifact, packaged: sbt.TaskKey[xsbti.VirtualFileRef] = packaged): PomRemoteCacheArtifact = { + private[this] def copy(artifact: sbt.librarymanagement.Artifact = artifact, packaged: sbt.TaskKey[xsbti.HashedVirtualFileRef] = packaged): PomRemoteCacheArtifact = { new PomRemoteCacheArtifact(artifact, packaged) } def withArtifact(artifact: sbt.librarymanagement.Artifact): PomRemoteCacheArtifact = { copy(artifact = artifact) } - def withPackaged(packaged: sbt.TaskKey[xsbti.VirtualFileRef]): PomRemoteCacheArtifact = { + def withPackaged(packaged: sbt.TaskKey[xsbti.HashedVirtualFileRef]): PomRemoteCacheArtifact = { copy(packaged = packaged) } } object PomRemoteCacheArtifact { - def apply(artifact: sbt.librarymanagement.Artifact, packaged: sbt.TaskKey[xsbti.VirtualFileRef]): PomRemoteCacheArtifact = new PomRemoteCacheArtifact(artifact, packaged) + def apply(artifact: sbt.librarymanagement.Artifact, packaged: sbt.TaskKey[xsbti.HashedVirtualFileRef]): PomRemoteCacheArtifact = new PomRemoteCacheArtifact(artifact, packaged) } diff --git a/main/src/main/contraband-scala/sbt/internal/remotecache/RemoteCacheArtifact.scala b/main/src/main/contraband-scala/sbt/internal/remotecache/RemoteCacheArtifact.scala index d66381ae46..1a2136a41f 100644 --- a/main/src/main/contraband-scala/sbt/internal/remotecache/RemoteCacheArtifact.scala +++ b/main/src/main/contraband-scala/sbt/internal/remotecache/RemoteCacheArtifact.scala @@ -6,7 +6,7 @@ package sbt.internal.remotecache abstract class RemoteCacheArtifact( val artifact: sbt.librarymanagement.Artifact, - val packaged: sbt.TaskKey[xsbti.VirtualFileRef]) extends Serializable { + val packaged: sbt.TaskKey[xsbti.HashedVirtualFileRef]) extends Serializable { diff --git a/main/src/main/contraband-scala/sbt/internal/remotecache/TestRemoteCacheArtifact.scala b/main/src/main/contraband-scala/sbt/internal/remotecache/TestRemoteCacheArtifact.scala index 26908ac194..b02b6c4be2 100644 --- a/main/src/main/contraband-scala/sbt/internal/remotecache/TestRemoteCacheArtifact.scala +++ b/main/src/main/contraband-scala/sbt/internal/remotecache/TestRemoteCacheArtifact.scala @@ -6,7 +6,7 @@ package sbt.internal.remotecache final class TestRemoteCacheArtifact private ( artifact: sbt.librarymanagement.Artifact, - packaged: sbt.TaskKey[xsbti.VirtualFileRef], + packaged: sbt.TaskKey[xsbti.HashedVirtualFileRef], val extractDirectory: java.io.File, val analysisFile: java.io.File, val testResult: java.io.File) extends sbt.internal.remotecache.RemoteCacheArtifact(artifact, packaged) with Serializable { @@ -23,13 +23,13 @@ final class TestRemoteCacheArtifact private ( override def toString: String = { "TestRemoteCacheArtifact(" + artifact + ", " + packaged + ", " + extractDirectory + ", " + analysisFile + ", " + testResult + ")" } - private[this] def copy(artifact: sbt.librarymanagement.Artifact = artifact, packaged: sbt.TaskKey[xsbti.VirtualFileRef] = packaged, extractDirectory: java.io.File = extractDirectory, analysisFile: java.io.File = analysisFile, testResult: java.io.File = testResult): TestRemoteCacheArtifact = { + private[this] def copy(artifact: sbt.librarymanagement.Artifact = artifact, packaged: sbt.TaskKey[xsbti.HashedVirtualFileRef] = packaged, extractDirectory: java.io.File = extractDirectory, analysisFile: java.io.File = analysisFile, testResult: java.io.File = testResult): TestRemoteCacheArtifact = { new TestRemoteCacheArtifact(artifact, packaged, extractDirectory, analysisFile, testResult) } def withArtifact(artifact: sbt.librarymanagement.Artifact): TestRemoteCacheArtifact = { copy(artifact = artifact) } - def withPackaged(packaged: sbt.TaskKey[xsbti.VirtualFileRef]): TestRemoteCacheArtifact = { + def withPackaged(packaged: sbt.TaskKey[xsbti.HashedVirtualFileRef]): TestRemoteCacheArtifact = { copy(packaged = packaged) } def withExtractDirectory(extractDirectory: java.io.File): TestRemoteCacheArtifact = { @@ -44,5 +44,5 @@ final class TestRemoteCacheArtifact private ( } object TestRemoteCacheArtifact { - def apply(artifact: sbt.librarymanagement.Artifact, packaged: sbt.TaskKey[xsbti.VirtualFileRef], extractDirectory: java.io.File, analysisFile: java.io.File, testResult: java.io.File): TestRemoteCacheArtifact = new TestRemoteCacheArtifact(artifact, packaged, extractDirectory, analysisFile, testResult) + def apply(artifact: sbt.librarymanagement.Artifact, packaged: sbt.TaskKey[xsbti.HashedVirtualFileRef], extractDirectory: java.io.File, analysisFile: java.io.File, testResult: java.io.File): TestRemoteCacheArtifact = new TestRemoteCacheArtifact(artifact, packaged, extractDirectory, analysisFile, testResult) } diff --git a/main/src/main/contraband/remotecache.json b/main/src/main/contraband/remotecache.json index 3bd48c0a61..77142117da 100644 --- a/main/src/main/contraband/remotecache.json +++ b/main/src/main/contraband/remotecache.json @@ -14,7 +14,7 @@ }, { "name": "packaged", - "type": "sbt.TaskKey[xsbti.VirtualFileRef]" + "type": "sbt.TaskKey[xsbti.HashedVirtualFileRef]" } ], "types": [ @@ -80,4 +80,4 @@ ] } ] -} \ No newline at end of file +} diff --git a/main/src/main/scala/sbt/Defaults.scala b/main/src/main/scala/sbt/Defaults.scala index da12487666..f0c58957f4 100644 --- a/main/src/main/scala/sbt/Defaults.scala +++ b/main/src/main/scala/sbt/Defaults.scala @@ -1949,7 +1949,7 @@ object Defaults extends BuildCommon { } def packageTaskSettings( - key: TaskKey[VirtualFileRef], + key: TaskKey[HashedVirtualFileRef], mappingsTask: Initialize[Task[Seq[(HashedVirtualFileRef, String)]]] ) = inTask(key)( @@ -1963,7 +1963,7 @@ object Defaults extends BuildCommon { ) ) - def packageTask: Initialize[Task[VirtualFileRef]] = + def packageTask: Initialize[Task[HashedVirtualFileRef]] = Def.cachedTask { val config = packageConfiguration.value val s = streams.value @@ -2913,12 +2913,12 @@ object Classpaths { } def defaultPackageKeys = Seq(packageBin, packageSrc, packageDoc) - lazy val defaultPackages: Seq[TaskKey[VirtualFileRef]] = + lazy val defaultPackages: Seq[TaskKey[HashedVirtualFileRef]] = for task <- defaultPackageKeys conf <- Seq(Compile, Test) yield (conf / task) - lazy val defaultArtifactTasks: Seq[TaskKey[VirtualFileRef]] = makePom +: defaultPackages + lazy val defaultArtifactTasks: Seq[TaskKey[HashedVirtualFileRef]] = makePom +: defaultPackages def findClasspathConfig( map: Configuration => Configuration, @@ -2938,16 +2938,16 @@ object Classpaths { } def packaged( - pkgTasks: Seq[TaskKey[VirtualFileRef]] - ): Initialize[Task[Map[Artifact, VirtualFileRef]]] = - enabledOnly(packagedArtifact.toSettingKey, pkgTasks) apply (_.join.map(_.toMap)) + pkgTasks: Seq[TaskKey[HashedVirtualFileRef]] + ): Initialize[Task[Map[Artifact, HashedVirtualFileRef]]] = + enabledOnly(packagedArtifact.toSettingKey, pkgTasks).apply(_.join.map(_.toMap)) - def artifactDefs(pkgTasks: Seq[TaskKey[VirtualFileRef]]): Initialize[Seq[Artifact]] = + def artifactDefs(pkgTasks: Seq[TaskKey[HashedVirtualFileRef]]): Initialize[Seq[Artifact]] = enabledOnly(artifact, pkgTasks) def enabledOnly[T]( key: SettingKey[T], - pkgTasks: Seq[TaskKey[VirtualFileRef]] + pkgTasks: Seq[TaskKey[HashedVirtualFileRef]] ): Initialize[Seq[T]] = (forallIn(key, pkgTasks) zipWith forallIn(publishArtifact, pkgTasks))(_ zip _ collect { case (a, true) => a diff --git a/main/src/main/scala/sbt/Keys.scala b/main/src/main/scala/sbt/Keys.scala index f75f05c1af..c8b9b75c35 100644 --- a/main/src/main/scala/sbt/Keys.scala +++ b/main/src/main/scala/sbt/Keys.scala @@ -267,11 +267,11 @@ object Keys { private[sbt] val reusableStamper = taskKey[ReadStamps]("The stamper can be reused across subprojects and sessions.") // package keys - val packageBin = taskKey[VirtualFileRef]("Produces a main artifact, such as a binary jar.").withRank(ATask) - val `package` = taskKey[VirtualFileRef]("Produces the main artifact, such as a binary jar. This is typically an alias for the task that actually does the packaging.").withRank(APlusTask) - val packageDoc = taskKey[VirtualFileRef]("Produces a documentation artifact, such as a jar containing API documentation.").withRank(AMinusTask) - val packageSrc = taskKey[VirtualFileRef]("Produces a source artifact, such as a jar containing sources and resources.").withRank(AMinusTask) - val packageCache = taskKey[VirtualFileRef]("Produces the main artifact for caching.") + val packageBin = taskKey[HashedVirtualFileRef]("Produces a main artifact, such as a binary jar.").withRank(ATask) + val `package` = taskKey[HashedVirtualFileRef]("Produces the main artifact, such as a binary jar. This is typically an alias for the task that actually does the packaging.").withRank(APlusTask) + val packageDoc = taskKey[HashedVirtualFileRef]("Produces a documentation artifact, such as a jar containing API documentation.").withRank(AMinusTask) + val packageSrc = taskKey[HashedVirtualFileRef]("Produces a source artifact, such as a jar containing sources and resources.").withRank(AMinusTask) + val packageCache = taskKey[HashedVirtualFileRef]("Produces the main artifact for caching.") val packageOptions = taskKey[Seq[PackageOption]]("Options for packaging.").withRank(BTask) val packageTimestamp = settingKey[Option[Long]]("Overwrites timestamps in JAR file to make the build reproducible; None keeps the existing timestamps (useful for web resources)").withRank(CSetting) @@ -401,7 +401,7 @@ object Keys { val pushRemoteCacheConfiguration = taskKey[PublishConfiguration]("") val pushRemoteCacheTo = settingKey[Option[Resolver]]("The resolver to publish remote cache to.") val remoteCacheResolvers = settingKey[Seq[Resolver]]("Resolvers for remote cache.") - val remoteCachePom = taskKey[VirtualFileRef]("Generates a pom for publishing when publishing Maven-style.") + val remoteCachePom = taskKey[HashedVirtualFileRef]("Generates a pom for publishing when publishing Maven-style.") val localCacheDirectory = settingKey[File]("Operating system specific cache directory.") val usePipelining = settingKey[Boolean]("Use subproject pipelining for compilation.").withRank(BSetting) val exportPipelining = settingKey[Boolean]("Product early output so downstream subprojects can do pipelining.").withRank(BSetting) @@ -498,12 +498,12 @@ object Keys { val makePomConfiguration = settingKey[MakePomConfiguration]("Configuration for generating a pom.").withRank(DSetting) val makeIvyXmlConfiguration = taskKey[PublishConfiguration]("Configuration for generating ivy.xml.").withRank(DSetting) val makeIvyXmlLocalConfiguration = taskKey[PublishConfiguration]("Configuration for generating ivy.xml.").withRank(DSetting) - val packagedArtifacts = taskKey[Map[Artifact, VirtualFileRef]]("Packages all artifacts for publishing and maps the Artifact definition to the generated file.").withRank(CTask) + val packagedArtifacts = taskKey[Map[Artifact, HashedVirtualFileRef]]("Packages all artifacts for publishing and maps the Artifact definition to the generated file.").withRank(CTask) val publishMavenStyle = settingKey[Boolean]("Configures whether to generate and publish a pom (true) or Ivy file (false).").withRank(BSetting) val credentials = taskKey[Seq[Credentials]]("The credentials to use for updating and publishing.").withRank(BMinusTask) val allCredentials = taskKey[Seq[Credentials]]("Aggregated credentials across current and root subprojects. Do not rewire this task.").withRank(DTask) - val makePom = taskKey[VirtualFileRef]("Generates a pom for publishing when publishing Maven-style.").withRank(BPlusTask) + val makePom = taskKey[HashedVirtualFileRef]("Generates a pom for publishing when publishing Maven-style.").withRank(BPlusTask) val deliver = taskKey[File]("Generates the Ivy file for publishing to a repository.").withRank(BTask) val deliverLocal = taskKey[File]("Generates the Ivy file for publishing to the local repository.").withRank(BTask) // makeIvyXml is currently identical to the confusingly-named "deliver", which may be deprecated in the future @@ -561,7 +561,7 @@ object Keys { val managedDirectory = settingKey[File]("Directory to which managed dependencies are retrieved.").withRank(BSetting) val classpathTypes = settingKey[Set[String]]("Artifact types that are included on the classpath.").withRank(BSetting) val publishArtifact = settingKey[Boolean]("Enables (true) or disables (false) publishing an artifact.").withRank(AMinusSetting) - val packagedArtifact = taskKey[(Artifact, VirtualFileRef)]("Generates a packaged artifact, returning the Artifact and the produced File.").withRank(CTask) + val packagedArtifact = taskKey[(Artifact, HashedVirtualFileRef)]("Generates a packaged artifact, returning the Artifact and the produced File.").withRank(CTask) val checksums = settingKey[Seq[String]]("The list of checksums to generate and to verify for dependencies.").withRank(BSetting) val forceUpdatePeriod = settingKey[Option[FiniteDuration]]("Duration after which to force a full update to occur").withRank(CSetting) val versionScheme = settingKey[Option[String]]("""Version scheme used for the subproject: Supported values are Some("early-semver"), Some("pvp"), and Some("semver-spec")""").withRank(BSetting) diff --git a/main/src/main/scala/sbt/RemoteCache.scala b/main/src/main/scala/sbt/RemoteCache.scala index c878df2ee4..a559fb74ea 100644 --- a/main/src/main/scala/sbt/RemoteCache.scala +++ b/main/src/main/scala/sbt/RemoteCache.scala @@ -290,7 +290,7 @@ object RemoteCache { // JarUtils.includeInJar(artp, Vector(sf -> s"META-INF/succeeded_tests")) // } // } - artp + converter.toVirtualFile(artpFile) }, pushRemoteCacheArtifact := true, remoteCacheArtifact := cacheArtifactTask.value, @@ -553,12 +553,12 @@ object RemoteCache { // } } - private def defaultArtifactTasks: Seq[TaskKey[VirtualFileRef]] = + private def defaultArtifactTasks: Seq[TaskKey[HashedVirtualFileRef]] = Seq(Compile / packageCache, Test / packageCache) private def enabledOnly[A]( key: SettingKey[A], - pkgTasks: Seq[TaskKey[VirtualFileRef]] + pkgTasks: Seq[TaskKey[HashedVirtualFileRef]] ): Def.Initialize[Seq[A]] = (Classpaths.forallIn(key, pkgTasks) zipWith Classpaths.forallIn(pushRemoteCacheArtifact, pkgTasks))(_ zip _ collect { case (a, true) =>