-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sbt
More file actions
124 lines (104 loc) · 4.3 KB
/
Copy pathbuild.sbt
File metadata and controls
124 lines (104 loc) · 4.3 KB
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
import scala.util.chaining.*
Global / onChangedBuildSource := ReloadOnSourceChanges
lazy val scala213 = "2.13.18"
lazy val scala3 = "3.3.8"
lazy val scalaVersions = Seq(scala213, scala3)
ThisBuild / scalaVersion := scala3
// GitHub Actions config
val javaVersions = Seq(11, 17, 21, 25).map(v => JavaSpec.temurin(v.toString))
ThisBuild / githubWorkflowJavaVersions := javaVersions
ThisBuild / githubWorkflowArtifactUpload := false
ThisBuild / githubWorkflowBuildMatrixFailFast := Some(false)
ThisBuild / githubWorkflowTargetBranches := Seq("master")
def isJava(v: Int) = s"matrix.java == '${javaVersions.find(_.version == v.toString).get.render}'"
ThisBuild / githubWorkflowBuild := Seq(
WorkflowStep.Run(List("sbt test"), name = Some("Build project")),
WorkflowStep.Run(List("sbt mimaReportBinaryIssues"), name = Some("Binary compatibility"), cond = Some(isJava(25))),
WorkflowStep.Run(List("sbt mdoc"), name = Some("Build docs"), cond = Some(isJava(25))),
)
ThisBuild / githubWorkflowPublishTargetBranches := Seq()
def foldScalaV[A](scalaVersion: String)(_213: => A, _3: => A): A =
CrossVersion.partialVersion(scalaVersion) match {
case Some((2, 13)) => _213
case Some((3, _)) => _3
}
lazy val baseSettings = Seq(
organization := "typify",
version := "13.0.0",
libraryDependencies ++= foldScalaV(scalaVersion.value)(
Seq(compilerPlugin("org.typelevel" %% "kind-projector" % "0.13.4" cross CrossVersion.patch)),
Seq(),
),
scalacOptions ++= foldScalaV(scalaVersion.value)(
Seq("-Vimplicits-verbose-tree"),
Seq("-no-indent"),
),
scalacOptions --= Seq(
"-language:existentials",
"-language:experimental.macros",
"-language:implicitConversions"
),
licenses += License.Apache2,
publish / skip := true,
mimaFailOnNoPrevious := false,
)
baseSettings
lazy val publishSettings = Seq(
publish / skip := false,
s3PublishBucket := "bondlink-maven-repo",
resolvers += "bondlink-maven-repo" at "https://maven.bondlink-cdn.com",
mimaPreviousArtifacts := Set(organization.value %%% name.value % "12.0.0"),
)
def baseProj(
id: String,
nme: String,
includeJVM: Boolean = true,
includeJS: Boolean = true,
includeNative: Boolean = true,
) =
sbt.internal.ProjectMatrix(id, file(id))
.pipe(p => if (includeJVM) p.jvmPlatform(scalaVersions = scalaVersions) else p)
.pipe(p => if (includeJS) p.jsPlatform(scalaVersions = scalaVersions) else p)
.pipe(p => if (includeNative) p.nativePlatform(scalaVersions = scalaVersions) else p)
.settings(baseSettings ++ Seq(name := nme))
lazy val cats = Def.setting("org.typelevel" %%% "cats-core" % "2.13.0")
lazy val circe = Def.setting("io.circe" %%% "circe-core" % "0.14.16")
lazy val formless = Def.setting("com.bondlink" %%% "formless" % "0.8.0")
lazy val json4s = "io.github.json4s" %% "json4s-jackson" % "4.1.1"
lazy val playJson = Def.setting("org.playframework" %%% "play-json" % "3.0.6")
lazy val scalacheck = Def.setting("org.scalacheck" %%% "scalacheck" % "1.19.0" % Test)
lazy val typify = baseProj("typify", "typify")
.settings(publishSettings)
.settings(
libraryDependencies ++= Seq(cats.value, formless.value, scalacheck.value),
)
lazy val circeTypify = baseProj("circe-typify", "circe-typify", includeJS = false, includeNative = false)
.settings(publishSettings)
.settings(
libraryDependencies += circe.value,
)
.dependsOn(typify % "test->test;compile->compile")
lazy val json4sTypify = baseProj("json4s-typify", "json4s-typify", includeJS = false, includeNative = false)
.settings(publishSettings)
.settings(
libraryDependencies += json4s
)
.dependsOn(typify % "test->test;compile->compile")
lazy val playjsonTypify = baseProj("play-json-typify", "play-json-typify", includeJS = false, includeNative = false)
.settings(publishSettings)
.settings(
libraryDependencies ++= Seq(cats.value, playJson.value)
)
.dependsOn(typify % "test->test;compile->compile")
lazy val sjsTypify = baseProj("jsdynamic-typify", "jsdynamic-typify", includeJVM = false, includeNative = false)
.settings(publishSettings)
.dependsOn(typify % "test->test;compile->compile")
lazy val docs = projectMatrix.in(file("typify-docs"))
.jvmPlatform(scalaVersions = Seq(scala3))
.settings(baseSettings)
.settings(
mdocOut := file("."),
scalacOptions -= "-Werror",
)
.dependsOn(typify)
.enablePlugins(MdocPlugin)