mirror of https://github.com/sbt/sbt.git
Option to automatically manage API documentation mappings
Set autoAPIMappings := true to enable. Then, set apiURL to the base URL of the API documentation for a project. This will get stored in an extra attribute in the ivy.xml or as a property a pom.xml. When using managed dependencies that have set their apiURL, the -doc-external-doc setting for scaladoc will be automatically configured. Note that this option will only be available in Scala 2.10.1 and so enabling autoAPIMappings for earlier versions will result in an error from scaladoc. For unmanaged dependencies or dependencies without an automatic apiURL, add the (File,URL) mapping to apiMappings. The File is the classpath entry and the URL is the location of the API documentation.
This commit is contained in:
parent
ff78892895
commit
8e34e15f69
|
|
@ -30,9 +30,14 @@ final class CustomPomParser(delegate: ModuleDescriptorParser, transform: (Module
|
|||
}
|
||||
object CustomPomParser
|
||||
{
|
||||
/** The key prefix that indicates that this is used only to store extra information and is not intended for dependency resolution.*/
|
||||
val InfoKeyPrefix = "info."
|
||||
val ApiURLKey = "info.apiURL"
|
||||
|
||||
val SbtVersionKey = "sbtVersion"
|
||||
val ScalaVersionKey = "scalaVersion"
|
||||
val ExtraAttributesKey = "extraDependencyAttributes"
|
||||
private[this] val unqualifiedKeys = Set(SbtVersionKey, ScalaVersionKey, ExtraAttributesKey, ApiURLKey)
|
||||
|
||||
// packagings that should be jars, but that Ivy doesn't handle as jars
|
||||
val JarPackagings = Set("eclipse-plugin", "hk2-jar", "orbit")
|
||||
|
|
@ -75,8 +80,7 @@ object CustomPomParser
|
|||
}
|
||||
private[this] def artifactExtIncorrect(md: ModuleDescriptor): Boolean =
|
||||
md.getConfigurations.exists(conf => md.getArtifacts(conf.getName).exists(art => JarPackagings(art.getExt)))
|
||||
private[this] def shouldBeUnqualified(m: Map[String, String]): Map[String, String] =
|
||||
m.filter { case (SbtVersionKey | ScalaVersionKey | ExtraAttributesKey,_) => true; case _ => false }
|
||||
private[this] def shouldBeUnqualified(m: Map[String, String]): Map[String, String] = m.filterKeys(unqualifiedKeys)
|
||||
|
||||
private[this] def condAddExtra(properties: Map[String, String], id: ModuleRevisionId): ModuleRevisionId =
|
||||
if(properties.isEmpty) id else addExtra(properties, id)
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ object IvyActions
|
|||
|
||||
def processUnresolved(err: ResolveException, log: Logger)
|
||||
{
|
||||
val withExtra = err.failed.filter(!_.extraAttributes.isEmpty)
|
||||
val withExtra = err.failed.filter(!_.extraDependencyAttributes.isEmpty)
|
||||
if(!withExtra.isEmpty)
|
||||
{
|
||||
log.warn("\n\tNote: Some unresolved dependencies have extra attributes. Check that these dependencies exist with the requested attributes.")
|
||||
|
|
|
|||
|
|
@ -11,11 +11,16 @@ import org.apache.ivy.util.url.CredentialsStore
|
|||
|
||||
final case class ModuleID(organization: String, name: String, revision: String, configurations: Option[String] = None, isChanging: Boolean = false, isTransitive: Boolean = true, isForce: Boolean = false, explicitArtifacts: Seq[Artifact] = Nil, exclusions: Seq[ExclusionRule] = Nil, extraAttributes: Map[String,String] = Map.empty, crossVersion: CrossVersion = CrossVersion.Disabled)
|
||||
{
|
||||
override def toString =
|
||||
override def toString: String =
|
||||
organization + ":" + name + ":" + revision +
|
||||
(configurations match { case Some(s) => ":" + s; case None => "" }) +
|
||||
(if(extraAttributes.isEmpty) "" else " " + extraString)
|
||||
def extraString = extraAttributes.map { case (k,v) => k + "=" + v } mkString("(",", ",")")
|
||||
|
||||
/** String representation of the extra attributes, excluding any information only attributes. */
|
||||
def extraString: String = extraDependencyAttributes.map { case (k,v) => k + "=" + v } mkString("(",", ",")")
|
||||
|
||||
/** Returns the extra attributes except for ones marked as information only (ones that typically would not be used for dependency resolution). */
|
||||
def extraDependencyAttributes: Map[String,String] = extraAttributes.filterKeys(!_.startsWith(CustomPomParser.InfoKeyPrefix))
|
||||
|
||||
@deprecated("Use `cross(CrossVersion)`, the variant accepting a CrossVersion value constructed by a member of the CrossVersion object instead.", "0.12.0")
|
||||
def cross(v: Boolean): ModuleID = cross(if(v) CrossVersion.binary else CrossVersion.Disabled)
|
||||
|
|
|
|||
Loading…
Reference in New Issue