mirror of https://github.com/sbt/sbt.git
don't write <scope> section of pom if scope is 'compile'
This commit is contained in:
parent
c7f6ce4aec
commit
7a7acce621
|
|
@ -212,7 +212,7 @@ class MakePom(val log: Logger)
|
|||
scopeElem(scope) ++ optionalElem(opt)
|
||||
}
|
||||
def scopeElem(scope: Option[String]): NodeSeq = scope match {
|
||||
case None => NodeSeq.Empty
|
||||
case None | Some(Configurations.Compile.name) => NodeSeq.Empty
|
||||
case Some(s) => <scope>{s}</scope>
|
||||
}
|
||||
def optionalElem(opt: Boolean) = if(opt) <optional>true</optional> else NodeSeq.Empty
|
||||
|
|
|
|||
|
|
@ -15,11 +15,12 @@ TaskKey[Unit]("check-pom") <<= makePom map { file =>
|
|||
<version>2.4.1</version>
|
||||
<type>pom</type>
|
||||
</dependency>
|
||||
val expected = <dependencies xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" >
|
||||
val expected = <d>
|
||||
{expectedDep}
|
||||
</dependencies>
|
||||
</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 = pp.format(expected)
|
||||
val actualString = pp.formatNodes(actual)
|
||||
val expectedString = dropTopElem(pp.format(expected))
|
||||
val actualString = dropTopElem(pp.formatNodes(actual))
|
||||
assert(expectedString == actualString, "Expected dependencies section:\n" + expectedString + "\n\nActual:\n" + actualString)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,12 +18,12 @@ TaskKey[Unit]("check-pom") <<= makePom map { file =>
|
|||
<version>2.8.2</version>
|
||||
<classifier>{classifier}</classifier>
|
||||
</dependency>
|
||||
val sections = depSection("natives-windows") ++ depSection("natives-linux") ++ depSection("natives-osx")
|
||||
val expected = <dependencies xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" >
|
||||
{sections}
|
||||
</dependencies>
|
||||
val sections = <d>
|
||||
{depSection("natives-windows") ++ depSection("natives-linux") ++ depSection("natives-osx")}
|
||||
</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 = pp.format(expected)
|
||||
val actualString = pp.formatNodes(actual)
|
||||
val expectedString = dropTopElem(pp.formatNodes(sections))
|
||||
val actualString = dropTopElem(pp.formatNodes(actual))
|
||||
assert(expectedString == actualString, "Expected dependencies section:\n" + expectedString + "\n\nActual:\n" + actualString)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue