Skip to content

Commit 6d85547

Browse files
committed
Cross compile for Scala.js
1 parent 4470bf1 commit 6d85547

File tree

2 files changed

+23
-12
lines changed

2 files changed

+23
-12
lines changed

Diff for: build.sbt

+21-12
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,27 @@
1-
ScalaModulePlugin.scalaModuleSettings
2-
ScalaModulePlugin.scalaModuleOsgiSettings
31

4-
name := "scala-async"
5-
scalaModuleAutomaticModuleName := Some("scala.async")
2+
val sharedSettings = ScalaModulePlugin.scalaModuleSettings ++ ScalaModulePlugin.scalaModuleOsgiSettings ++ Seq(
3+
name := "scala-async",
4+
scalaModuleAutomaticModuleName := Some("scala.async"),
65

7-
libraryDependencies += "org.scala-lang" % "scala-reflect" % scalaVersion.value % "provided"
8-
libraryDependencies += "junit" % "junit" % "4.13.2" % Test
9-
libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % Test
6+
OsgiKeys.exportPackage := Seq(s"scala.async.*;version=${version.value}"),
107

11-
ScalaModulePlugin.enableOptimizer
12-
testOptions += Tests.Argument(TestFrameworks.JUnit, "-q", "-v", "-s")
13-
Test / scalacOptions ++= Seq("-Yrangepos")
14-
scalacOptions ++= List("-deprecation" , "-Xasync")
8+
libraryDependencies += "org.scala-lang" % "scala-reflect" % scalaVersion.value % "provided",
9+
libraryDependencies += "junit" % "junit" % "4.13.2" % Test,
10+
libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % Test,
11+
12+
ScalaModulePlugin.enableOptimizer,
13+
testOptions += Tests.Argument(TestFrameworks.JUnit, "-q", "-v", "-s"),
14+
Test / scalacOptions ++= Seq("-Yrangepos"),
15+
scalacOptions ++= List("-deprecation" , "-Xasync")
16+
)
17+
18+
lazy val proj = crossProject(JSPlatform, JVMPlatform)
19+
.withoutSuffixFor(JVMPlatform)
20+
.crossType(CrossType.Pure)
21+
.in(file("."))
22+
.settings(sharedSettings)
23+
24+
lazy val root = project.in(file(".")).settings(sharedSettings)
1525

1626
Global / parallelExecution := false
1727

@@ -41,7 +51,6 @@ pomExtra := (
4151
</developer>
4252
</developers>
4353
)
44-
OsgiKeys.exportPackage := Seq(s"scala.async.*;version=${version.value}")
4554

4655
commands += testDeterminism
4756

Diff for: project/plugins.sbt

+2
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.3.1")
2+
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.7.0")
3+
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0")

0 commit comments

Comments
 (0)