forked from typelevel/cats-parse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
173 lines (153 loc) · 5.3 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
161
162
163
164
165
166
167
168
169
170
171
172
173
import com.typesafe.tools.mima.core._
import sbtcrossproject.CrossPlugin.autoImport.{crossProject, CrossType}
import Dependencies._
addCommandAlias("fmt", "; scalafmtAll; scalafmtSbt")
addCommandAlias("fmtCheck", "; scalafmtCheckAll; scalafmtSbtCheck")
addCommandAlias("prePR", "; githubWorkflowGenerate ; +fmt; bench/compile; +test")
ThisBuild / baseVersion := "0.3"
ThisBuild / organization := "org.typelevel"
ThisBuild / organizationName := "Typelevel"
ThisBuild / publishGithubUser := "johnynek"
ThisBuild / publishFullName := "P. Oscar Boykin"
ThisBuild / crossScalaVersions := List("3.0.2", "2.11.12", "2.12.15", "2.13.6")
ThisBuild / spiewakCiReleaseSnapshots := true
ThisBuild / spiewakMainBranches := List("main")
ThisBuild / githubWorkflowBuild := Seq(
WorkflowStep.Run(
List(
"""sbt ++${{ matrix.scala }} fmtCheck \
| "++${{ matrix.scala }} test" \
| "++${{ matrix.scala }} mimaReportBinaryIssues"""".stripMargin
)
)
)
ThisBuild / githubWorkflowAddedJobs ++= Seq(
WorkflowJob(
id = "build-docs",
name = "Build docs",
scalas = List("2.13.6"),
steps = List(
WorkflowStep.Checkout,
WorkflowStep.SetupScala
) ++ githubWorkflowGeneratedCacheSteps.value ++ List(WorkflowStep.Sbt(List("docs/mdoc")))
),
WorkflowJob(
id = "coverage",
name = "Generate coverage report",
scalas = List("2.13.6"),
steps = List(
WorkflowStep.Checkout,
WorkflowStep.SetupScala
) ++ githubWorkflowGeneratedCacheSteps.value ++ List(
WorkflowStep.Sbt(List("coverage", "test", "coverageAggregate")),
WorkflowStep.Run(List("bash <(curl -s https://codecov.io/bash)"))
)
)
)
ThisBuild / githubWorkflowPublish ++= Seq(
WorkflowStep.Sbt(List("docs/makeSite")),
WorkflowStep.Use(
UseRef.Public("JamesIves", "github-pages-deploy-action", "3.7.1"),
params = Map(
"GITHUB_TOKEN" -> "${{ secrets.GITHUB_TOKEN }}",
"BRANCH" -> "gh-pages",
"FOLDER" -> "docs/target/site"
)
)
)
ThisBuild / homepage := Some(url("https://github.com/typelevel/cats-parse"))
ThisBuild / scmInfo := Some(
ScmInfo(
url("https://github.com/typelevel/cats-parse"),
"[email protected]:typelevel/cats-parse.git"
)
)
ThisBuild / licenses := List(("MIT", url("http://opensource.org/licenses/MIT")))
ThisBuild / testFrameworks += new TestFramework("munit.Framework")
lazy val root = project
.in(file("."))
.aggregate(core.jvm, core.js, bench)
.enablePlugins(NoPublishPlugin, SonatypeCiReleasePlugin)
.settings(scalaVersion := "2.13.6")
lazy val docs = project
.enablePlugins(
ParadoxSitePlugin,
ParadoxMaterialThemePlugin,
MdocPlugin,
NoPublishPlugin,
GhpagesPlugin
)
.settings(
name := "paradox-docs",
libraryDependencies += jawnAst,
Compile / paradoxProperties ++= Map(
"empty" -> "",
"version" -> version.value
),
githubWorkflowArtifactUpload := false,
git.remoteRepo := "[email protected]:typelevel/cats-parse.git",
mdocIn := (Compile / baseDirectory).value / "src",
Compile / paradox / sourceDirectory := mdocOut.value,
Compile / paradox := (Compile / paradox).dependsOn(mdoc.toTask("")).value,
Compile / paradoxMaterialTheme := ParadoxMaterialTheme()
.withColor("red", "orange")
.withFont("Ubuntu", "Ubuntu Mono")
.withCopyright("Copyright (c) 2020 Typelevel")
.withRepository(uri("https://github.com/typelevel/cats-parse"))
)
.dependsOn(coreJVM, bench)
lazy val core = crossProject(JSPlatform, JVMPlatform)
.crossType(CrossType.Full)
.settings(
name := "cats-parse",
libraryDependencies ++= {
val isScala211 = CrossVersion.partialVersion(scalaVersion.value).contains((2, 11))
Seq(
if (isScala211) cats211.value else cats.value,
munit.value % Test,
munitScalacheck.value % Test
)
},
scalacOptions ++= {
val isScala211 = CrossVersion.partialVersion(scalaVersion.value).contains((2, 11))
// this code seems to trigger a bug in 2.11 pattern analysis
if (isScala211) List("-Xno-patmat-analysis") else Nil
},
mimaPreviousArtifacts := {
val isScala211 = CrossVersion.partialVersion(scalaVersion.value).contains((2, 11))
if (isScala211) Set.empty else mimaPreviousArtifacts.value
}
)
.jsSettings(
crossScalaVersions := (ThisBuild / crossScalaVersions).value.filterNot(_.startsWith("2.11")),
Global / scalaJSStage := FastOptStage,
parallelExecution := false,
jsEnv := new org.scalajs.jsenv.nodejs.NodeJSEnv(),
// batch mode decreases the amount of memory needed to compile scala.js code
scalaJSLinkerConfig := scalaJSLinkerConfig.value
.withBatchMode(scala.sys.env.get("TRAVIS").isDefined)
.withModuleKind(ModuleKind.CommonJSModule),
coverageEnabled := false,
scalaJSUseMainModuleInitializer := false
)
lazy val coreJVM = core.jvm
lazy val coreJS = core.js
lazy val bench = project
.enablePlugins(JmhPlugin, NoPublishPlugin)
.settings(
name := "bench",
coverageEnabled := false,
crossScalaVersions := (ThisBuild / crossScalaVersions).value.filter { v =>
v.startsWith("2.12") || v.startsWith("2.13")
},
libraryDependencies ++=
Seq(
fastParse,
parsley,
jawnAst,
parboiled,
attoCore
),
githubWorkflowArtifactUpload := false
)
.dependsOn(coreJVM)