forked from scala-js/scala-js-dom
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
113 lines (93 loc) · 3.08 KB
/
build.sbt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
import scalatex.ScalatexReadme
lazy val root = project.in(file(".")).
enablePlugins(ScalaJSPlugin)
name := "Scala.js DOM"
crossScalaVersions in ThisBuild := {
if (scalaJSVersion.startsWith("1.")) Seq("2.12.6", "2.11.12", "2.13.0-M3")
else Seq("2.12.6", "2.11.12", "2.10.7", "2.13.0-M3", "2.13.0-M4")
}
scalaVersion in ThisBuild := crossScalaVersions.value.head
val commonSettings = Seq(
version := "0.9.7-SNAPSHOT",
organization := "org.scala-js",
scalacOptions ++= Seq("-deprecation", "-feature", "-Xfatal-warnings")
)
normalizedName := "scalajs-dom"
commonSettings
homepage := Some(url("http://scala-js.org/"))
licenses += ("MIT", url("http://opensource.org/licenses/mit-license.php"))
scalacOptions ++= {
if (isSnapshot.value)
Seq.empty
else {
val a = baseDirectory.value.toURI
val g = "https://raw.githubusercontent.com/scala-js/scala-js-dom"
Seq(s"-P:scalajs:mapSourceURI:$a->$g/v${version.value}/")
}
}
def hasNewCollections(version: String): Boolean = {
!version.startsWith("2.10.") &&
!version.startsWith("2.11.") &&
!version.startsWith("2.12.") &&
version != "2.13.0-M3"
}
/** Returns the appropriate subdirectory of `sourceDir` depending on whether
* the `scalaV` uses the new collections (introduced in 2.13.0-M4) or not.
*/
def collectionsEraDependentDirectory(scalaV: String, sourceDir: File): File =
if (hasNewCollections(scalaV)) sourceDir / "scala-new-collections"
else sourceDir / "scala-old-collections"
inConfig(Compile)(Def.settings(
unmanagedSourceDirectories +=
collectionsEraDependentDirectory(scalaVersion.value, sourceDirectory.value)
))
scalacOptions ++= {
if (scalaJSVersion.startsWith("0.6.")) Seq("-P:scalajs:sjsDefinedByDefault")
else Nil
}
scmInfo := Some(ScmInfo(
url("https://github.com/scala-js/scala-js-dom"),
"scm:git:git@github.com:scala-js/scala-js-dom.git",
Some("scm:git:git@github.com:scala-js/scala-js-dom.git")))
publishMavenStyle := true
publishTo := {
val nexus = "https://oss.sonatype.org/"
if (isSnapshot.value)
Some("snapshots" at nexus + "content/repositories/snapshots")
else
Some("releases" at nexus + "service/local/staging/deploy/maven2")
}
pomExtra := (
<developers>
<developer>
<id>lihaoyi</id>
<name>Li Haoyi</name>
<url>https://github.com/lihaoyi/</url>
</developer>
<developer>
<id>sjrd</id>
<name>Sébastien Doeraene</name>
<url>https://github.com/sjrd/</url>
</developer>
<developer>
<id>gzm0</id>
<name>Tobias Schlatter</name>
<url>https://github.com/gzm0/</url>
</developer>
</developers>
)
pomIncludeRepository := { _ => false }
lazy val readme = ScalatexReadme(
folder = "readme",
url = "https://github.com/scala-js/scala-js-dom/tree/master",
source = "Index",
targetFolder = "target/site",
autoResources = Seq("example-opt.js")
).settings(
scalaVersion := "2.11.12",
(resources in Compile) += (fullOptJS in (example, Compile)).value.data
)
lazy val example = project.
enablePlugins(ScalaJSPlugin).
settings(commonSettings: _*).
dependsOn(root)