generated from indoorvivants/scala3-library-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
133 lines (119 loc) · 3.35 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
Global / excludeLintKeys += logManager
Global / excludeLintKeys += scalaJSUseMainModuleInitializer
Global / excludeLintKeys += scalaJSLinkerConfig
inThisBuild(
List(
semanticdbEnabled := true,
semanticdbVersion := scalafixSemanticdb.revision,
scalafixScalaBinaryVersion := scalaBinaryVersion.value,
organization := "com.indoorvivants",
organizationName := "Anton Sviridov",
homepage := Some(
url("https://github.com/indoorvivants/rendition")
),
startYear := Some(2022),
licenses := List(
"Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")
),
developers := List(
Developer(
"keynmol",
"Anton Sviridov",
url("https://blog.indoorvivants.com")
)
)
)
)
val Versions = new {
val Scala3 = "3.3.1"
val munit = "1.0.0-M6"
val organizeImports = "0.6.0"
val scalaVersions = Seq(Scala3)
}
// https://github.com/cb372/sbt-explicit-dependencies/issues/27
lazy val disableDependencyChecks = Seq(
unusedCompileDependenciesTest := {},
missinglinkCheck := {},
undeclaredCompileDependenciesTest := {}
)
lazy val munitSettings = Seq(
libraryDependencies += {
"org.scalameta" %%% "munit" % Versions.munit % Test
}
)
lazy val root = project
.in(file("."))
.aggregate(core.projectRefs*)
.aggregate(docs.projectRefs*)
.settings(noPublish)
lazy val core = projectMatrix
.in(file("modules/core"))
.defaultAxes(defaults*)
.settings(
name := "rendition",
moduleName := "rendition",
Test / scalacOptions ~= filterConsoleScalacOptions
)
.settings(munitSettings)
.jvmPlatform(Versions.scalaVersions)
.jsPlatform(Versions.scalaVersions, disableDependencyChecks)
.nativePlatform(Versions.scalaVersions, disableDependencyChecks)
.enablePlugins(BuildInfoPlugin)
.settings(
buildInfoPackage := "rendition",
buildInfoOptions += BuildInfoOption.PackagePrivate,
buildInfoKeys := Seq[BuildInfoKey](
version,
scalaVersion,
scalaBinaryVersion
),
scalaJSUseMainModuleInitializer := true,
scalaJSLinkerConfig ~= (_.withModuleKind(ModuleKind.CommonJSModule))
)
lazy val docs = projectMatrix
.in(file("myproject-docs"))
.dependsOn(core)
.defaultAxes(defaults*)
.settings(
mdocVariables := Map(
"VERSION" -> version.value
)
)
.settings(disableDependencyChecks)
.jvmPlatform(Versions.scalaVersions)
.enablePlugins(MdocPlugin)
.settings(noPublish)
val noPublish = Seq(
publish / skip := true,
publishLocal / skip := true
)
val defaults = Seq(VirtualAxis.scalaABIVersion("3.3.1"), VirtualAxis.jvm)
val scalafixRules = Seq(
"OrganizeImports",
"DisableSyntax",
"LeakingImplicitClassVal",
"NoValInForComprehension"
).mkString(" ")
val CICommands = Seq(
"clean",
"compile",
"test",
"docs/mdoc --in README.md",
"scalafmtCheckAll",
"scalafmtSbtCheck",
s"scalafix --check $scalafixRules",
"headerCheck",
"undeclaredCompileDependenciesTest",
"unusedCompileDependenciesTest",
"missinglinkCheck"
).mkString(";")
val PrepareCICommands = Seq(
s"scalafix --rules $scalafixRules",
"scalafmtAll",
"scalafmtSbt",
"headerCreate",
"undeclaredCompileDependenciesTest"
).mkString(";")
addCommandAlias("ci", CICommands)
addCommandAlias("preCI", PrepareCICommands)