mirror of https://github.com/sbt/sbt.git
Only write 'info' tag if user has not provided one.
This commit is contained in:
parent
9bb813a2fc
commit
28b24ed3f9
|
|
@ -235,10 +235,15 @@ object ManageDependencies
|
|||
{
|
||||
import module._
|
||||
<ivy-module version="2.0">
|
||||
<info organisation={organization} module={name} revision={revision}/>
|
||||
{ if(hasInfo(dependencies))
|
||||
scala.xml.NodeSeq.Empty
|
||||
else
|
||||
<info organisation={organization} module={name} revision={revision}/>
|
||||
}
|
||||
{dependencies}
|
||||
</ivy-module>
|
||||
}
|
||||
def hasInfo(x: scala.xml.NodeSeq) = !(<g>{x}</g> \ "info").isEmpty
|
||||
/** Performs checks/adds filters on Scala dependencies (if enabled in IvyScala). */
|
||||
def checkModule(moduleAndConf: (ModuleDescriptor, String)): Either[String, (ModuleDescriptor, String)] =
|
||||
ivyScala match
|
||||
|
|
|
|||
|
|
@ -0,0 +1,3 @@
|
|||
project.name=test
|
||||
project.org=test
|
||||
project.version=1.0
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
import sbt._
|
||||
|
||||
class InfoTest(info: ProjectInfo) extends DefaultProject(info)
|
||||
{
|
||||
def ivyCacheDirectory = outputPath / "ivy-cache"
|
||||
override def updateOptions = CacheDirectory(ivyCacheDirectory) :: super.updateOptions.toList
|
||||
|
||||
override def ivyXML =
|
||||
if(customInfo)
|
||||
(<info organisation="test" module="test" revision="1.0">
|
||||
<license name="Two-clause BSD-style" url="http://github.com/szeiger/scala-query/blob/master/LICENSE.txt" />
|
||||
<description homepage="http://github.com/szeiger/scala-query/">
|
||||
ScalaQuery is a type-safe database query API for Scala.
|
||||
</description>
|
||||
</info>
|
||||
<dependency org="org.scalacheck" name="scalacheck" rev="1.5"/>)
|
||||
else
|
||||
<dependency org="org.scalacheck" name="scalacheck" rev="1.5"/>
|
||||
|
||||
def customInfo = "info".asFile.exists
|
||||
|
||||
lazy val checkDownload = task { if(compileClasspath.get.isEmpty) Some("Dependency not downloaded") else None }
|
||||
lazy val checkInfo = task {
|
||||
if((delivered \ "info").isEmpty)
|
||||
Some("No info tag generated")
|
||||
else if(customInfo)
|
||||
if( deliveredWithCustom ) None else Some("Expected 'license' and 'description' tags in info tag, got: \n" + (delivered \ "info"))
|
||||
else
|
||||
if( deliveredWithCustom ) Some("Expected empty 'info' tag, got: \n" + (delivered \ "info")) else None
|
||||
}
|
||||
def deliveredWithCustom = !(delivered \ "info" \ "license").isEmpty && !(delivered \ "info" \ "description").isEmpty
|
||||
def delivered = scala.xml.XML.loadFile(ivyFile)
|
||||
|
||||
def ivyFile = (outputPath * "ivy*.xml").get.toList.head.asFile
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
> update [success]
|
||||
> check-download [success]
|
||||
> deliver-local [success]
|
||||
> check-info [success]
|
||||
|
||||
> clean [success]
|
||||
> clean-lib [success]
|
||||
$ touch info [success]
|
||||
|
||||
> update [success]
|
||||
> check-download [success]
|
||||
> deliver-local [success]
|
||||
> check-info [success]
|
||||
Loading…
Reference in New Issue