Skip to content

Commit a50666e

Browse files
committed
Update Scala & buiold
1 parent a43836f commit a50666e

File tree

2 files changed

+32
-110
lines changed

2 files changed

+32
-110
lines changed

build.sbt

Lines changed: 29 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
11
import com.softwaremill.Publish.Release.updateVersionInDocs
22
import sbtrelease.ReleasePlugin.autoImport._
33
import sbtrelease.ReleaseStateTransformations._
4+
// run JS tests inside Chrome, due to jsdom not supporting fetch
5+
import com.softwaremill.SbtSoftwareMillBrowserTestJS._
46

57
val scala2_11 = "2.11.12"
68
val scala2_12 = "2.12.11"
7-
val scala2_13 = "2.13.3"
8-
val scala3 = "0.27.0-RC1"
9+
val scala2_13 = "2.13.4"
10+
val scala2 = List(scala2_11, scala2_12, scala2_13)
11+
val dotty = "0.27.0-RC1"
12+
val scala3 = List(dotty, "3.0.0-M1")
913

10-
val sttpModelVersion = "1.2.0-RC5"
14+
val sttpModelVersion = "1.2.0-RC6"
1115

12-
val scalaTestVersion = "3.2.2"
16+
def scalaTestVersion(scalaVersion: String): String = if (scalaVersion == dotty) "3.2.2" else "3.2.3"
1317
val scalaNativeTestInterfaceVersion = "0.4.0-M2"
1418
val zioVersion = "1.0.3"
1519
val fs2Version: Option[(Long, Long)] => String = {
1620
case Some((2, 11)) => "2.1.0"
17-
case _ => "2.4.2"
21+
case _ => "2.4.6"
1822
}
1923

2024
excludeLintKeys in Global ++= Set(ideSkipProject)
@@ -50,7 +54,7 @@ val commonSettings = commonSmlBuildSettings ++ ossPublishSettings ++ Seq(
5054
sources in (Compile, doc) := {
5155
val scalaV = scalaVersion.value
5256
val current = (sources in (Compile, doc)).value
53-
if (scalaV == scala3) Seq() else current
57+
if (scala3.contains(scalaV)) Seq() else current
5458
}
5559
)
5660

@@ -63,7 +67,7 @@ val commonJvmSettings = commonSettings ++ Seq(
6367
},
6468
ideSkipProject := (scalaVersion.value != scala2_13),
6569
libraryDependencies ++= Seq(
66-
"org.scalatest" %% "scalatest" % scalaTestVersion % Test
70+
"org.scalatest" %% "scalatest" % scalaTestVersion(scalaVersion.value) % Test
6771
)
6872
)
6973

@@ -84,7 +88,7 @@ val commonJsSettings = commonSettings ++ Seq(
8488
ideSkipProject := true,
8589
libraryDependencies ++= Seq(
8690
"org.scala-js" %%% "scalajs-dom" % "1.1.0",
87-
"org.scalatest" %%% "scalatest" % scalaTestVersion % Test
91+
"org.scalatest" %%% "scalatest" % scalaTestVersion(scalaVersion.value) % Test
8892
)
8993
)
9094

@@ -93,107 +97,24 @@ val commonNativeSettings = commonSettings ++ Seq(
9397
ideSkipProject := true,
9498
libraryDependencies ++= Seq(
9599
"org.scala-native" %%% "test-interface" % scalaNativeTestInterfaceVersion,
96-
"org.scalatest" %%% "scalatest" % scalaTestVersion % Test
100+
"org.scalatest" %%% "scalatest" % scalaTestVersion(scalaVersion.value) % Test
97101
)
98102
)
99103

