Skip to content

Commit

Permalink
Use HashedVirtualFileRef for packageBin
Browse files Browse the repository at this point in the history
  • Loading branch information
eed3si9n committed Dec 11, 2023
1 parent 3c13d06 commit be5c7a7
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 40 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions main/src/main/contraband/remotecache.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
},
{
"name": "packaged",
"type": "sbt.TaskKey[xsbti.VirtualFileRef]"
"type": "sbt.TaskKey[xsbti.HashedVirtualFileRef]"
}
],
"types": [
Expand Down Expand Up @@ -80,4 +80,4 @@
]
}
]
}
}
18 changes: 9 additions & 9 deletions main/src/main/scala/sbt/Defaults.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1949,7 +1949,7 @@ object Defaults extends BuildCommon {
}

def packageTaskSettings(
key: TaskKey[VirtualFileRef],
key: TaskKey[HashedVirtualFileRef],
mappingsTask: Initialize[Task[Seq[(HashedVirtualFileRef, String)]]]
) =
inTask(key)(
Expand All @@ -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
Expand Down Expand Up @@ -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,
Expand All @@ -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
Expand Down
18 changes: 9 additions & 9 deletions main/src/main/scala/sbt/Keys.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions main/src/main/scala/sbt/RemoteCache.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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) =>
Expand Down

0 comments on commit be5c7a7

Please sign in to comment.