From acf54b62a56356ab43966cc77d1bb35ef00f96fe Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Fri, 19 Dec 2014 00:56:13 -0500 Subject: [PATCH] Reproduce potential scenario that could be happening with #321 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- .../dependency-management/mvn-local/build.sbt | 48 +++++++++++-------- .../dependency-management/mvn-local/test | 11 +++-- 2 files changed, 35 insertions(+), 24 deletions(-) diff --git a/sbt/src/sbt-test/dependency-management/mvn-local/build.sbt b/sbt/src/sbt-test/dependency-management/mvn-local/build.sbt index f29ff5029..f56f1ba15 100644 --- a/sbt/src/sbt-test/dependency-management/mvn-local/build.sbt +++ b/sbt/src/sbt-test/dependency-management/mvn-local/build.sbt @@ -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 + } } diff --git a/sbt/src/sbt-test/dependency-management/mvn-local/test b/sbt/src/sbt-test/dependency-management/mvn-local/test index a6b7f81d1..1050ee336 100644 --- a/sbt/src/sbt-test/dependency-management/mvn-local/test +++ b/sbt/src/sbt-test/dependency-management/mvn-local/test @@ -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