mirror of https://github.com/sbt/sbt.git
Strip explicitArtifacts from projectDependencies. Fixes #546.
The module definition (ModuleID) got copied as to be the dependency definition, but as a dependency definition, it should not include explicit artifacts.
This commit is contained in:
parent
b15fb72727
commit
37661c9576
|
|
@ -1002,7 +1002,9 @@ object Classpaths
|
|||
|
||||
def projectDependenciesTask: Initialize[Task[Seq[ModuleID]]] =
|
||||
(thisProjectRef, settings, buildDependencies) map { (ref, data, deps) =>
|
||||
deps.classpath(ref) flatMap { dep => (projectID in dep.project) get data map { _.copy(configurations = dep.configuration) } }
|
||||
deps.classpath(ref) flatMap { dep => (projectID in dep.project) get data map {
|
||||
_.copy(configurations = dep.configuration, explicitArtifacts = Nil) }
|
||||
}
|
||||
}
|
||||
|
||||
def depMap: Initialize[Task[Map[ModuleRevisionId, ModuleDescriptor]]] =
|
||||
|
|
|
|||
|
|
@ -1,26 +0,0 @@
|
|||
scalaVersion := "2.9.2"
|
||||
|
||||
libraryDependencies += "org.mongodb" %% "casbah" % "2.4.1" pomOnly()
|
||||
|
||||
autoScalaLibrary := false
|
||||
|
||||
|
||||
TaskKey[Unit]("check-pom") <<= makePom map { file =>
|
||||
val pom = xml.XML.loadFile(file)
|
||||
val actual = pom \\ "dependencies"
|
||||
val expectedDep =
|
||||
<dependency>
|
||||
<groupId>org.mongodb</groupId>
|
||||
<artifactId>casbah_2.9.2</artifactId>
|
||||
<version>2.4.1</version>
|
||||
<type>pom</type>
|
||||
</dependency>
|
||||
val expected = <d>
|
||||
{expectedDep}
|
||||
</d>
|
||||
def dropTopElem(s:String): String = s.split("""\n""").drop(1).dropRight(1).mkString("\n")
|
||||
val pp = new xml.PrettyPrinter(Int.MaxValue, 0)
|
||||
val expectedString = dropTopElem(pp.format(expected))
|
||||
val actualString = dropTopElem(pp.formatNodes(actual))
|
||||
assert(expectedString == actualString, "Expected dependencies section:\n" + expectedString + "\n\nActual:\n" + actualString)
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
import sbt._
|
||||
import Keys._
|
||||
|
||||
object build extends Build {
|
||||
override def settings = super.settings ++ Seq(
|
||||
organization := "org.example",
|
||||
version := "1.0",
|
||||
scalaVersion := "2.9.2",
|
||||
autoScalaLibrary := false
|
||||
)
|
||||
|
||||
lazy val p1 = Project("p1",file("p1")) settings(
|
||||
checkTask(expectedMongo),
|
||||
libraryDependencies += "org.mongodb" %% "casbah" % "2.4.1" pomOnly()
|
||||
)
|
||||
lazy val p2 = Project("p2", file("p2")) dependsOn(p1) settings(
|
||||
checkTask(expectedInter)
|
||||
)
|
||||
|
||||
lazy val expectedMongo =
|
||||
<dependency>
|
||||
<groupId>org.mongodb</groupId>
|
||||
<artifactId>casbah_2.9.2</artifactId>
|
||||
<version>2.4.1</version>
|
||||
<type>pom</type>
|
||||
</dependency>
|
||||
|
||||
lazy val expectedInter =
|
||||
<dependency>
|
||||
<groupId>org.example</groupId>
|
||||
<artifactId>p1_2.9.2</artifactId>
|
||||
<version>1.0</version>
|
||||
</dependency>
|
||||
|
||||
def checkTask(expectedDep: xml.Elem) = TaskKey[Unit]("check-pom") <<= makePom map { file =>
|
||||
val pom = xml.XML.loadFile(file)
|
||||
val actual = pom \\ "dependencies"
|
||||
val expected = <d>
|
||||
{expectedDep}
|
||||
</d>
|
||||
def dropTopElem(s:String): String = s.split("""\n""").drop(1).dropRight(1).mkString("\n")
|
||||
val pp = new xml.PrettyPrinter(Int.MaxValue, 0)
|
||||
val expectedString = dropTopElem(pp.format(expected))
|
||||
val actualString = dropTopElem(pp.formatNodes(actual))
|
||||
assert(expectedString == actualString, "Expected dependencies section:\n" + expectedString + "\n\nActual:\n" + actualString)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -1 +1,2 @@
|
|||
> check-pom
|
||||
> p1/check-pom
|
||||
> p2/check-pom
|
||||
Loading…
Reference in New Issue