mirror of https://github.com/sbt/sbt.git
User local resolver in scripted tests
This commit is contained in:
parent
cf9af290ee
commit
d1cf3f80f6
|
|
@ -1,4 +1,5 @@
|
|||
import sbt.internal.inc.classpath.ClasspathUtilities
|
||||
import xsbti.AppConfiguration
|
||||
|
||||
lazy val checkFull = taskKey[Unit]("")
|
||||
lazy val check = taskKey[Unit]("")
|
||||
|
|
@ -19,7 +20,8 @@ lazy val root = (project in file("."))
|
|||
.settings(
|
||||
ivyPaths := IvyPaths(baseDirectory.value, Some(target.value / "ivy-cache")),
|
||||
publishTo := Some(Resolver.file("Test Publish Repo", file("test-repo"))),
|
||||
resolvers += (baseDirectory { base => "Test Repo" at (base / "test-repo").toURI.toString }).value,
|
||||
scalaCompilerBridgeResolvers += userLocalFileResolver(appConfiguration.value),
|
||||
resolvers += baseDirectory { base => "Test Repo" at (base / "test-repo").toURI.toString }.value,
|
||||
moduleName := artifactID,
|
||||
projectID := (if (baseDirectory.value / "retrieve" exists) retrieveID else publishedID),
|
||||
artifact in (Compile, packageBin) := mainArtifact,
|
||||
|
|
@ -67,3 +69,9 @@ def checkTask(classpath: TaskKey[Classpath]) = Def.task {
|
|||
try { Class.forName("test.Test", false, loader); () }
|
||||
catch { case _: ClassNotFoundException | _: NoClassDefFoundError => sys.error(s"Dependency not retrieved properly: $deps, $cp") }
|
||||
}
|
||||
|
||||
// use the user local resolver to fetch the SNAPSHOT version of the compiler-bridge
|
||||
def userLocalFileResolver(appConfig: AppConfiguration): Resolver = {
|
||||
val ivyHome = appConfig.provider.scalaProvider.launcher.ivyHome
|
||||
Resolver.file("User Local", ivyHome / "local")(Resolver.defaultIvyPatterns)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
import xsbti.AppConfiguration
|
||||
|
||||
ThisBuild / scalaVersion := "2.12.12"
|
||||
|
||||
// TTL of Coursier is 24h
|
||||
|
|
@ -11,6 +13,7 @@ val b = project
|
|||
.settings(
|
||||
localCache,
|
||||
libraryDependencies += "org.example" %% "artifacta" % "1.0.0-SNAPSHOT" withSources() classifier("tests"),
|
||||
scalaCompilerBridgeResolvers += userLocalFileResolver(appConfiguration.value),
|
||||
externalResolvers := Vector(
|
||||
MavenCache("demo", ((baseDirectory in ThisBuild).value / "demo-repo")),
|
||||
DefaultMavenRepository
|
||||
|
|
@ -26,3 +29,9 @@ val a = project
|
|||
publishArtifact in (Test,packageBin) := true,
|
||||
publishTo := Some(MavenCache("demo", ((baseDirectory in ThisBuild).value / "demo-repo")))
|
||||
)
|
||||
|
||||
// use the user local resolver to fetch the SNAPSHOT version of the compiler-bridge
|
||||
def userLocalFileResolver(appConfig: AppConfiguration): Resolver = {
|
||||
val ivyHome = appConfig.provider.scalaProvider.launcher.ivyHome
|
||||
Resolver.file("User Local", ivyHome / "local")(Resolver.defaultIvyPatterns)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
import xsbti.AppConfiguration
|
||||
|
||||
ThisBuild / csrCacheDirectory := (ThisBuild / baseDirectory).value / "coursier-cache"
|
||||
|
||||
def commonSettings: Vector[Def.Setting[_]] =
|
||||
|
|
@ -5,6 +7,7 @@ def commonSettings: Vector[Def.Setting[_]] =
|
|||
organization := "com.example",
|
||||
ivyPaths := IvyPaths( (baseDirectory in ThisBuild).value, Some((baseDirectory in LocalRootProject).value / "ivy-cache")),
|
||||
dependencyCacheDirectory := (baseDirectory in LocalRootProject).value / "dependency",
|
||||
scalaCompilerBridgeResolvers += userLocalFileResolver(appConfiguration.value),
|
||||
resolvers += Resolver.file("buggy", (baseDirectory in LocalRootProject).value / "repo")(
|
||||
Patterns(
|
||||
ivyPatterns = Vector("[organization]/[module]/[revision]/ivy.xml"),
|
||||
|
|
@ -28,3 +31,9 @@ lazy val b = project dependsOn(a) settings(
|
|||
updateOptions := updateOptions.value.withCachedResolution(true), //comment this line to make ws compile
|
||||
libraryDependencies += "a" % "b" % "1.0.1" % "compile->runtime"
|
||||
)
|
||||
|
||||
// use the user local resolver to fetch the SNAPSHOT version of the compiler-bridge
|
||||
def userLocalFileResolver(appConfig: AppConfiguration): Resolver = {
|
||||
val ivyHome = appConfig.provider.scalaProvider.launcher.ivyHome
|
||||
Resolver.file("User Local", ivyHome / "local")(Resolver.defaultIvyPatterns)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
import xsbti.AppConfiguration
|
||||
// ThisBuild / useCoursier := false
|
||||
ThisBuild / organization := "com.example"
|
||||
ThisBuild / scalaVersion := "2.13.3"
|
||||
ThisBuild / versionScheme := Some("semver-spec")
|
||||
|
|
@ -7,6 +9,7 @@ def commonSettings: Seq[Def.Setting[_]] =
|
|||
Seq(
|
||||
fullResolvers := fullResolvers.value.filterNot(_.name == "inter-project"),
|
||||
publishTo := Some(MavenCache("local-maven", (LocalRootProject / target).value / "local-maven")),
|
||||
scalaCompilerBridgeResolvers += userLocalFileResolver(appConfiguration.value),
|
||||
resolvers += MavenCache("local-maven", (LocalRootProject / target).value / "local-maven"),
|
||||
)
|
||||
|
||||
|
|
@ -65,3 +68,8 @@ val use2 = project
|
|||
"org.typelevel" %% "cats-effect" % "3.0.0-M4",
|
||||
),
|
||||
)
|
||||
// use the user local resolver to fetch the SNAPSHOT version of the compiler-bridge
|
||||
def userLocalFileResolver(appConfig: AppConfiguration): Resolver = {
|
||||
val ivyHome = appConfig.provider.scalaProvider.launcher.ivyHome
|
||||
Resolver.file("User Local", ivyHome / "local")(Resolver.defaultIvyPatterns)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue