From 55d13bd8cd30f1d9b772b7a896b7a1193e29e828 Mon Sep 17 00:00:00 2001 From: Dan Sanduleac Date: Wed, 4 Dec 2013 13:29:35 +0000 Subject: [PATCH] Fix artifact, deprecate stuff --- .../main/scala/sbt/librarymanagement/Artifact.scala | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/librarymanagement/src/main/scala/sbt/librarymanagement/Artifact.scala b/librarymanagement/src/main/scala/sbt/librarymanagement/Artifact.scala index d45dd395a..b5b209bcb 100644 --- a/librarymanagement/src/main/scala/sbt/librarymanagement/Artifact.scala +++ b/librarymanagement/src/main/scala/sbt/librarymanagement/Artifact.scala @@ -40,7 +40,7 @@ object Artifact { val TestsClassifier = "tests" // Artifact types used when: // * artifacts are explicitly created for Maven dependency resolution (see updateClassifiers) - // * declaring artifacts as part of publishing Ivy files. + // * declaring artifacts as part of creating Ivy files. val DocType = "doc" val SourceType = "src" val PomType = "pom" @@ -74,15 +74,19 @@ object Artifact { } val classifierTypeMap = Map(SourceClassifier -> SourceType, DocClassifier -> DocType) - // TODO this function shouldn't exist. Configuration should not just be conjured up like that. + @deprecated("Configuration should not be decided from the classifier.", "1.0") def classifierConf(classifier: String): Configuration = if(classifier.startsWith(TestsClassifier)) Test else Optional def classifierType(classifier: String): String = classifierTypeMap.getOrElse(classifier.stripPrefix(TestsClassifier + "-"), DefaultType) + + /** Create a classified explicit artifact, to be used when trying to resolve sources|javadocs from Maven. This is + * necessary because those artifacts are not published in the Ivy generated from the Pom of the module in question. + * The artifact is created under the default configuration. */ def classified(name: String, classifier: String): Artifact = - Artifact(name, classifierType(classifier), DefaultExtension, Some(classifier), classifierConf(classifier) :: Nil, None) + Artifact(name, classifierType(classifier), DefaultExtension, Some(classifier), Nil, None) private val optStringPickler = implicitly[Pickler[Option[String]]] private val optStringUnpickler = implicitly[Unpickler[Option[String]]]