forked from lightbend-labs/mima
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sbt
73 lines (66 loc) · 2.91 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
import mimabuild._
inThisBuild(Seq(
organization := "com.typesafe",
licenses := Seq("Apache License v2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")),
homepage := Some(url("http://github.com/lightbend/mima")),
developers := List(
Developer("mdotta", "Mirco Dotta", "@dotta", url("https://github.com/dotta")),
Developer("jsuereth", "Josh Suereth", "@jsuereth", url("https://github.com/jsuereth")),
Developer("dwijnand", "Dale Wijnand", "@dwijnand", url("https://github.com/dwijnand")),
),
scmInfo := Some(ScmInfo(url("https://github.com/lightbend/mima"), "scm:git:[email protected]:lightbend/mima.git")),
dynverVTagPrefix := false,
scalacOptions := Seq("-feature", "-deprecation", "-Xlint"),
useCoursier := false, // b/c otherwise IntegrationTest/test uses scala-library-2.12 always
resolvers ++= (if (isStaging) List(stagingResolver) else Nil),
publishTo := Some(if (isSnapshot.value) Opts.resolver.sonatypeSnapshots else Opts.resolver.sonatypeStaging),
))
// Useful to self-test releases
val stagingResolver = "Sonatype OSS Staging" at "https://oss.sonatype.org/content/repositories/staging"
def isStaging = sys.props.contains("mimabuild.staging")
commands += Command.command("testStaging") { state =>
val prep = if (isStaging) Nil else List("reload")
sys.props("mimabuild.staging") = "true"
prep ::: "mimaReportBinaryIssues" :: state
}
val root = project.in(file(".")).settings(
name := "mima",
crossScalaVersions := Nil,
mimaFailOnNoPrevious := false,
skip in publish := true,
)
aggregateProjects(core, sbtplugin, functionalTests)
val core = project.settings(
name := "mima-core",
libraryDependencies ++= Seq(
"org.scala-lang" % "scala-compiler" % scalaVersion.value,
"org.scalatest" %% "scalatest" % "3.1.1" % Test,
),
MimaSettings.mimaSettings,
apiMappings ++= {
// WORKAROUND https://github.com/scala/bug/issues/9311
// from https://stackoverflow.com/a/31322970/463761
sys.props.get("sun.boot.class.path").toList
.flatMap(_.split(java.io.File.pathSeparator))
.collectFirst { case str if str.endsWith(java.io.File.separator + "rt.jar") =>
file(str) -> url("http://docs.oracle.com/javase/8/docs/api/index.html")
}
.toMap
},
)
val sbtplugin = project.enablePlugins(SbtPlugin).dependsOn(core).settings(
name := "sbt-mima-plugin",
// drop the previous value to drop running Test/compile
scriptedDependencies := Def.task(()).dependsOn(publishLocal, publishLocal in core).value,
scriptedLaunchOpts += s"-Dplugin.version=${version.value}",
scriptedLaunchOpts += s"-Dsbt.boot.directory=${file(sys.props("user.home")) / ".sbt" / "boot"}",
MimaSettings.mimaSettings,
)
val functionalTests = Project("functional-tests", file("functional-tests"))
.dependsOn(core)
.enablePlugins(TestsPlugin)
.settings(
libraryDependencies += "com.typesafe" % "config" % "1.4.0",
mimaFailOnNoPrevious := false,
skip in publish := true,
)