mirror of https://github.com/sbt/sbt.git
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:
parent
1952e25c41
commit
acf54b62a5
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue