Merge pull request #8422 from eed3si9n/wip/crosspath

[2.x] fix: Replace Scala version with u when crossPaths is false
This commit is contained in:
eugene yokota 2025-12-19 03:11:09 -05:00 committed by GitHub
commit 5b92e34dbd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 35 additions and 35 deletions

View File

@ -3038,8 +3038,12 @@ object Classpaths {
outputPath := {
val p = platform.value
val m = moduleName.value
val c = crossPaths.value
val sv = scalaVersion.value
s"$p/scala-$sv/$m"
val sv1 =
if c then s"scala-$sv"
else "u"
s"$p/$sv1/$m"
},
ivyPaths := IvyPaths(
baseDirectory.value.toString,

View File

@ -5,10 +5,10 @@
# hybrid project, only scaladoc run
> doc
> packageBin
$ exists target/out/jvm/scala-2.12.20/root/api/index.js
$ exists target/out/jvm/scala-2.12.20/root/api/A$.html
$ absent target/out/jvm/scala-2.12.20/root/api/scala
$ absent target/out/jvm/scala-2.12.20/root/api/java
$ exists target/out/jvm/u/root/api/index.js
$ exists target/out/jvm/u/root/api/A$.html
$ absent target/out/jvm/u/root/api/scala
$ absent target/out/jvm/u/root/api/java
> setDocExtension scala
@ -19,12 +19,12 @@ $ copy-file changes/B.scala B.scala
> clean ; compile ; doc
# pure scala project, only scaladoc at top level
$ exists target/out/jvm/scala-2.12.20/root/api/index.js
$ exists target/out/jvm/scala-2.12.20/root/api/A$.html
$ exists target/out/jvm/scala-2.12.20/root/api/B$.html
$ absent target/out/jvm/scala-2.12.20/root/api/package-list
$ absent target/out/jvm/scala-2.12.20/root/api/scala
$ absent target/out/jvm/scala-2.12.20/root/api/java
$ exists target/out/jvm/u/root/api/index.js
$ exists target/out/jvm/u/root/api/A$.html
$ exists target/out/jvm/u/root/api/B$.html
$ absent target/out/jvm/u/root/api/package-list
$ absent target/out/jvm/u/root/api/scala
$ absent target/out/jvm/u/root/api/java
> setDocExtension java
@ -34,14 +34,14 @@ $ absent target/out/jvm/scala-2.12.20/root/api/java
> doc
# pure java project, only javadoc at top level
$ exists target/out/jvm/scala-2.12.20/root/api/index.html
$ exists target/out/jvm/scala-2.12.20/root/api/pkg/J.html
$ absent target/out/jvm/scala-2.12.20/root/api/index.js
$ exists target/out/jvm/u/root/api/index.html
$ exists target/out/jvm/u/root/api/pkg/J.html
$ absent target/out/jvm/u/root/api/index.js
> setDocExtension scala
> ++2.13.x
> clean
$ absent target/out/jvm/scala-2.12.20/root/api/A$.html
$ absent target/out/jvm/u/root/api/A$.html
> doc
$ exists target/out/jvm/scala-2.13.12/root/api/A$.html
$ exists target/out/jvm/scala-2.13.12/root/api/B$.html
$ exists target/out/jvm/u/root/api/A$.html
$ exists target/out/jvm/u/root/api/B$.html

View File

@ -10,14 +10,14 @@
> set version := "0.1.1"
> package
$ exists target/out/jvm/scala-3.3.1/lazy-package-name/lazy-package-name-0.1.1.jar
$ exists target/out/jvm/u/lazy-package-name/lazy-package-name-0.1.1.jar
> clean
> set version := "0.1.2"
> package
$ exists target/out/jvm/scala-3.3.1/lazy-package-name/lazy-package-name-0.1.2.jar
$ exists target/out/jvm/u/lazy-package-name/lazy-package-name-0.1.2.jar
> clean
> set version := "0.1.3"
> package
$ exists target/out/jvm/scala-3.3.1/lazy-package-name/lazy-package-name-0.1.3.jar
$ exists target/out/jvm/u/lazy-package-name/lazy-package-name-0.1.3.jar

View File

@ -1,4 +1,4 @@
> package
$ exists target/out/jvm/scala-2.12.18/jar-manifest-test/jar-manifest-test-0.2.jar
$ exec java -jar ./target/out/jvm/scala-2.12.18/jar-manifest-test/jar-manifest-test-0.2.jar
$ exists target/out/jvm/u/jar-manifest-test/jar-manifest-test-0.2.jar
$ exec java -jar ./target/out/jvm/u/jar-manifest-test/jar-manifest-test-0.2.jar
> run

View File

@ -10,7 +10,7 @@
# This should fail because sbt should include the resource in the jar but it won't have the right
# directory structure
-$ exec java -jar ./target/out/jvm/scala-3.3.1/main-resources-test/main-resources-test-0.1.jar
-$ exec java -jar ./target/out/jvm/u/main-resources-test/main-resources-test-0.1.jar
# Give the resource the right directory structure
$ mkdir src/main/resources/jartest
@ -27,4 +27,4 @@ $ delete src/main/resources/main_resource_test
> package
# This should succeed because sbt should include the resource in the jar with the right directory structure
$ exec java -jar ./target/out/jvm/scala-3.3.1/main-resources-test/main-resources-test-0.1.jar
$ exec java -jar ./target/out/jvm/u/main-resources-test/main-resources-test-0.1.jar

View File

@ -1,5 +1,3 @@
crossPaths := false
name := "definition-lib-test"
version := "1.0"
version := "1.0"

View File

@ -0,0 +1,4 @@
package injar
object Test:
def foo: Option[String] = None

View File

@ -1,8 +1,8 @@
# this step builds a test jar for use by the project definition
> package
> packageBin
$ delete build.sbt
$ copy-file target/definition-lib-test-1.0.jar project/lib/test.jar
$ copy-file target/out/jvm/u/definition-lib-test/definition-lib-test-1.0.jar project/lib/test.jar
$ copy-file changes/build2.sbt build.sbt
# the copied project definition depends on the Test module in test.jar and will

View File

@ -1,6 +0,0 @@
package injar
object Test
{
def foo: Option[String] = None
}