Reproduce potential scenario that could be happening with #321

The basic mechanism is the same as #1514, which is short circuiting
issue.
For maven there’s the second problem of the availability of the
publication date.
This commit is contained in:
Eugene Yokota 2014-12-19 00:56:13 -05:00 committed by Josh Suereth
parent 1952e25c41
commit acf54b62a5
2 changed files with 35 additions and 24 deletions

View File

@ -1,28 +1,38 @@
organization in ThisBuild := "org.example"
def commonSettings: Seq[Def.Setting[_]] =
Seq(
ivyPaths := new IvyPaths( (baseDirectory in ThisBuild).value, Some((baseDirectory in LocalRootProject).value / "ivy-cache")),
dependencyCacheDirectory := (baseDirectory in LocalRootProject).value / "dependency",
scalaVersion := "2.10.4",
organization in ThisBuild := "org.example",
version in ThisBuild := "1.0-SNAPSHOT"
)
version in ThisBuild := "1.0-SNAPSHOT"
lazy val main = project.
settings(commonSettings: _*).
settings(
uniqueName,
libraryDependencies += (projectID in library).value,
fullResolvers := fullResolvers.value.filterNot(_.name == "inter-project")
)
lazy val main = project.settings(
uniqueName,
libraryDependencies += (projectID in library).value
)
lazy val library = project.settings(uniqueName)
lazy val library = project.
settings(commonSettings: _*).
settings(
uniqueName
)
def uniqueName =
name := (name.value + "-" + randomSuffix( (baseDirectory in ThisBuild).value))
name := (name.value + "-" + randomSuffix( (baseDirectory in ThisBuild).value))
// better long-term approach to a clean cache/local
// would be to not use the actual ~/.m2/repository
def randomSuffix(base: File) = {
// need to persist it so that it doesn't change across reloads
val persist = base / "suffix"
if(persist.exists)
IO.read(persist)
else {
val s = Hash.halfHashString(System.currentTimeMillis.toString)
IO.write(persist, s)
s
}
// need to persist it so that it doesn't change across reloads
val persist = base / "suffix"
if(persist.exists) IO.read(persist)
else {
val s = Hash.halfHashString(System.currentTimeMillis.toString)
IO.write(persist, s)
s
}
}

View File

@ -1,9 +1,12 @@
# this mimics any resolver that comes before m2.
> library/publishLocal
> library/publishM2
# should fail because local Maven repository not added yet
-> main/update
# should suceed because local Ivy repository works
> main/update
# should succeed now that local Maven repository is added
# should succeed when local Maven repository is added
$ copy-file changes/mvnLocal.sbt main/build.sbt
> reload
> main/update
@ -24,8 +27,6 @@ $ copy-file changes/libA.scala library/A.scala
> main/update
> main/compile
# update B.scala to depend on a dependency that 'library' doesn't declare yet
$ delete main/B.scala
$ copy-file changes/mainB2.scala main/B.scala