-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathbuild.sbt
More file actions
170 lines (150 loc) · 5.61 KB
/
Copy pathbuild.sbt
File metadata and controls
170 lines (150 loc) · 5.61 KB
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
import com.typesafe.tools.mima.core._
import xerial.sbt.Sonatype._
addCommandAlias("validate", "all test doc scapegoat mimaReportBinaryIssues")
// *****************************************************************************
// Projects
// *****************************************************************************
lazy val `teleproto` = project
.in(file("."))
.enablePlugins(GitVersioning, GitBranchPrompt)
.settings(commonSettings: _*)
.settings(sonatypeSettings: _*)
.settings(Project.inConfig(Test)(sbtprotoc.ProtocPlugin.protobufConfigSettings): _*)
.settings(
name := "teleproto",
version := "1.13.0",
versionScheme := Some("early-semver"),
libraryDependencies ++= Seq(
library.scalaPB % "protobuf;compile",
library.scalaPBJson % Compile,
library.scalaTest % Test,
library.scalaTestPlusCheck % Test,
library.scalaCheck % Test,
"org.scala-lang.modules" %% "scala-collection-compat" % "2.4.4",
"org.scala-lang" % "scala-reflect" % (ThisBuild / scalaVersion).value
)
)
// *****************************************************************************
// Dependencies
// *****************************************************************************
lazy val library = new {
object Version {
val scalaPB = scalapb.compiler.Version.scalapbVersion
val scalaPBJson = "0.10.3"
val scalaCheck = "1.15.4"
val scalaTest = "3.2.9"
val scalaTestPlusCheck = "3.2.2.0"
val scapeGoat = "1.4.8"
}
val scalaPB = "com.thesamet.scalapb" %% "scalapb-runtime" % Version.scalaPB
val scalaPBJson = "com.thesamet.scalapb" %% "scalapb-json4s" % Version.scalaPBJson
val scalaCheck = "org.scalacheck" %% "scalacheck" % Version.scalaCheck
val scalaTest = "org.scalatest" %% "scalatest" % Version.scalaTest
val scalaTestPlusCheck = "org.scalatestplus" %% "scalacheck-1-14" % Version.scalaTestPlusCheck
}
// *****************************************************************************
// Settings
// *****************************************************************************
lazy val commonSettings = Seq.concat(
compilerSettings,
gitSettings,
organizationSettings,
scmSettings,
sbtSettings,
scalaFmtSettings,
scapegoatSettings,
mimaSettings
)
lazy val compilerSettings = Seq(
scalaVersion := crossScalaVersions.value.head,
crossScalaVersions := List("2.13.5", "2.12.13"),
Compile / packageBin / mappings += (ThisBuild / baseDirectory).value / "LICENSE" -> "LICENSE",
scalacOptions ++= (CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, 12)) => scalacOptions_2_12
case Some((2, 13)) => scalacOptions_2_13
case _ => Nil
})
)
lazy val scalacOptions_2_12 = Seq(
"-unchecked",
"-deprecation",
"-language:_",
"-target:jvm-1.8",
"-encoding",
"UTF-8",
"-Xfatal-warnings",
"-Ywarn-unused-import",
"-Yno-adapted-args",
"-Ywarn-dead-code",
"-Ywarn-inaccessible",
"-Ywarn-infer-any",
"-Ywarn-nullary-override",
"-Ywarn-nullary-unit"
)
lazy val scalacOptions_2_13 = Seq(
"-unchecked",
"-deprecation",
"-language:_",
"-target:jvm-1.8",
"-encoding",
"UTF-8",
"-Xfatal-warnings",
"-Xlint",
"-Ywarn-dead-code",
"-Ymacro-annotations"
)
lazy val gitSettings = Seq(
git.useGitDescribe.withRank(KeyRanks.Invisible) := false
)
lazy val organizationSettings = Seq(
organization := "io.moia",
organizationName := "MOIA GmbH",
startYear := Some(2019),
licenses += ("Apache-2.0", url("http://www.apache.org/licenses/LICENSE-2.0"))
)
lazy val scmSettings = Seq(
scmInfo := Some(
ScmInfo(
url("https://github.com/moia-dev/teleproto"),
"scm:git@github.com:moia-dev/teleproto.git"
)
),
homepage := Some(url("https://github.com/moia-dev/teleproto"))
)
lazy val sonatypeSettings = Seq(
publishTo := sonatypePublishTo.value,
sonatypeProfileName := organization.value,
publishMavenStyle := true,
sonatypeProjectHosting := Some(GitHubHosting("moia-dev", "teleproto", "oss-support@moia.io")),
credentials += Credentials(Path.userHome / ".sbt" / "sonatype_credential")
)
lazy val sbtSettings = Seq(
Global / cancelable := true,
sourceGenerators / logLevel.withRank(KeyRanks.Invisible) := Level.Error
)
lazy val scalaFmtSettings = Seq(
scalafmtOnCompile := true
)
lazy val scapegoatSettings = Seq(
ThisBuild / scapegoatVersion := library.Version.scapeGoat,
// do not check generated files
scapegoatIgnoredFiles := Seq(".*/src_managed/.*")
)
lazy val mimaSettings = Seq(
// First 2.13 release of 1.x
mimaPreviousArtifacts := Set("io.moia" %% "teleproto" % "1.2.0"),
mimaBinaryIssueFilters ++= Seq(
// No binary compatibility guarantees for macro implementations (they run at compile time).
ProblemFilters.exclude[Problem]("io.moia.protos.teleproto.FormatImpl*"),
ProblemFilters.exclude[Problem]("io.moia.protos.teleproto.MigrationImpl*"),
ProblemFilters.exclude[Problem]("io.moia.protos.teleproto.ReaderImpl*"),
ProblemFilters.exclude[Problem]("io.moia.protos.teleproto.WriterImpl*"),
// PbResult is a sealed trait so linking from Scala should be fine.
// Also, this method was added before introducing MiMa.
ProblemFilters.exclude[ReversedMissingMethodProblem]("io.moia.protos.teleproto.PbResult.toOption"),
// Writer.Mapped was an unused private class.
ProblemFilters.exclude[MissingClassProblem]("io.moia.protos.teleproto.Writer$Mapped")
)
)
Test / PB.targets := Seq(scalapb.gen(flatPackage = false) -> (Test / sourceManaged).value)
Test / PB.protoSources := Seq(file("src/test/protobuf"))