-
Notifications
You must be signed in to change notification settings - Fork 6
/
build.sbt
160 lines (130 loc) · 4.22 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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
// scalac plugin has its own version
val scala213 = "2.13.14"
val scala3 = "3.5.0"
val scala3Nightly = "3.5.0-RC1-bin-20240520-8563571-NIGHTLY"
ThisBuild / crossScalaVersions := List(scala213, scala3)
ThisBuild / scalaVersion := scala213
ThisBuild / organization := "io.github.fehu"
ThisBuild / versionScheme := Some("semver-spec")
lazy val commonSettings = Seq(
libraryDependencies ++= {
(CrossVersion.partialVersion(scalaVersion.value): @unchecked) match {
case Some((2, 13)) =>
Seq(
Dependencies.`kind-projector`,
Dependencies.`monadic-for`
).map(sbt.compilerPlugin)
case Some((3, _)) =>
Seq()
}
},
Compile / scalacOptions ++= Seq(
"-feature",
"-deprecation"
) ++ {
(CrossVersion.partialVersion(scalaVersion.value): @unchecked) match {
case Some((3, _)) =>
Seq(
"-Xkind-projector:underscores",
"-Yexplicit-nulls",
"-Wsafe-init",
"-source:future"
)
case Some((2, 13)) =>
Seq(
"-language:higherKinds",
"-Xsource:3",
"-P:kind-projector:underscore-placeholders"
)
}
}
)
// // // Modules // // //
val namePrefix = "opentracing-scala"
def moduleName(suff: String): String = s"$namePrefix-$suff"
def module(nme: String): Project =
Project(nme, file(nme)).settings(
name := moduleName(nme),
releaseModuleSettings
)
lazy val root = (project in file("."))
.settings(
name := namePrefix,
releaseCommonSettings,
publish / skip := true,
sonatypePublishTo := None,
sonatypePublishToBundle := None
)
.aggregate(core, akka, fs2, noop, jaeger)
lazy val core = module("core")
.settings(
libraryDependencies ++= Seq(
Dependencies.`opentracing-api`,
Dependencies.`cats-core`,
Dependencies.`cats-effect`
),
libraryDependencies ++= testDependencies
)
.settings(commonSettings)
lazy val akka = module("akka")
.settings(
libraryDependencies += Dependencies.`akka-actor`,
libraryDependencies ++= testDependencies
)
.dependsOn(core % "compile->compile;test->test")
lazy val fs2 = module("fs2")
.settings(
libraryDependencies += Dependencies.`fs2-core`
)
.dependsOn(core)
// // // Backends // // //
lazy val noop = module("noop")
.settings(
libraryDependencies += Dependencies.`opentracing-noop`
)
.dependsOn(core)
lazy val jaeger = module("jaeger")
.settings(
libraryDependencies += Dependencies.`jaeger-client`
)
.dependsOn(core)
// // // Tests // // //
lazy val testDependencies = Seq(
Dependencies.scalatest % Test,
Dependencies.`opentracing-mock` % Test
)
ThisBuild / Test / parallelExecution := false
// // // Compiler Plugin (Scala 2 only) // // //
// Has its own configuration file (and own version)
lazy val `compiler-plugin` = project in file("compiler-plugin") settings (
releaseCommonSettings,
crossScalaVersions := List(scala213)
)
// Has its own configuration file (and own version)
lazy val `compiler-plugin-3` = project in file("compiler-plugin-3") settings (
releaseCommonSettings,
scalaVersion := scala3Nightly,
crossScalaVersions := List(scala3Nightly)
)
// // // Misc // // //
addCommandAlias("fullDependencyUpdates", ";dependencyUpdates; reload plugins; dependencyUpdates; reload return")
// // // Publishing // // //
ThisBuild / crossVersion := CrossVersion.binary
// Continues at [[sonatype.sbt]]
// // // Release // // //
import Release._
import ReleaseDefs._
ThisBuild / releaseVerFile := (root / releaseVersionFile).value
ThisBuild / releaseOutDir := (root / sonatypeBundleDirectory).value
lazy val releaseCommonSettings: Def.SettingsDefinition = Seq(
publishTo := sonatypePublishToBundle.value,
releaseCrossBuild := true,
releaseProcess := stages.value(releaseStage.value),
releaseTarget := Target.Staging,
releaseStage := Stage.Check,
releasePublishArtifactsAction := PgpKeys.publishSigned.value
)
lazy val releaseModuleSettings: Def.SettingsDefinition = releaseCommonSettings.settings ++ Seq(
releaseVersionFile := releaseVerFile.value,
sonatypeBundleDirectory := releaseOutDir.value
)