mirror of https://github.com/sbt/sbt.git
define type for artifacts looked up by update-classifiers, fixes #49
This commit is contained in:
parent
69afc20bf1
commit
51b8d38356
|
|
@ -142,7 +142,7 @@ object IvyActions
|
||||||
{
|
{
|
||||||
assert(!classifiers.isEmpty, "classifiers cannot be empty")
|
assert(!classifiers.isEmpty, "classifiers cannot be empty")
|
||||||
val baseModules = modules map { m => ModuleID(m.organization, m.name, m.revision, crossVersion = m.crossVersion) }
|
val baseModules = modules map { m => ModuleID(m.organization, m.name, m.revision, crossVersion = m.crossVersion) }
|
||||||
val deps = baseModules.distinct map { m => m.copy(explicitArtifacts = classifiers map { c => Artifact(m.name, c) }) }
|
val deps = baseModules.distinct map { m => m.copy(explicitArtifacts = classifiers map { c => Artifact.classified(m.name, c) }) }
|
||||||
val base = id.copy(name = id.name + classifiers.mkString("$","_",""))
|
val base = id.copy(name = id.name + classifiers.mkString("$","_",""))
|
||||||
val module = new ivySbt.Module(InlineConfiguration(base, deps).copy(ivyScala = ivyScala))
|
val module = new ivySbt.Module(InlineConfiguration(base, deps).copy(ivyScala = ivyScala))
|
||||||
update(module, configuration, log)
|
update(module, configuration, log)
|
||||||
|
|
|
||||||
|
|
@ -359,8 +359,10 @@ object Artifact
|
||||||
Artifact(name, `type`, extension, classifier, configurations, url, Map.empty)
|
Artifact(name, `type`, extension, classifier, configurations, url, Map.empty)
|
||||||
val defaultExtension = "jar"
|
val defaultExtension = "jar"
|
||||||
val defaultType = "jar"
|
val defaultType = "jar"
|
||||||
def sources(name: String) = Artifact(name, "src", "jar", "sources")
|
def sources(name: String) = classified(name, SourceClassifier)
|
||||||
def javadoc(name: String) = Artifact(name, "doc", "jar", "javadoc")
|
def javadoc(name: String) = classified(name, DocClassifier)
|
||||||
|
val DocClassifier = "javadoc"
|
||||||
|
val SourceClassifier = "sources"
|
||||||
def extract(url: URL, default: String): String = extract(url.toString, default)
|
def extract(url: URL, default: String): String = extract(url.toString, default)
|
||||||
def extract(name: String, default: String): String =
|
def extract(name: String, default: String): String =
|
||||||
{
|
{
|
||||||
|
|
@ -385,6 +387,9 @@ object Artifact
|
||||||
base + "-" + module.revision + classifierStr + "." + artifact.extension
|
base + "-" + module.revision + classifierStr + "." + artifact.extension
|
||||||
}
|
}
|
||||||
def cross(enable: Boolean, scalaVersion: String): String = if(enable) "_" + scalaVersion else ""
|
def cross(enable: Boolean, scalaVersion: String): String = if(enable) "_" + scalaVersion else ""
|
||||||
|
|
||||||
|
val classifierTypeMap = Map("sources" -> "src", "javadoc" -> "doc")
|
||||||
|
def classified(name: String, classifier: String): Artifact = Artifact(name, classifierTypeMap.getOrElse(classifier, defaultType), defaultExtension, classifier)
|
||||||
}
|
}
|
||||||
final case class ModuleConfiguration(organization: String, name: String, revision: String, resolver: Resolver)
|
final case class ModuleConfiguration(organization: String, name: String, revision: String, resolver: Resolver)
|
||||||
object ModuleConfiguration
|
object ModuleConfiguration
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue