From 367ada5aca245dfdb82c5d81df567828e9dabe57 Mon Sep 17 00:00:00 2001 From: Mark Harrah Date: Sat, 16 Apr 2011 11:14:45 -0400 Subject: [PATCH] more work on dependency management tests --- ivy/Ivy.scala | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/ivy/Ivy.scala b/ivy/Ivy.scala index 116f95418..57e19ec4b 100644 --- a/ivy/Ivy.scala +++ b/ivy/Ivy.scala @@ -336,7 +336,7 @@ private object IvySbt { import module._ - { if(hasInfo(dependencies)) + { if(hasInfo(module, dependencies)) NodeSeq.Empty else @@ -348,7 +348,24 @@ private object IvySbt } } - private def hasInfo(x: scala.xml.NodeSeq) = !({x} \ "info").isEmpty + private def hasInfo(module: ModuleID, x: scala.xml.NodeSeq) = + { + val info = {x} \ "info" + if(!info.isEmpty) + { + def check(found: NodeSeq, expected: String, label: String) = + if(found.isEmpty) + error("Missing " + label + " in inline Ivy XML.") + else { + val str = found.text + if(str != expected) error("Inconsistent " + label + " in inline Ivy XML. Expected '" + expected + "', got '" + str + "'") + } + check(info \ "@organisation", module.organization, "organisation") + check(info \ "@module", module.name, "name") + check(info \ "@revision", module.revision, "version") + } + !info.isEmpty + } /** Parses the given in-memory Ivy file 'xml', using the existing 'moduleID' and specifying the given 'defaultConfiguration'. */ private def parseIvyXML(settings: IvySettings, xml: scala.xml.NodeSeq, moduleID: DefaultModuleDescriptor, defaultConfiguration: String, validate: Boolean): CustomXmlParser.CustomParser = parseIvyXML(settings, xml.toString, moduleID, defaultConfiguration, validate)