Test case showing that cached resolver is not ignored

This commit is contained in:
Mark Harrah 2013-03-08 14:23:31 -05:00
parent b8c11678d9
commit cb4b00c0e8
7 changed files with 86 additions and 0 deletions

View File

@ -0,0 +1,10 @@
ivyPaths in ThisBuild := {
val base = (baseDirectory in ThisBuild).value
new IvyPaths(base, Some(base / "ivy-cache"))
}
managedScalaInstance in ThisBuild := false
autoScalaLibrary in ThisBuild := false
crossPaths in ThisBuild := false

View File

@ -0,0 +1,15 @@
import sbt._
import Keys._
object B extends Build {
override def settings = super.settings ++ Seq(
organization := "org.example",
version := "2.0"
)
lazy val root = proj("root", ".") aggregate(a,b)
lazy val a = proj("a", "a") dependsOn(b)
lazy val b = proj("b", "b")
private[this] def proj(id: String, f: String): Project = Project(id, file(f)).settings( ivyPaths <<= ivyPaths in ThisBuild )
}

View File

@ -0,0 +1,4 @@
public final class Def {
public static final int x = 3;
}

View File

@ -0,0 +1,3 @@
public final class Use {
public static final int x = Def.x;
}

View File

@ -0,0 +1,3 @@
object Use {
val x = Def.x
}

View File

@ -0,0 +1,9 @@
name := "use"
organization := "org.example"
version := "1.0"
libraryDependencies += "org.example" % "b" % "2.0"
ivyPaths <<= ivyPaths in ThisBuild

View File

@ -0,0 +1,42 @@
# Publish the def/{a,b} projects to the local repository
$ copy-file changes/def/Build.scala project/Build.scala
$ copy-file changes/def/Def.java b/Def.java
> reload
> publish-local
> clean
# Resolve the projects from the local repository
# The resolver will be marked as local in the cache
# The dependency on def/b will be properly resolved
$ delete project/Build.scala
$ delete b/Def.java
$ copy-file changes/use/build.sbt build.sbt
$ copy-file changes/use/Use.java Use.java
> reload
> compile
> clean
# Publish the def/{a,b} projects to the local repository again
# This will change the resolver in the cache to be inter-project
$ copy-file changes/def/Build.scala project/Build.scala
$ copy-file changes/def/Def.java b/Def.java
> reload
> publish-local
> clean
# Resolve from local again. This will succeed, but the jars
# won't be on the classpath if the resolver isn't ignoredy.
$ delete project/Build.scala
$ delete b/Def.java
$ copy-file changes/use/build.sbt build.sbt
$ copy-file changes/use/Use.java Use.java
> reload
> compile