-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.sbt
129 lines (107 loc) · 3.91 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
ThisBuild / organization := "org.reactivemongo"
name := "reactivemongo-scalafix-root"
import _root_.scalafix.sbt.{ BuildInfo => SF }
ThisBuild / resolvers ++= {
Resolver.typesafeRepo("releases") +:
Resolver.sonatypeOssRepos("staging") ++:
Resolver.sonatypeOssRepos("snapshots")
}
addCompilerPlugin(scalafixSemanticdb)
lazy val extraOpts = Def.setting[Seq[String]] {
val opts = Seq.newBuilder[String] += "-deprecation"
if (scalaBinaryVersion.value != "2.13") {
opts += "-Xfatal-warnings"
} else {
opts += "-Werror"
}
opts.result()
}
lazy val rules = project.in(file("rules")).settings(
name := "reactivemongo-scalafix",
moduleName := name.value,
libraryDependencies ++= Seq(
"ch.epfl.scala" %% "scalafix-core" % SF.scalafixVersion// cross CrossVersion.full
),
scalacOptions ++= extraOpts.value
)
lazy val input = project.in(file("input")).settings(
Compile / unmanagedSourceDirectories += {
val base = (Compile / sourceDirectory).value
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, n)) if n < 13 => base / "scala-2.13-"
case _ => base / "scala-2.13+"
}
},
scalacOptions += "-deprecation",
libraryDependencies ++= {
val previousVer = {
if (scalaBinaryVersion.value == "2.13") "0.20.9"
else "0.12.7"
}
val (playPrefix, playVer) = {
if (scalaBinaryVersion.value == "2.13") "27" -> "2.7.4"
else "26" -> "2.6.6"
}
val deps = Seq.newBuilder[(String, String)] ++= Seq(
"reactivemongo" -> previousVer,
"reactivemongo-akkastream" -> previousVer,
"play2-reactivemongo" -> s"${previousVer}-play${playPrefix}")
if (scalaBinaryVersion.value != "2.13") {
deps += "reactivemongo-iteratees" -> previousVer
}
(deps.result().map {
case (nme, ver) => organization.value %% nme % ver % Provided
}) ++: Seq(
"com.typesafe.play" %% "play" % playVer % Provided)
},
publish / skip := true
)
lazy val output = project.in(file("output")).settings(
publish / skip := true,
Compile / sources ~= {
_.filterNot(_.getName endsWith "RequireMigration.scala")
},
Compile / unmanagedSourceDirectories += {
val base = (Compile / sourceDirectory).value
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, n)) if n < 13 => base / "scala-2.13-"
case _ => base / "scala-2.13+"
}
},
scalacOptions ++= extraOpts.value,
scalacOptions += "-P:silencer:globalFilters=.*Unused\\ import.*",
libraryDependencies ++= {
val latestVer = "1.0.0-rc.2"
val play2Ver = if (scalaBinaryVersion.value == "2.11") "7" else "8"
val rmPlayVer = s"1.0.0-play2${play2Ver}-rc.2"
val deps = Seq.newBuilder[(String, String)] ++= Seq(
"reactivemongo" -> latestVer,
"reactivemongo-play-json-compat" -> rmPlayVer,
"play2-reactivemongo" -> rmPlayVer)
if (scalaBinaryVersion.value != "2.13") {
deps += "reactivemongo-iteratees" -> latestVer
}
(deps.result().map {
case (nme, ver) => organization.value %% nme % ver % Provided
}) ++: Seq(
"com.typesafe.play" %% "play" % s"2.${play2Ver}.0" % Provided)
}
).disablePlugins(SbtScalariform)
lazy val tests = project.in(file("tests"))
.settings(
publish / skip := true,
libraryDependencies += "ch.epfl.scala" % "scalafix-testkit" % SF.scalafixVersion % Test cross CrossVersion.full,
Compile / compile :=
(Compile / compile).dependsOn(input / Compile / compile).value,
scalafixTestkitOutputSourceDirectories :=
(output / Compile / sourceDirectories).value,
scalafixTestkitInputSourceDirectories :=
(input / Compile / sourceDirectories).value,
scalafixTestkitInputClasspath :=
(input / Compile / fullClasspath).value,
)
.dependsOn(rules, output)
.enablePlugins(ScalafixTestkitPlugin)
lazy val root = (project in file(".")).settings(
publish / skip := true
).aggregate(rules, tests)