-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.sbt
339 lines (319 loc) · 14.5 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
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
import sbt.ThisBuild
import sbtcrossproject.CrossPlugin.autoImport.{crossProject, CrossType}
import Dependencies.*
name := "SolidApp"
ThisBuild / organization := "net.bblfish"
ThisBuild / version := "0.2"
ThisBuild / scalaVersion := Ver.scala
ThisBuild / startYear := Some(2021)
ThisBuild / developers := List(
tlGitHubDev("bblfish", "Henry Story")
)
//import org.scalajs.jsenv.nodejs.NodeJSEnv
lazy val commonSettings = Seq(
name := "Solid App",
version := "0.2-SNAPSHOT",
description := "Solid App",
headerLicense := Some(HeaderLicense.ALv2("2021", "bblfish.net")),
startYear := Some(2021),
scalaVersion := Ver.scala,
updateOptions := updateOptions.value.withCachedResolution(
true
) // to speed up dependency resolution
)
val scala3jsOptions = Seq(
// "-classpath", "foo:bar:...", // Add to the classpath.
// "-encoding", "utf-8", // Specify character encoding used by source files.
"-deprecation", // Emit warning and location for usages of deprecated APIs.
"-unchecked", // Enable additional warnings where generated code depends on assumptions.
"-feature", // Emit warning and location for usages of features that should be imported explicitly.
// "-explain", // Explain errors in more detail.
// "-explain-types", // Explain type errors in more detail.
"-indent", // Together with -rewrite, remove {...} syntax when possible due to significant indentation.
// "-no-indent", // Require classical {...} syntax, indentation is not significant.
"-new-syntax", // Require `then` and `do` in control expressions.
// "-old-syntax", // Require `(...)` around conditions.
// "-language:Scala2", // Compile Scala 2 code, highlight what needs updating
// "-language:strictEquality", // Require +derives Eql+ for using == or != comparisons
// "-rewrite", // Attempt to fix code automatically. Use with -indent and ...-migration.
// "-scalajs", // Compile in Scala.js mode (requires scalajs-library.jar on the classpath).
"-source:future", // Choices: future and future-migration. I use this to force future deprecation warnings, etc.
// "-Xfatal-warnings", // Fail on warnings, not just errors
// "-Xmigration", // Warn about constructs whose behavior may have changed since version.
// "-Ysafe-init", // Warn on field access before initialization
"-Yexplicit-nulls" // For explicit nulls behavior.
)
//val outwatchVersion = "0.11.1-SNAPSHOT"
resolvers += "jitpack" at "https://jitpack.io"
//libraryDependencies ++= Seq(
// ("io.github.outwatch" %%% "outwatch" % outwatchVersion) cross CrossVersion.for3Use2_13,
// "org.scalatest" %%% "scalatest" % "3.2.9" % Test
//)
lazy val authN = crossProject(JVMPlatform) // , JSPlatform)
.crossType(CrossType.Full).in(file("authn")).settings(commonSettings*).settings(
name := "AuthNClient",
description := "Http Client Middleware that knows how to use a Wallet interface to authenticate",
// scalacOptions := scala3jsOptions,
resolvers += sonatypeSNAPSHOT,
libraryDependencies ++= Seq(http4s.client.value),
libraryDependencies ++= Seq(
munit.value % Test,
cats.munitEffect.value % Test,
http4s.server.value % Test,
http4s.client.value % Test,
http4s.theDsl.value % Test
)
// // useYarn := true, // makes scalajs-bundler use yarn instead of npm
// Test / requireJsDomEnv := true,
// scalaJSUseMainModuleInitializer := true,
// scalaJSLinkerConfig ~= (_.withModuleKind(ModuleKind.CommonJSModule)), // configure Scala.js to emit a JavaScript module instead of a top-level script
// ESModule cannot be used because we are using ScalaJSBundlerPlugin
// scalaJSLinkerConfig ~= { _.withModuleKind(ModuleKind.ESModule) },
// fastOptJS / webpackConfigFile := Some(baseDirectory.value / "webpack.config.dev.js"),
// https://github.com/rdfjs/N3.js/
// do I also need to run `npm install n3` ?
// Compile / npmDependencies += NPM.n3,
// Test / npmDependencies += NPM.n3
).dependsOn(wallet)
lazy val free = crossProject(JVMPlatform) // , JSPlatform)
.crossType(CrossType.Full).in(file("free")).settings(commonSettings*).settings(
name := "Free LDP",
description := "Free LDP client and provisionally interpreters (to be moved)",
libraryDependencies ++= Seq(
cats.core.value,
cats.free.value,
http4s.core.value
)
)
// an LDES client
lazy val ldes = crossProject(JVMPlatform).crossType(CrossType.Full).in(file("ldes"))
.dependsOn(ioExt4s).settings(commonSettings*).settings(
name := "LDES Client",
description := "Linked Data Event Stream Libraries and Client",
// scalacOptions := scala3jsOptions,
resolvers += sonatypeSNAPSHOT,
libraryDependencies ++= Seq(
// cats.effect.value,
cats.fs2.value
),
libraryDependencies ++= Seq(
munit.value % Test,
cats.munitEffect.value % Test,
banana.bananaJena.value % Test
)
)
// make a new project called cache
lazy val cache = crossProject(JVMPlatform).crossType(CrossType.Full).in(file("cache"))
.settings(commonSettings*).settings(
name := "Cache",
description := "Cache",
libraryDependencies ++= Seq(
cats.core.value,
cats.free.value,
http4s.core.value,
http4s.client.value
),
libraryDependencies ++= Seq(
// munit.value % Test,
cats.munitEffect.value % Test,
http4s.theDsl.value % Test
)
)
lazy val test = crossProject(JVMPlatform).crossType(CrossType.Full).in(file("test"))
.settings(commonSettings*).settings(
name := "test",
description := "test stuff",
libraryDependencies ++= Seq(
mules.http4s.value,
mules.core.value,
mules.caffeine.value,
mules.ember_client.value
),
libraryDependencies ++= Seq(
munit.value % Test
)
)
// todo: should be moved closer to banana-rdf repo
lazy val ioExt4s = crossProject(JVMPlatform).crossType(CrossType.Full).in(file("ioExt4s"))
.settings(commonSettings*).settings(
name := "IO http4s ext",
description := "rdf io extensions for http4s",
// scalacOptions := scala3jsOptions,
resolvers += sonatypeSNAPSHOT,
libraryDependencies ++= Seq(
http4s.client.value,
banana.bananaJenaIO.value
),
libraryDependencies ++= Seq(
munit.value % Test,
cats.munitEffect.value % Test
)
)
//todo: we should split the wallet into client-wallet and the full wallet library
// as clients of the wallet only need a minimal interface
lazy val wallet = crossProject(JVMPlatform) // , JSPlatform)
.crossType(CrossType.Full).in(file("wallet")).dependsOn(ioExt4s).settings(commonSettings*)
.settings(
name := "Solid Wallet",
description := "Solid Wallet libraries ",
// scalacOptions := scala3jsOptions,
resolvers += sonatypeSNAPSHOT,
libraryDependencies ++= Seq(
http4s.client.value,
cats.free.value,
http4s.ember_client.value, // <- remove. added to explore implementation
banana.bananaJena.value,
crypto.http4sSig.value
),
libraryDependencies ++= Seq(
munit.value % Test,
cats.munitEffect.value % Test,
// http4s.server.value % Test,
http4s.client.value % Test,
http4s.theDsl.value % Test
)
// // useYarn := true, // makes scalajs-bundler use yarn instead of npm
// Test / requireJsDomEnv := true,
// scalaJSUseMainModuleInitializer := true,
// scalaJSLinkerConfig ~= (_.withModuleKind(ModuleKind.CommonJSModule)), // configure Scala.js to emit a JavaScript module instead of a top-level script
// ESModule cannot be used because we are using ScalaJSBundlerPlugin
// scalaJSLinkerConfig ~= { _.withModuleKind(ModuleKind.ESModule) },
// fastOptJS / webpackConfigFile := Some(baseDirectory.value / "webpack.config.dev.js"),
// https://github.com/rdfjs/N3.js/
// do I also need to run `npm install n3` ?
// Compile / npmDependencies += NPM.n3,
// Test / npmDependencies += NPM.n3
).dependsOn(cache)
lazy val scripts = crossProject(JVMPlatform).in(file("scripts"))
// .settings(
// libraryDependencies ++= Seq(
// other.scalaUri.value,
// crypto.bobcats.value classifier ("tests"), // bobcats test examples,
// crypto.bobcats.value classifier ("tests-sources") // bobcats test examples soources,
// )
// )
.dependsOn(wallet, authN, ldes).jvmSettings(
libraryDependencies ++= Seq(
crypto.bobcats.value classifier ("tests"), // bobcats test examples,
crypto.bobcats.value classifier ("tests-sources"), // bobcats test examples soources,
other.scalaUri.value,
http4s.ember_client.value,
crypto.nimbusJWT_JDK.value,
crypto.bouncyJCA_JDK.value
)
)
//lazy val app = project
// .in(file("app"))
// // note enabling the bundler changes what js needs to be called https://github.com/scalacenter/scalajs-bundler/issues/193
// // https://stackoverflow.com/questions/41904346/sscalajsmodulekind-modulekind-commonjsmodule-cannot-invoke-main-method-anym
// // reference doc for Bundler: https://scalacenter.github.io/scalajs-bundler/reference.html
// .enablePlugins(ScalaJSBundlerPlugin)
// .enablePlugins(ScalaJSPlugin)
// //perhaps instead if the ScalaJSPlugin I should use https://github.com/vmunier/sbt-web-scalajs
// .settings(commonSettings: _*)
// .settings(
// description := "The Solid App",
// libraryDependencies ++= Seq(
// http4s.Dom.value,
// scalajsDom.value,
// bananaRdfLib.value
// ),
// libraryDependencies += munit.value % Test,
//
// // useYarn := true, // makes scalajs-bundler use yarn instead of npm
//
// // with ComminJSModule set one gets "exports is not defined" problem when just trying to call js from html
// // scalaJSLinkerConfig ~= (_.withModuleKind(ModuleKind.CommonJSModule)), // configure Scala.js to emit a JavaScript module instead of a top-level script
// // scalaJSLinkerConfig ~= { _.withModuleKind(ModuleKind.ESModule) }, //does not work because we are using ScalaJSBundlerPlugin
//
// // this is only needed for run, should be moved to tests when tests are working
// // Compile / npmDependencies += "node-fetch" -> "3.1.0",
// Test / npmDependencies += NPM.jsDom,
//
// // https://webpack.github.io
// // https://github.com/webpack/webpack
// // webpack 5 should be supported https://github.com/scalacenter/scalajs-bundler/issues/350
// webpack / version := "5.64.2",
// // https://webpack.js.org/configuration/dev-server/
// // startWebpackDevServer / version := "4.5.0",
//
// // https://github.com/scalacenter/scalajs-bundler/issues/385#issuecomment-756243511
// webpackEmitSourceMaps := false,
//
// // needed to be able to have multiple entry points
// // https://scalacenter.github.io/scalajs-bundler/cookbook.html#several-entry-points
// webpackBundlingMode := BundlingMode.LibraryAndApplication(),
//
// //in order to be able to use run in sbt shell we need both the following (and scalajs-env-jsdom-nodejs in plugins)
//// jsEnv := new org.scalajs.jsenv.jsdomnodejs.JSDOMNodeJSEnv(),
// // one could use the net.exoego fork? (then also change plugin)
// jsEnv := new net.exoego.jsenv.jsdomnodejs.JSDOMNodeJSEnv(),
// scalaJSUseMainModuleInitializer := true,
//
// // https://scalacenter.github.io/scalajs-bundler/reference.html#jsdom
// // it turns out that jsdDomEnv
// Test / requireJsDomEnv := true,
//
// // webpackDevServerExtraArgs := Seq("--color"),
// // webpackDevServerPort := 8080,
// fastOptJS / webpackConfigFile := Some(
// baseDirectory.value / "webpack.config.dev.js"
// )
// // fastOptJS / webpackBundlingMode := BundlingMode.LibraryOnly(), // https://scalacenter.github.io/scalajs-bundler/cookbook.html#performance
// )
//.dependsOn(n3js)
//
// Move n3js to banana rdf !!
//
//lazy val n3jsDir = Path("n3js").asFile.getAbsoluteFile
////project to use when we want to create code from the TypeScript Template for N3
//// https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/n3
//// lazy val n3jsST = project.in(n3jsDir/"ST")
//// .enablePlugins(ScalablyTypedConverterGenSourcePlugin)
//// .settings(
//// name := "n3js Scalably Typed project",
//// stUseScalaJsDom := true,
//// stSourceGenMode := SourceGenMode.Manual(n3jsDir/"src"/"main"/"scala"),
//// useYarn := true, // makes scalajs-bundler use yarn instead of npm
//// Compile / npmDependencies += "@types/n3" -> "1.10.3",
//// stMinimize := Selection.AllExcept("n3"),
//// stOutputPackage := "n3js",
//// )
//
//lazy val n3js = project.in(n3jsDir)
// .settings(commonSettings:_*)
// .enablePlugins(ScalaJSPlugin)
// .enablePlugins(ScalaJSBundlerPlugin)
// .settings(
// name := "N3js",
// // scalacOptions := scala3jsOptions,
// libraryDependencies ++= Seq(http4s.Dom.value, modelJS.value, munit.value),
// resolvers += sonatypeSNAPSHOT,
// // useYarn := true, // makes scalajs-bundler use yarn instead of npm
// // Test / requireJsDomEnv := true,
// // scalaJSUseMainModuleInitializer := true,
// // scalaJSLinkerConfig ~= (_.withModuleKind(ModuleKind.CommonJSModule)), // configure Scala.js to emit a JavaScript module instead of a top-level script
// // ESModule cannot be used because we are using ScalaJSBundlerPlugin
// // scalaJSLinkerConfig ~= { _.withModuleKind(ModuleKind.ESModule) },
//
//// fastOptJS / webpackConfigFile := Some(baseDirectory.value / "webpack.config.dev.js"),
//
// // https://github.com/rdfjs/N3.js/
// // do I also need to run `npm install n3` ?
// Compile / npmDependencies += NPM.n3,
// Test / npmDependencies += NPM.n3,
// )
// hot reloading configuration:
// https://github.com/scalacenter/scalajs-bundler/issues/180
// addCommandAlias("dev", "; compile; fastOptJS::startWebpackDevServer; devwatch; fastOptJS::stopWebpackDevServer")
//addCommandAlias("devwatch", "~; fastOptJS; copyFastOptJS")
// when running the "dev" alias, after every fastOptJS compile all artifacts are copied into
// a folder which is served and watched by the webpack devserver.
// this is a workaround for: https://github.com/scalacenter/scalajs-bundler/issues/180
// lazy val copyFastOptJS = TaskKey[Unit]("copyFastOptJS", "Copy javascript files to target directory")
// copyFastOptJS := {
// val inDir = (Compile / fastOptJS / crossTarget).value
// val outDir = (Compile / fastOptJS / crossTarget).value / "dev"
// val files = Seq(name.value.toLowerCase + "-fastopt-loader.js", name.value.toLowerCase + "-fastopt.js") map { p => (inDir / p, outDir / p) }
// IO.copy(files, overwrite = true, preserveLastModified = true, preserveExecutable = true)
// }