Merge pull request #1473 from sbt/wip/resolve-consolidation2

Improved consolidated resolution testing. #1454
This commit is contained in:
eugene yokota 2014-07-29 21:29:47 -04:00
commit ea2c7f7d46
2 changed files with 27 additions and 25 deletions

View File

@ -3,41 +3,43 @@ lazy val check = taskKey[Unit]("Runs the check")
def commonSettings: Seq[Def.Setting[_]] =
Seq(
ivyPaths := new IvyPaths( (baseDirectory in ThisBuild).value, Some((target in LocalRootProject).value / "ivy-cache")),
libraryDependencies := Seq("net.sf.json-lib" % "json-lib" % "2.4" classifier "jdk15" intransitive()),
autoScalaLibrary := false, // avoid downloading fresh scala-library/scala-compiler
managedScalaInstance := false,
libraryDependencies := Seq(
"net.sf.json-lib" % "json-lib" % "2.4" classifier "jdk15" intransitive(),
"com.typesafe.akka" %% "akka-remote" % "2.3.4" exclude("com.typesafe.akka", "akka-actor_2.10"),
"commons-io" % "commons-io" % "1.3"
),
dependencyOverrides += "commons-io" % "commons-io" % "1.4",
scalaVersion := "2.10.4"
)
def consolidatedResolutionSettings: Seq[Def.Setting[_]] =
commonSettings ++ Seq(
updateOptions := updateOptions.value.withConsolidatedResolution(true)
)
lazy val root = (project in file(".")).settings(
organization in ThisBuild := "org.example",
version in ThisBuild := "1.0"
)
lazy val a = project.
settings(commonSettings: _*).
settings(consolidatedResolutionSettings: _*).
settings(
artifact in (Compile, packageBin) := Artifact("demo")
)
lazy val b = project.
settings(commonSettings: _*).
settings(
check := {
val report = update.value
val configurationReport = (report.configurations find {_.configuration == "compile"}).head
val x = configurationReport.modules match {
case Seq(moduleReport) =>
moduleReport.module match {
case ModuleID("net.sf.json-lib", "json-lib", "2.4", _, _, _, _, _, _, _, _) => ()
case x => sys.error("Unexpected module: " + x.toString)
}
case x => sys.error("Unexpected modules: " + x.toString)
}
}
)
settings(commonSettings: _*)
lazy val c = project.
settings(commonSettings: _*).
settings(consolidatedResolutionSettings: _*).
settings(
libraryDependencies := Seq(organization.value %% "a" % version.value)
)
lazy val root = (project in file(".")).
settings(
organization in ThisBuild := "org.example",
version in ThisBuild := "1.0",
check := {
val acp = (externalDependencyClasspath in Compile in a).value
val bcp = (externalDependencyClasspath in Compile in b).value
if (acp == bcp) ()
else sys.error("Different classpaths are found:\n" + acp.toString + "\n" + bcp.toString)
}
)

View File

@ -1,5 +1,5 @@
> a/publishLocal
> b/check
> check
> c/run