-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.sbt
142 lines (123 loc) · 4.78 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
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 := "2.4.1",
versionScheme := Some("early-semver"),
libraryDependencies ++= Seq(
library.scalaPB % "protobuf;compile",
library.scalaPBJson % "compile;optional",
library.scalaTest % Test,
library.scalaTestPlusCheck % Test,
library.scalaCheck % Test,
library.scalaCollectionCompat,
"org.scala-lang" % "scala-reflect" % (ThisBuild / scalaVersion).value
)
)
// *****************************************************************************
// Dependencies
// *****************************************************************************
lazy val library = new {
object Version {
val scalaPB = scalapb.compiler.Version.scalapbVersion
val scalaPBJson = "0.12.1"
val scalaCheck = "1.18.1"
val scalaTest = "3.2.19"
val scalaTestPlusCheck = "3.2.14.0"
val scapeGoat = "3.1.2"
val scalaCollectionCompat = "2.12.0"
}
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-16" % Version.scalaTestPlusCheck
val scalaCollectionCompat = "org.scala-lang.modules" %% "scala-collection-compat" % Version.scalaCollectionCompat
}
// *****************************************************************************
// Settings
// *****************************************************************************
lazy val commonSettings = Seq.concat(
compilerSettings,
gitSettings,
organizationSettings,
scmSettings,
sbtSettings,
scalaFmtSettings,
scapegoatSettings,
mimaSettings
)
lazy val compilerSettings = Seq(
scalaVersion := "2.13.15",
Compile / packageBin / mappings += (ThisBuild / baseDirectory).value / "LICENSE" -> "LICENSE",
scalacOptions ++= scalacOptions_2_13
)
lazy val scalacOptions_2_13 = Seq(
"-unchecked",
"-deprecation",
"-language:_",
"-release",
"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:[email protected]: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", "[email protected]")),
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(
mimaPreviousArtifacts := Set("io.moia" %% "teleproto" % "2.0.0"),
mimaBinaryIssueFilters ++= Seq(
// Method was added in 2.1.0
ProblemFilters.exclude[ReversedMissingMethodProblem]("io.moia.protos.teleproto.PbResult.toEither")
)
)
Test / PB.targets := Seq(scalapb.gen(flatPackage = false) -> (Test / sourceManaged).value)
Test / PB.protoSources := Seq(baseDirectory.value / "src" / "test" / "protobuf")