-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
190 lines (174 loc) · 6.13 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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
import xerial.sbt.Sonatype._
val scala3Version = "3.0.2"
val scala213Version = "2.13.8"
val scala212Version = "2.12.14"
val allScalaVersions = List(scala3Version, scala212Version, scala213Version)
Global / semanticdbEnabled := true
Global / onChangedBuildSource := ReloadOnSourceChanges
ThisBuild / testFrameworks += new TestFramework("munit.Framework")
ThisBuild / scalaVersion := scala213Version
ThisBuild / versionScheme := Some("early-semver")
ThisBuild / organization := "com.heroestools"
ThisBuild / licenses := Seq("LGPLv3" -> url("https://www.gnu.org/licenses/lgpl-3.0.en.html"))
ThisBuild / developers := List(
Developer(
id = "Martijn",
name = "Martijn Hoekstra",
email = "[email protected]",
url = url("https://www.github.com")
)
)
//to start server with debugging in breakpoint:
//ThisBuild / Test / jsEnv := new org.scalajs.jsenv.nodejs.NodeJSEnv(org.scalajs.jsenv.nodejs.NodeJSEnv.Config().withArgs(List("--inspect-brk")))
def onCI = sys.env.contains("CI")
//attempt not to starve memory, but limitAll(1) is prone to deadlock
ThisBuild / concurrentRestrictions ++= {
if (onCI) List(Tags.limitAll(2)) else Nil
}
val batchModeOnCI =
if (onCI) List(scalaJSLinkerConfig ~= {
_.withBatchMode(true)
})
else Nil
//a subproject "semver4s" gets automatically created
//and aggregates all subprojects.
//I don't think you can disable that project, only rename it
//lazy val global = project
// .in(file("."))
// .aggregate(lib, cli)
// .settings(
// publish / skip := true
// )
//core datatypes, no parsing, no cats
lazy val core = projectMatrix
.in(file("core"))
.settings(
name := "semver4s-core",
version := "1.0.0",
scalacOptions --= List("-Xfatal-warnings").filter(_ => scalaVersion.value.startsWith("3")),
publishTo := sonatypePublishToBundle.value,
sonatypeProjectHosting := Some(
GitHubHosting("martijnhoekstra", "semver4s", "[email protected]")
)
)
.jvmPlatform(scalaVersions = allScalaVersions)
.jsPlatform(
scalaVersions = allScalaVersions,
settings =
(scalaJSLinkerConfig ~= { _.withModuleKind(ModuleKind.CommonJSModule) }) :: batchModeOnCI
)
//one-stop all-in-one lib, depends on cats and parsing
lazy val lib = projectMatrix
.in(file("semver4s"))
.settings(
name := "semver4s",
version := "2.0.0",
libraryDependencies ++= List(
"org.scala-lang" % "scala-reflect" % scalaVersion.value % "provided"
)
.filter(_ => scalaVersion.value.startsWith("2")),
scalacOptions --= List("-Xfatal-warnings").filter(_ => scalaVersion.value.startsWith("3")),
publishTo := sonatypePublishToBundle.value,
sonatypeProjectHosting := Some(
GitHubHosting("martijnhoekstra", "semver4s", "[email protected]")
)
)
.dependsOn(catsParse)
.dependsOn(catsParseReporter)
.dependsOn(core)
.jvmPlatform(scalaVersions = allScalaVersions)
.jsPlatform(
scalaVersions = allScalaVersions,
settings =
(scalaJSLinkerConfig ~= { _.withModuleKind(ModuleKind.CommonJSModule) }) :: batchModeOnCI
)
lazy val cli = projectMatrix
.in(file("cli"))
.settings(
name := "semver4s-cli",
version := "1.0.2",
libraryDependencies ++= List(
"com.monovore" %%% "decline" % "2.2.0",
"com.monovore" %%% "decline-effect" % "2.2.0"
)
)
.dependsOn(lib)
.dependsOn(catsParseReporter)
.jvmPlatform(scalaVersions = List(scala3Version))
.jsPlatform(
scalaVersions = List(scala3Version),
settings =
(scalaJSLinkerConfig ~= { _.withModuleKind(ModuleKind.CommonJSModule) }) :: batchModeOnCI
)
lazy val catsParse = projectMatrix
.in(file("catsParse"))
.settings(
name := "semver4s-cats-parse",
version := "1.0.0",
libraryDependencies ++= List("org.typelevel" %%% "cats-parse" % "0.3.6")
)
.dependsOn(core)
.jvmPlatform(scalaVersions = allScalaVersions)
.jsPlatform(
scalaVersions = allScalaVersions,
settings =
(scalaJSLinkerConfig ~= { _.withModuleKind(ModuleKind.CommonJSModule) }) :: batchModeOnCI
)
lazy val npmEquivalence = projectMatrix
.in(file("npmEquivalence"))
.enablePlugins(ScalaJSBundlerPlugin)
.settings(
// testFrameworks += new TestFramework("munit.Framework"),
name := "npmFacade",
Test / npmDependencies += "semver" -> "7.3.5",
publish / skip := true,
libraryDependencies ++= List(
"org.scalameta" %%% "munit" % "0.7.29" % "test",
"org.scalameta" %%% "munit-scalacheck" % "0.7.29" % "test",
"io.github.cquiroz" %%% "scala-java-time" % "2.3.0" % "test"
)
)
.dependsOn(tests % "compile->compile;test->test")
.jsPlatform(
scalaVersions = List(scala3Version),
settings =
(scalaJSLinkerConfig ~= { _.withModuleKind(ModuleKind.CommonJSModule) }) :: batchModeOnCI
)
lazy val tests = projectMatrix
.in(file("tests"))
.settings(
// testFrameworks += new TestFramework("munit.Framework"),
name := "tests",
scalacOptions -= "-Xfatal-warnings",
publish / skip := true,
libraryDependencies ++= List(
"org.scalameta" %%% "munit" % "0.7.29" % "test",
"org.scalameta" %%% "munit-scalacheck" % "0.7.29" % "test",
"io.github.cquiroz" %%% "scala-java-time" % "2.3.0" % "test"
)
)
.dependsOn(lib)
.jvmPlatform(scalaVersions = allScalaVersions)
.jsPlatform(
scalaVersions = allScalaVersions,
settings = (scalaJSLinkerConfig ~= { _.withModuleKind(ModuleKind.CommonJSModule) }) ::
batchModeOnCI
)
lazy val catsParseReporter = projectMatrix
.in(file("reporter"))
.settings(
// testFrameworks += new TestFramework("munit.Framework"),
version := "0.1.0-SNAPSHOT",
name := "catsParseReporter",
libraryDependencies ++= List(
"org.typelevel" %%% "cats-parse" % "0.3.6",
"org.scalameta" %%% "munit" % "0.7.29" % "test",
"org.scalameta" %%% "munit-scalacheck" % "0.7.29" % "test"
)
)
.jvmPlatform(scalaVersions = allScalaVersions)
.jsPlatform(
scalaVersions = allScalaVersions,
settings =
(scalaJSLinkerConfig ~= { _.withModuleKind(ModuleKind.CommonJSModule) }) :: batchModeOnCI
)