Skip to content

Commit ad7c202

Browse files
committed
Fix build issue for scala 3
1 parent 199b580 commit ad7c202

File tree

2 files changed

+33
-12
lines changed

2 files changed

+33
-12
lines changed

build.sbt

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ lazy val commonSettings = Seq(
22
organization := "com.whisk",
33
version := "0.13.0",
44
scalaVersion := "2.13.16",
5-
crossScalaVersions := Seq("2.13.16", "2.12.20", "3.0.2"),
5+
crossScalaVersions := Seq("2.13.16", "2.12.20", "3.7.0"),
66
scalacOptions ++= Seq("-feature", "-deprecation"),
77
Test / fork := true,
88
licenses += ("MIT", url("http://opensource.org/licenses/MIT")),
@@ -43,11 +43,19 @@ lazy val core =
4343
.settings(commonSettings: _*)
4444
.settings(
4545
name := "docker-testkit-core",
46-
libraryDependencies ++= Seq(
47-
"org.slf4j" % "slf4j-api" % "1.7.25",
48-
"org.mandas" % "docker-client" % "9.0.3",
49-
"com.google.code.findbugs" % "jsr305" % "3.0.1"
50-
)
46+
libraryDependencies ++= {
47+
val base = Seq(
48+
"org.slf4j" % "slf4j-api" % "1.7.25",
49+
"org.mandas" % "docker-client" % "9.0.3",
50+
"com.google.code.findbugs" % "jsr305" % "3.0.1"
51+
)
52+
CrossVersion.partialVersion(scalaVersion.value) match {
53+
case Some((3, _)) =>
54+
base :+ ("org.immutables" % "value" % "2.9.3" % Provided)
55+
case _ =>
56+
base
57+
}
58+
}
5159
)
5260

5361
lazy val scalatest =
@@ -87,10 +95,17 @@ lazy val coreShaded =
8795
.settings(commonSettings: _*)
8896
.settings(
8997
name := "docker-testkit-core-shaded",
90-
libraryDependencies ++=
91-
Seq(
98+
libraryDependencies ++= {
99+
val base = Seq(
92100
"org.mandas" % "docker-client" % "9.0.3",
93101
"com.google.code.findbugs" % "jsr305" % "3.0.1"
94-
),
102+
)
103+
CrossVersion.partialVersion(scalaVersion.value) match {
104+
case Some((3, _)) =>
105+
base :+ ("org.immutables" % "value" % "2.9.3" % Provided)
106+
case _ =>
107+
base
108+
}
109+
},
95110
target := baseDirectory.value / "target-shaded"
96111
)

core/src/main/scala/com/whisk/docker/testkit/ContainerCommandExecutor.scala

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package com.whisk.docker.testkit
33
import java.nio.charset.StandardCharsets
44
import java.util.concurrent.TimeUnit
55

6-
import org.mandas.docker.client.DockerClient.{AttachParameter, RemoveContainerParam}
6+
import org.mandas.docker.client.DockerClient.RemoveContainerParam
77
import org.mandas.docker.client.messages._
88
import org.mandas.docker.client.{DockerClient, LogMessage, LogStream}
99

@@ -57,8 +57,14 @@ class ContainerCommandExecutor(val client: DockerClient) {
5757
private def logStreamFuture(id: String, withErr: Boolean)(implicit
5858
ec: ExecutionContext
5959
): Future[LogStream] = {
60-
val baseParams = List(AttachParameter.STDOUT, AttachParameter.STREAM, AttachParameter.LOGS)
61-
val logParams = if (withErr) AttachParameter.STDERR :: baseParams else baseParams
60+
val baseParams = List(
61+
DockerClient.AttachParameter.STDOUT,
62+
DockerClient.AttachParameter.STREAM,
63+
DockerClient.AttachParameter.LOGS
64+
)
65+
val logParams =
66+
if (withErr) DockerClient.AttachParameter.STDERR :: baseParams
67+
else baseParams
6268
Future(scala.concurrent.blocking(client.attachContainer(id, logParams: _*)))
6369
}
6470

0 commit comments

Comments
 (0)