mirror of
https://github.com/sbt/sbt.git
synced 2026-08-22 06:07:24 +02:00
Merge pull request #5984 from xuwei-k/dotty-sandwich-scala-js
Scala-2-dependsOn-Scala-3 feature with Scala.js
This commit is contained in:
@@ -3590,17 +3590,18 @@ object Classpaths {
|
|||||||
deps.classpath(ref) flatMap { dep =>
|
deps.classpath(ref) flatMap { dep =>
|
||||||
for {
|
for {
|
||||||
depProjId <- (dep.project / projectID).get(data)
|
depProjId <- (dep.project / projectID).get(data)
|
||||||
depSV <- (dep.project / scalaVersion).get(data)
|
|
||||||
depSBV <- (dep.project / scalaBinaryVersion).get(data)
|
depSBV <- (dep.project / scalaBinaryVersion).get(data)
|
||||||
depCross <- (dep.project / crossVersion).get(data)
|
depCross <- (dep.project / crossVersion).get(data)
|
||||||
} yield {
|
} yield {
|
||||||
if (isScala2Scala3Sandwich(sbv, depSBV) && depCross == CrossVersion.binary)
|
depCross match {
|
||||||
depProjId
|
case b: CrossVersion.Binary if isScala2Scala3Sandwich(sbv, depSBV) =>
|
||||||
.withCrossVersion(CrossVersion.constant(depSBV))
|
depProjId
|
||||||
.withConfigurations(dep.configuration)
|
.withCrossVersion(CrossVersion.constant(b.prefix + depSBV))
|
||||||
.withExplicitArtifacts(Vector.empty)
|
.withConfigurations(dep.configuration)
|
||||||
else
|
.withExplicitArtifacts(Vector.empty)
|
||||||
depProjId.withConfigurations(dep.configuration).withExplicitArtifacts(Vector.empty)
|
case _ =>
|
||||||
|
depProjId.withConfigurations(dep.configuration).withExplicitArtifacts(Vector.empty)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package app
|
||||||
|
|
||||||
|
import mylib._
|
||||||
|
|
||||||
|
object Main {
|
||||||
|
def main(args: Array[String]): Unit = {
|
||||||
|
println(MyLib.square(5))
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
// TODO use 2.13.4 when it's out
|
||||||
|
ThisBuild / scalaVersion := "2.13.4-bin-d526da6"
|
||||||
|
|
||||||
|
Global / resolvers += "scala-integration".at("https://scala-ci.typesafe.com/artifactory/scala-integration/")
|
||||||
|
|
||||||
|
lazy val scala3code = project
|
||||||
|
.enablePlugins(ScalaJSPlugin)
|
||||||
|
.settings(scalaVersion := "0.27.0-RC1")
|
||||||
|
|
||||||
|
lazy val app = project
|
||||||
|
.enablePlugins(ScalaJSPlugin)
|
||||||
|
.dependsOn(scala3code)
|
||||||
|
.settings(
|
||||||
|
libraryDependencies ~= (_.filterNot(_.name.contains("scalajs-compiler"))),
|
||||||
|
addCompilerPlugin("org.scala-js" % "scalajs-compiler_2.13.3" % scalaJSVersion),
|
||||||
|
scalaJSUseMainModuleInitializer := true,
|
||||||
|
)
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.4.3")
|
||||||
|
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.3.0")
|
||||||
+5
@@ -0,0 +1,5 @@
|
|||||||
|
package mylib
|
||||||
|
|
||||||
|
object MyLib {
|
||||||
|
def square(x: Int): Int = x * x
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
> app/run
|
||||||
Reference in New Issue
Block a user