-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.sbt
134 lines (124 loc) · 4.19 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
inThisBuild(
Seq(
scalaVersion := "3.5.2",
versionScheme := Some("early-semver"),
// Github Workflow
githubWorkflowPublishTargetBranches := Seq(), // Don't publish anywhere
githubWorkflowJavaVersions := Seq(JavaSpec.temurin("21")),
githubWorkflowUseSbtThinClient := true,
githubWorkflowEnv := Map("SBT_OPTS" -> "-Xmx2048M"),
githubWorkflowBuild ++= Seq(
WorkflowStep.Sbt(List("build"), name = Some("Build projects")),
WorkflowStep.Sbt(List("check"), name = Some("Check Formatting")),
WorkflowStep.Sbt(List("docs/mdoc"), name = Some("Check docs formatting")),
WorkflowStep.Use(
UseRef.Public("actions", "setup-node", "v2"),
params = Map(
"node-version" -> "16.x",
"cache" -> "yarn",
"cache-dependency-path" -> "website/yarn.lock",
),
name = Some("Setup Node"),
),
WorkflowStep.Run(
commands = List(
"cd ./website",
"yarn install --frozen-lockfile",
"yarn build",
),
name = Some("Check build website"),
),
WorkflowStep.Use(
UseRef.Public("peaceiris", "actions-gh-pages", "v3"),
params = Map(
"github_token" -> "${{ secrets.GITHUB_TOKEN }}",
"publish_dir" -> "./website/build",
"user_name" -> "github-actions[bot]",
"user_email" -> "41898282+github-actions[bot]@users.noreply.github.com",
),
name = Some("Deploy to Github Pages"),
cond = Some("${{ github.ref == 'refs/heads/main' }}"),
),
),
)
)
val commonSettings = Seq(
scalacOptions -= "-Xfatal-warnings",
scalacOptions += "-source:future",
scalacOptions += "-rewrite",
scalacOptions += "-indent",
scalacOptions += "-Yexplicit-nulls",
scalacOptions += "-explain",
scalacOptions += "-Wunused:all",
libraryDependencies ++= Seq(
Dependencies.catsCore.value,
Dependencies.scribe.value,
Dependencies.scribeCats.value,
Dependencies.catsEffect.value,
Dependencies.fs2.value,
Dependencies.scalaCheckEffect.value,
Dependencies.munit.value,
Dependencies.munitCatsEffect.value,
Dependencies.munitScalaCheck.value,
Dependencies.munitScalaCheckEffect.value,
),
)
val commonJsSettings = Seq(
scalaJSLinkerConfig ~= (_.withModuleKind(ModuleKind.CommonJSModule))
)
val kantan = crossProject(JSPlatform, JVMPlatform)
.settings(scalacOptions -= "-Xfatal-warnings", scalacOptions += "-Wconf:all")
.jsSettings(commonJsSettings)
val compiler = crossProject(JSPlatform, JVMPlatform)
.settings(
commonSettings,
libraryDependencies ++= Seq(
Dependencies.catsParse.value
),
)
.dependsOn(kantan)
.jsSettings(commonJsSettings)
val cli = crossProject(JSPlatform, JVMPlatform)
.settings(
commonSettings,
libraryDependencies ++= Seq(
Dependencies.fs2IO.value,
Dependencies.decline.value,
Dependencies.declineEffect.value,
),
)
.dependsOn(compiler)
.jsSettings(commonJsSettings, scalaJSUseMainModuleInitializer := true)
val web = project
.enablePlugins(ScalaJSPlugin)
.settings(
commonSettings,
commonJsSettings,
libraryDependencies ++= Seq(
Dependencies.fs2IO.value,
Dependencies.tyrian.value,
),
Compile / fastLinkJS / scalaJSLinkerOutputDirectory := file("./web/target/scala-3"),
Compile / fullLinkJS / scalaJSLinkerOutputDirectory := file("./web/target/scala-3"),
)
.dependsOn(compiler.js)
lazy val docs = project // new documentation project
.in(file("grox-docs")) // important: it must not be docs/
.dependsOn(root)
.settings(
moduleName := "grox-docs",
mdocVariables := Map("VERSION" -> version.value),
)
.enablePlugins(MdocPlugin, DocusaurusPlugin)
lazy val root = project
.in(file("."))
.settings(publish := {}, publish / skip := true)
.aggregate(compiler.js, compiler.jvm, cli.js, cli.jvm, web, kantan.js, kantan.jvm)
// Commands
addCommandAlias("build", "buildJs")
addCommandAlias("buildJs", ";root/fullLinkJS")
addCommandAlias("testAll", "all test")
addCommandAlias("prepare", "fmt")
addCommandAlias("fmt", "all root/scalafmtSbt root/scalafmtAll")
addCommandAlias("fmtCheck", "all root/scalafmtSbtCheck root/scalafmtCheckAll")
addCommandAlias("check", "fmtCheck")