mirror of https://github.com/sbt/sbt.git
add a simpler version of snapshot-resolution
Ivy is able to check for SNAPSHOT across different resolvers. Coursier seems to be sticky about the resolver within the TTL (24h).
This commit is contained in:
parent
ca53934941
commit
464325ad1d
|
|
@ -0,0 +1,38 @@
|
|||
ThisBuild / organization := "com.example"
|
||||
ThisBuild / scalaVersion := "2.12.8"
|
||||
|
||||
def customIvyPaths: Seq[Def.Setting[_]] = Seq(
|
||||
ivyPaths := IvyPaths((baseDirectory in ThisBuild).value, Some((baseDirectory in ThisBuild).value / "ivy-cache"))
|
||||
)
|
||||
|
||||
lazy val sharedResolver: Resolver = {
|
||||
val r = Resolver.defaultShared
|
||||
r withConfiguration (r.configuration withIsLocal false)
|
||||
//MavenRepository("example-shared-repo", "file:///tmp/shared-maven-repo-bad-example")
|
||||
//Resolver.file("example-shared-repo", repoDir)(Resolver.defaultPatterns)
|
||||
}
|
||||
|
||||
lazy val common = project
|
||||
.settings(customIvyPaths)
|
||||
.settings(
|
||||
organization := "com.badexample",
|
||||
name := "badexample",
|
||||
version := "1.0-SNAPSHOT",
|
||||
publishTo := Some(sharedResolver),
|
||||
crossVersion := Disabled(),
|
||||
publishMavenStyle := (sharedResolver match {
|
||||
case repo: PatternsBasedRepository => repo.patterns.isMavenCompatible
|
||||
case _: RawRepository => false // TODO - look deeper
|
||||
case _: MavenRepository => true
|
||||
case _ => false // TODO - Handle chain repository?
|
||||
})
|
||||
)
|
||||
|
||||
lazy val dependent = project
|
||||
.settings(customIvyPaths)
|
||||
.settings(
|
||||
// Ignore the inter-project resolver, so we force to look remotely.
|
||||
resolvers += sharedResolver,
|
||||
fullResolvers := fullResolvers.value.filterNot(_==projectResolver.value),
|
||||
libraryDependencies += "com.badexample" % "badexample" % "1.0-SNAPSHOT"
|
||||
)
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
object Common {
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
object Common {
|
||||
def name = "common"
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
object Common {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
object User {
|
||||
println(Common.name)
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
# Ivy is able to check for SNAPSHOT across different resolvers
|
||||
# Coursier seems to be sticky about the resolver within the TTL
|
||||
|
||||
> show dependent/fullResolvers
|
||||
|
||||
# Validate that a bad dependency fails the compile
|
||||
$ copy-file changes/BadCommon.scala common/src/main/scala/Common.scala
|
||||
> common/publishLocal
|
||||
|
||||
# Force dep resolution to be successful, then compilation to fail
|
||||
> dependent/update
|
||||
-> dependent/compile
|
||||
|
||||
# Push new good change to the same repository.
|
||||
$ copy-file changes/GoodCommon.scala common/src/main/scala/Common.scala
|
||||
$ sleep 1000
|
||||
> common/publishLocal
|
||||
|
||||
# This should compile now because Coursier checks for local update
|
||||
> show dependent/update
|
||||
> dependent/compile
|
||||
|
|
@ -212,6 +212,7 @@ final class ScriptedTests(
|
|||
case "dependency-management/pom-parent-pom" => LauncherBased // tbd
|
||||
case "dependency-management/publish-to-maven-local-file" => LauncherBased // sbt/Package$
|
||||
case "dependency-management/snapshot-resolution" => LauncherBased // tbd
|
||||
case "dependency-management/snapshot-local" => LauncherBased // tbd
|
||||
case "dependency-management/test-artifact" => LauncherBased // sbt/Package$
|
||||
case "dependency-management/transitive-version-range" => LauncherBased // tbd
|
||||
case "dependency-management/update-sbt-classifiers" => LauncherBased // tbd
|
||||
|
|
|
|||
Loading…
Reference in New Issue