-
Notifications
You must be signed in to change notification settings - Fork 28
/
build.sbt
109 lines (95 loc) · 3.39 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
import com.softwaremill.SbtSoftwareMillBrowserTestJS._
import com.softwaremill.SbtSoftwareMillCommon.commonSmlBuildSettings
import com.softwaremill.Publish.ossPublishSettings
val scala2_12 = "2.12.20"
val scala2_13 = "2.13.15"
val scala2 = List(scala2_12, scala2_13)
val scala3 = List("3.3.4")
val scalaTestVersion = "3.2.19"
excludeLintKeys in Global ++= Set(ideSkipProject)
def dependenciesFor(version: String)(deps: (Option[(Long, Long)] => ModuleID)*): Seq[ModuleID] =
deps.map(_.apply(CrossVersion.partialVersion(version)))
val commonSettings = commonSmlBuildSettings ++ ossPublishSettings ++ Seq(
organization := "com.softwaremill.sttp.model",
mimaPreviousArtifacts := Set.empty,
versionScheme := Some("semver-spec")
)
val commonJvmSettings = commonSettings ++ Seq(
ideSkipProject := (scalaVersion.value != scala2_13),
libraryDependencies ++= Seq(
"org.scalatest" %% "scalatest" % scalaTestVersion % Test
),
mimaPreviousArtifacts := previousStableVersion.value.map(organization.value %% moduleName.value % _).toSet,
mimaReportBinaryIssues := { if ((publish / skip).value) {} else mimaReportBinaryIssues.value }
)
val commonJsSettings = commonSettings ++ Seq(
ideSkipProject := true,
Compile / scalacOptions ++= {
if (isSnapshot.value) Seq.empty
else
Seq {
val mapSourcePrefix =
if (ScalaArtifacts.isScala3(scalaVersion.value))
"-scalajs-mapSourceURI"
else
"-P:scalajs:mapSourceURI"
val dir = project.base.toURI.toString.replaceFirst("[^/]+/?$", "")
val url = "https://raw.githubusercontent.com/softwaremill/sttp-model"
s"$mapSourcePrefix:$dir->$url/v${version.value}/"
}
},
libraryDependencies ++= Seq(
"org.scala-js" %%% "scalajs-dom" % "2.8.0",
"org.scalatest" %%% "scalatest" % scalaTestVersion % Test
)
)
val commonNativeSettings = commonSettings ++ Seq(
ideSkipProject := true,
libraryDependencies ++= Seq(
"org.scalatest" %%% "scalatest" % scalaTestVersion % Test
)
)
lazy val rawAllAggregates: Seq[ProjectReference] = core.projectRefs
lazy val allAggregates: Seq[ProjectReference] = {
if (sys.env.isDefinedAt("STTP_NATIVE")) {
println("[info] STTP_NATIVE defined, including native in the aggregate projects")
rawAllAggregates
} else {
println("[info] STTP_NATIVE *not* defined, *not* including native in the aggregate projects")
rawAllAggregates.filterNot(_.toString.contains("Native"))
}
}
val compileAndTest = "compile->compile;test->test"
lazy val rootProject = (project in file("."))
.settings(commonSettings: _*)
.settings(publish / skip := true, name := "sttp-model", scalaVersion := scala2_13)
.aggregate(allAggregates: _*)
lazy val core = (projectMatrix in file("core"))
.settings(
name := "core"
)
.jvmPlatform(
scalaVersions = scala2 ++ scala3,
settings = commonJvmSettings
)
.jsPlatform(
scalaVersions = scala2 ++ scala3,
settings = commonJsSettings ++ browserChromeTestSettings ++ Seq(
libraryDependencies += "io.github.cquiroz" %%% "scala-java-time" % "2.6.0"
)
)
.nativePlatform(
scalaVersions = scala2 ++ scala3,
settings = commonNativeSettings
)
lazy val benchmark = (projectMatrix in file("benchmark"))
.settings(
name := "benchmark",
publish / skip := true
)
.jvmPlatform(
scalaVersions = scala2,
settings = commonJvmSettings
)
.dependsOn(core)
.enablePlugins(JmhPlugin)