mirror of https://github.com/sbt/sbt.git
- Extra Settings are now available to control project information, viz., name, description, homepage, organization name, organization homepage, licenses
- Modified name/signature of some private types/methods to reduce confusion (all in limited scope, so nothing should change from end user's pov) - Enriched Ivy and Maven descriptors produced out of the box (see Keys.scala and Defaults.scala for more) - Projects do not need to create custom Ivy <info/> block anymore, there is more settings-specific control instead
This commit is contained in:
parent
e67b3be331
commit
67102aadff
|
|
@ -14,7 +14,7 @@ import org.apache.ivy.{core, plugins, util, Ivy}
|
||||||
import core.IvyPatternHelper
|
import core.IvyPatternHelper
|
||||||
import core.cache.{CacheMetadataOptions, DefaultRepositoryCacheManager}
|
import core.cache.{CacheMetadataOptions, DefaultRepositoryCacheManager}
|
||||||
import core.module.descriptor.{Artifact => IArtifact, DefaultArtifact, DefaultDependencyArtifactDescriptor, MDArtifact}
|
import core.module.descriptor.{Artifact => IArtifact, DefaultArtifact, DefaultDependencyArtifactDescriptor, MDArtifact}
|
||||||
import core.module.descriptor.{DefaultDependencyDescriptor, DefaultModuleDescriptor, DependencyDescriptor, ModuleDescriptor}
|
import core.module.descriptor.{DefaultDependencyDescriptor, DefaultModuleDescriptor, DependencyDescriptor, ModuleDescriptor, License}
|
||||||
import core.module.id.{ArtifactId,ModuleId, ModuleRevisionId}
|
import core.module.id.{ArtifactId,ModuleId, ModuleRevisionId}
|
||||||
import core.resolve.IvyNode
|
import core.resolve.IvyNode
|
||||||
import core.settings.IvySettings
|
import core.settings.IvySettings
|
||||||
|
|
@ -26,7 +26,7 @@ import plugins.resolver.{ChainResolver, DependencyResolver}
|
||||||
import util.{Message, MessageLogger}
|
import util.{Message, MessageLogger}
|
||||||
import util.extendable.ExtendableItem
|
import util.extendable.ExtendableItem
|
||||||
|
|
||||||
import scala.xml.NodeSeq
|
import scala.xml.{NodeSeq, Text}
|
||||||
|
|
||||||
final class IvySbt(val configuration: IvyConfiguration)
|
final class IvySbt(val configuration: IvyConfiguration)
|
||||||
{
|
{
|
||||||
|
|
@ -124,9 +124,9 @@ final class IvySbt(val configuration: IvyConfiguration)
|
||||||
moduleSettings match
|
moduleSettings match
|
||||||
{
|
{
|
||||||
case ic: InlineConfiguration => configureInline(ic, configuration.log)
|
case ic: InlineConfiguration => configureInline(ic, configuration.log)
|
||||||
case ec: EmptyConfiguration => configureEmpty(ec.module)
|
case ec: EmptyConfiguration => configureEmpty(ec)
|
||||||
case pc: PomConfiguration => readPom(pc.file, pc.validate)
|
case pc: PomConfiguration => configurePom(pc)
|
||||||
case ifc: IvyFileConfiguration => readIvyFile(ifc.file, ifc.validate)
|
case ifc: IvyFileConfiguration => configureIvyFile(ifc)
|
||||||
}
|
}
|
||||||
moduleSettings.ivyScala.foreach(IvyScala.checkModule(baseModule, baseConfiguration))
|
moduleSettings.ivyScala.foreach(IvyScala.checkModule(baseModule, baseConfiguration))
|
||||||
baseModule.getExtraAttributesNamespaces.asInstanceOf[java.util.Map[String,String]].put("e", "http://ant.apache.org/ivy/extra")
|
baseModule.getExtraAttributesNamespaces.asInstanceOf[java.util.Map[String,String]].put("e", "http://ant.apache.org/ivy/extra")
|
||||||
|
|
@ -135,7 +135,7 @@ final class IvySbt(val configuration: IvyConfiguration)
|
||||||
private def configureInline(ic: InlineConfiguration, log: Logger) =
|
private def configureInline(ic: InlineConfiguration, log: Logger) =
|
||||||
{
|
{
|
||||||
import ic._
|
import ic._
|
||||||
val moduleID = newConfiguredModuleID(module, configurations)
|
val moduleID = newConfiguredModuleID(module, moduleInfo, configurations)
|
||||||
val defaultConf = defaultConfiguration getOrElse Configurations.config(ModuleDescriptor.DEFAULT_CONFIGURATION)
|
val defaultConf = defaultConfiguration getOrElse Configurations.config(ModuleDescriptor.DEFAULT_CONFIGURATION)
|
||||||
log.debug("Using inline dependencies specified in Scala" + (if(ivyXML.isEmpty) "." else " and XML."))
|
log.debug("Using inline dependencies specified in Scala" + (if(ivyXML.isEmpty) "." else " and XML."))
|
||||||
|
|
||||||
|
|
@ -144,44 +144,43 @@ final class IvySbt(val configuration: IvyConfiguration)
|
||||||
IvySbt.addMainArtifact(moduleID)
|
IvySbt.addMainArtifact(moduleID)
|
||||||
(moduleID, parser.getDefaultConf)
|
(moduleID, parser.getDefaultConf)
|
||||||
}
|
}
|
||||||
private def newConfiguredModuleID(module: ModuleID, configurations: Iterable[Configuration]) =
|
private def newConfiguredModuleID(module: ModuleID, moduleInfo: ModuleInfo, configurations: Iterable[Configuration]) =
|
||||||
{
|
{
|
||||||
val mod = new DefaultModuleDescriptor(IvySbt.toID(module), "release", null, false)
|
val mod = new DefaultModuleDescriptor(IvySbt.toID(module), "release", null, false)
|
||||||
mod.setLastModified(System.currentTimeMillis)
|
mod.setLastModified(System.currentTimeMillis)
|
||||||
|
mod.setDescription(moduleInfo.description)
|
||||||
|
moduleInfo.homepage foreach { h => mod.setHomePage(h.toString) }
|
||||||
|
moduleInfo.licenses foreach { l => mod.addLicense(new License(l._1, l._2.toString)) }
|
||||||
IvySbt.addConfigurations(mod, configurations)
|
IvySbt.addConfigurations(mod, configurations)
|
||||||
IvySbt.addArtifacts(mod, module.explicitArtifacts)
|
IvySbt.addArtifacts(mod, module.explicitArtifacts)
|
||||||
mod
|
mod
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Parses the given Maven pom 'pomFile'.*/
|
/** Parses the Maven pom 'pomFile' from the given `PomConfiguration`.*/
|
||||||
private def readPom(pomFile: File, validate: Boolean) =
|
private def configurePom(pc: PomConfiguration) =
|
||||||
{
|
{
|
||||||
val md = PomModuleDescriptorParser.getInstance.parseDescriptor(settings, toURL(pomFile), validate)
|
val md = PomModuleDescriptorParser.getInstance.parseDescriptor(settings, toURL(pc.file), pc.validate)
|
||||||
val dmd = IvySbt.toDefaultModuleDescriptor(md)
|
val dmd = IvySbt.toDefaultModuleDescriptor(md)
|
||||||
IvySbt.addConfigurations(dmd, Configurations.defaultInternal)
|
IvySbt.addConfigurations(dmd, Configurations.defaultInternal)
|
||||||
(dmd, "compile")
|
(dmd, "compile")
|
||||||
}
|
}
|
||||||
/** Parses the given Ivy file 'ivyFile'.*/
|
/** Parses the Ivy file 'ivyFile' from the given `IvyFileConfiguration`.*/
|
||||||
private def readIvyFile(ivyFile: File, validate: Boolean) =
|
private def configureIvyFile(ifc: IvyFileConfiguration) =
|
||||||
{
|
{
|
||||||
val url = toURL(ivyFile)
|
|
||||||
val parser = new CustomXmlParser.CustomParser(settings, None)
|
val parser = new CustomXmlParser.CustomParser(settings, None)
|
||||||
parser.setValidate(validate)
|
parser.setValidate(ifc.validate)
|
||||||
parser.setSource(url)
|
parser.setSource(toURL(ifc.file))
|
||||||
parser.parse()
|
parser.parse()
|
||||||
val md = parser.getModuleDescriptor()
|
val md = parser.getModuleDescriptor()
|
||||||
(IvySbt.toDefaultModuleDescriptor(md), parser.getDefaultConf)
|
(IvySbt.toDefaultModuleDescriptor(md), parser.getDefaultConf)
|
||||||
}
|
}
|
||||||
private def toURL(file: File) = file.toURI.toURL
|
private def toURL(file: File) = file.toURI.toURL
|
||||||
private def configureEmpty(module: ModuleID) =
|
private def configureEmpty(ec: EmptyConfiguration) =
|
||||||
{
|
{
|
||||||
val defaultConf = ModuleDescriptor.DEFAULT_CONFIGURATION
|
val defaultConf = ModuleDescriptor.DEFAULT_CONFIGURATION
|
||||||
val moduleID = new DefaultModuleDescriptor(IvySbt.toID(module), "release", null, false)
|
val mod = newConfiguredModuleID(ec.module, ec.moduleInfo, Seq(Configurations.Default))
|
||||||
moduleID.setLastModified(System.currentTimeMillis)
|
IvySbt.addMainArtifact(mod)
|
||||||
moduleID.addConfiguration(IvySbt.toIvyConfiguration(Configurations.Default))
|
(mod, defaultConf)
|
||||||
IvySbt.addArtifacts(moduleID, module.explicitArtifacts)
|
|
||||||
IvySbt.addMainArtifact(moduleID)
|
|
||||||
(moduleID, defaultConf)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -348,12 +347,11 @@ private object IvySbt
|
||||||
/** Creates a full ivy file for 'module' using the 'dependencies' XML as the part after the <info>...</info> section. */
|
/** Creates a full ivy file for 'module' using the 'dependencies' XML as the part after the <info>...</info> section. */
|
||||||
private def wrapped(module: ModuleID, dependencies: NodeSeq) =
|
private def wrapped(module: ModuleID, dependencies: NodeSeq) =
|
||||||
{
|
{
|
||||||
import module._
|
|
||||||
<ivy-module version="2.0" xmlns:e="http://ant.apache.org/ivy/extra">
|
<ivy-module version="2.0" xmlns:e="http://ant.apache.org/ivy/extra">
|
||||||
{ if(hasInfo(module, dependencies))
|
{ if(hasInfo(module, dependencies))
|
||||||
NodeSeq.Empty
|
NodeSeq.Empty
|
||||||
else
|
else
|
||||||
addExtraAttributes(<info organisation={organization} module={name} revision={revision}/>, module.extraAttributes)
|
addExtraAttributes(defaultInfo(module), module.extraAttributes)
|
||||||
}
|
}
|
||||||
{dependencies}
|
{dependencies}
|
||||||
{
|
{
|
||||||
|
|
@ -362,6 +360,10 @@ private object IvySbt
|
||||||
}
|
}
|
||||||
</ivy-module>
|
</ivy-module>
|
||||||
}
|
}
|
||||||
|
private[this] def defaultInfo(module: ModuleID): scala.xml.Elem = {
|
||||||
|
import module._
|
||||||
|
<info organisation={organization} module={name} revision={revision}/>
|
||||||
|
}
|
||||||
private[this] def addExtraAttributes(elem: scala.xml.Elem, extra: Map[String, String]): scala.xml.Elem =
|
private[this] def addExtraAttributes(elem: scala.xml.Elem, extra: Map[String, String]): scala.xml.Elem =
|
||||||
(elem /: extra) { case (e, (key,value) ) => e % new scala.xml.UnprefixedAttribute(key, value, scala.xml.Null) }
|
(elem /: extra) { case (e, (key,value) ) => e % new scala.xml.UnprefixedAttribute(key, value, scala.xml.Null) }
|
||||||
private def hasInfo(module: ModuleID, x: scala.xml.NodeSeq) =
|
private def hasInfo(module: ModuleID, x: scala.xml.NodeSeq) =
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ final class PublishConfiguration(val ivyFile: Option[File], val resolverName: St
|
||||||
|
|
||||||
final class UpdateConfiguration(val retrieve: Option[RetrieveConfiguration], val missingOk: Boolean, val logging: UpdateLogging.Value)
|
final class UpdateConfiguration(val retrieve: Option[RetrieveConfiguration], val missingOk: Boolean, val logging: UpdateLogging.Value)
|
||||||
final class RetrieveConfiguration(val retrieveDirectory: File, val outputPattern: String)
|
final class RetrieveConfiguration(val retrieveDirectory: File, val outputPattern: String)
|
||||||
final case class MakePomConfiguration(file: File, configurations: Option[Iterable[Configuration]] = None, extra: NodeSeq = NodeSeq.Empty, process: XNode => XNode = n => n, filterRepositories: MavenRepository => Boolean = _ => true, allRepositories: Boolean)
|
final case class MakePomConfiguration(file: File, moduleInfo: ModuleInfo, configurations: Option[Iterable[Configuration]] = None, extra: NodeSeq = NodeSeq.Empty, process: XNode => XNode = n => n, filterRepositories: MavenRepository => Boolean = _ => true, allRepositories: Boolean)
|
||||||
// exclude is a map on a restricted ModuleID
|
// exclude is a map on a restricted ModuleID
|
||||||
final case class GetClassifiersConfiguration(module: GetClassifiersModule, exclude: Map[ModuleID, Set[String]], configuration: UpdateConfiguration, ivyScala: Option[IvyScala])
|
final case class GetClassifiersConfiguration(module: GetClassifiersModule, exclude: Map[ModuleID, Set[String]], configuration: UpdateConfiguration, ivyScala: Option[IvyScala])
|
||||||
final case class GetClassifiersModule(id: ModuleID, modules: Seq[ModuleID], configurations: Seq[Configuration], classifiers: Seq[String])
|
final case class GetClassifiersModule(id: ModuleID, modules: Seq[ModuleID], configurations: Seq[Configuration], classifiers: Seq[String])
|
||||||
|
|
@ -66,9 +66,9 @@ object IvyActions
|
||||||
/** Creates a Maven pom from the given Ivy configuration*/
|
/** Creates a Maven pom from the given Ivy configuration*/
|
||||||
def makePom(module: IvySbt#Module, configuration: MakePomConfiguration, log: Logger)
|
def makePom(module: IvySbt#Module, configuration: MakePomConfiguration, log: Logger)
|
||||||
{
|
{
|
||||||
import configuration.{allRepositories, configurations, extra, file, filterRepositories, process}
|
import configuration.{allRepositories, moduleInfo, configurations, extra, file, filterRepositories, process}
|
||||||
module.withModule(log) { (ivy, md, default) =>
|
module.withModule(log) { (ivy, md, default) =>
|
||||||
(new MakePom).write(ivy, md, configurations, extra, process, filterRepositories, allRepositories, file)
|
(new MakePom).write(ivy, md, moduleInfo, configurations, extra, process, filterRepositories, allRepositories, file)
|
||||||
log.info("Wrote " + file.getAbsolutePath)
|
log.info("Wrote " + file.getAbsolutePath)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -170,7 +170,7 @@ object IvyActions
|
||||||
import config.{configuration => c, ivyScala, module => mod}
|
import config.{configuration => c, ivyScala, module => mod}
|
||||||
import mod.{configurations => confs, id, modules => deps}
|
import mod.{configurations => confs, id, modules => deps}
|
||||||
val base = restrictedCopy(id).copy(name = id.name + "$" + label)
|
val base = restrictedCopy(id).copy(name = id.name + "$" + label)
|
||||||
val module = new ivySbt.Module(InlineConfiguration(base, deps).copy(ivyScala = ivyScala))
|
val module = new ivySbt.Module(InlineConfiguration(base, ModuleInfo(base.name), deps).copy(ivyScala = ivyScala))
|
||||||
val report = update(module, c, log)
|
val report = update(module, c, log)
|
||||||
val newConfig = config.copy(module = mod.copy(modules = report.allModules))
|
val newConfig = config.copy(module = mod.copy(modules = report.allModules))
|
||||||
updateClassifiers(ivySbt, newConfig, log)
|
updateClassifiers(ivySbt, newConfig, log)
|
||||||
|
|
@ -183,7 +183,7 @@ object IvyActions
|
||||||
val baseModules = modules map restrictedCopy
|
val baseModules = modules map restrictedCopy
|
||||||
val deps = baseModules.distinct flatMap classifiedArtifacts(classifiers, exclude)
|
val deps = baseModules.distinct flatMap classifiedArtifacts(classifiers, exclude)
|
||||||
val base = restrictedCopy(id).copy(name = id.name + classifiers.mkString("$","_",""))
|
val base = restrictedCopy(id).copy(name = id.name + classifiers.mkString("$","_",""))
|
||||||
val module = new ivySbt.Module(InlineConfiguration(base, deps).copy(ivyScala = ivyScala, configurations = confs))
|
val module = new ivySbt.Module(InlineConfiguration(base, ModuleInfo(base.name), deps).copy(ivyScala = ivyScala, configurations = confs))
|
||||||
val upConf = new UpdateConfiguration(c.retrieve, true, c.logging)
|
val upConf = new UpdateConfiguration(c.retrieve, true, c.logging)
|
||||||
update(module, upConf, log)
|
update(module, upConf, log)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -62,21 +62,17 @@ final case class PomConfiguration(file: File, ivyScala: Option[IvyScala], valida
|
||||||
{
|
{
|
||||||
def noScala = copy(ivyScala = None)
|
def noScala = copy(ivyScala = None)
|
||||||
}
|
}
|
||||||
final case class InlineConfiguration(module: ModuleID, dependencies: Seq[ModuleID], ivyXML: NodeSeq,
|
final case class InlineConfiguration(module: ModuleID, moduleInfo: ModuleInfo, dependencies: Seq[ModuleID], ivyXML: NodeSeq = NodeSeq.Empty, configurations: Seq[Configuration] = Nil, defaultConfiguration: Option[Configuration] = None, ivyScala: Option[IvyScala] = None, validate: Boolean = false) extends ModuleSettings
|
||||||
configurations: Seq[Configuration], defaultConfiguration: Option[Configuration], ivyScala: Option[IvyScala],
|
|
||||||
validate: Boolean) extends ModuleSettings
|
|
||||||
{
|
{
|
||||||
def withConfigurations(configurations: Seq[Configuration]) = copy(configurations = configurations)
|
def withConfigurations(configurations: Seq[Configuration]) = copy(configurations = configurations)
|
||||||
def noScala = copy(ivyScala = None)
|
def noScala = copy(ivyScala = None)
|
||||||
}
|
}
|
||||||
final case class EmptyConfiguration(module: ModuleID, ivyScala: Option[IvyScala], validate: Boolean) extends ModuleSettings
|
final case class EmptyConfiguration(module: ModuleID, moduleInfo: ModuleInfo, ivyScala: Option[IvyScala], validate: Boolean) extends ModuleSettings
|
||||||
{
|
{
|
||||||
def noScala = copy(ivyScala = None)
|
def noScala = copy(ivyScala = None)
|
||||||
}
|
}
|
||||||
object InlineConfiguration
|
object InlineConfiguration
|
||||||
{
|
{
|
||||||
def apply(module: ModuleID, dependencies: Seq[ModuleID]) =
|
|
||||||
new InlineConfiguration(module, dependencies, NodeSeq.Empty, Nil, None, None, false)
|
|
||||||
def configurations(explicitConfigurations: Iterable[Configuration], defaultConfiguration: Option[Configuration]) =
|
def configurations(explicitConfigurations: Iterable[Configuration], defaultConfiguration: Option[Configuration]) =
|
||||||
if(explicitConfigurations.isEmpty)
|
if(explicitConfigurations.isEmpty)
|
||||||
{
|
{
|
||||||
|
|
@ -92,7 +88,7 @@ object InlineConfiguration
|
||||||
}
|
}
|
||||||
object ModuleSettings
|
object ModuleSettings
|
||||||
{
|
{
|
||||||
def apply(ivyScala: Option[IvyScala], validate: Boolean, module: => ModuleID)(baseDirectory: File, log: Logger) =
|
def apply(ivyScala: Option[IvyScala], validate: Boolean, module: => ModuleID, moduleInfo: => ModuleInfo)(baseDirectory: File, log: Logger) =
|
||||||
{
|
{
|
||||||
log.debug("Autodetecting dependencies.")
|
log.debug("Autodetecting dependencies.")
|
||||||
val defaultPOMFile = IvySbt.defaultPOM(baseDirectory)
|
val defaultPOMFile = IvySbt.defaultPOM(baseDirectory)
|
||||||
|
|
@ -106,7 +102,7 @@ object ModuleSettings
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
log.warn("No dependency configuration found, using defaults.")
|
log.warn("No dependency configuration found, using defaults.")
|
||||||
new EmptyConfiguration(module, ivyScala, validate)
|
new EmptyConfiguration(module, moduleInfo, ivyScala, validate)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,14 @@ object ModuleID
|
||||||
for ( (key, value) <- attributes) yield
|
for ( (key, value) <- attributes) yield
|
||||||
if(key.startsWith("e:")) (key, value) else ("e:" + key, value)
|
if(key.startsWith("e:")) (key, value) else ("e:" + key, value)
|
||||||
}
|
}
|
||||||
|
/** Additional information about a project module */
|
||||||
|
case class ModuleInfo(nameFormal: String, description: String = "", homepage: Option[URL] = None, licenses: Seq[(String, URL)] = Nil, organizationName: String = "", organizationHomepage: Option[URL] = None)
|
||||||
|
{
|
||||||
|
def formally(name: String) = copy(nameFormal = name)
|
||||||
|
def describing(desc: String, home: Option[URL]) = copy(description = desc, homepage = home)
|
||||||
|
def licensed(lics: (String, URL)*) = copy(licenses = lics)
|
||||||
|
def organization(name: String, home: Option[URL]) = copy(organizationName = name, organizationHomepage = home)
|
||||||
|
}
|
||||||
sealed trait Resolver
|
sealed trait Resolver
|
||||||
{
|
{
|
||||||
def name: String
|
def name: String
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,8 @@ import plugins.resolver.{ChainResolver, DependencyResolver, IBiblioResolver}
|
||||||
class MakePom
|
class MakePom
|
||||||
{
|
{
|
||||||
def encoding = "UTF-8"
|
def encoding = "UTF-8"
|
||||||
def write(ivy: Ivy, module: ModuleDescriptor, configurations: Option[Iterable[Configuration]], extra: NodeSeq, process: XNode => XNode, filterRepositories: MavenRepository => Boolean, allRepositories: Boolean, output: File): Unit =
|
def write(ivy: Ivy, module: ModuleDescriptor, moduleInfo: ModuleInfo, configurations: Option[Iterable[Configuration]], extra: NodeSeq, process: XNode => XNode, filterRepositories: MavenRepository => Boolean, allRepositories: Boolean, output: File): Unit =
|
||||||
write(process(toPom(ivy, module, configurations, extra, filterRepositories, allRepositories)), output)
|
write(process(toPom(ivy, module, moduleInfo, configurations, extra, filterRepositories, allRepositories)), output)
|
||||||
// use \n as newline because toString uses PrettyPrinter, which hard codes line endings to be \n
|
// use \n as newline because toString uses PrettyPrinter, which hard codes line endings to be \n
|
||||||
def write(node: XNode, output: File): Unit = write(toString(node), output, "\n")
|
def write(node: XNode, output: File): Unit = write(toString(node), output, "\n")
|
||||||
def write(xmlString: String, output: File, newline: String)
|
def write(xmlString: String, output: File, newline: String)
|
||||||
|
|
@ -37,10 +37,12 @@ class MakePom
|
||||||
}
|
}
|
||||||
|
|
||||||
def toString(node: XNode): String = new PrettyPrinter(1000, 4).format(node)
|
def toString(node: XNode): String = new PrettyPrinter(1000, 4).format(node)
|
||||||
def toPom(ivy: Ivy, module: ModuleDescriptor, configurations: Option[Iterable[Configuration]], extra: NodeSeq, filterRepositories: MavenRepository => Boolean, allRepositories: Boolean): XNode =
|
def toPom(ivy: Ivy, module: ModuleDescriptor, moduleInfo: ModuleInfo, configurations: Option[Iterable[Configuration]], extra: NodeSeq, filterRepositories: MavenRepository => Boolean, allRepositories: Boolean): XNode =
|
||||||
(<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
(<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
{ makeModuleID(module) }
|
{ makeModuleID(module) }
|
||||||
|
<name>{moduleInfo.nameFormal}</name>
|
||||||
|
{ makeOrganization(moduleInfo) }
|
||||||
{ extra }
|
{ extra }
|
||||||
{ makeProperties(module) }
|
{ makeProperties(module) }
|
||||||
{ makeDependencies(module, configurations) }
|
{ makeDependencies(module, configurations) }
|
||||||
|
|
@ -61,6 +63,13 @@ class MakePom
|
||||||
licenses(module.getLicenses)) : NodeSeq )
|
licenses(module.getLicenses)) : NodeSeq )
|
||||||
a ++ b
|
a ++ b
|
||||||
}
|
}
|
||||||
|
def makeOrganization(moduleInfo: ModuleInfo): NodeSeq =
|
||||||
|
{
|
||||||
|
<organization>
|
||||||
|
<name>{moduleInfo.organizationName}</name>
|
||||||
|
{ moduleInfo.organizationHomepage map { h => <url>{h}</url> } getOrElse NodeSeq.Empty }
|
||||||
|
</organization>
|
||||||
|
}
|
||||||
def makeProperties(module: ModuleDescriptor): NodeSeq =
|
def makeProperties(module: ModuleDescriptor): NodeSeq =
|
||||||
{
|
{
|
||||||
val extra = IvySbt.getExtraAttributes(module)
|
val extra = IvySbt.getExtraAttributes(module)
|
||||||
|
|
|
||||||
|
|
@ -595,7 +595,13 @@ object Classpaths
|
||||||
conflictWarning <<= (thisProjectRef, conflictWarning) { (ref, cw) => cw.copy(label = Project.display(ref)) },
|
conflictWarning <<= (thisProjectRef, conflictWarning) { (ref, cw) => cw.copy(label = Project.display(ref)) },
|
||||||
unmanagedBase <<= baseDirectory / "lib",
|
unmanagedBase <<= baseDirectory / "lib",
|
||||||
normalizedName <<= name(StringUtilities.normalize),
|
normalizedName <<= name(StringUtilities.normalize),
|
||||||
|
description <<= description or name.identity,
|
||||||
|
homepage in GlobalScope :== None,
|
||||||
|
licenses in GlobalScope :== Nil,
|
||||||
organization <<= organization or normalizedName.identity,
|
organization <<= organization or normalizedName.identity,
|
||||||
|
organizationName in GlobalScope <<= organizationName or organization.identity,
|
||||||
|
organizationHomepage in GlobalScope <<= organizationHomepage or homepage.identity,
|
||||||
|
projectInfo <<= (name, description, homepage, licenses, organizationName, organizationHomepage) apply ModuleInfo,
|
||||||
classpathFilter in GlobalScope :== "*.jar",
|
classpathFilter in GlobalScope :== "*.jar",
|
||||||
externalResolvers <<= (externalResolvers.task.? zipWith resolvers.identity) {
|
externalResolvers <<= (externalResolvers.task.? zipWith resolvers.identity) {
|
||||||
case (Some(delegated), Seq()) => delegated
|
case (Some(delegated), Seq()) => delegated
|
||||||
|
|
@ -645,8 +651,8 @@ object Classpaths
|
||||||
},
|
},
|
||||||
ivyConfigurations ++= Configurations.auxiliary,
|
ivyConfigurations ++= Configurations.auxiliary,
|
||||||
moduleSettings <<= moduleSettings0,
|
moduleSettings <<= moduleSettings0,
|
||||||
makePomConfiguration <<= (artifactPath in makePom, pomExtra, pomPostProcess, pomIncludeRepository, pomAllRepositories) {
|
makePomConfiguration <<= (artifactPath in makePom, projectInfo, pomExtra, pomPostProcess, pomIncludeRepository, pomAllRepositories) {
|
||||||
(file, extra, process, include, all) => new MakePomConfiguration(file, None, extra, process, include, all)
|
(file, minfo, extra, process, include, all) => new MakePomConfiguration(file, minfo, None, extra, process, include, all)
|
||||||
},
|
},
|
||||||
deliverLocalConfiguration <<= (crossTarget, ivyLoggingLevel) map { (outDir, level) => deliverConfig( outDir, logging = level ) },
|
deliverLocalConfiguration <<= (crossTarget, ivyLoggingLevel) map { (outDir, level) => deliverConfig( outDir, logging = level ) },
|
||||||
deliverConfiguration <<= deliverLocalConfiguration.identity,
|
deliverConfiguration <<= deliverLocalConfiguration.identity,
|
||||||
|
|
@ -686,8 +692,8 @@ object Classpaths
|
||||||
new IvySbt(conf)
|
new IvySbt(conf)
|
||||||
}
|
}
|
||||||
def moduleSettings0: Initialize[Task[ModuleSettings]] =
|
def moduleSettings0: Initialize[Task[ModuleSettings]] =
|
||||||
(projectID, allDependencies, ivyXML, ivyConfigurations, defaultConfiguration, ivyScala, ivyValidate) map {
|
(projectID, allDependencies, ivyXML, ivyConfigurations, defaultConfiguration, ivyScala, ivyValidate, projectInfo) map {
|
||||||
(pid, deps, ivyXML, confs, defaultConf, ivyS, validate) => new InlineConfiguration(pid, deps, ivyXML, confs, defaultConf, ivyS, validate)
|
(pid, deps, ivyXML, confs, defaultConf, ivyS, validate, pinfo) => new InlineConfiguration(pid, pinfo, deps, ivyXML, confs, defaultConf, ivyS, validate)
|
||||||
}
|
}
|
||||||
|
|
||||||
def sbtClassifiersTasks = inTask(updateSbtClassifiers)(Seq(
|
def sbtClassifiersTasks = inTask(updateSbtClassifiers)(Seq(
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@
|
||||||
package sbt
|
package sbt
|
||||||
|
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
import java.net.URL
|
||||||
import Project.ScopedKey
|
import Project.ScopedKey
|
||||||
import complete._
|
import complete._
|
||||||
import inc.Analysis
|
import inc.Analysis
|
||||||
|
|
@ -171,9 +172,15 @@ object Keys
|
||||||
// Classpath/Dependency Management Keys
|
// Classpath/Dependency Management Keys
|
||||||
type Classpath = Seq[Attributed[File]]
|
type Classpath = Seq[Attributed[File]]
|
||||||
|
|
||||||
val name = SettingKey[String]("name", "Name.")
|
val name = SettingKey[String]("name", "Project name.")
|
||||||
val normalizedName = SettingKey[String]("normalized-name", "Name transformed from mixed case and spaces to lowercase and dash-separated.")
|
val normalizedName = SettingKey[String]("normalized-name", "Project name transformed from mixed case and spaces to lowercase and dash-separated.")
|
||||||
|
val description = SettingKey[String]("description", "Project description.")
|
||||||
|
val homepage = SettingKey[Option[URL]]("homepage", "Project homepage.")
|
||||||
|
val licenses = SettingKey[Seq[(String, URL)]]("licenses", "Project licenses as (name, url) pairs.")
|
||||||
val organization = SettingKey[String]("organization", "Organization/group ID.")
|
val organization = SettingKey[String]("organization", "Organization/group ID.")
|
||||||
|
val organizationName = SettingKey[String]("organization-name", "Organization full/formal name.")
|
||||||
|
val organizationHomepage = SettingKey[Option[URL]]("organization-homepage", "Organization homepage.")
|
||||||
|
val projectInfo = SettingKey[ModuleInfo]("project-info", "Addition project information like formal name, homepage, licenses etc.")
|
||||||
val defaultConfiguration = SettingKey[Option[Configuration]]("default-configuration", "Defines the configuration used when none is specified for a dependency.")
|
val defaultConfiguration = SettingKey[Option[Configuration]]("default-configuration", "Defines the configuration used when none is specified for a dependency.")
|
||||||
val defaultConfigurationMapping = SettingKey[String]("default-configuration-mapping", "Defines the mapping used for a simple, unmapped configuration definition.")
|
val defaultConfigurationMapping = SettingKey[String]("default-configuration-mapping", "Defines the mapping used for a simple, unmapped configuration definition.")
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue