-
Notifications
You must be signed in to change notification settings - Fork 53
/
build.sbt
151 lines (138 loc) · 4.8 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
import com.typesafe.tools.mima.core._
import Dependencies._
val scala211 = "2.11.12"
val scala212 = "2.12.20"
val scala213 = "2.13.14"
val scala3 = "3.3.4"
GlobalScope / tlCommandAliases ++= Map(
"fmt" -> List("scalafmtAll", "scalafmtSbt"),
"fmtCheck" -> List("scalafmtCheckAll", "scalafmtSbtCheck"),
"prePR" -> List("githubWorkflowGenerate", "+fmt", "bench/compile", "+test")
)
ThisBuild / tlBaseVersion := "1.0"
// continue enforcing bincompat with 0.3.x series
ThisBuild / tlMimaPreviousVersions ++= (0 to 10).map(x => s"0.3.$x").toSet
ThisBuild / startYear := Some(2021)
ThisBuild / developers += tlGitHubDev("johnynek", "P. Oscar Boykin")
ThisBuild / crossScalaVersions := List(scala211, scala212, scala213, scala3)
ThisBuild / scalaVersion := scala213
ThisBuild / tlVersionIntroduced := Map("3" -> "0.3.4")
ThisBuild / tlCiDependencyGraphJob := false // omit after dropping scala 2.11
ThisBuild / githubWorkflowBuildMatrixExclusions ++=
Seq(
MatrixExclude(Map("project" -> "rootJS", "scala" -> "2.11")),
MatrixExclude(Map("project" -> "rootNative", "scala" -> "2.11"))
)
ThisBuild / githubWorkflowAddedJobs ++= Seq(
WorkflowJob(
id = "coverage",
name = "Generate coverage report",
scalas = Nil,
sbtStepPreamble = Nil,
steps = List(WorkflowStep.Checkout) ++ WorkflowStep.SetupJava(
githubWorkflowJavaVersions.value.toList
) ++ githubWorkflowGeneratedCacheSteps.value ++ List(
WorkflowStep.Sbt(List("coverage", "rootJVM/test", "coverageAggregate")),
WorkflowStep.Use(
UseRef.Public(
"codecov",
"codecov-action",
"v3"
)
)
)
)
)
ThisBuild / licenses := List(License.MIT)
lazy val root = tlCrossRootProject.aggregate(core, bench)
lazy val docs =
project.in(file("site")).enablePlugins(TypelevelSitePlugin).dependsOn(core.jvm, bench)
lazy val isScala211 = Def.setting {
scalaBinaryVersion.value == "2.11"
}
lazy val core = crossProject(JSPlatform, JVMPlatform, NativePlatform)
.crossType(CrossType.Full)
.settings(
name := "cats-parse",
libraryDependencies ++= {
if (isScala211.value)
Seq(
cats211.value,
munit211.value % Test,
munitScalacheck211.value % Test
)
else
Seq(
cats.value,
munit.value % Test,
munitScalacheck.value % Test
)
},
libraryDependencies ++= {
if (tlIsScala3.value) Nil else Seq("org.scala-lang" % "scala-reflect" % scalaVersion.value)
},
scalacOptions ++= {
// this code seems to trigger a bug in 2.11 pattern analysis
if (isScala211.value) List("-Xno-patmat-analysis") else Nil
},
tlFatalWarnings := {
if (isScala211.value) false
else tlFatalWarnings.value
},
mimaPreviousArtifacts := {
if (isScala211.value) Set.empty else mimaPreviousArtifacts.value
},
mimaBinaryIssueFilters ++= {
/*
* It is okay to filter anything in Impl or RadixNode which are private
*/
if (tlIsScala3.value)
List(
ProblemFilters.exclude[DirectMissingMethodProblem]("cats.parse.Parser#Error.fromProduct"),
ProblemFilters.exclude[IncompatibleResultTypeProblem]("cats.parse.Parser#Error.unapply"),
ProblemFilters.exclude[MissingTypesProblem]("cats.parse.Parser$Error$"),
ProblemFilters.exclude[IncompatibleResultTypeProblem]("cats.parse.Parser#Error.unapply"),
ProblemFilters.exclude[DirectMissingMethodProblem]("cats.parse.Parser#Error.fromProduct")
)
else Nil
} ++ MimaExclusionRules.parserImpl ++ MimaExclusionRules.bitSetUtil
)
.jvmSettings(
// We test against jawn on JVM for some json parsers
libraryDependencies +=
(if (isScala211.value) jawnAst211.value else jawnAst.value) % Test
)
.jsSettings(
crossScalaVersions := (ThisBuild / crossScalaVersions).value.filterNot(_.startsWith("2.11")),
coverageEnabled := false
)
.nativeSettings(
crossScalaVersions := (ThisBuild / crossScalaVersions).value.filterNot(_.startsWith("2.11")),
// cats-parse 1.0.1 switches to Scala Native 0.5, reset tlVersionIntroduced
tlVersionIntroduced := List("2.12", "2.13", "3").map(_ -> "1.0.1").toMap,
coverageEnabled := false
)
lazy val bench = project
.enablePlugins(JmhPlugin, NoPublishPlugin)
.settings(
name := "bench",
coverageEnabled := false,
scalacOptions += "-Wconf:cat=unused-nowarn:s",
Compile / unmanagedSources := {
if (Set("2.12", "2.13").contains(scalaBinaryVersion.value)) {
(Compile / unmanagedSources).value
} else Nil
},
libraryDependencies ++= {
if (Set("2.12", "2.13").contains(scalaBinaryVersion.value))
Seq(
fastParse,
parsley,
jawnAst.value,
parboiled,
attoCore
)
else Nil
}
)
.dependsOn(core.jvm)