mirror of https://github.com/sbt/sbt.git
Minimizing scripted repro
This commit is contained in:
parent
899d5295c8
commit
15185d9004
|
|
@ -1,11 +1,15 @@
|
|||
def customIvyPaths: Seq[Def.Setting[_]] = Seq(
|
||||
ivyPaths := new IvyPaths((baseDirectory in ThisBuild).value, Some((baseDirectory in ThisBuild).value / "ivy-cache"))
|
||||
)
|
||||
|
||||
lazy val sharedResolver =
|
||||
Resolver.defaultShared.nonlocal()
|
||||
//MavenRepository("example-shared-repo", "file:///tmp/shared-maven-repo-bad-example")
|
||||
//Resolver.file("example-shared-repo", repoDir)(Resolver.defaultPatterns)
|
||||
|
||||
lazy val common = (
|
||||
project
|
||||
.settings(
|
||||
lazy val common = project.
|
||||
settings(customIvyPaths: _*).
|
||||
settings(
|
||||
organization := "com.badexample",
|
||||
name := "badexample",
|
||||
version := "1.0-SNAPSHOT",
|
||||
|
|
@ -22,33 +26,15 @@ lazy val common = (
|
|||
case _ => true
|
||||
})
|
||||
)
|
||||
)
|
||||
|
||||
lazy val dependent = (
|
||||
project
|
||||
.settings(
|
||||
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"
|
||||
)
|
||||
)
|
||||
|
||||
TaskKey[Unit]("cleanLocalCache") := {
|
||||
val ivyHome = file(sys.props.get("ivy.home") orElse sys.props.get("sbt.ivy.home") match {
|
||||
case Some(home) => home
|
||||
case None => s"${sys.props("user.home")}/.ivy2"
|
||||
})
|
||||
val ivyCache = ivyHome / "cache"
|
||||
val ivyShared = ivyHome / "shared"
|
||||
val ivyLocal = ivyHome / "local"
|
||||
def deleteDirContents(dir: String)(base: File): Unit = {
|
||||
val toDelete = base / dir
|
||||
streams.value.log.info(s"Deleting: ${toDelete.getAbsolutePath}")
|
||||
IO.delete(toDelete)
|
||||
}
|
||||
Seq(ivyCache, ivyShared, ivyLocal).map(deleteDirContents("com.badexample"))
|
||||
}
|
||||
|
||||
TaskKey[Unit]("dumpResolvers") := {
|
||||
streams.value.log.info(s" -- dependent/fullResolvers -- ")
|
||||
|
|
@ -1,6 +1,3 @@
|
|||
# First clean any previous test state
|
||||
> cleanLocalCache
|
||||
|
||||
# Validate that a bad dependency fails the compile
|
||||
$ copy-file changes/BadCommon.scala common/src/main/scala/Common.scala
|
||||
> common/publish
|
||||
|
|
@ -11,21 +8,10 @@ $ copy-file changes/BadCommon.scala common/src/main/scala/Common.scala
|
|||
|
||||
# Push new good change to a DIFFERENT repository.
|
||||
$ copy-file changes/GoodCommon.scala common/src/main/scala/Common.scala
|
||||
# Ensure timestamp change
|
||||
$ sleep 1000
|
||||
> common/publishLocal
|
||||
|
||||
# Force the update task to look for the new -SNAPSHOT.
|
||||
> dependent/update
|
||||
|
||||
|
||||
$ copy-file changes/BadCommon.scala common/src/main/scala/Common.scala
|
||||
> common/publish
|
||||
> dependent/update
|
||||
|
||||
|
||||
$ copy-file changes/GoodCommon.scala common/src/main/scala/Common.scala
|
||||
> common/publishLocal
|
||||
> dependent/update
|
||||
|
||||
|
||||
# This should compile now, because Ivy should look at each repository for the most up-to-date file.
|
||||
> dependent/compile
|
||||
Loading…
Reference in New Issue