Fix earlyOutput paths

Fixes https://github.com/sbt/sbt/issues/5929
This commit is contained in:
Eugene Yokota 2020-10-21 23:51:51 -04:00
parent f35675286b
commit 88d7da5141
1 changed files with 23 additions and 3 deletions

View File

@ -623,7 +623,7 @@ object Defaults extends BuildCommon {
val dir = classDirectory.value
converter.toVirtualFile(dir.toPath)
},
earlyOutput / artifactPath := earlyArtifactPathSetting(artifact).value,
earlyOutput / artifactPath := configArtifactPathSetting(artifact, "early").value,
earlyOutput := {
val converter = fileConverter.value
val jar = (earlyOutput / artifactPath).value
@ -1591,10 +1591,30 @@ object Defaults extends BuildCommon {
excludes: ScopedTaskable[FileFilter]
): Initialize[Task[Seq[File]]] = collectFiles(dirs: Taskable[Seq[File]], filter, excludes)
private[sbt] def earlyArtifactPathSetting(art: SettingKey[Artifact]): Initialize[File] =
private[sbt] def configArtifactPathSetting(
art: SettingKey[Artifact],
extraPrefix: String
): Initialize[File] =
Def.setting {
val f = artifactName.value
crossTarget.value / "early" / f(
crossTarget.value /
(prefix(configuration.value.name) + extraPrefix) / f(
ScalaVersion(
(scalaVersion in artifactName).value,
(scalaBinaryVersion in artifactName).value
),
projectID.value,
art.value
)
}
private[sbt] def prefixArtifactPathSetting(
art: SettingKey[Artifact],
extraPrefix: String
): Initialize[File] =
Def.setting {
val f = artifactName.value
crossTarget.value / extraPrefix / f(
ScalaVersion(
(scalaVersion in artifactName).value,
(scalaBinaryVersion in artifactName).value