Repository navigation
Expand file tree
/
Copy pathbuild.sbt
More file actions
152 lines (136 loc) · 4.34 KB
/
Copy pathbuild.sbt
File metadata and controls
152 lines (136 loc) · 4.34 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
import com.typesafe.tools.mima.core._, ProblemFilters._
import com.typesafe.tools.mima.plugin.MimaKeys.{
mimaBinaryIssueFilters,
mimaPreviousArtifacts
}
// TODO: Rename play2- suffix to play-
val specs2Dependencies = Def.setting[Seq[ModuleID]] {
val specsVersion = {
if (scalaBinaryVersion.value.startsWith("3")) {
"5.5.3"
} else if (scalaBinaryVersion.value == "2.13") {
"4.20.9"
} else {
"4.10.6"
}
}
Seq("specs2-core", "specs2-junit").map { n =>
"org.specs2" %% n % specsVersion % Test
}
}
val playDependencies = Def.setting[Seq[ModuleID]] {
val scalaVer = scalaBinaryVersion.value
val ver = Common.playVer.value
val base = Seq(
"play" -> Provided,
"play-test" -> Test
)
val groupId = {
if (ver.startsWith("2.") && !ver.startsWith("2.10")) {
"com.typesafe.play"
} else {
"org.playframework"
}
}
base.map {
case (name, scope) =>
(groupId %% name % ver % scope).cross(CrossVersion.binary)
}
}
lazy val reactivemongo = Project("Play2-ReactiveMongo", file(".")).settings(
Seq(
credentials ++= sys.env.get("SONATYPE_USERNAME").toSeq.map { user =>
Credentials(
"", // Empty realm credential - this one is actually used by Coursier!
"central.sonatype.com",
user,
Publish.env("SONATYPE_PASSWORD")
)
},
resolvers ++= Seq(
"Central Testing repository" at "https://central.sonatype.com/api/v1/publisher/deployments/download",
"Sonatype Snapshots" at "https://central.sonatype.com/repository/maven-snapshots/",
Resolver.typesafeRepo("releases")
),
scalacOptions ++= {
if (scalaBinaryVersion.value != "3") {
Seq("-P:silencer:globalFilters=.*JSONException.*")
} else {
Seq.empty
}
},
libraryDependencies ++= {
val silencerVer = "1.7.19" // 13
val v = scalaBinaryVersion.value
val additionalDeps = {
if (v != "2.13" && v != "3") {
Seq("com.typesafe.play" %% "play-iteratees" % "2.6.1" % Provided)
} else {
Seq.empty
}
}
val driverDeps = {
val dv = Common.driverVersion.value
val dep = ("org.reactivemongo" %% "reactivemongo" % dv)
.cross(CrossVersion.binary)
.exclude("com.typesafe.akka", "*")
.exclude("org.apache.pekko", "*")
. // provided by Play
exclude("com.typesafe.play", "*")
if (Common.useShaded.value) {
Seq(dep)
} else {
Seq(dep, "io.netty" % "netty-handler" % "4.1.43.Final" % Provided)
}
}
def silencer: Seq[ModuleID] = {
if (v != "3") {
Seq(
compilerPlugin(
("com.github.ghik" %% "silencer-plugin" % silencerVer)
.cross(CrossVersion.full)
),
("com.github.ghik" %% "silencer-lib" % silencerVer % Provided)
.cross(CrossVersion.full)
)
} else {
Seq.empty
}
}
val buildVer = (ThisBuild / version).value
val ver = version.value // != buildVer (includes play suffix)
val jsonCompat =
("org.reactivemongo" %% "reactivemongo-play-json-compat" % ver)
.cross(CrossVersion.binary)
.exclude("org.reactivemongo", "*") // Avoid mixing shaded w/ nonshaded
val reactiveMongoStreaming = {
if (Common.playVer.value.startsWith("2.")) {
("org.reactivemongo" %% "reactivemongo-akkastream" % buildVer)
.cross(CrossVersion.binary)
.exclude("com.typesafe.akka", "*") // provided by Play
} else {
("org.reactivemongo" %% "reactivemongo-pekkostream" % buildVer)
.cross(CrossVersion.binary)
.exclude("org.apache.pekko", "*") // provided by Play
}
}
driverDeps ++ Seq(
jsonCompat,
reactiveMongoStreaming,
"junit" % "junit" % "4.13.2" % Test,
"ch.qos.logback" % "logback-classic" % "1.2.13" % Test
) ++ additionalDeps ++ playDependencies.value ++ specs2Dependencies.value ++ silencer
},
dependencyOverrides ++= {
if (
scalaBinaryVersion.value == "2.13" && Common.playVer.value
.startsWith("2.")
) {
Seq("org.scala-lang.modules" %% "scala-xml" % "2.5.0")
} else {
Seq.empty
}
},
mimaBinaryIssueFilters ++= Seq.empty
)
)