-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sbt
185 lines (169 loc) · 5.71 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
import laika.ast.LengthUnit._
import laika.ast._
import laika.helium.Helium
import laika.helium.config.Favicon
import laika.helium.config.HeliumIcon
import laika.helium.config.IconLink
import laika.helium.config.ImageLink
import TypelevelGitHubPlugin._
Global / onChangedBuildSource := ReloadOnSourceChanges
// https://typelevel.org/sbt-typelevel/faq.html#what-is-a-base-version-anyway
ThisBuild / tlBaseVersion := "0.14" // your current series x.y
ThisBuild / organization := "org.creativescala"
ThisBuild / organizationName := "Creative Scala"
ThisBuild / organizationHomepage := Some(url("http://creativescala.org/"))
ThisBuild / startYear := Some(2022)
ThisBuild / licenses := Seq(License.Apache2)
ThisBuild / developers := List(
// your GitHub handle and name
tlGitHubDev("noelwelsh", "Noel Welsh")
)
ThisBuild / scalafixDependencies += "com.github.liancheng" %% "organize-imports" % "0.6.0"
ThisBuild / semanticdbEnabled := true
ThisBuild / semanticdbVersion := scalafixSemanticdb.revision
ThisBuild / tlSonatypeUseLegacyHost := true
ThisBuild / tlSitePublishBranch := Some("main")
val scala3 = "3.1.3"
val scala2 = "2.13.9"
ThisBuild / crossScalaVersions := Seq(scala3 /*, scala2*/ )
ThisBuild / scalaVersion := crossScalaVersions.value.head
// Dependencies used by all the sub-projects
ThisBuild / libraryDependencies ++= Seq(
"org.typelevel" %%% "cats-core" % "2.8.0",
"org.typelevel" %%% "cats-effect" % "3.3.14",
"co.fs2" %%% "fs2-core" % "3.3.0",
"org.creativescala" %%% "doodle" % "0.11.2",
"org.scalameta" %%% "munit" % "0.7.29" % Test,
"org.typelevel" %%% "munit-cats-effect-3" % "1.0.7" % Test
)
// Run this (build) to do everything involved in building the project
commands += Command.command("build") { state =>
"dependencyUpdates" ::
"compile" ::
"test" ::
"scalafixAll" ::
"scalafmtAll" ::
"headerCreate" ::
state
}
lazy val root = crossProject(JSPlatform, JVMPlatform)
.in(file("."))
.settings(moduleName := "doodle-explore")
lazy val rootJvm =
root.jvm.dependsOn(core.jvm, java2d).aggregate(core.jvm, java2d)
lazy val rootJs =
root.js.dependsOn(core.js, laminar).aggregate(core.js, laminar)
lazy val core = crossProject(JVMPlatform, JSPlatform)
.crossType(CrossType.Pure)
.in(file("core"))
.settings(moduleName := "doodle-explore-core")
lazy val java2d = project
.in(file("java2d"))
.dependsOn(core.jvm)
.settings(moduleName := "doodle-explore-java2d")
lazy val laminar = project
.in(file("laminar"))
.enablePlugins(ScalaJSPlugin)
.settings(
moduleName := "doodle-explore-laminar",
// scalaJSUseMainModuleInitializer := true,
// Compile / mainClass := Some("doodle.explore.laminar.Main"),
libraryDependencies ++= Seq(
"com.raquo" %%% "laminar" % "0.14.2",
"org.creativescala" %%% "doodle-svg" % "0.11.3"
)
)
.dependsOn(core.js)
/* lazy val buildLaminarExample = taskKey[String]("Builds a doodle-explore laminar example") */
/* import complete.DefaultParsers._ */
/* buildLaminarExample := { */
/* val args = spaceDelimited("<arg>").parsed */
/* laminar.js / Compile / mainClass := Some(sys.env("MainClass")) */
/* (laminar.js / Compile / fullOptJS).value */
/* "test" */
/* } */
/** Example that is used in documentation */
lazy val example = project
.in(file("example"))
.enablePlugins(ScalaJSPlugin)
.settings(
libraryDependencies ++= Seq(
"com.raquo" %%% "laminar" % "0.14.2",
"org.creativescala" %%% "doodle-svg" % "0.11.3"
)
)
.dependsOn(laminar)
.enablePlugins(NoPublishPlugin)
lazy val docs = project
.in(file("site"))
.settings(
tlSiteRelatedProjects := Seq(
("Doodle", url("https://creativescala.org/doodle")),
("Doodle SVG", url("https://creativescala.github.io/doodle-svg")),
("Creative Scala", url("https://creativescala.org"))
),
laikaExtensions += DoodleDirectives,
tlSiteHeliumConfig := {
Helium.defaults.site
.metadata(
title = Some("Doodle Explore"),
authors = developers.value.map(_.name),
language = Some("en"),
version = Some(version.value.toString)
)
.site
.layout(
contentWidth = px(860),
navigationWidth = px(275),
topBarHeight = px(50),
defaultBlockSpacing = px(10),
defaultLineHeight = 1.5,
anchorPlacement = laika.helium.config.AnchorPlacement.Right
)
.site
.darkMode
.disabled
.site
.favIcons(
Favicon.external(
"https://typelevel.org/img/favicon.png",
"32x32",
"image/png"
)
)
.site
.topNavigationBar(
homeLink = IconLink.external(
"https://creativescala.org",
HeliumIcon.home
),
navLinks = tlSiteApiUrl.value.toList.map { url =>
IconLink.external(
url.toString,
HeliumIcon.api,
options = Styles("svg-link")
)
} ++ List(
IconLink.external(
scmInfo.value
.fold("https://github.com/creativescala")(_.browseUrl.toString),
HeliumIcon.github,
options = Styles("svg-link")
)
// IconLink.external("https://discord.gg/XF3CXcMzqD", HeliumIcon.chat),
// IconLink.external("https://twitter.com/typelevel", HeliumIcon.twitter)
)
)
},
Laika / sourceDirectories +=
(example / Compile / fastOptJS / artifactPath).value
.getParentFile() / s"${(example / moduleName).value}-fastopt",
tlSite := Def
.sequential(
(example / Compile / fastOptJS),
mdoc.toTask(""),
laikaSite
)
.value
)
.enablePlugins(TypelevelSitePlugin)