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
be1bdbb350
commit
b97eb58396
|
|
@ -142,7 +142,7 @@ object IvyActions
|
|||
{
|
||||
assert(!classifiers.isEmpty, "classifiers cannot be empty")
|
||||
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 module = new ivySbt.Module(InlineConfiguration(base, deps).copy(ivyScala = ivyScala))
|
||||
update(module, configuration, log)
|
||||
|
|
|
|||
|
|
@ -359,8 +359,10 @@ object Artifact
|
|||
Artifact(name, `type`, extension, classifier, configurations, url, Map.empty)
|
||||
val defaultExtension = "jar"
|
||||
val defaultType = "jar"
|
||||
def sources(name: String) = Artifact(name, "src", "jar", "sources")
|
||||
def javadoc(name: String) = Artifact(name, "doc", "jar", "javadoc")
|
||||
def sources(name: String) = classified(name, SourceClassifier)
|
||||
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(name: String, default: String): String =
|
||||
{
|
||||
|
|
@ -385,6 +387,9 @@ object Artifact
|
|||
base + "-" + module.revision + classifierStr + "." + artifact.extension
|
||||
}
|
||||
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)
|
||||
object ModuleConfiguration
|
||||
|
|
|
|||
|
|
@ -600,7 +600,7 @@ object Classpaths
|
|||
},
|
||||
resolvers in GlobalScope :== Nil,
|
||||
projectDescriptors <<= depMap,
|
||||
retrievePattern in GlobalScope :== "[type]/[organisation]/[module]/[artifact](-[revision])(-[classifier]).[ext]",
|
||||
retrievePattern in GlobalScope :== "[type]s/[organisation]/[module]/[artifact](-[revision])(-[classifier]).[ext]",
|
||||
updateConfiguration <<= (retrieveConfiguration, ivyLoggingLevel)((conf,level) => new UpdateConfiguration(conf, false, level) ),
|
||||
retrieveConfiguration <<= (managedDirectory, retrievePattern, retrieveManaged) { (libm, pattern, enabled) => if(enabled) Some(new RetrieveConfiguration(libm, pattern)) else None },
|
||||
ivyConfiguration <<= ivyConfiguration or mkIvyConfiguration,
|
||||
|
|
|
|||
Loading…
Reference in New Issue