forked from lightbend-labs/mima
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
88 lines (79 loc) · 3.67 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
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"),
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 scala213 = "2.13.5"
val root = project.in(file(".")).settings(
name := "mima",
crossScalaVersions := Nil,
mimaFailOnNoPrevious := false,
publish / skip := true,
)
aggregateProjects(core, sbtplugin, functionalTests)
val munit = "org.scalameta" %% "munit" % "0.7.25"
val core = project.settings(
name := "mima-core",
crossScalaVersions += scala213,
libraryDependencies += munit % Test,
testFrameworks += new TestFramework("munit.Framework"),
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, core / publishLocal).value,
scriptedLaunchOpts += s"-Dplugin.version=${version.value}",
scriptedLaunchOpts += s"-Dsbt.boot.directory=${file(sys.props("user.home")) / ".sbt" / "boot"}",
MimaSettings.mimaSettings,
)
val testFunctional = taskKey[Unit]("Run the functional test")
val functionalTests = Project("functional-tests", file("functional-tests"))
.dependsOn(core)
.configs(IntegrationTest)
.settings(
crossScalaVersions += scala213,
libraryDependencies += "com.typesafe" % "config" % "1.4.1",
libraryDependencies += "io.get-coursier" %% "coursier" % "2.0.16",
libraryDependencies += munit,
testFrameworks += new TestFramework("munit.Framework"),
//Test / run / fork := true,
//Test / run / forkOptions := (Test / run / forkOptions).value.withWorkingDirectory((ThisBuild / baseDirectory).value),
// Test / testOnly / watchTriggers += baseDirectory.value.toGlob / "src" / "test" / **,
// ^ disabled b/c of "Build triggered by [..]/target/scala-2.12/v2-classes."
testFunctional := (Test / test).value,
Defaults.itSettings,
Test / mainClass := Some("com.typesafe.tools.mima.lib.UnitTests"),
IntegrationTest / mainClass := Some("com.typesafe.tools.mima.lib.IntegrationTests"),
mimaFailOnNoPrevious := false,
publish / skip := true,
)