100-
lazy val downloadChromeDriver = taskKey[Unit]("Download chrome driver corresponding to installed google-chrome version")
101-
Global / downloadChromeDriver := {
102-
if (java.nio.file.Files.notExists(new File("target", "chromedriver").toPath)) {
103-
println("ChromeDriver binary file not found. Detecting google-chrome version...")
104-
import sys.process._
105-
val osName = sys.props("os.name")
106-
val isMac = osName.toLowerCase.contains("mac")
107-
val isWin = osName.toLowerCase.contains("win")
108-
val chromeVersionExecutable =
109-
if (isMac)
110-
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
111-
else "google-chrome"
112-
val chromeVersion = Seq(chromeVersionExecutable, "--version").!!.split(' ')(2)
113-
println(s"Detected google-chrome version: $chromeVersion")
114-
val withoutLastPart = chromeVersion.split('.').dropRight(1).mkString(".")
115-
println(s"Selected release: $withoutLastPart")
116-
val latestVersion =
117-
IO.readLinesURL(new URL(s"https://chromedriver.storage.googleapis.com/LATEST_RELEASE_$withoutLastPart")).mkString
118-
val platformDependentName = if (isMac) {
119-
"chromedriver_mac64.zip"
120-
} else if (isWin) {
121-
"chromedriver_win32.zip"
122-
} else {
123-
"chromedriver_linux64.zip"
124-
}
125-
println(s"Downloading chrome driver version $latestVersion for $osName")
126-
IO.unzipURL(
127-
new URL(s"https://chromedriver.storage.googleapis.com/$latestVersion/$platformDependentName"),
128-
new File("target")
129-
)
130-
IO.chmod("rwxrwxr-x", new File("target", "chromedriver"))
131-
} else {
132-
println("Detected chromedriver binary file, skipping downloading.")
133-
}
134-
}
135-
136-
// run JS tests inside Chrome, due to jsdom not supporting fetch
137-
val browserTestSettings = Seq(
138-
jsEnv in Test := {
139-
val debugging = false // set to true to help debugging
140-
System.setProperty("webdriver.chrome.driver", "target/chromedriver")
141-
new org.scalajs.jsenv.selenium.SeleniumJSEnv(
142-
{
143-
val options = new org.openqa.selenium.chrome.ChromeOptions()
144-
val args = Seq(
145-
"auto-open-devtools-for-tabs", // devtools needs to be open to capture network requests
146-
"no-sandbox",
147-
"allow-file-access-from-files" // change the origin header from 'null' to 'file'
148-
) ++ (if (debugging) Seq.empty else Seq("headless"))
149-
options.addArguments(args: _*)
150-
val capabilities = org.openqa.selenium.remote.DesiredCapabilities.chrome()
151-
capabilities.setCapability(org.openqa.selenium.chrome.ChromeOptions.CAPABILITY, options)
152-
capabilities
153-
},
154-
org.scalajs.jsenv.selenium.SeleniumJSEnv.Config().withKeepAlive(debugging)
155-
)
156-
},
157-
test in Test := (test in Test)
158-
.dependsOn(downloadChromeDriver in Global)
159-
.value
160-
)
161-
162104
lazy val projectAggregates: Seq[ProjectReference] = if (sys.env.isDefinedAt("STTP_NATIVE")) {
163105
println("[info] STTP_NATIVE defined, including sttp-native in the aggregate projects")
164106
core.projectRefs ++ ws.projectRefs ++ akka.projectRefs ++ fs2.projectRefs ++ monix.projectRefs ++ zio.projectRefs
165107
} else {
166108
println("[info] STTP_NATIVE *not* defined, *not* including sttp-native in the aggregate projects")
167-
List(
168-
core.jvm(scala2_11),
169-
core.jvm(scala2_12),
170-
core.jvm(scala2_13),
171-
core.jvm(scala3),
172-
core.js(scala2_11),
173-
core.js(scala2_12),
174-
core.js(scala2_13),
175-
ws.jvm(scala2_11),
176-
ws.jvm(scala2_12),
177-
ws.jvm(scala2_13),
178-
ws.jvm(scala3),
179-
ws.js(scala2_11),
180-
ws.js(scala2_12),
181-
ws.js(scala2_13),
182-
akka.jvm(scala2_12),
183-
akka.jvm(scala2_13),
184-
fs2.jvm(scala2_11),
185-
fs2.jvm(scala2_12),
186-
fs2.jvm(scala2_13),
187-
monix.jvm(scala2_11),
188-
monix.jvm(scala2_12),
189-
monix.jvm(scala2_13),
190-
monix.js(scala2_12),
191-
monix.js(scala2_13),
192-
zio.jvm(scala2_11),
193-
zio.jvm(scala2_12),
194-
zio.jvm(scala2_13),
195-
zio.jvm(scala3)
196-
)
109+
scala2.flatMap(v => List[ProjectReference](core.js(v), ws.js(v))) ++
110+
scala2.flatMap(v => List[ProjectReference](core.jvm(v), ws.jvm(v), fs2.jvm(v), monix.jvm(v))) ++
111+
scala3.flatMap(v => List[ProjectReference](core.jvm(v), ws.jvm(v), zio.jvm(v))) ++
112+
List[ProjectReference](
113+
akka.jvm(scala2_12),
114+
akka.jvm(scala2_13),
115+
monix.js(scala2_12),
116+
monix.js(scala2_13)
117+
)
197118
}
198119

