Skip to content

Commit a1a9e52

Browse files
Prepare build.sbt for Scala.js support
1 parent 150a237 commit a1a9e52

File tree

3 files changed

+33
-34
lines changed

3 files changed

+33
-34
lines changed

build.sbt

Lines changed: 29 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
11
import com.typesafe.tools.mima.plugin.{MimaPlugin, MimaKeys}
22

3-
scalaModuleSettings
4-
5-
name := "scala-xml"
6-
7-
version := "1.0.6-SNAPSHOT"
8-
9-
scalaVersion := crossScalaVersions.value.head
10-
11-
crossScalaVersions := {
3+
scalaVersion in ThisBuild := crossScalaVersions.value.head
4+
crossScalaVersions in ThisBuild := {
125
val java = System.getProperty("java.version")
136
if (java.startsWith("1.6.") || java.startsWith("1.7."))
147
Seq("2.11.8")
@@ -18,27 +11,30 @@ crossScalaVersions := {
1811
sys.error(s"don't know what Scala versions to build on $java")
1912
}
2013

21-
//reenable -Xfatal-warnings?
22-
scalacOptions ++= "-deprecation:false -feature -Xlint:-stars-align,-nullary-unit,_".split("\\s+").to[Seq]
23-
24-
scalacOptions in Test += "-Xxml:coalescing"
25-
26-
// important!! must come here (why?)
27-
scalaModuleOsgiSettings
28-
29-
OsgiKeys.exportPackage := Seq(s"scala.xml.*;version=${version.value}")
30-
31-
libraryDependencies += "junit" % "junit" % "4.11" % "test"
32-
33-
libraryDependencies += "com.novocode" % "junit-interface" % "0.10" % "test"
34-
35-
//// testing:
36-
// used in CompilerErrors test
37-
libraryDependencies += ("org.scala-lang" % "scala-compiler" % scalaVersion.value % "test").exclude("org.scala-lang.modules", s"scala-xml*")
38-
39-
mimaPreviousVersion := Some("1.0.5")
40-
41-
// You cannot disable JVM test forking when working on scala modules
42-
// that are distributed with the compiler because of an SBT
43-
// classloader leaking issue (scala/scala-xml#20 and #112).
44-
fork in Test := true
14+
lazy val root = project.in(file("."))
15+
.aggregate(xmlJS, xmlJVM)
16+
.settings(publish := {}, publishLocal := {})
17+
18+
lazy val xml = crossProject.in(file("."))
19+
.settings(
20+
name := "scala-xml",
21+
version := "1.0.6-SNAPSHOT",
22+
scalacOptions ++= "-deprecation:false -feature -Xlint:-stars-align,-nullary-unit,_".split("\\s+").to[Seq],
23+
scalacOptions in Test += "-Xxml:coalescing")
24+
.jvmSettings(
25+
scalaModuleSettings ++
26+
scalaModuleOsgiSettings ++
27+
List(
28+
OsgiKeys.exportPackage := Seq(s"scala.xml.*;version=${version.value}"),
29+
libraryDependencies += "junit" % "junit" % "4.11" % "test",
30+
libraryDependencies += "com.novocode" % "junit-interface" % "0.10" % "test",
31+
libraryDependencies += ("org.scala-lang" % "scala-compiler" % scalaVersion.value % "test").exclude("org.scala-lang.modules", s"scala-xml*"),
32+
mimaPreviousVersion := Some("1.0.5"),
33+
// You cannot disable JVM test forking when working on scala modules
34+
// that are distributed with the compiler because of an SBT
35+
// classloader leaking issue (scala/scala-xml#20 and #112).
36+
fork in Test := true): _*)
37+
.jsConfigure(_.enablePlugins(ScalaJSJUnitPlugin))
38+
39+
lazy val xmlJVM = xml.jvm
40+
lazy val xmlJS = xml.js

project/build.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
sbt.version=0.13.8
1+
sbt.version=0.13.12

project/plugins.sbt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
addSbtPlugin("org.scala-lang.modules" % "scala-module-plugin" % "1.0.4")
2+
3+
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.12")
4+

0 commit comments

Comments
 (0)