diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ffd630a74..186b9e3c7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,7 +28,7 @@ jobs: fetch-depth: 0 submodules: true - uses: coursier/cache-action@v6.3 - - uses: coursier/setup-action@v1 + - uses: coursier/setup-action@v1.2.1 with: jvm: 8 apps: sbt @@ -48,7 +48,7 @@ jobs: fetch-depth: 0 submodules: true - uses: coursier/cache-action@v6.3 - - uses: coursier/setup-action@v1 + - uses: coursier/setup-action@v1.2.1 with: jvm: 8 apps: sbt diff --git a/build.sbt b/build.sbt index 78d50a86e..a9ce2bfa6 100644 --- a/build.sbt +++ b/build.sbt @@ -66,6 +66,10 @@ lazy val definitions = project dontPublish, ) +// FIXME Ideally, we should depend on the same version of io.get-coursier.jniutils:windows-jni-utils that +// io.get-coursier::coursier depends on. +val jniUtilsVersion = "0.3.3" + lazy val `lm-coursier` = project .in(file("modules/lm-coursier")) .settings( @@ -75,6 +79,7 @@ lazy val `lm-coursier` = project Mima.lmCoursierFilters, libraryDependencies ++= Seq( "io.get-coursier" %% "coursier" % coursierVersion0, + "io.get-coursier.jniutils" % "windows-jni-utils-lmcoursier" % jniUtilsVersion, "net.hamnaberg" %% "dataclass-annotation" % dataclassScalafixV % Provided, // We depend on librarymanagement-ivy rather than just // librarymanagement-core to handle the ModuleDescriptor passed @@ -106,7 +111,10 @@ lazy val `lm-coursier-shaded` = project Mima.lmCoursierFilters, Mima.lmCoursierShadedFilters, Compile / sources := (`lm-coursier` / Compile / sources).value, - shadedModules += "io.get-coursier" %% "coursier", + shadedModules ++= Set( + "io.get-coursier" %% "coursier", + "io.get-coursier.jniutils" % "windows-jni-utils-lmcoursier" + ), validNamespaces += "lmcoursier", validEntries ++= Set( // FIXME Ideally, we should just strip those from the resulting JAR… @@ -139,6 +147,7 @@ lazy val `lm-coursier-shaded` = project }, libraryDependencies ++= Seq( "io.get-coursier" %% "coursier" % coursierVersion0, + "io.get-coursier.jniutils" % "windows-jni-utils-lmcoursier" % jniUtilsVersion, "net.hamnaberg" %% "dataclass-annotation" % dataclassScalafixV % Provided, "org.scala-lang.modules" %% "scala-collection-compat" % "2.8.1", "org.scala-lang.modules" %% "scala-xml" % "1.3.0", // depending on that one so that it doesn't get shaded diff --git a/scripts/ci.sh b/scripts/ci.sh index 218e87dce..c0849d995 100755 --- a/scripts/ci.sh +++ b/scripts/ci.sh @@ -1,6 +1,15 @@ #!/usr/bin/env bash set -euvx +# Force the use of coursier JNI stuff on Windows, which ought to work fine. +# JNI stuff is used to compute the default cache location on Windows (to get the AppData local +# dir, or something like this, via native Windows APIs). +# Without this, if ever coursier fails to load its JNI library on Windows, it falls back +# to using some powershell scripts (via dirs-dev/directories-jvm), which are often a problem, +# see sbt/sbt#5206. +# Enable this once sbt uses the upcoming lm-coursier-shaded version (> 2.0.10-1) +# export COURSIER_JNI="force" + if [ "$(expr substr $(uname -s) 1 5 2>/dev/null)" == "Linux" ]; then SBT="sbt" elif [ "$(uname)" == "Darwin" ]; then