mirror of https://github.com/sbt/sbt.git
Get rid of sources/docs configurations
This commit is contained in:
parent
4f2729c0b0
commit
565acc4e2a
|
|
@ -8,10 +8,10 @@ import java.net.URL
|
|||
import sbt.serialization._
|
||||
|
||||
final case class Artifact(name: String, `type`: String, extension: String, classifier: Option[String], configurations: Iterable[Configuration], url: Option[URL], extraAttributes: Map[String, String]) {
|
||||
def extra(attributes: (String, String)*) = Artifact(name, `type`, extension, classifier, configurations, url, extraAttributes ++ ModuleID.checkE(attributes))
|
||||
def extra(attributes: (String, String)*) = copy(extraAttributes = extraAttributes ++ ModuleID.checkE(attributes))
|
||||
}
|
||||
|
||||
import Configurations.{ config, Docs, Optional, Pom, Sources, Test }
|
||||
import Configurations.{ config, Optional, Pom, Test }
|
||||
|
||||
object Artifact {
|
||||
def apply(name: String): Artifact = Artifact(name, DefaultType, DefaultExtension, None, Nil, None)
|
||||
|
|
@ -30,12 +30,23 @@ object Artifact {
|
|||
def javadoc(name: String) = classified(name, DocClassifier)
|
||||
def pom(name: String) = Artifact(name, PomType, PomType, None, Pom :: Nil, None)
|
||||
|
||||
val DocClassifier = "javadoc"
|
||||
val SourceClassifier = "sources"
|
||||
val DocType = "doc"
|
||||
val SourceType = "src"
|
||||
val PomType = "pom"
|
||||
val TestsClassifier = "tests"
|
||||
// Possible ivy artifact types such that sbt will treat those artifacts at sources / docs
|
||||
val DefaultSourceTypes = Set("src", "source", "sources")
|
||||
val DefaultDocTypes = Set("doc", "docs", "javadoc", "javadocs")
|
||||
|
||||
val DocClassifier = "javadoc"
|
||||
val SourceClassifier = "sources"
|
||||
|
||||
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.
|
||||
val DocType = "doc"
|
||||
val SourceType = "src"
|
||||
val PomType = "pom"
|
||||
|
||||
assert (DefaultDocTypes contains DocType)
|
||||
assert (DefaultSourceTypes contains SourceType)
|
||||
|
||||
def extract(url: URL, default: String): String = extract(url.toString, default)
|
||||
def extract(name: String, default: String): String =
|
||||
|
|
@ -62,18 +73,18 @@ object Artifact {
|
|||
base + "-" + module.revision + classifierStr + "." + artifact.extension
|
||||
}
|
||||
|
||||
val classifierConfMap = Map(SourceClassifier -> Sources, DocClassifier -> Docs)
|
||||
val classifierTypeMap = Map(SourceClassifier -> SourceType, DocClassifier -> DocType)
|
||||
def classifierConf(classifier: String): Configuration =
|
||||
if (classifier.startsWith(TestsClassifier))
|
||||
Test
|
||||
else
|
||||
classifierConfMap.getOrElse(classifier, Optional)
|
||||
def classifierType(classifier: String): String = classifierTypeMap.getOrElse(classifier.stripPrefix(TestsClassifier + "-"), DefaultType)
|
||||
def classified(name: String, classifier: String): Artifact =
|
||||
Artifact(name, classifierType(classifier), DefaultExtension, Some(classifier), classifierConf(classifier) :: Nil, None)
|
||||
val classifierTypeMap = Map(SourceClassifier -> SourceType, DocClassifier -> DocType)
|
||||
// TODO this function shouldn't exist. Configuration should not just be conjured up like that.
|
||||
def classifierConf(classifier: String): Configuration =
|
||||
if(classifier.startsWith(TestsClassifier))
|
||||
Test
|
||||
else
|
||||
Optional
|
||||
def classifierType(classifier: String): String = classifierTypeMap.getOrElse(classifier.stripPrefix(TestsClassifier + "-"), DefaultType)
|
||||
def classified(name: String, classifier: String): Artifact =
|
||||
Artifact(name, classifierType(classifier), DefaultExtension, Some(classifier), classifierConf(classifier) :: Nil, None)
|
||||
|
||||
private val optStringPickler = implicitly[Pickler[Option[String]]]
|
||||
private val optStringPickler = implicitly[Pickler[Option[String]]]
|
||||
private val optStringUnpickler = implicitly[Unpickler[Option[String]]]
|
||||
private val vectorConfigurationPickler = implicitly[Pickler[Vector[Configuration]]]
|
||||
private val vectorConfigurationUnpickler = implicitly[Unpickler[Vector[Configuration]]]
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ object Configurations {
|
|||
def default: Seq[Configuration] = defaultMavenConfigurations
|
||||
def defaultMavenConfigurations: Seq[Configuration] = Seq(Compile, Runtime, Test, Provided, Optional)
|
||||
def defaultInternal: Seq[Configuration] = Seq(CompileInternal, RuntimeInternal, TestInternal)
|
||||
def auxiliary: Seq[Configuration] = Seq(Sources, Docs, Pom)
|
||||
def auxiliary: Seq[Configuration] = Seq(Pom)
|
||||
def names(cs: Seq[Configuration]) = cs.map(_.name)
|
||||
|
||||
lazy val RuntimeInternal = optionalInternal(Runtime)
|
||||
|
|
@ -34,10 +34,8 @@ object Configurations {
|
|||
lazy val Compile = config("compile")
|
||||
lazy val IntegrationTest = config("it") extend (Runtime)
|
||||
lazy val Provided = config("provided")
|
||||
lazy val Docs = config("docs")
|
||||
lazy val Runtime = config("runtime") extend (Compile)
|
||||
lazy val Test = config("test") extend (Runtime)
|
||||
lazy val Sources = config("sources")
|
||||
lazy val System = config("system")
|
||||
lazy val Optional = config("optional")
|
||||
lazy val Pom = config("pom")
|
||||
|
|
|
|||
Loading…
Reference in New Issue