199120
val compileAndTest = "compile->compile;test->test"
@@ -208,11 +129,11 @@ lazy val core = (projectMatrix in file("core"))
208129
name := "core"
209130
)
210131
.jvmPlatform(
211-
scalaVersions = List(scala2_11, scala2_12, scala2_13, scala3),
132+
scalaVersions = scala2 ++ scala3,
212133
settings = commonJvmSettings
213134
)
214135
.jsPlatform(
215-
scalaVersions = List(scala2_11, scala2_12, scala2_13),
136+
scalaVersions = scala2,
216137
settings = commonJsSettings ++ browserTestSettings
217138
)
218139
.nativePlatform(
@@ -226,11 +147,11 @@ lazy val ws = (projectMatrix in file("ws"))
226147
libraryDependencies += "com.softwaremill.sttp.model" %%% "core" % sttpModelVersion
227148
)
228149
.jvmPlatform(
229-
scalaVersions = List(scala2_11, scala2_12, scala2_13, scala3),
150+
scalaVersions = scala2 ++ scala3,
230151
settings = commonJvmSettings
231152
)
232153
.jsPlatform(
233-
scalaVersions = List(scala2_11, scala2_12, scala2_13),
154+
scalaVersions = scala2,
234155
settings = commonJsSettings ++ browserTestSettings
235156
)
236157
.nativePlatform(
@@ -259,7 +180,7 @@ lazy val fs2 = (projectMatrix in file("fs2"))
259180
)
260181
)
261182
.jvmPlatform(
262-
scalaVersions = List(scala2_11, scala2_12, scala2_13),
183+
scalaVersions = scala2,
263184
settings = commonJvmSettings
264185
)
265186
.dependsOn(core)
@@ -270,7 +191,7 @@ lazy val monix = (projectMatrix in file("monix"))
270191
libraryDependencies += "io.monix" %%% "monix" % "3.3.0"
271192
)
272193
.jvmPlatform(
273-
scalaVersions = List(scala2_11, scala2_12, scala2_13),
194+
scalaVersions = scala2,
274195
settings = commonJvmSettings
275196
)
276197
.jsPlatform(
@@ -285,7 +206,7 @@ lazy val zio = (projectMatrix in file("zio"))
285206
libraryDependencies ++= Seq("dev.zio" %% "zio-streams" % zioVersion, "dev.zio" %% "zio" % zioVersion)
286207
)
287208
.jvmPlatform(
288-
scalaVersions = List(scala2_11, scala2_12, scala2_13, scala3),
209+
scalaVersions = scala2 ++ List(dotty),
289210
settings = commonJvmSettings
290211
)
291212
.dependsOn(core)

project/plugins.sbt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.3.1")
33
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.0-M2")
44
addSbtPlugin("com.eed3si9n" % "sbt-projectmatrix" % "0.6.0")
55

6-
val sbtSoftwareMillVersion = "1.9.14"
6+
val sbtSoftwareMillVersion = "1.9.15-SNAPSHOT"
77
addSbtPlugin("com.softwaremill.sbt-softwaremill" % "sbt-softwaremill-common" % sbtSoftwareMillVersion)
88
addSbtPlugin("com.softwaremill.sbt-softwaremill" % "sbt-softwaremill-publish" % sbtSoftwareMillVersion)
9+
addSbtPlugin("com.softwaremill.sbt-softwaremill" % "sbt-softwaremill-browser-test-js" % sbtSoftwareMillVersion)
910

1011
addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.4.6")
1112

12-
addSbtPlugin("org.jetbrains" % "sbt-ide-settings" % "1.1.0")
13+
addSbtPlugin("org.jetbrains" % "sbt-ide-settings" % "1.1.0")

0 commit comments

Comments
 (0)