Delay the initialization of Coursier cache

This attempts to delay the initialization of Coursier cache, such that it will not trigger Coursier directory related code if `ThisBuild / useCoursier` or `-Dsbt.coursier` is set to `false`.
This commit is contained in:
Eugene Yokota 2020-08-11 02:12:37 -04:00
parent b111704620
commit c8b9283a74
50 changed files with 176 additions and 79 deletions

View File

@ -193,59 +193,6 @@ object Defaults extends BuildCommon {
},
extraIncOptions :== Seq("JAVA_CLASS_VERSION" -> sys.props("java.class.version")),
allowMachinePath :== true,
rootPaths := {
val app = appConfiguration.value
val base = app.baseDirectory.getCanonicalFile
val boot = app.provider.scalaProvider.launcher.bootDirectory
val ih = app.provider.scalaProvider.launcher.ivyHome
val coursierCache = csrCacheDirectory.value
val javaHome = Paths.get(sys.props("java.home"))
Map(
"BASE" -> base.toPath,
"SBT_BOOT" -> boot.toPath,
"CSR_CACHE" -> coursierCache.toPath,
"IVY_HOME" -> ih.toPath,
"JAVA_HOME" -> javaHome,
)
},
fileConverter := MappedFileConverter(rootPaths.value, allowMachinePath.value),
fullServerHandlers := {
Seq(
LanguageServerProtocol.handler(fileConverter.value),
BuildServerProtocol
.handler(sbtVersion.value, semanticdbEnabled.value, semanticdbVersion.value),
VirtualTerminal.handler,
) ++ serverHandlers.value :+ ServerHandler.fallback
},
timeWrappedStamper := Stamps
.timeWrapBinaryStamps(Stamps.uncachedStamps(fileConverter.value), fileConverter.value),
reusableStamper := {
val converter = fileConverter.value
val unmanagedCache = unmanagedFileStampCache.value
val managedCache = managedFileStampCache.value
val backing = timeWrappedStamper.value
new xsbti.compile.analysis.ReadStamps {
def getAllLibraryStamps()
: java.util.Map[xsbti.VirtualFileRef, xsbti.compile.analysis.Stamp] =
backing.getAllLibraryStamps()
def getAllProductStamps()
: java.util.Map[xsbti.VirtualFileRef, xsbti.compile.analysis.Stamp] =
backing.getAllProductStamps()
def getAllSourceStamps()
: java.util.Map[xsbti.VirtualFileRef, xsbti.compile.analysis.Stamp] =
new java.util.HashMap[xsbti.VirtualFileRef, xsbti.compile.analysis.Stamp]
def library(fr: xsbti.VirtualFileRef): xsbti.compile.analysis.Stamp = backing.library(fr)
def product(fr: xsbti.VirtualFileRef): xsbti.compile.analysis.Stamp = backing.product(fr)
def source(fr: xsbti.VirtualFile): xsbti.compile.analysis.Stamp = {
val path = converter.toPath(fr)
unmanagedCache
.get(path)
.orElse(managedCache.getOrElseUpdate(path, sbt.nio.FileStamper.Hash))
.map(_.stamp)
.getOrElse(backing.source(fr))
}
}
},
traceLevel in run :== 0,
traceLevel in runMain :== 0,
traceLevel in bgRun :== 0,
@ -323,7 +270,6 @@ object Defaults extends BuildCommon {
// coursier settings
csrExtraCredentials :== Nil,
csrLogger := LMCoursier.coursierLoggerTask.value,
csrCacheDirectory :== LMCoursier.defaultCacheLocation,
csrMavenProfiles :== Set.empty,
csrReconciliations :== LMCoursier.relaxedForAllModules,
)
@ -450,6 +396,70 @@ object Defaults extends BuildCommon {
++ RemoteCache.globalSettings
)
private[sbt] lazy val buildLevelJvmSettings: Seq[Setting[_]] = Seq(
rootPaths := {
val app = appConfiguration.value
val base = app.baseDirectory.getCanonicalFile
val boot = app.provider.scalaProvider.launcher.bootDirectory
val ih = app.provider.scalaProvider.launcher.ivyHome
val coursierCache = csrCacheDirectory.value
val javaHome = Paths.get(sys.props("java.home"))
Map(
"BASE" -> base.toPath,
"SBT_BOOT" -> boot.toPath,
"CSR_CACHE" -> coursierCache.toPath,
"IVY_HOME" -> ih.toPath,
"JAVA_HOME" -> javaHome,
)
},
fileConverter := MappedFileConverter(rootPaths.value, allowMachinePath.value),
fullServerHandlers := {
Seq(
LanguageServerProtocol.handler(fileConverter.value),
BuildServerProtocol
.handler(sbtVersion.value, semanticdbEnabled.value, semanticdbVersion.value),
VirtualTerminal.handler,
) ++ serverHandlers.value :+ ServerHandler.fallback
},
timeWrappedStamper := Stamps
.timeWrapBinaryStamps(Stamps.uncachedStamps(fileConverter.value), fileConverter.value),
reusableStamper := {
val converter = fileConverter.value
val unmanagedCache = unmanagedFileStampCache.value
val managedCache = managedFileStampCache.value
val backing = timeWrappedStamper.value
new xsbti.compile.analysis.ReadStamps {
def getAllLibraryStamps()
: java.util.Map[xsbti.VirtualFileRef, xsbti.compile.analysis.Stamp] =
backing.getAllLibraryStamps()
def getAllProductStamps()
: java.util.Map[xsbti.VirtualFileRef, xsbti.compile.analysis.Stamp] =
backing.getAllProductStamps()
def getAllSourceStamps()
: java.util.Map[xsbti.VirtualFileRef, xsbti.compile.analysis.Stamp] =
new java.util.HashMap[xsbti.VirtualFileRef, xsbti.compile.analysis.Stamp]
def library(fr: xsbti.VirtualFileRef): xsbti.compile.analysis.Stamp = backing.library(fr)
def product(fr: xsbti.VirtualFileRef): xsbti.compile.analysis.Stamp = backing.product(fr)
def source(fr: xsbti.VirtualFile): xsbti.compile.analysis.Stamp = {
val path = converter.toPath(fr)
unmanagedCache
.get(path)
.orElse(managedCache.getOrElseUpdate(path, sbt.nio.FileStamper.Hash))
.map(_.stamp)
.getOrElse(backing.source(fr))
}
}
},
)
// csrCacheDirectory is scoped to ThisBuild to allow customization.
private[sbt] lazy val buildLevelIvySettings: Seq[Setting[_]] = Seq(
csrCacheDirectory := {
if (useCoursier.value) LMCoursier.defaultCacheLocation
else Classpaths.dummyCoursierDirectory(appConfiguration.value)
},
)
def defaultTestTasks(key: Scoped): Seq[Setting[_]] =
inTask(key)(
Seq(
@ -2618,15 +2628,19 @@ object Classpaths {
ivyPaths := IvyPaths(baseDirectory.value, bootIvyHome(appConfiguration.value)),
csrCacheDirectory := {
val old = csrCacheDirectory.value
val ac = appConfiguration.value
val ip = ivyPaths.value
val defaultIvyCache = bootIvyHome(appConfiguration.value)
if (old != LMCoursier.defaultCacheLocation) old
else if (ip.ivyHome == defaultIvyCache) old
else
ip.ivyHome match {
case Some(home) => home / "coursier-cache"
case _ => old
}
// if ivyPaths is customized, create coursier-cache directory in it
if (useCoursier.value) {
val defaultIvyCache = bootIvyHome(ac)
if (old != LMCoursier.defaultCacheLocation) old
else if (ip.ivyHome == defaultIvyCache) old
else
ip.ivyHome match {
case Some(home) => home / "coursier-cache"
case _ => old
}
} else Classpaths.dummyCoursierDirectory(ac)
},
dependencyCacheDirectory := {
val st = state.value
@ -3747,6 +3761,12 @@ object Classpaths {
case _: NoSuchMethodError => None
}
// This is a place holder in case someone doesn't want to use Coursier
private[sbt] def dummyCoursierDirectory(app: xsbti.AppConfiguration): File = {
val base = app.baseDirectory.getCanonicalFile
base / "target" / "coursier-temp"
}
private[this] def mavenCompatible(ivyRepo: xsbti.IvyRepository): Boolean =
try {
ivyRepo.mavenCompatible

View File

@ -521,7 +521,7 @@ object Project extends ProjectExtra {
val authentication: Option[Set[ServerAuthentication]] = get(serverAuthentication)
val connectionType: Option[ConnectionType] = get(serverConnectionType)
val srvLogLevel: Option[Level.Value] = (logLevel in (ref, serverLog)).get(structure.data)
val hs: Option[Seq[ServerHandler]] = get(fullServerHandlers)
val hs: Option[Seq[ServerHandler]] = get(fullServerHandlers in ThisBuild)
val commandDefs = allCommands.distinct.flatten[Command].map(_ tag (projectCommand, true))
val newDefinedCommands = commandDefs ++ BasicCommands.removeTagged(
s.definedCommands,

View File

@ -26,8 +26,11 @@ object IvyPlugin extends AutoPlugin {
override def requires = CorePlugin
override def trigger = allRequirements
override lazy val projectSettings: Seq[Setting[_]] =
Classpaths.ivyPublishSettings ++ Classpaths.ivyBaseSettings
override lazy val globalSettings: Seq[Setting[_]] =
Defaults.globalIvyCore
override lazy val buildSettings: Seq[Setting[_]] =
Defaults.buildLevelIvySettings
override lazy val projectSettings: Seq[Setting[_]] =
Classpaths.ivyPublishSettings ++ Classpaths.ivyBaseSettings
}

View File

@ -30,6 +30,12 @@ object JvmPlugin extends AutoPlugin {
override def requires = IvyPlugin
override def trigger = allRequirements
override lazy val globalSettings: Seq[Setting[_]] =
Defaults.globalJvmCore
override lazy val buildSettings: Seq[Setting[_]] =
Defaults.buildLevelJvmSettings
override lazy val projectSettings: Seq[Setting[_]] =
Defaults.runnerSettings ++
Defaults.paths ++
@ -38,8 +44,6 @@ object JvmPlugin extends AutoPlugin {
Defaults.baseTasks ++
Defaults.compileBase ++
Defaults.defaultConfigs
override lazy val globalSettings: Seq[Setting[_]] =
Defaults.globalJvmCore
override def projectConfigurations: Seq[Configuration] =
Configurations.default

View File

@ -9,6 +9,7 @@ ThisBuild / scalaVersion := "2.12.11"
ThisBuild / version := "0.1.0-SNAPSHOT"
ThisBuild / organization := "com.example"
ThisBuild / organizationName := "example"
ThisBuild / csrCacheDirectory := (ThisBuild / baseDirectory).value / "coursier-cache"
lazy val Dev = config("dev").extend(Compile)
.describedAs("Dependencies required for development environments")

View File

@ -2,6 +2,7 @@ ThisBuild / scalaVersion := "2.12.11"
// TTL of Coursier is 24h
ThisBuild / useCoursier := false
ThisBuild / csrCacheDirectory := (ThisBuild / baseDirectory).value / "coursier-cache"
def localCache =
ivyPaths := IvyPaths(baseDirectory.value, Some((baseDirectory in ThisBuild).value / "ivy" / "cache"))

View File

@ -1 +1,2 @@
ThisBuild / csrCacheDirectory := (ThisBuild / baseDirectory).value / "coursier-cache"
ivyPaths := { IvyPaths(baseDirectory.value, Some(target.value / ".ivy2")) }

View File

@ -1,7 +1,8 @@
ivyPaths in ThisBuild := {
val base = (baseDirectory in ThisBuild).value
ThisBuild / csrCacheDirectory := (ThisBuild / baseDirectory).value / "coursier-cache"
ThisBuild / ivyPaths := {
val base = (ThisBuild / baseDirectory).value
IvyPaths(base, Some(base / "ivy-cache"))
}
managedScalaInstance in ThisBuild := false
autoScalaLibrary in ThisBuild := false
crossPaths in ThisBuild := false
ThisBuild / managedScalaInstance := false
ThisBuild / autoScalaLibrary := false
ThisBuild / crossPaths := false

View File

@ -1,5 +1,6 @@
scalaVersion in ThisBuild := "2.10.4"
dependencyOverrides in ThisBuild += "com.github.nscala-time" %% "nscala-time" % "1.0.0"
ThisBuild / scalaVersion := "2.10.4"
ThisBuild / dependencyOverrides += "com.github.nscala-time" %% "nscala-time" % "1.0.0"
ThisBuild / csrCacheDirectory := (ThisBuild / baseDirectory).value / "coursier-cache"
lazy val root = (project in file("."))
.dependsOn(p1 % Compile)

View File

@ -6,6 +6,8 @@ val summingbirdVersion = "0.4.0"
val luceneVersion = "4.0.0"
val akkaVersion = "2.3.1"
ThisBuild / csrCacheDirectory := (ThisBuild / baseDirectory).value / "coursier-cache"
def commonSettings: Seq[Def.Setting[_]] =
Seq(
ivyPaths := IvyPaths( (baseDirectory in ThisBuild).value, Some((target in LocalRootProject).value / "ivy-cache")),

View File

@ -6,6 +6,8 @@ val summingbirdVersion = "0.4.0"
val luceneVersion = "4.0.0"
val akkaVersion = "2.3.1"
ThisBuild / csrCacheDirectory := (ThisBuild / baseDirectory).value / "coursier-cache"
def commonSettings: Seq[Def.Setting[_]] =
Seq(
ivyPaths := IvyPaths( (baseDirectory in ThisBuild).value, Some((target in LocalRootProject).value / "ivy-cache")),

View File

@ -2,6 +2,8 @@ ThisBuild / useCoursier := false
lazy val check = taskKey[Unit]("Runs the check")
ThisBuild / csrCacheDirectory := (ThisBuild / baseDirectory).value / "coursier-cache"
def commonSettings: Seq[Def.Setting[_]] =
Seq(
ivyPaths := IvyPaths( (baseDirectory in ThisBuild).value, Some((baseDirectory in LocalRootProject).value / "ivy-cache")),

View File

@ -1,3 +1,5 @@
ThisBuild / csrCacheDirectory := (ThisBuild / baseDirectory).value / "coursier-cache"
def commonSettings: Vector[Def.Setting[_]] =
Vector(
organization := "com.example",

View File

@ -1,6 +1,8 @@
// https://github.com/sbt/sbt/issues/1710
// https://github.com/sbt/sbt/issues/1760
ThisBuild / csrCacheDirectory := (ThisBuild / baseDirectory).value / "coursier-cache"
inThisBuild(Seq(
organization := "com.example",
version := "0.1.0",

View File

@ -2,6 +2,7 @@
lazy val check = taskKey[Unit]("Runs the check")
ThisBuild / useCoursier := false
ThisBuild / csrCacheDirectory := (ThisBuild / baseDirectory).value / "coursier-cache"
def commonSettings: Seq[Def.Setting[_]] =
Seq(

View File

@ -1,5 +1,7 @@
lazy val check = taskKey[Unit]("Runs the check")
ThisBuild / csrCacheDirectory := (ThisBuild / baseDirectory).value / "coursier-cache"
def commonSettings: Seq[Def.Setting[_]] =
Seq(
ivyPaths := IvyPaths( (baseDirectory in ThisBuild).value, Some((baseDirectory in LocalRootProject).value / "ivy-cache")),

View File

@ -4,6 +4,7 @@ val scalatest = "org.scalatest" %% "scalatest" % "3.0.5"
val junit = "junit" % "junit" % "4.11"
ThisBuild / scalaVersion := "2.12.11"
ThisBuild / csrCacheDirectory := (ThisBuild / baseDirectory).value / "coursier-cache"
def commonSettings: Seq[Def.Setting[_]] =
Seq(

View File

@ -1,5 +1,7 @@
lazy val check = taskKey[Unit]("Runs the check")
ThisBuild / csrCacheDirectory := (ThisBuild / baseDirectory).value / "coursier-cache"
def commonSettings: Seq[Def.Setting[_]] =
Seq(
ivyPaths := IvyPaths( (baseDirectory in ThisBuild).value, Some((baseDirectory in LocalRootProject).value / "ivy-cache")),

View File

@ -1,5 +1,7 @@
lazy val check = taskKey[Unit]("Runs the check")
ThisBuild / csrCacheDirectory := (ThisBuild / baseDirectory).value / "coursier-cache"
def commonSettings: Seq[Def.Setting[_]] =
Seq(
ivyPaths := IvyPaths( (baseDirectory in ThisBuild).value, Some((target in LocalRootProject).value / "ivy-cache")),

View File

@ -1,4 +1,5 @@
ThisBuild / useCoursier := false
ThisBuild / csrCacheDirectory := (ThisBuild / baseDirectory).value / "coursier-cache"
lazy val check = taskKey[Unit]("Runs the check")

View File

@ -1,5 +1,7 @@
lazy val check = taskKey[Unit]("Runs the check")
ThisBuild / csrCacheDirectory := (ThisBuild / baseDirectory).value / "coursier-cache"
def commonSettings: Seq[Def.Setting[_]] =
Seq(
ivyPaths := IvyPaths( (baseDirectory in ThisBuild).value, Some((target in LocalRootProject).value / "ivy-cache")),

View File

@ -1,3 +1,4 @@
ivyPaths := IvyPaths(baseDirectory.value, Some(target.value / "ivy-cache"))
ThisBuild / csrCacheDirectory := (ThisBuild / baseDirectory).value / "coursier-cache"
libraryDependencies += "org.testng" % "testng" % "5.7" classifier "jdk15"

View File

@ -1,4 +1,5 @@
ThisBuild / scalaVersion := "2.13.0"
ThisBuild / csrCacheDirectory := (ThisBuild / baseDirectory).value / "coursier-cache"
ivyPaths := IvyPaths(baseDirectory.value, Some(target.value / "ivy-cache"))
// don't blow up when credential file doesn't exist

View File

@ -1,3 +1,7 @@
ThisBuild / csrCacheDirectory := (ThisBuild / baseDirectory).value / "coursier-cache"
ThisBuild / organization := "org.example"
ThisBuild / version := "1.0"
lazy val a = project.settings(common: _*).settings(
// verifies that a can be published as an ivy.xml file and preserve the extra artifact information,
// such as a classifier
@ -10,10 +14,6 @@ lazy val b = project.settings(common: _*).settings(
libraryDependencies := Seq(organization.value %% "a" % version.value)
)
organization in ThisBuild := "org.example"
version in ThisBuild := "1.0"
lazy val common = Seq(
autoScalaLibrary := false, // avoid downloading fresh scala-library/scala-compiler
managedScalaInstance := false,

View File

@ -2,6 +2,7 @@
ThisBuild / organization := "com.example"
ThisBuild / scalaVersion := "2.12.11"
ThisBuild / versionScheme := Some("semver-spec")
ThisBuild / csrCacheDirectory := (ThisBuild / baseDirectory).value / "coursier-cache"
def commonSettings: Seq[Def.Setting[_]] =
Seq(
@ -9,7 +10,6 @@ def commonSettings: Seq[Def.Setting[_]] =
(ThisBuild / baseDirectory).value,
Some((LocalRootProject / target).value / "ivy-cache")
),
csrCacheDirectory := (LocalRootProject / target).value / "cache",
fullResolvers := fullResolvers.value.filterNot(_.name == "inter-project"),
publishTo := Some(MavenCache("local-maven", (LocalRootProject / target).value / "local-maven")),
resolvers += MavenCache("local-maven", (LocalRootProject / target).value / "local-maven"),

View File

@ -1,3 +1,5 @@
ThisBuild / csrCacheDirectory := (ThisBuild / baseDirectory).value / "coursier-cache"
lazy val root = (project in file(".")).
settings(
ivyPaths := IvyPaths(baseDirectory.value, Some(target.value / "ivy-cache")),

View File

@ -14,6 +14,7 @@ $ touch transitive
# load the project definition with transitive dependencies disabled
# and check that they are not downloaded
$ delete coursier-cache
$ delete ivy-cache
$ delete transitive
> reload

View File

@ -1,3 +1,5 @@
ThisBuild / csrCacheDirectory := (ThisBuild / baseDirectory).value / "coursier-cache"
lazy val root = (project in file("."))
.settings(
organization := "com.example",

View File

@ -1,4 +1,5 @@
ThisBuild / useCoursier := false
ThisBuild / csrCacheDirectory := (ThisBuild / baseDirectory).value / "coursier-cache"
lazy val root = (project in file("."))
.settings(

View File

@ -1,3 +1,5 @@
ThisBuild / csrCacheDirectory := (ThisBuild / baseDirectory).value / "coursier-cache"
lazy val root = (project in file(".")).
settings(
ivyPaths := IvyPaths(baseDirectory.value, Some(target.value / "ivy-cache")),

View File

@ -1,4 +1,5 @@
ThisBuild / useCoursier := false
ThisBuild / csrCacheDirectory := (ThisBuild / baseDirectory).value / "coursier-cache"
import scala.xml._

View File

@ -1,3 +1,5 @@
ThisBuild / csrCacheDirectory := (ThisBuild / baseDirectory).value / "coursier-cache"
libraryDependencies += "org.scalacheck" % "scalacheck" % "1.5"
ivyPaths := baseDirectory( dir => IvyPaths(dir, Some(dir / "ivy-home"))).value

View File

@ -1,3 +1,5 @@
ThisBuild / csrCacheDirectory := (ThisBuild / baseDirectory).value / "coursier-cache"
ivyPaths := IvyPaths(baseDirectory.value, Some(target.value / ".ivy2"))
// not in the default repositories

View File

@ -1,3 +1,5 @@
ThisBuild / csrCacheDirectory := (ThisBuild / baseDirectory).value / "coursier-cache"
ivyScala ~= { (is: Option[IvyScala]) => is.map(_.copy(checkExplicit = false, overrideScalaVersion = false, filterImplicit = false)) }
ivyPaths := baseDirectory( dir => IvyPaths(dir, Some(dir / "ivy-home"))).value

View File

@ -1,3 +1,5 @@
ThisBuild / csrCacheDirectory := (ThisBuild / baseDirectory).value / "coursier-cache"
def commonSettings: Seq[Def.Setting[_]] =
Seq(
ivyPaths := IvyPaths( (baseDirectory in ThisBuild).value, Some((baseDirectory in LocalRootProject).value / "ivy-cache")),

View File

@ -1,3 +1,5 @@
ThisBuild / csrCacheDirectory := (ThisBuild / baseDirectory).value / "coursier-cache"
ivyPaths := IvyPaths(baseDirectory.value, Some(target.value / "ivy-cache"))
organization := "org.example"

View File

@ -1,3 +1,5 @@
ThisBuild / csrCacheDirectory := (ThisBuild / baseDirectory).value / "coursier-cache"
autoScalaLibrary := false
ivyPaths := IvyPaths(baseDirectory.value, Some(target.value / "ivy-cache"))

View File

@ -1,5 +1,7 @@
import complete.DefaultParsers._
ThisBuild / csrCacheDirectory := (ThisBuild / baseDirectory).value / "coursier-cache"
lazy val root = (project in file(".")).
settings(
resolvers ++= Seq(local, Resolver.sonatypeRepo("releases"), Resolver.sonatypeRepo("snapshots")),

View File

@ -1,4 +1,5 @@
ThisBuild / useCoursier := false
ThisBuild / csrCacheDirectory := (ThisBuild / baseDirectory).value / "coursier-cache"
val checkIvyXml = taskKey[Unit]("Checks the ivy.xml transform was correct")

View File

@ -1,3 +1,5 @@
ThisBuild / csrCacheDirectory := (ThisBuild / baseDirectory).value / "coursier-cache"
lazy val root = (project in file(".")).
dependsOn(sub).
aggregate(sub).

View File

@ -1,3 +1,5 @@
ThisBuild / csrCacheDirectory := (ThisBuild / baseDirectory).value / "coursier-cache"
lazy val root = (project in file(".")).
settings(inThisBuild(List(
organization := "A",

View File

@ -1,5 +1,6 @@
ThisBuild / organization := "com.example"
ThisBuild / scalaVersion := "2.12.11"
ThisBuild / csrCacheDirectory := (ThisBuild / baseDirectory).value / "coursier-cache"
def customIvyPaths: Seq[Def.Setting[_]] = Seq(
ivyPaths := IvyPaths((baseDirectory in ThisBuild).value, Some((baseDirectory in ThisBuild).value / "ivy-cache"))

View File

@ -3,6 +3,7 @@ ThisBuild / scalaVersion := "2.12.11"
// TTL is 24h so we can't detect the change
ThisBuild / useCoursier := false
ThisBuild / csrCacheDirectory := (ThisBuild / baseDirectory).value / "coursier-cache"
def customIvyPaths: Seq[Def.Setting[_]] = Seq(
ivyPaths := IvyPaths((baseDirectory in ThisBuild).value, Some((baseDirectory in ThisBuild).value / "ivy-cache"))

View File

@ -1,3 +1,5 @@
ThisBuild / csrCacheDirectory := (ThisBuild / baseDirectory).value / "coursier-cache"
autoScalaLibrary := false
ivyPaths := IvyPaths(baseDirectory.value, Some(target.value / "ivy-cache"))

View File

@ -1,4 +1,5 @@
ThisBuild / useCoursier := false
ThisBuild / csrCacheDirectory := (ThisBuild / baseDirectory).value / "coursier-cache"
ivyPaths := {
val base = baseDirectory.value

View File

@ -1,5 +1,7 @@
import sbt.internal.inc.classpath.ClasspathUtilities
ThisBuild / csrCacheDirectory := (ThisBuild / baseDirectory).value / "coursier-cache"
lazy val root = (project in file(".")).
settings(
ivyPaths := IvyPaths(baseDirectory.value, Some(target.value / "ivy-cache")),

View File

@ -1,6 +1,8 @@
def ivyHome = Def.setting((target in LocalRootProject).value / "ivy")
def localRepo = Def.setting((target in LocalRootProject).value / "local-repo")
ThisBuild / csrCacheDirectory := (ThisBuild / baseDirectory).value / "coursier-cache"
val commonSettings = Seq[Def.Setting[_]](
organization := "org.example",
version := "1.0-SNAPSHOT",

View File

@ -1,3 +1,5 @@
ThisBuild / csrCacheDirectory := (ThisBuild / baseDirectory).value / "coursier-cache"
val commonSettings = Seq(
organization := "com.example",
version := "0.1.0",

View File

@ -1,3 +1,5 @@
ThisBuild / csrCacheDirectory := (ThisBuild / baseDirectory).value / "coursier-cache"
organization := "com.example"
version := "0.1.0"
ivyPaths := IvyPaths((baseDirectory in LocalRootProject).value, Some((target in LocalRootProject).value / "ivy-cache"))

View File

@ -1,4 +1,5 @@
ThisBuild / organization := "org.example"
ThisBuild / csrCacheDirectory := (ThisBuild / baseDirectory).value / "coursier-cache"
lazy val root = (project in file("."))
.settings(