-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathbuild.sbt
115 lines (102 loc) · 4.36 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
import sbt._
import Keys._
import com.jsuereth.sbtpgp.PgpKeys.publishSigned
import sbt.Reference.display
import com.softwaremill.SbtSoftwareMillCommon.commonSmlBuildSettings
import com.softwaremill.Publish.ossPublishSettings
val scala2_12 = "2.12.19"
val scala2_13 = "2.13.14"
val scala3 = "3.3.3"
val scala2Versions = List(scala2_12, scala2_13)
val scala2And3Versions = scala2Versions ++ List(scala3)
val scalaTest = "org.scalatest" %% "scalatest" % "3.2.19"
lazy val commonSettings = commonSmlBuildSettings ++ ossPublishSettings ++ Seq(
organization := "com.softwaremill.common",
parallelExecution := false,
// Sonatype OSS deployment
credentials += Credentials(Path.userHome / ".ivy2" / ".credentials"),
Test / publishArtifact := false
)
val publishTagging = taskKey[Unit]("Publish the tagging projects; run sonatypeBundleRelease later")
val publishFutureTry = taskKey[Unit]("Publish the futureTry projects; run sonatypeBundleRelease later")
val publishFutureSquash = taskKey[Unit]("Publish the futureSquash projects; run sonatypeBundleRelease later")
val publishEitherOps = taskKey[Unit]("Publish the eitherOps projects; run sonatypeBundleRelease later")
val publishBenchmark = taskKey[Unit]("Publish the benchmark projects; run sonatypeBundleRelease later")
val enableMimaSettings = Seq(
mimaPreviousArtifacts := {
val current = version.value
println(current)
val isRcOrMilestone = current.contains("M") || current.contains("RC")
if (!isRcOrMilestone) {
val previous = previousStableVersion.value
println(s"[info] Not a M or RC version, using previous version for MiMa check: $previous")
previousStableVersion.value.map(organization.value %% moduleName.value % _).toSet
} else {
println(s"[info] $current is an M or RC version, no previous version to check with MiMa")
Set.empty
}
}
)
val allAggregates =
tagging.projectRefs ++ futureTry.projectRefs ++ futureSquash.projectRefs ++ eitherOps.projectRefs ++ benchmark.projectRefs
def filterProject(p: String => Boolean) = ScopeFilter(inProjects(allAggregates.filter(pr => p(display(pr.project))): _*))
lazy val scalaCommon = (project in file("."))
.settings(commonSettings)
.settings(
publishArtifact := false,
name := "scala-common",
version := "1.0.0",
scalaVersion := scala2_13,
mimaPreviousArtifacts := Set.empty,
publishTagging := publishSigned.all(filterProject(p => p.contains("tagging"))).value,
publishFutureTry := publishSigned.all(filterProject(p => p.contains("futureTry"))).value,
publishFutureSquash := publishSigned.all(filterProject(p => p.contains("futureSquash"))).value,
publishEitherOps := publishSigned.all(filterProject(p => p.contains("eitherOps"))).value,
publishBenchmark := publishSigned.all(filterProject(p => p.contains("benchmark"))).value
)
.aggregate(allAggregates: _*)
lazy val tagging = (projectMatrix in file("tagging"))
.settings(commonSettings ++ enableMimaSettings)
.settings(
version := "2.3.5",
name := "tagging"
)
.jvmPlatform(scalaVersions = scala2And3Versions)
.jsPlatform(scalaVersions = scala2And3Versions)
.nativePlatform(scalaVersions = scala2And3Versions)
lazy val futureTry = (projectMatrix in file("futureTry"))
.settings(commonSettings ++ enableMimaSettings)
.settings(
version := "1.0.1",
name := "futuretry",
libraryDependencies += scalaTest
)
.jvmPlatform(scalaVersions = scala2And3Versions)
.jsPlatform(scalaVersions = scala2And3Versions)
lazy val futureSquash = (projectMatrix in file("futureSquash"))
.settings(commonSettings ++ enableMimaSettings)
.settings(
version := "1.0.1",
name := "futureSquash",
libraryDependencies += scalaTest
)
.jvmPlatform(scalaVersions = scala2And3Versions)
.jsPlatform(scalaVersions = scala2And3Versions)
lazy val eitherOps = (projectMatrix in file("eitherOps"))
.settings(commonSettings ++ enableMimaSettings)
.settings(
version := "1.0.1",
name := "eitherOps",
libraryDependencies += scalaTest
)
.jvmPlatform(scalaVersions = scala2And3Versions)
.jsPlatform(scalaVersions = scala2And3Versions)
lazy val benchmark = (projectMatrix in file("benchmark"))
.settings(commonSettings ++ enableMimaSettings)
.settings(
version := "1.0.1",
name := "benchmark",
libraryDependencies += scalaTest
)
.jvmPlatform(scalaVersions = scala2And3Versions)
.jsPlatform(scalaVersions = scala2And3Versions)