ExclusionRule -> InclExclRule

This commit is contained in:
Dan Sanduleac 2013-11-29 09:38:22 +00:00
parent c7dfbbf705
commit 00bcd222e6
3 changed files with 22 additions and 6 deletions

View File

@ -27,10 +27,17 @@ final case class ScmInfo(browseUrl: URL, connection: String, devConnection: Opti
final case class Developer(id: String, name: String, email: String, url: URL)
/** Rule to exclude unwanted dependencies pulled in transitively by a module. */
final case class ExclusionRule(organization: String = "*", name: String = "*", artifact: String = "*", configurations: Seq[String] = Nil)
object ExclusionRule {
implicit val pickler: Pickler[ExclusionRule] with Unpickler[ExclusionRule] = PicklerUnpickler.generate[ExclusionRule]
/** Rule to either:
* <ul>
* <li> exclude unwanted dependencies pulled in transitively by a module, or to</li>
* <li> include and merge artifacts coming from the ModuleDescriptor if "dependencyArtifacts" are also provided.</li>
* </ul>
* Which one depends on the parameter name which it is passed to, but the filter has the same fields in both cases. */
final case class InclExclRule(organization: String = "*", name: String = "*", artifact: String = "*", configurations: Seq[String] = Nil)
object InclExclRule {
def everything = InclExclRule("*", "*", "*", Nil)
implicit val pickler: Pickler[InclExclRule] with Unpickler[InclExclRule] = PicklerUnpickler.generate[InclExclRule]
}
/** Work around the inadequacy of Ivy's ArtifactTypeFilter (that it cannot reverse a filter)

View File

@ -70,10 +70,10 @@ final case class ModuleID(organization: String, name: String, revision: String,
* Applies the provided exclusions to dependencies of this module. Note that only exclusions that specify
* both the exact organization and name and nothing else will be included in a pom.xml.
*/
def excludeAll(rules: ExclusionRule*) = copy(exclusions = this.exclusions ++ rules)
def excludeAll(rules: InclExclRule*) = copy(exclusions = this.exclusions ++ rules)
/** Excludes the dependency with organization `org` and `name` from being introduced by this dependency during resolution. */
def exclude(org: String, name: String) = excludeAll(ExclusionRule(org, name))
def exclude(org: String, name: String) = excludeAll(InclExclRule(org, name))
/**
* Adds extra attributes for this module. All keys are prefixed with `e:` if they are not already so prefixed.

View File

@ -0,0 +1,9 @@
package sbt
package object librarymanagement {
type ExclusionRule = InclExclRule
val ExclusionRule = InclExclRule
type InclusionRule = InclExclRule
val InclusionRule = InclExclRule
}