Fix artifact, deprecate stuff

This commit is contained in:
Dan Sanduleac 2013-12-04 13:29:35 +00:00
parent 055859ea9a
commit 55d13bd8cd
1 changed files with 7 additions and 3 deletions

View File

@ -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]]]