Repository navigation
Expand file tree
/
Copy pathbuild.sbt
More file actions
90 lines (80 loc) · 2.7 KB
/
Copy pathbuild.sbt
File metadata and controls
90 lines (80 loc) · 2.7 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
import com.softwaremill.SbtSoftwareMillCommon.commonSmlBuildSettings
import com.softwaremill.Publish.{updateDocs, ossPublishSettings}
import com.softwaremill.UpdateVersionInDocs
val scala212 = "2.12.21"
val scala213 = "2.13.18"
val scala3 = "3.9.0"
val scalaIdeaVersion = scala3 // the version for which to import sources into intellij
Global / excludeLintKeys ++= Set(ideSkipProject)
commonSmlBuildSettings
ossPublishSettings
organization := "com.softwaremill.quicklens"
scalacOptions ++= Seq(
"-deprecation",
"-feature",
"-unchecked"
) // useful for debugging macros: "-Ycheck:all", "-Xcheck-macros"
ideSkipProject := (scalaVersion.value != scalaIdeaVersion)
lazy val root =
rootProject
.settings(
publishArtifact := false,
moduleName := "quicklens-root",
scalaVersion := scalaIdeaVersion,
updateDocs := Def.uncached(
UpdateVersionInDocs(sLog.value, organization.value, version.value, List(file("README.md")))
)
)
.autoAggregate
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(
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(scala212, scala213, scala3),
settings = Seq(
scalacOptions ++= (if (ScalaArtifacts.isScala3(scalaVersion.value)) Seq.empty else Seq("-release", "8"))
)
)
.jsPlatform(
scalaVersions = List(scala212, scala213, scala3)
)
.nativePlatform(
scalaVersions = List(scala212, scala213, scala3)
)