Add developers keySetting

The motivation for this is mainly to avoid having to define a pomExtra to publish to Maven central
This commit is contained in:
Jean-Rémi Desjardins 2014-09-10 20:18:28 -07:00
parent 68602278d5
commit 183c2bcfe2
4 changed files with 21 additions and 2 deletions

View File

@ -10,7 +10,7 @@ import org.apache.ivy.plugins.resolver.{ DependencyResolver, IBiblioResolver }
import org.apache.ivy.util.url.CredentialsStore
/** Additional information about a project module */
final case class ModuleInfo(nameFormal: String, description: String = "", homepage: Option[URL] = None, startYear: Option[Int] = None, licenses: Seq[(String, URL)] = Nil, organizationName: String = "", organizationHomepage: Option[URL] = None, scmInfo: Option[ScmInfo] = None) {
final case class ModuleInfo(nameFormal: String, description: String = "", homepage: Option[URL] = None, startYear: Option[Int] = None, licenses: Seq[(String, URL)] = Nil, organizationName: String = "", organizationHomepage: Option[URL] = None, scmInfo: Option[ScmInfo] = None, developers: Seq[Developer] = Seq()) {
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)
@ -20,6 +20,8 @@ final case class ModuleInfo(nameFormal: String, description: String = "", homepa
/** Basic SCM information for a project module */
final case class ScmInfo(browseUrl: URL, connection: String, devConnection: Option[String] = None)
final case class Developer(id: String, name: String, email: String, url: URL)
/** Rule to exclude unwanted dependencies pulled in transitively by a module. */
final case class ExclusionRule(organization: String = "*", name: String = "*", artifact: String = "*", configurations: Seq[String] = Nil)

View File

@ -42,6 +42,7 @@ class MakePom(val log: Logger) {
{ makeStartYear(moduleInfo) }
{ makeOrganization(moduleInfo) }
{ makeScmInfo(moduleInfo) }
{ makeDeveloperInfo(moduleInfo) }
{ extra }
{
val deps = depsInConfs(module, configurations)
@ -100,6 +101,21 @@ class MakePom(val log: Logger) {
case _ => NodeSeq.Empty
}
}
def makeDeveloperInfo(moduleInfo: ModuleInfo): NodeSeq =
{
if (moduleInfo.developers.nonEmpty) {
<developers>
moduleInfo.developers.map{ developer: Developer =>
<developer>
<id>{ developer.id }</id>
<name>{ developer.name }</name>
<email>{ developer.email }</email>
<url>{ developer.url }</url>
</developer>
}
</developers>
} else NodeSeq.Empty
}
def makeProperties(module: ModuleDescriptor, dependencies: Seq[DependencyDescriptor]): NodeSeq =
{
val extra = IvySbt.getExtraAttributes(module)

View File

@ -1042,7 +1042,7 @@ object Classpaths {
organization <<= organization or normalizedName,
organizationName <<= organizationName or organization,
organizationHomepage <<= organizationHomepage or homepage,
projectInfo <<= (name, description, homepage, startYear, licenses, organizationName, organizationHomepage, scmInfo) apply ModuleInfo,
projectInfo <<= (name, description, homepage, startYear, licenses, organizationName, organizationHomepage, scmInfo, developers) apply ModuleInfo,
overrideBuildResolvers <<= appConfiguration(isOverrideRepositories),
externalResolvers <<= (externalResolvers.task.?, resolvers, appResolvers) {
case (Some(delegated), Seq(), _) => delegated

View File

@ -214,6 +214,7 @@ object Keys {
val organization = SettingKey[String]("organization", "Organization/group ID.", APlusSetting)
val organizationName = SettingKey[String]("organization-name", "Organization full/formal name.", BMinusSetting)
val organizationHomepage = SettingKey[Option[URL]]("organization-homepage", "Organization homepage.", BMinusSetting)
val developers = SettingKey[List[Developer]]("developers", "List of developers implicated in the project", BMinusSetting)
val apiURL = SettingKey[Option[URL]]("api-url", "Base URL for API documentation.", BMinusSetting)
val entryApiURL = AttributeKey[URL]("entry-api-url", "Base URL for the API documentation for a classpath entry.")
val apiMappings = TaskKey[Map[File, URL]]("api-mappings", "Mappings from classpath entry to API documentation base URL.", BMinusSetting)