-
Notifications
You must be signed in to change notification settings - Fork 50
/
build.sbt
144 lines (131 loc) · 4.87 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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
import com.typesafe.tools.mima.core._, ProblemFilters._
import com.typesafe.tools.mima.plugin.MimaPlugin.mimaDefaultSettings
import com.typesafe.tools.mima.plugin.MimaKeys.{
mimaBinaryIssueFilters,
mimaPreviousArtifacts
}
import sbtrelease.ReleasePlugin.autoImport._
import sbtrelease.ReleaseStateTransformations._
import xerial.sbt.Sonatype._
lazy val bcSettings: Seq[Setting[_]] = mimaDefaultSettings ++ Seq(
mimaPreviousArtifacts := {
val sv = scalaVersion.value
if (sv startsWith "2.9.") {
Set("com.jsuereth" % "scala-arm_2.9.1" % "1.2")
} else if (sv startsWith "2.10.") {
Set("com.jsuereth" %% "scala-arm" % "1.2")
} else if (sv startsWith "2.13.") {
Set.empty[ModuleID]
} else {
Set("com.jsuereth" %% "scala-arm" % "2.0")
}
},
mimaBinaryIssueFilters ++= {
val missingMethodInOld: ProblemFilter = {
case ReversedMissingMethodProblem(_) => false
case DirectMissingMethodProblem(old) => !old.isAccessible
case InheritedNewAbstractMethodProblem(_, _) => false
case IncompatibleResultTypeProblem(old, _) => !old.isAccessible
case IncompatibleMethTypeProblem(old, _) => !old.isAccessible
case MissingClassProblem(old) => !old.isPublic
case AbstractClassProblem(old) => !old.isPublic
case _ => true
}
Seq(
missingMethodInOld, // forward compat
ProblemFilters.exclude[IncompatibleTemplateDefProblem]("resource.AbstractManagedResource"), // previous change
ProblemFilters.exclude[MissingTypesProblem]("resource.DefaultManagedResource"), // previous change
ProblemFilters.exclude[UpdateForwarderBodyProblem]("resource.ManagedResourceOperations.toTraversable") // mixin for 2.13 compat
)
}
)
lazy val publishSettings: Seq[Setting[_]] = Seq(
// If we want on maven central, we need to be in maven style.
publishMavenStyle := true,
publishArtifact in Test := false,
// The Nexus repo we're publishing to.
publishTo := {
val nexus = "https://oss.sonatype.org/"
if (version.value.trim.endsWith("SNAPSHOT")) {
Some("snapshots" at s"${nexus}content/repositories/snapshots")
} else {
Some("releases" at s"${nexus}service/local/staging/deploy/maven2")
}
},
// Maven central cannot allow other repos. We're ok here because the artifacts we
// we use externally are *optional* dependencies.
pomIncludeRepository := { _ => false },
// Maven central wants some extra metadata to keep things 'clean'.
homepage := Some(url("http://jsuereth.com/scala-arm")),
licenses += "BSD-Style" -> url(
"http://www.opensource.org/licenses/bsd-license.php"),
scmInfo := Some(ScmInfo(url(
"http://github.com/jsuereth/scala-arm"),
"scm:[email protected]:jsuereth/scala-arm.git")),
pomExtra := (
<developers>
<developer>
<id>jsuereth</id>
<name>Josh Suereth</name>
<url>http://jsuereth.com</url>
</developer>
</developers>),
releaseProcess := Seq[ReleaseStep](
checkSnapshotDependencies,
inquireVersions,
runClean,
runTest,
setReleaseVersion,
commitReleaseVersion,
tagRelease,
ReleaseStep(
action = { state =>
val extracted = Project extract state
extracted.runAggregated(
PgpKeys.publishSigned in Global in extracted.get(
thisProjectRef), state)
},
enableCrossBuild = true
),
releaseStepCommand("sonatypeReleaseAll"),
setNextVersion,
commitNextVersion,
pushChanges
)
)
lazy val websiteSettings: Seq[Setting[_]] = Seq(
git.remoteRepo := "[email protected]:jsuereth/scala-arm.git",
includeFilter in Jekyll := (
"*.html" | "*.png" | "*.js" | "*.css" | "CNAME")
)
val arm = project.in(file(".")).
enablePlugins(SiteScaladocPlugin).
settings(Seq(
organization := "com.jsuereth",
name := "scala-arm",
scalaVersion := "2.12.8",
crossScalaVersions := Seq(
"2.10.7", "2.11.12", scalaVersion.value, "2.13.0"),
resolvers += "java.net repo" at "http://download.java.net/maven/2/",
libraryDependencies ++= Seq(
"com.novocode" % "junit-interface" % "0.11" % Test,
"org.apache.derby" % "derby" % "10.15.1.3" % Test,
"javax.transaction" % "jta" % "1.1" % Provided
),
scalacOptions ++= Seq("-deprecation", "-feature"),
unmanagedSourceDirectories in Compile += {
val base = (sourceDirectory in Compile).value
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, n)) if n >= 13 => base / "scala-2.13+"
case _ => base / "scala-2.13-"
}
},
unmanagedSourceDirectories in Test += {
val base = (sourceDirectory in Test).value
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, n)) if n >= 13 => base / "scala-2.13+"
case _ => base / "scala-2.13-"
}
}
) ++ sonatypeSettings ++ publishSettings ++ (
websiteSettings ++ bcSettings))