2009-08-16 20:29:08 +02:00
|
|
|
/* sbt -- Simple Build Tool
|
|
|
|
|
* Copyright 2008, 2009 Mark Harrah
|
|
|
|
|
*/
|
|
|
|
|
package xsbt
|
|
|
|
|
|
|
|
|
|
import java.io.ByteArrayInputStream
|
|
|
|
|
import java.net.URL
|
|
|
|
|
|
|
|
|
|
import org.apache.ivy.{core, plugins}
|
|
|
|
|
import core.module.descriptor.{DefaultDependencyDescriptor, DefaultModuleDescriptor}
|
|
|
|
|
import core.settings.IvySettings
|
|
|
|
|
import plugins.parser.xml.XmlModuleDescriptorParser
|
|
|
|
|
import plugins.repository.Resource
|
|
|
|
|
import plugins.repository.url.URLResource
|
|
|
|
|
|
|
|
|
|
/** Subclasses the default Ivy file parser in order to provide access to protected methods.*/
|
2009-08-18 06:51:08 +02:00
|
|
|
private[xsbt] object CustomXmlParser extends XmlModuleDescriptorParser with NotNull
|
2009-08-16 20:29:08 +02:00
|
|
|
{
|
|
|
|
|
import XmlModuleDescriptorParser.Parser
|
2009-09-27 20:39:26 +02:00
|
|
|
class CustomParser(settings: IvySettings, defaultConfig: Option[String]) extends Parser(CustomXmlParser, settings) with NotNull
|
2009-08-16 20:29:08 +02:00
|
|
|
{
|
2009-10-02 04:56:23 +02:00
|
|
|
if(defaultConfig.isDefined) setDefaultConfMapping("*->default(compile)")
|
|
|
|
|
|
2009-08-16 20:29:08 +02:00
|
|
|
def setSource(url: URL) =
|
|
|
|
|
{
|
|
|
|
|
super.setResource(new URLResource(url))
|
|
|
|
|
super.setInput(url)
|
|
|
|
|
}
|
|
|
|
|
def setInput(bytes: Array[Byte]) { setInput(new ByteArrayInputStream(bytes)) }
|
|
|
|
|
/** Overridden because the super implementation overwrites the module descriptor.*/
|
|
|
|
|
override def setResource(res: Resource) {}
|
|
|
|
|
override def setMd(md: DefaultModuleDescriptor) = super.setMd(md)
|
|
|
|
|
override def parseDepsConfs(confs: String, dd: DefaultDependencyDescriptor) = super.parseDepsConfs(confs, dd)
|
2009-09-27 20:39:26 +02:00
|
|
|
override def getDefaultConf = defaultConfig.getOrElse(super.getDefaultConf)
|
2009-08-16 20:29:08 +02:00
|
|
|
}
|
|
|
|
|
}
|