mirror of https://github.com/sbt/sbt.git
Merge pull request #169 from indrajitr/dep-exclude
Basic support for exclusions in inline dependencies
This commit is contained in:
commit
63931234d4
|
|
@ -419,6 +419,13 @@ private object IvySbt
|
|||
for(conf <- dependencyDescriptor.getModuleConfigurations)
|
||||
dependencyDescriptor.addDependencyArtifact(conf, ivyArtifact)
|
||||
}
|
||||
for(excls <- dependency.exclusions)
|
||||
{
|
||||
for(conf <- dependencyDescriptor.getModuleConfigurations)
|
||||
{
|
||||
dependencyDescriptor.addExcludeRule(conf, IvyScala.excludeRule(excls.organization, excls.name, excls.configurations))
|
||||
}
|
||||
}
|
||||
moduleID.addDependency(dependencyDescriptor)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import scala.xml.NodeSeq
|
|||
import org.apache.ivy.plugins.resolver.{DependencyResolver, IBiblioResolver}
|
||||
import org.apache.ivy.util.url.CredentialsStore
|
||||
|
||||
final case class ModuleID(organization: String, name: String, revision: String, configurations: Option[String] = None, isChanging: Boolean = false, isTransitive: Boolean = true, explicitArtifacts: Seq[Artifact] = Nil, extraAttributes: Map[String,String] = Map.empty, crossVersion: Boolean = false)
|
||||
final case class ModuleID(organization: String, name: String, revision: String, configurations: Option[String] = None, isChanging: Boolean = false, isTransitive: Boolean = true, explicitArtifacts: Seq[Artifact] = Nil, exclusions: Seq[ExclusionRule] = Nil, extraAttributes: Map[String,String] = Map.empty, crossVersion: Boolean = false)
|
||||
{
|
||||
override def toString =
|
||||
organization + ":" + name + ":" + revision +
|
||||
|
|
@ -24,6 +24,8 @@ final case class ModuleID(organization: String, name: String, revision: String,
|
|||
def from(url: String) = artifacts(Artifact(name, new URL(url)))
|
||||
def classifier(c: String) = artifacts(Artifact(name, c))
|
||||
def artifacts(newArtifacts: Artifact*) = copy(explicitArtifacts = newArtifacts ++ this.explicitArtifacts)
|
||||
def excludeAll(rules: ExclusionRule*) = copy(exclusions = this.exclusions ++ rules)
|
||||
def exclude(org: String, name: String) = excludeAll(ExclusionRule(org, name))
|
||||
def extra(attributes: (String,String)*) = copy(extraAttributes = this.extraAttributes ++ ModuleID.checkE(attributes))
|
||||
def sources() = artifacts(Artifact.sources(name))
|
||||
def javadoc() = artifacts(Artifact.javadoc(name))
|
||||
|
|
@ -46,6 +48,8 @@ case class ModuleInfo(nameFormal: String, description: String = "", homepage: Op
|
|||
def licensed(lics: (String, URL)*) = copy(licenses = lics)
|
||||
def organization(name: String, home: Option[URL]) = copy(organizationName = name, organizationHomepage = home)
|
||||
}
|
||||
/** Rule to exclude unwanted dependencies pulled in transitively by a module. */
|
||||
case class ExclusionRule(organization: String = "*", name: String = "*", artifact: String = "*", configurations: Seq[String] = Nil)
|
||||
sealed trait Resolver
|
||||
{
|
||||
def name: String
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ private object IvyScala
|
|||
}
|
||||
/** Creates an ExcludeRule that excludes artifacts with the given module organization and name for
|
||||
* the given configurations. */
|
||||
private def excludeRule(organization: String, name: String, configurationNames: Iterable[String]): ExcludeRule =
|
||||
private[sbt] def excludeRule(organization: String, name: String, configurationNames: Iterable[String]): ExcludeRule =
|
||||
{
|
||||
val artifact = new ArtifactId(ModuleId.newInstance(organization, name), "*", "jar", "*")
|
||||
val rule = new DefaultExcludeRule(artifact, ExactPatternMatcher.INSTANCE, emptyMap[AnyRef,AnyRef])
|
||||
|
|
|
|||
Loading…
Reference in New Issue