forked from harrah/browse
-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.sbt
66 lines (62 loc) · 2.3 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
import XRay._
import Configurations.CompilerPlugin
lazy val sxr = (project in file(".")).
settings(
inThisBuild(Seq(
organization := "org.scala-sbt.sxr",
version := "0.4.0-SNAPSHOT",
scalaVersion := "2.10.6",
crossScalaVersions := List("2.12.1", "2.11.8", "2.10.6"),
bintrayOrganization := Some("typesafe"),
bintrayRepository := s"ivy-releases",
bintrayPackage := "sxr",
bintrayReleaseOnPublish := false
)),
name := "sxr",
scalacOptions += "-deprecation",
licenses := Seq("BSD New" -> file("LICENSE").toURL),
ivyConfigurations += js,
exportJars := true,
libraryDependencies ++= dependencies,
libraryDependencies += "org.scala-lang" % "scala-compiler" % scalaVersion.value % "provided",
jqueryAll := target.value / "jquery-all.js",
combineJs := combineJquery(update.value, jqueryAll.value, streams.value.log),
resourceGenerators in Compile <+= combineJs,
commands += Command.command("testAll") { s: State => "testProj/test" :: "testLink/test" :: s },
bintrayPackage := (bintrayPackage in ThisBuild).value,
bintrayRepository := (bintrayRepository in ThisBuild).value
)
lazy val testProj: Project = (project in file("test")).
dependsOn(sxr % CompilerPlugin).
settings(
testProjectSettings,
publish := {},
publishLocal := {}
)
lazy val testLink: Project = project.dependsOn(sxr % CompilerPlugin, testProj).
settings(
testProjectSettings,
publish := {},
publishLocal := {},
scalacOptions += {
val _ = clean.value
val linkFile = target.value / "links"
val testLinkFile = classDirectory.in(testProj, Compile).value.getParentFile / "classes.sxr"
IO.write(linkFile, testLinkFile.toURI.toURL.toExternalForm)
s"-P:sxr:link-file:$linkFile"
}
)
def testProjectSettings = Seq(
libraryDependencies ++= (scalaBinaryVersion.value match {
case "2.10" => Seq()
case _ => Seq("org.scala-lang.modules" %% "scala-xml" % "1.0.6")
}),
autoCompilerPlugins := true,
compile in Compile <<= (compile in Compile).dependsOn(clean),
test := {
val _ = (compile in Compile).value
val out = (classDirectory in Compile).value
val base = baseDirectory.value
checkOutput(out / "../classes.sxr", base / "expected" / scalaBinaryVersion.value, streams.value.log)
}
)