From 183c2bcfe2a84295deea82eed2179a72c50289cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-R=C3=A9mi=20Desjardins?= Date: Wed, 10 Sep 2014 20:18:28 -0700 Subject: [PATCH] Add developers keySetting The motivation for this is mainly to avoid having to define a pomExtra to publish to Maven central --- ivy/src/main/scala/sbt/IvyInterface.scala | 4 +++- ivy/src/main/scala/sbt/MakePom.scala | 16 ++++++++++++++++ main/src/main/scala/sbt/Defaults.scala | 2 +- main/src/main/scala/sbt/Keys.scala | 1 + 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/ivy/src/main/scala/sbt/IvyInterface.scala b/ivy/src/main/scala/sbt/IvyInterface.scala index 05720e6aa..3e63c4871 100644 --- a/ivy/src/main/scala/sbt/IvyInterface.scala +++ b/ivy/src/main/scala/sbt/IvyInterface.scala @@ -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) diff --git a/ivy/src/main/scala/sbt/MakePom.scala b/ivy/src/main/scala/sbt/MakePom.scala index e05221b43..eba0cd94d 100644 --- a/ivy/src/main/scala/sbt/MakePom.scala +++ b/ivy/src/main/scala/sbt/MakePom.scala @@ -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) { + + moduleInfo.developers.map{ developer: Developer => + + { developer.id } + { developer.name } + { developer.email } + { developer.url } + + } + + } else NodeSeq.Empty + } def makeProperties(module: ModuleDescriptor, dependencies: Seq[DependencyDescriptor]): NodeSeq = { val extra = IvySbt.getExtraAttributes(module) diff --git a/main/src/main/scala/sbt/Defaults.scala b/main/src/main/scala/sbt/Defaults.scala index 8d933dc02..7cf91d619 100755 --- a/main/src/main/scala/sbt/Defaults.scala +++ b/main/src/main/scala/sbt/Defaults.scala @@ -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 diff --git a/main/src/main/scala/sbt/Keys.scala b/main/src/main/scala/sbt/Keys.scala index 8ff0aefe1..e8a3347c7 100644 --- a/main/src/main/scala/sbt/Keys.scala +++ b/main/src/main/scala/sbt/Keys.scala @@ -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)