From 8c182110b4c69dd25ea421a9a53d77a15f7eba8e Mon Sep 17 00:00:00 2001 From: Wojciech Mazur Date: Wed, 3 Apr 2024 17:20:27 +0200 Subject: [PATCH 1/2] Set COURSIER_REPOSITORIES env variable when building with scala-cli, use fixed versions of toolkit and scala --- project-builder/scala-cli/build.scala | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/project-builder/scala-cli/build.scala b/project-builder/scala-cli/build.scala index b38ffecd..6eedc5b4 100644 --- a/project-builder/scala-cli/build.scala +++ b/project-builder/scala-cli/build.scala @@ -1,5 +1,5 @@ -//> using toolkit latest -//> using scala 3 +//> using toolkit 0.2.1 +//> using scala 3.3 //> using file ../shared/CommunityBuildCore.scala import Scala3CommunityBuild.* @@ -146,7 +146,9 @@ class CliTaskEvaluator(scalaVersion: String, repositoryDir: String, mavenRepoURL mavenRepoURL.map(s"--repository=" + _).toList, extraLibraryDependencies ) - .call(check = false, stdout = os.Inherit, stderr = os.Pipe) + .call(check = false, stdout = os.Inherit, stderr = os.Pipe, env = Map( + "COURSIER_REPOSITORIES" -> s"central|sonatype:releases|sonatype:snapshots|sonatype-s01:snapshots|snapshots|${mavenRepoURL.getOrElse("")}" + )) val result = proc.exitCode val tookMillis = (System.currentTimeMillis() - evalStart).toInt def nullT = null.asInstanceOf[T] From 7d0a5d6ff9a833b1c17f035965e3759eb07ff169 Mon Sep 17 00:00:00 2001 From: Wojciech Mazur Date: Wed, 3 Apr 2024 17:21:43 +0200 Subject: [PATCH 2/2] fix linting --- project-builder/scala-cli/build.scala | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/project-builder/scala-cli/build.scala b/project-builder/scala-cli/build.scala index 6eedc5b4..f891f732 100644 --- a/project-builder/scala-cli/build.scala +++ b/project-builder/scala-cli/build.scala @@ -107,7 +107,7 @@ import os.CommandResult case class CliCommand[T]( command: Seq[String], errHandler: (CommandResult, EvalResult.Failure) => EvalResult[T] -){ +) { override def toString(): String = s"${command.mkString(" ")}" } def cmd(args: String*) = CliCommand[Unit](args, (_, failure) => failure) @@ -127,9 +127,9 @@ class CliTaskEvaluator(scalaVersion: String, repositoryDir: String, mavenRepoURL } def eval[T](task: CliCommand[T]): EvalResult[T] = { - val extraLibraryDependencies = Utils.extraLibraryDependencies(scalaVersion).map{ - case Utils.LibraryDependency(org, artifact, version, scalaCrossVersion) => - if(scalaCrossVersion) s"--dependency=$org::$artifact:$version" + val extraLibraryDependencies = Utils.extraLibraryDependencies(scalaVersion).map { + case Utils.LibraryDependency(org, artifact, version, scalaCrossVersion) => + if (scalaCrossVersion) s"--dependency=$org::$artifact:$version" else s"--dependency=$org:$artifact:$version" } val evalStart = System.currentTimeMillis() @@ -146,9 +146,14 @@ class CliTaskEvaluator(scalaVersion: String, repositoryDir: String, mavenRepoURL mavenRepoURL.map(s"--repository=" + _).toList, extraLibraryDependencies ) - .call(check = false, stdout = os.Inherit, stderr = os.Pipe, env = Map( - "COURSIER_REPOSITORIES" -> s"central|sonatype:releases|sonatype:snapshots|sonatype-s01:snapshots|snapshots|${mavenRepoURL.getOrElse("")}" - )) + .call( + check = false, + stdout = os.Inherit, + stderr = os.Pipe, + env = Map( + "COURSIER_REPOSITORIES" -> s"central|sonatype:releases|${mavenRepoURL.getOrElse("")}" + ) + ) val result = proc.exitCode val tookMillis = (System.currentTimeMillis() - evalStart).toInt def nullT = null.asInstanceOf[T]