This repository has been archived by the owner on Jul 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.sbt
138 lines (120 loc) · 4.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
import sbtcrossproject.{crossProject, CrossType}
import sbtghactions.UseRef
//=============================================================================
//============================== build details ================================
//=============================================================================
addCommandAlias("format", ";scalafmtSbt;scalafmtConfig;scalafmtAll")
Global / onChangedBuildSource := ReloadOnSourceChanges
val Scala212 = "2.12.14"
val Scala213 = "2.13.6"
val Scala3 = "3.0.2"
//=============================================================================
//============================ publishing details =============================
//=============================================================================
ThisBuild / baseVersion := "0.0.5"
ThisBuild / organization := "com.lorandszakacs"
ThisBuild / homepage := Option(url("https://github.com/lorandszakacs/sprout"))
ThisBuild / publishFullName := "Loránd Szakács"
ThisBuild / scmInfo := Option(
ScmInfo(
browseUrl = url("https://github.com/lorandszakacs/sprout"),
connection = "git@github.com:lorandszakacs/sprout.git"
)
)
/** I want my email. So I put this here. To reduce a few lines of code, the sbt-spiewak plugin generates this (except
* email) from these two settings:
* {{{
* ThisBuild / publishFullName := "Loránd Szakács"
* ThisBuild / publishGithubUser := "lorandszakacs"
* }}}
*/
ThisBuild / developers := List(
Developer(
id = "lorandszakacs",
name = "Loránd Szakács",
email = "lorand.szakacs@protonmail.com",
url = new java.net.URL("https://github.com/lorandszakacs")
)
)
ThisBuild / startYear := Option(2021)
ThisBuild / licenses := List("Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0"))
//until we get to 1.0.0, we keep strictSemVer false
ThisBuild / strictSemVer := false
ThisBuild / spiewakCiReleaseSnapshots := false
ThisBuild / spiewakMainBranches := List("main")
ThisBuild / Test / publishArtifact := false
ThisBuild / scalaVersion := Scala3
ThisBuild / crossScalaVersions := List(Scala3, Scala213, Scala212)
//required for binary compat checks
ThisBuild / versionIntroduced := Map(
Scala212 -> "0.0.1",
Scala213 -> "0.0.1",
Scala3 -> "0.0.4"
)
//=============================================================================
//============================== Project details ==============================
//=============================================================================
// format: off
val catsV = "2.6.1" // https://github.com/typelevel/cats/releases
val munitV = "0.7.29" // https://github.com/scalameta/munit/releases
val shapelessV = "2.3.7" // https://github.com/milessabin/shapeless/releases
// format: on
lazy val root = project
.in(file("."))
.aggregate(
sproutJVM,
sproutJS
)
.enablePlugins(NoPublishPlugin)
.enablePlugins(SonatypeCiReleasePlugin)
.settings(commonSettings)
lazy val sprout = crossProject(JSPlatform, JVMPlatform)
.settings(commonSettings)
.jsSettings(
scalaJSLinkerConfig ~= (_.withModuleKind(ModuleKind.CommonJSModule))
)
.settings(
name := "sprout",
libraryDependencies ++= Seq(
// format: off
"org.typelevel" %%% "cats-core" % catsV withSources(),
"org.scalameta" %%% "munit" % munitV % Test withSources()
// format: on
) ++ (if (isDotty.value)
Seq.empty
else
Seq(
"com.chuusai" %%% "shapeless" % shapelessV withSources ()
))
)
lazy val sproutJVM = sprout.jvm.settings(
javaOptions ++= Seq("-source", "1.8", "-target", "1.8")
)
lazy val sproutJS = sprout.js
lazy val commonSettings = Seq(
// Flag -source and -encoding set repeatedly
// previous source flag set by one of the many plugins used
scalacOptions := scalacOptions.value
.filterNot(_.startsWith("-source:")) ++
(if (isDotty.value) {
Seq(
"-source:future",
"-language:strictEquality"
)
}
else {
Seq()
}),
Compile / unmanagedSourceDirectories ++= {
val major = if (isDotty.value) "-3" else "-2"
List(CrossType.Pure, CrossType.Full).flatMap(
_.sharedSrcDir(baseDirectory.value, "main").toList.map(f => file(f.getPath + major))
)
},
Test / unmanagedSourceDirectories ++= {
val major = if (isDotty.value) "-3" else "-2"
List(CrossType.Pure, CrossType.Full).flatMap(
_.sharedSrcDir(baseDirectory.value, "test").toList.map(f => file(f.getPath + major))
)
}
)