mirror of
https://github.com/sbt/sbt.git
synced 2026-08-22 06:07:24 +02:00
Merge pull request #2027 from cunei/wip-fix-2001
Do not emit in the pom dependencies that are only sources or docs
This commit is contained in:
@@ -233,28 +233,33 @@ class MakePom(val log: Logger) {
|
|||||||
val artifacts = dependency.getAllDependencyArtifacts
|
val artifacts = dependency.getAllDependencyArtifacts
|
||||||
val includeArtifacts = artifacts.filter(d => includeTypes(d.getType))
|
val includeArtifacts = artifacts.filter(d => includeTypes(d.getType))
|
||||||
if (artifacts.isEmpty) {
|
if (artifacts.isEmpty) {
|
||||||
val (scope, optional) = getScopeAndOptional(dependency.getModuleConfigurations)
|
val configs = dependency.getModuleConfigurations
|
||||||
makeDependencyElem(dependency, scope, optional, None, None)
|
if (configs.filterNot(Set("sources","docs")).nonEmpty) {
|
||||||
|
val (scope, optional) = getScopeAndOptional(dependency.getModuleConfigurations)
|
||||||
|
makeDependencyElem(dependency, scope, optional, None, None)
|
||||||
|
} else NodeSeq.Empty
|
||||||
} else if (includeArtifacts.isEmpty)
|
} else if (includeArtifacts.isEmpty)
|
||||||
NodeSeq.Empty
|
NodeSeq.Empty
|
||||||
else
|
else
|
||||||
NodeSeq.fromSeq(artifacts.map(a => makeDependencyElem(dependency, a)))
|
NodeSeq.fromSeq(artifacts.flatMap(a => makeDependencyElem(dependency, a)))
|
||||||
}
|
}
|
||||||
|
|
||||||
def makeDependencyElem(dependency: DependencyDescriptor, artifact: DependencyArtifactDescriptor): Elem =
|
def makeDependencyElem(dependency: DependencyDescriptor, artifact: DependencyArtifactDescriptor): Option[Elem] =
|
||||||
{
|
{
|
||||||
val configs = artifact.getConfigurations.toList match {
|
val configs = artifact.getConfigurations.toList match {
|
||||||
case Nil | "*" :: Nil => dependency.getModuleConfigurations
|
case Nil | "*" :: Nil => dependency.getModuleConfigurations
|
||||||
case x => x.toArray
|
case x => x.toArray
|
||||||
}
|
}
|
||||||
val (scope, optional) = getScopeAndOptional(configs)
|
if (configs.filterNot(Set("sources","docs")).nonEmpty) {
|
||||||
val classifier = artifactClassifier(artifact)
|
val (scope, optional) = getScopeAndOptional(configs)
|
||||||
val baseType = artifactType(artifact)
|
val classifier = artifactClassifier(artifact)
|
||||||
val tpe = (classifier, baseType) match {
|
val baseType = artifactType(artifact)
|
||||||
case (Some(c), Some(tpe)) if Artifact.classifierType(c) == tpe => None
|
val tpe = (classifier, baseType) match {
|
||||||
case _ => baseType
|
case (Some(c), Some(tpe)) if Artifact.classifierType(c) == tpe => None
|
||||||
}
|
case _ => baseType
|
||||||
makeDependencyElem(dependency, scope, optional, classifier, tpe)
|
}
|
||||||
|
Some(makeDependencyElem(dependency, scope, optional, classifier, tpe))
|
||||||
|
} else None
|
||||||
}
|
}
|
||||||
def makeDependencyElem(dependency: DependencyDescriptor, scope: Option[String], optional: Boolean, classifier: Option[String], tpe: Option[String]): Elem =
|
def makeDependencyElem(dependency: DependencyDescriptor, scope: Option[String], optional: Boolean, classifier: Option[String], tpe: Option[String]): Elem =
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
|
||||||
|
[@cunei]: http://github.com/cunei
|
||||||
|
[2001]: https://github.com/sbt/sbt/issues/2001
|
||||||
|
[2027]: https://github.com/sbt/sbt/pull/2027
|
||||||
|
|
||||||
|
### Fixes with compatibility implications
|
||||||
|
|
||||||
|
- Starting with 0.13.9, the generated POM files no longer include dependencies on source or javadoc jars
|
||||||
|
obtained via withSources() or withJavadoc()
|
||||||
|
|
||||||
|
### Improvements
|
||||||
|
|
||||||
|
### Bug fixes
|
||||||
|
|
||||||
|
### POM files no longer include certain source and javadoc jars
|
||||||
|
|
||||||
|
When declaring library dependencies using the withSources() or withJavadoc() options, sbt was also including
|
||||||
|
in the pom file, as dependencies, the source or javadoc jars using the default Maven scope. Such dependencies
|
||||||
|
might be erroneously processed as they were regular jars by automated tools
|
||||||
|
|
||||||
|
[#2001][2001]/[#2027][2027] by [@cunei][@cunei]
|
||||||
Reference in New Issue
Block a user