Merge pull request #6424 from adpi2/scala3-cross-target

Use full Scala 3 version in crossTarget
This commit is contained in:
eugene yokota 2021-04-02 10:55:05 -04:00 committed by GitHub
commit 0a0e87ff22
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 29 additions and 2 deletions

View File

@ -692,6 +692,7 @@ object Defaults extends BuildCommon {
crossSbtVersions := Vector((pluginCrossBuild / sbtVersion).value),
crossTarget := makeCrossTarget(
target.value,
scalaVersion.value,
scalaBinaryVersion.value,
(pluginCrossBuild / sbtBinaryVersion).value,
sbtPlugin.value,
@ -772,8 +773,23 @@ object Defaults extends BuildCommon {
else Vector()
}
def makeCrossTarget(t: File, sv: String, sbtv: String, plugin: Boolean, cross: Boolean): File = {
val scalaBase = if (cross) t / ("scala-" + sv) else t
@deprecated("Use constructor with scalaVersion and scalaBinaryVersion", "1.5.0")
def makeCrossTarget(t: File, bv: String, sbtv: String, plugin: Boolean, cross: Boolean): File = {
val scalaBase = if (cross) t / ("scala-" + bv) else t
if (plugin) scalaBase / ("sbt-" + sbtv) else scalaBase
}
def makeCrossTarget(
t: File,
scalaVersion: String,
scalaBinaryVersion: String,
sbtv: String,
plugin: Boolean,
cross: Boolean
): File = {
val scalaSuffix =
if (ScalaArtifacts.isScala3(scalaVersion)) scalaVersion else scalaBinaryVersion
val scalaBase = if (cross) t / ("scala-" + scalaSuffix) else t
if (plugin) scalaBase / ("sbt-" + sbtv) else scalaBase
}

View File

@ -0,0 +1,3 @@
scalaVersion := "3.0.0-RC2-bin-20210328-cca5f8f-NIGHTLY"
name := "foo"
version := "1.0.0"

View File

@ -0,0 +1 @@
object Foo

View File

@ -0,0 +1,7 @@
> compile
$ exists target/scala-3.0.0-RC2-bin-20210328-cca5f8f-NIGHTLY/classes/Foo$.class
> package
$ exists target/scala-3.0.0-RC2-bin-20210328-cca5f8f-NIGHTLY/foo_3.0.0-RC2-1.0.0.jar