forked from com-lihaoyi/scalatags
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.sbt
118 lines (108 loc) · 4.28 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
114
115
116
117
118
scalaVersion := "2.11.8"
crossScalaVersions := Seq("2.11.8", "2.10.6", "2.12.0")
resolvers in ThisBuild += Resolver.sonatypeRepo("releases")
lazy val scalatags = crossProject
.settings(
organization := "com.lihaoyi",
name := "scalatags",
scalaVersion := "2.11.8",
autoCompilerPlugins := true,
libraryDependencies ++= Seq(
"com.lihaoyi" %% "acyclic" % "0.1.5" % "provided",
"com.lihaoyi" %%% "utest" % "0.4.4" % "test",
"com.lihaoyi" %%% "sourcecode" % "0.1.3",
"org.scala-lang" % "scala-reflect" % scalaVersion.value % "provided"
) ++ (
if (scalaVersion.value startsWith "2.10.")
Seq(
"org.scalamacros" %% s"quasiquotes" % "2.1.0" % "provided",
compilerPlugin("org.scalamacros" % s"paradise" % "2.1.0" cross CrossVersion.full)
)
else Nil
),
unmanagedSourceDirectories in Compile ++= {
if (scalaVersion.value startsWith "2.12.") Seq(baseDirectory.value / ".."/"shared"/"src"/ "main" / "scala-2.11")
else Seq()
},
addCompilerPlugin("com.lihaoyi" %% "acyclic" % "0.1.5"),
libraryDependencies ++= (
if (scalaVersion.value.startsWith("2.10")) Nil
else Seq("org.scala-lang.modules" %% "scala-xml" % "1.0.5" % "test")
),
testFrameworks += new TestFramework("utest.runner.Framework"),
// Sonatype
version := _root_.scalatags.Constants.version,
publishTo := Some("releases" at "https://oss.sonatype.org/service/local/staging/deploy/maven2"),
pomExtra :=
<url>https://github.com/lihaoyi/scalatags</url>
<licenses>
<license>
<name>MIT license</name>
<url>http://www.opensource.org/licenses/mit-license.php</url>
</license>
</licenses>
<scm>
<url>git://github.com/lihaoyi/scalatags.git</url>
<connection>scm:git://github.com/lihaoyi/scalatags.git</connection>
</scm>
<developers>
<developer>
<id>lihaoyi</id>
<name>Li Haoyi</name>
<url>https://github.com/lihaoyi</url>
</developer>
</developers>
)
.jvmSettings()
.jsSettings(
libraryDependencies ++= Seq(
"org.scala-js" %%% "scalajs-dom" % "0.9.1"
),
scalaJSStage in Test := FullOptStage,
requiresDOM := true,
jsEnv := PhantomJSEnv().value,
scalacOptions ++= (if (isSnapshot.value) Seq.empty else Seq({
val a = baseDirectory.value.toURI.toString.replaceFirst("[^/]+/?$", "")
val g = "https://raw.githubusercontent.com/lihaoyi/scalatags"
s"-P:scalajs:mapSourceURI:$a->$g/${version.value}/scalatags/"
}))
)
// Needed, so sbt finds the projects
lazy val scalatagsJVM = scalatags.jvm
lazy val scalatagsJS = scalatags.js
lazy val example = project.in(file("example"))
.dependsOn(scalatagsJS)
.enablePlugins(ScalaJSPlugin)
.settings(
scalaVersion := "2.11.8",
scalacOptions ++= Seq(
"-deprecation", // warning and location for usages of deprecated APIs
"-feature", // warning and location for usages of features that should be imported explicitly
"-unchecked", // additional warnings where generated code depends on assumptions
"-Xlint", // recommended additional warnings
"-Xcheckinit", // runtime error when a val is not initialized due to trait hierarchies (instead of NPE somewhere else)
"-Ywarn-adapted-args", // Warn if an argument list is modified to match the receiver
"-Ywarn-value-discard", // Warn when non-Unit expression results are unused
"-Ywarn-inaccessible",
"-Ywarn-dead-code"
)
)
lazy val readme = scalatex.ScalatexReadme(
projectId = "readme",
wd = file(""),
url = "https://github.com/lihaoyi/scalatags/tree/master",
source = "Readme",
autoResources = Seq("Autocomplete.png", "ErrorHighlighting.png", "InlineDocs.png", "example-opt.js")
).settings(
scalaVersion := "2.11.8",
(unmanagedSources in Compile) += baseDirectory.value/".."/"project"/"Constants.scala",
(resources in Compile) += (fullOptJS in (example, Compile)).value.data,
(resources in Compile) += (doc in (scalatagsJS, Compile)).value,
(run in Compile) := (run in Compile).dependsOn(Def.task{
sbt.IO.copyDirectory(
(doc in (scalatagsJS, Compile)).value,
(target in Compile).value/"scalatex"/"api",
overwrite = true
)
}).evaluated
)