From 6956a1a27799701bc1f013be1da34ad1d79587b7 Mon Sep 17 00:00:00 2001 From: Georg Ofenbeck - taaofge1 Date: Sat, 4 May 2024 12:27:01 +0200 Subject: [PATCH] Reformat with scalafmt --- .../mill/contrib/docker/DockerModule.scala | 33 ++++++++++++------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/contrib/docker/src/mill/contrib/docker/DockerModule.scala b/contrib/docker/src/mill/contrib/docker/DockerModule.scala index cde659281bf..8e8038ed72b 100644 --- a/contrib/docker/src/mill/contrib/docker/DockerModule.scala +++ b/contrib/docker/src/mill/contrib/docker/DockerModule.scala @@ -85,12 +85,12 @@ trait DockerModule { outer: JavaModule => def user: T[String] = "" /** - * Optional platform parameter, if set uses buildkit to build for specified platform. - * - * See also the Docker docs on - * [[https://docs.docker.com/reference/cli/docker/buildx/build/#platform]] - * for more information. - */ + * Optional platform parameter, if set uses buildkit to build for specified platform. + * + * See also the Docker docs on + * [[https://docs.docker.com/reference/cli/docker/buildx/build/#platform]] + * for more information. + */ def platform: T[String] = "" /** @@ -164,14 +164,25 @@ trait DockerModule { outer: JavaModule => val (pull, _) = pullAndHash() val pullLatestBase = IterableShellable(if (pull) Some("--pull") else None) - val result = if (platform().isEmpty || executable() != "docker") { - if (platform().nonEmpty) log.info("Platform parameter is ignored when using non-docker executable") + if (!platform().isEmpty) + log.warn( + "Building for other platforms is currently only supported through buildx on docker" + ) os.proc(executable(), "build", tagArgs, pullLatestBase, dest) - .call(stdout = os.Inherit, stderr = os.Inherit) + .call(stdout = os.Inherit, stderr = os.Inherit) } else { - os.proc(executable(),"buildx", "build", tagArgs, pullLatestBase, "--platform", platform(), dest) - .call(stdout = os.Inherit, stderr = os.Inherit) + os.proc( + executable(), + "buildx", + "build", + tagArgs, + pullLatestBase, + "--platform", + platform(), + dest + ) + .call(stdout = os.Inherit, stderr = os.Inherit) } log.info(s"Docker build completed ${if (result.exitCode == 0) "successfully" else "unsuccessfully"} with ${result.exitCode}")