-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.sbt
104 lines (89 loc) · 3.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
Global / onChangedBuildSource := ReloadOnSourceChanges
lazy val scala213 = "2.13.15"
lazy val scala3 = "3.3.4"
lazy val scalaVersions = Seq(scala213, scala3)
ThisBuild / crossScalaVersions := scalaVersions
// GitHub Actions config
val javaVersions = Seq(8, 11, 17, 21).map(v => JavaSpec.temurin(v.toString))
ThisBuild / githubWorkflowJavaVersions := javaVersions
ThisBuild / githubWorkflowArtifactUpload := false
ThisBuild / githubWorkflowBuildMatrixFailFast := Some(false)
ThisBuild / githubWorkflowTargetBranches := Seq("master")
ThisBuild / githubWorkflowPublishTargetBranches := Seq()
def isJava(v: Int) = s"matrix.java == '${javaVersions.find(_.version == v.toString).get.render}'"
ThisBuild / githubWorkflowBuild ++= Seq(
WorkflowStep.Sbt(List("example/run"), name = Some("Run example"), cond = Some(isJava(21))),
WorkflowStep.Sbt(List("docs/mdoc"), name = Some("Build docs"), cond = Some(isJava(21))),
)
def forScalaV[A](scalaVersion: String)(_213: => A, _3: => A): A =
CrossVersion.partialVersion(scalaVersion) match {
case Some((2, 13)) => _213
case Some((3, _)) => _3
}
lazy val commonSettings = Seq(
version := "7.0.0",
organization := "bondlink",
scalaVersion := scala3,
crossScalaVersions := scalaVersions,
scalacOptions ++= Seq(
"-Wconf:msg=package object inheritance is deprecated:s",
) ++ forScalaV(scalaVersion.value)(
Seq("-Xsource:3.3", "-Ymacro-annotations"),
Seq(),
),
libraryDependencies ++= forScalaV(scalaVersion.value)(
Seq(compilerPlugin("org.typelevel" %% "kind-projector" % "0.13.3" cross CrossVersion.full)),
Seq(),
),
publish / skip := true
)
commonSettings
gitRelease := {}
lazy val catsVersion = "2.12.0"
lazy val catsCore = "org.typelevel" %% "cats-core" % catsVersion
lazy val catsFree = "org.typelevel" %% "cats-free" % catsVersion
lazy val catsLaws = "org.typelevel" %% "cats-laws" % catsVersion % Test
lazy val newtype = "io.estatico" %% "newtype" % "0.4.4"
lazy val scalaCheck = "org.scalacheck" %% "scalacheck" % "1.18.1" % Test
lazy val publishSettings = Seq(
publish / skip := false,
gitPublishDir := file("/src/maven-repo"),
licenses += License.Apache2,
)
lazy val core = project.in(file("core"))
.settings(commonSettings ++ publishSettings ++ Seq(
name := "composefree",
libraryDependencies ++= Seq(
catsCore,
catsFree
)
))
lazy val future = project.in(file("future"))
.settings(commonSettings ++ publishSettings ++ Seq(
name := "composefree-future",
libraryDependencies ++= Seq(
catsCore,
catsLaws,
scalaCheck,
),
libraryDependencies ++= forScalaV(scalaVersion.value)(
Seq(newtype),
Seq(),
),
))
lazy val example = project.in(file("example"))
.settings(commonSettings ++ Seq(
name := "composefree-example",
libraryDependencies += "org.typelevel" %% "cats-effect" % "3.5.4",
gitRelease := {}
))
.dependsOn(core, future)
.aggregate(core, future)
lazy val docs = project.in(file("composefree-docs"))
.settings(commonSettings ++ Seq(
mdocOut := file("."),
scalacOptions ~= (_.filterNot(o => o == "-Xfatal-warnings" || o.startsWith("-Wconf:msg=package"))),
gitRelease := {}
))
.dependsOn(core, future)
.enablePlugins(MdocPlugin)