-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
219 lines (202 loc) · 6.25 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
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
val V = new {
val brotli = "0.1.2"
val brotli4j = "1.18.0"
val commonsCompress = "1.27.1"
val logbackClassic = "1.5.15"
val lz4 = "1.8.0"
val zio = "2.1.14"
val zip4j = "2.11.5"
val zstdJni = "1.5.6-9"
}
val _scala212 = "2.12.20"
val _scala213 = "2.13.15"
val _scala3 = "3.3.4"
val scalaVersions = List(_scala3, _scala213, _scala212)
enablePlugins(ZioSbtEcosystemPlugin, ZioSbtCiPlugin)
inThisBuild(
List(
name := "ZIO Streams Compress",
// zio-sbt defines these 'scala*' settings, we redefine them here for better control
scala212 := _scala212,
scala213 := _scala213,
scala3 := _scala3,
crossScalaVersions := List(scala3.value, scala213.value, scala212.value),
run / fork := true,
ciEnabledBranches := Seq("main"),
ciJvmOptions ++= Seq("-Xmx4G", "-Xss2M", "-XX:+UseG1GC"),
versionScheme := Some("early-semver"),
developers := List(
Developer(
"erikvanoosten",
"Erik van Oosten",
"",
url("https://github.com/erikvanoosten"),
)
),
// Needed for scalafix:
semanticdbEnabled := Keys.scalaBinaryVersion.value != "3",
// semanticdbOptions += "-P:semanticdb:synthetics:on", // Causes errors during lint
semanticdbVersion := scalafixSemanticdb.revision,
scalafixDependencies ++= List(
"com.github.vovapolu" %% "scaluzzi" % "0.1.23",
"io.github.ghostbuster91.scalafix-unified" %% "unified" % "0.0.9",
),
)
)
def commonSettings(projectName: String) = Seq(
name := s"zio-streams-compress-$projectName",
libraryDependencies ++= Seq(
"dev.zio" %%% "zio-test" % V.zio % Test,
"dev.zio" %%% "zio-test-sbt" % V.zio % Test,
"ch.qos.logback" % "logback-classic" % V.logbackClassic % Test,
),
libraryDependencies ++= {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, _)) => Seq(compilerPlugin("com.olegpy" %% "better-monadic-for" % "0.3.1"))
case _ => List.empty
}
},
)
lazy val root =
project
.in(file("."))
.settings(
name := "zio-streams-compress",
publish / skip := true,
crossScalaVersions := Nil, // https://www.scala-sbt.org/1.x/docs/Cross-Build.html#Cross+building+a+project+statefully,
publishArtifact := false,
)
.aggregate(core.projectRefs: _*)
.aggregate(brotli.projectRefs: _*)
.aggregate(brotli4j.projectRefs: _*)
.aggregate(bzip2.projectRefs: _*)
.aggregate(gzip.projectRefs: _*)
.aggregate(lz4.projectRefs: _*)
.aggregate(tar.projectRefs: _*)
.aggregate(zip.projectRefs: _*)
.aggregate(zip4j.projectRefs: _*)
.aggregate(zstd.projectRefs: _*)
.aggregate(example.projectRefs: _*)
.aggregate(docs)
lazy val core = projectMatrix
.in(file("core"))
.settings(commonSettings("core"))
.settings(
libraryDependencies ++= Seq(
"dev.zio" %%% "zio-streams" % V.zio
)
)
.jvmPlatform(scalaVersions)
.jsPlatform(scalaVersions)
lazy val brotli = projectMatrix
.in(file("brotli"))
.dependsOn(core % "compile->compile;test->test")
.settings(commonSettings("brotli"))
.settings(
libraryDependencies ++= Seq(
"org.brotli" % "dec" % V.brotli
)
)
.jvmPlatform(scalaVersions)
lazy val brotli4j = projectMatrix
.in(file("brotli4j"))
.dependsOn(core % "compile->compile;test->test")
.settings(commonSettings("brotli4j"))
.settings(
libraryDependencies ++= Seq(
"com.aayushatharva.brotli4j" % "brotli4j" % V.brotli4j
)
)
.jvmPlatform(scalaVersions)
lazy val bzip2 = projectMatrix
.in(file("bzip2"))
.dependsOn(core % "compile->compile;test->test")
.settings(commonSettings("bzip2"))
.settings(
libraryDependencies ++= Seq(
"org.apache.commons" % "commons-compress" % V.commonsCompress
)
)
.jvmPlatform(scalaVersions)
lazy val gzip = projectMatrix
.in(file("gzip"))
.dependsOn(core % "compile->compile;test->test")
.settings(commonSettings("gzip"))
.jvmPlatform(scalaVersions)
//.jsPlatform(scalaVersions)
lazy val lz4 = projectMatrix
.in(file("lz4"))
.dependsOn(core % "compile->compile;test->test")
.settings(commonSettings("lz4"))
.settings(
name := "zio-streams-compress-lz4",
libraryDependencies ++= Seq(
"org.lz4" % "lz4-java" % V.lz4
),
)
.jvmPlatform(scalaVersions)
lazy val tar = projectMatrix
.in(file("tar"))
.dependsOn(core % "compile->compile;test->test")
.dependsOn(gzip % "test")
.settings(commonSettings("tar"))
.settings(
libraryDependencies ++= Seq(
"org.apache.commons" % "commons-compress" % V.commonsCompress
)
)
.jvmPlatform(scalaVersions)
lazy val zip = projectMatrix
.in(file("zip"))
.dependsOn(core % "compile->compile;test->test")
.settings(commonSettings("zip"))
.jvmPlatform(scalaVersions)
lazy val zip4j = projectMatrix
.in(file("zip4j"))
.dependsOn(core % "compile->compile;test->test")
.settings(commonSettings("zip4j"))
.settings(
libraryDependencies ++= Seq(
"net.lingala.zip4j" % "zip4j" % V.zip4j
)
)
.jvmPlatform(scalaVersions)
lazy val zstd = projectMatrix
.in(file("zstd"))
.dependsOn(core % "compile->compile;test->test")
.settings(commonSettings("zstd"))
.settings(
libraryDependencies ++= Seq(
"com.github.luben" % "zstd-jni" % V.zstdJni
)
)
.jvmPlatform(scalaVersions)
lazy val example = projectMatrix
.in(file("example"))
.dependsOn(gzip, tar, zip4j)
.settings(commonSettings("example"))
.settings(
publishArtifact := false,
publish / skip := true,
)
.settings(
name := "zio-streams-compress-example"
)
.jvmPlatform(scalaVersions)
lazy val docs = project
.in(file("docs-project"))
.dependsOn(core.jvm(_scala213))
.enablePlugins(WebsitePlugin)
.settings(commonSettings("docs"))
.settings(
scalacOptions -= "-Yno-imports",
scalacOptions -= "-Xfatal-warnings",
crossScalaVersions := List(_scala213),
projectName := "ZIO Streams Compress docs",
mainModuleName := "zio-streams-compress-docs",
projectStage := ProjectStage.ProductionReady,
ScalaUnidoc / unidoc / unidocProjectFilter := inProjects(core.jvm(_scala213)),
readmeCredits :=
"This library is heavily inspired by [fs2-compress](https://github.com/lhns/fs2-compress).",
readmeLicense += s"\n\nCopyright 2024-${java.time.Year.now()} Erik van Oosten and the zio-streams-compress contributors.",
)