Fix #9343 route pipelined dependencyPicklePath through internalDependencyPicklePath (#9425)

This commit is contained in:
Anatolii Kmetiuk 2026-07-13 10:18:10 +09:00 committed by Eugene Yokota
parent b5ecb37ae7
commit 7d77f44cdc
8 changed files with 71 additions and 3 deletions

View File

@ -2839,7 +2839,7 @@ object Classpaths {
case (false, _) =>
Def.task { filteredDependencyClasspath.value }
case (true, DependencyMode.Transitive) =>
Def.task { dependencyClasspath.value }
Def.task { internalDependencyPicklePath.value ++ externalDependencyClasspath.value }
case (true, DependencyMode.Direct) =>
Def.task {
val internalFiltered = ClasspathImpl.filterInternalByMode(
@ -2847,7 +2847,7 @@ object Classpaths {
thisProjectRef.value,
settingsData.value,
buildDependencies.value,
internalDependencyClasspath.value,
internalDependencyPicklePath.value,
)
val externalFiltered = ClasspathImpl.filterByDirectDeps(
allDependencies.value,
@ -2862,7 +2862,7 @@ object Classpaths {
thisProjectRef.value,
settingsData.value,
buildDependencies.value,
internalDependencyClasspath.value,
internalDependencyPicklePath.value,
)
val externalFiltered = ClasspathImpl.filterByPlusOne(
allDependencies.value,

View File

@ -0,0 +1,28 @@
ThisBuild / scalaVersion := "2.13.18"
ThisBuild / usePipelining := true
lazy val root = (project in file("."))
.aggregate(upstream, `downstream-transitive`, `downstream-direct`, `downstream-plusone`)
.settings(
name := "pipelining Java then Scala",
)
lazy val upstream = project
lazy val `downstream-transitive` = project
.in(file("downstream-transitive"))
.dependsOn(upstream)
lazy val `downstream-direct` = project
.in(file("downstream-direct"))
.dependsOn(upstream)
.settings(
dependencyMode := DependencyMode.Direct,
)
lazy val `downstream-plusone` = project
.in(file("downstream-plusone"))
.dependsOn(upstream)
.settings(
dependencyMode := DependencyMode.PlusOne,
)

View File

@ -0,0 +1,5 @@
package example
object Main {
def run(): String = Greeter.greet("world")
}

View File

@ -0,0 +1,5 @@
package example
object Main {
def run(): String = Greeter.greet("world")
}

View File

@ -0,0 +1,5 @@
package example
object Main {
def run(): String = Greeter.greet("world")
}

View File

@ -0,0 +1,13 @@
# Regression test for https://github.com/sbt/sbt/issues/9343
# With usePipelining := true, a downstream Scala source that references a
# Java class defined in an upstream project must still compile; the early
# pickle artifacts from upstream must stay visible on the pipelined classpath.
# Three downstream projects exercise Transitive, Direct, and PlusOne modes.
# A single aggregate compile fans out from one upstream pickle-producing task
# to all three downstream compilations without reusing a pipelining promise.
> compile
$ exists target/**/downstream-transitive/classes/example/Main.class
$ exists target/**/downstream-direct/classes/example/Main.class
$ exists target/**/downstream-plusone/classes/example/Main.class

View File

@ -0,0 +1,7 @@
package example;
public class Greeter {
public static String greet(String name) {
return "Hello, " + name;
}
}

View File

@ -0,0 +1,5 @@
package example
object Marker {
val tag = "upstream"
}