-
Notifications
You must be signed in to change notification settings - Fork 53
/
build.sbt
84 lines (75 loc) · 2.69 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
import com.softwaremill.SbtSoftwareMillCommon.commonSmlBuildSettings
import com.softwaremill.Publish.{updateDocs, ossPublishSettings}
import com.softwaremill.UpdateVersionInDocs
val scala211 = "2.11.12"
val scala212 = "2.12.19"
val scala213 = "2.13.14"
val scala3 = "3.3.3"
val scalaIdeaVersion = scala3 // the version for which to import sources into intellij
excludeLintKeys in Global ++= Set(ideSkipProject)
val commonSettings = commonSmlBuildSettings ++ ossPublishSettings ++ Seq(
organization := "com.softwaremill.quicklens",
updateDocs := UpdateVersionInDocs(sLog.value, organization.value, version.value, List(file("README.md"))),
scalacOptions ++= Seq("-deprecation", "-feature", "-unchecked"), // useful for debugging macros: "-Ycheck:all"
ideSkipProject := (scalaVersion.value != scalaIdeaVersion)
)
lazy val root =
project
.in(file("."))
.settings(commonSettings)
.settings(publishArtifact := false)
.settings(scalaVersion := scalaIdeaVersion)
.aggregate(quicklens.projectRefs: _*)
val versionSpecificScalaSources = {
Compile / unmanagedSourceDirectories := {
val current = (Compile / unmanagedSourceDirectories).value
val sv = (Compile / scalaVersion).value
val baseDirectory = (Compile / scalaSource).value
val suffixes = CrossVersion.partialVersion(sv) match {
case Some((2, 13)) => List("2", "2.13+")
case Some((2, _)) => List("2", "2.13-")
case Some((3, _)) => List("3")
case _ => Nil
}
val versionSpecificSources = suffixes.map(s => new File(baseDirectory.getAbsolutePath + "-" + s))
versionSpecificSources ++ current
}
}
def compilerLibrary(scalaVersion: String) = {
if (scalaVersion == scala3) {
Seq.empty
} else {
Seq("org.scala-lang" % "scala-compiler" % scalaVersion % Test)
}
}
def reflectLibrary(scalaVersion: String) = {
if (scalaVersion == scala3) {
Seq.empty
} else {
Seq("org.scala-lang" % "scala-reflect" % scalaVersion % Provided)
}
}
lazy val quicklens = (projectMatrix in file("quicklens"))
.settings(commonSettings)
.settings(
name := "quicklens",
libraryDependencies ++= reflectLibrary(scalaVersion.value),
Test / publishArtifact := false,
libraryDependencies ++= compilerLibrary(scalaVersion.value),
versionSpecificScalaSources,
libraryDependencies ++= Seq("flatspec", "shouldmatchers").map(m =>
"org.scalatest" %%% s"scalatest-$m" % "3.2.18" % Test
)
)
.jvmPlatform(
scalaVersions = List(scala211, scala212, scala213, scala3)
)
.jsPlatform(
scalaVersions = List(scala212, scala213, scala3)
)
.nativePlatform(
scalaVersions = List(scala212, scala213, scala3),
settings = Seq(
nativeLinkStubs := true
)
)