-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathbuild.sbt
65 lines (61 loc) · 2.92 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
val scalaMajorVersion = SettingKey[Int]("scalaMajorVersion")
// copied from Roman Janusz's Silencer plugin (/~https://github.com/ghik/silencer/)
val saveTestClasspath = taskKey[File](
"Saves test classpath to a file so that it can be used by embedded scalac in tests")
lazy val root = (project in file("."))
.settings(defaults)
.settings(
name := "genjavadoc-plugin",
scalaMajorVersion := CrossVersion.partialVersion(scalaVersion.value).get._2.toInt,
libraryDependencies ++= Seq(
"org.scala-lang" % "scala-compiler" % scalaVersion.value,
"junit" % "junit" % "4.13.2" % Test,
"com.github.sbt" % "junit-interface" % "0.13.3" % Test
),
// make JUnit more verbose (info print instead of debug, w/ exception names & stacktraces)
Test / testOptions := Seq(Tests.Argument(TestFrameworks.JUnit, "-a", "-v")),
saveTestClasspath := {
val result = (Test / classDirectory).value / "embeddedcp"
IO.write(result, (Test / fullClasspath).value.map(_.data.getAbsolutePath).mkString("\n"))
result
},
Test / test := {
saveTestClasspath.value
(Test / test).value
},
Test / fork := true,
Compile / unmanagedSourceDirectories := {
val default = (Compile / unmanagedSourceDirectories).value
def r(from: String, to: String) = default.map(f => new java.io.File(f.getPath.replaceAll(from, to)))
if (scalaVersion.value == "2.12.0") r("""/scala-2\.12$""", "/scala-2.11")
else if (scalaMajorVersion.value == 13) r("""/scala-2\.13[^/]*$""", "/scala-2.13")
else default
},
crossVersion := CrossVersion.full,
exportJars := true,
scalacOptions ++=
Seq("-deprecation", "-feature", "-unchecked", "-Xlint") ++ (
if (scalaMajorVersion.value == 13) Seq() // deprecation warnings due to SortedSet.from/to
else Seq("-Xfatal-warnings"))
)
lazy val defaults = Seq(
organization := "com.typesafe.genjavadoc",
sonatypeProfileName := "com.typesafe",
scalaVersion := crossScalaVersions.value.last,
crossScalaVersions := {
val supportedScala212Versions = (18 to 20).map(p => s"2.12.$p")
val supportedScala213Versions = (11 to 16).map(p => s"2.13.$p")
supportedScala212Versions ++ supportedScala213Versions
},
scalaMajorVersion := CrossVersion.partialVersion(scalaVersion.value).get._2.toInt,
resolvers += Resolver.mavenLocal,
startYear := Some(2012),
homepage := Some(url("/~https://github.com/lightbend/genjavadoc")),
licenses := Seq("Apache-2.0" -> url("http://opensource.org/licenses/Apache-2.0")),
scmInfo := Some(ScmInfo(url("/~https://github.com/lightbend/genjavadoc"), "git@github.com:lightbend/genjavadoc.git")),
developers += Developer("contributors",
"Contributors",
"https://gitter.im/akka/dev",
url("/~https://github.com/lightbend/genjavadoc/graphs/contributors"))
)
lazy val browse = SettingKey[Boolean]("browse", "run with -Ybrowse:uncurry")