mirror of https://github.com/sbt/sbt.git
turn back syntax classes into traits
This commit is contained in:
parent
7844190964
commit
358b750dde
|
|
@ -8,7 +8,12 @@ import sbt.internal.librarymanagement.StringUtilities.nonEmpty
|
|||
/**
|
||||
* DependencyBuilders implements the implicits for % and %% DSL.
|
||||
*/
|
||||
abstract class DependencyBuilders {
|
||||
trait DependencyBuilders {
|
||||
// See http://www.scala-lang.org/news/2.12.0#traits-compile-to-interfaces
|
||||
// Avoid defining fields (val or var, but a constant is ok – final val without result type)
|
||||
// Avoid calling super
|
||||
// Avoid initializer statements in the body
|
||||
|
||||
import DependencyBuilders._
|
||||
|
||||
implicit def stringToOrganization(organization: String): Organization = {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,11 @@ package sbt.librarymanagement
|
|||
import sbt.io.{ AllPassFilter, NameFilter }
|
||||
|
||||
trait DependencyFilterExtra {
|
||||
// See http://www.scala-lang.org/news/2.12.0#traits-compile-to-interfaces
|
||||
// Avoid defining fields (val or var, but a constant is ok – final val without result type)
|
||||
// Avoid calling super
|
||||
// Avoid initializer statements in the body
|
||||
|
||||
def moduleFilter(
|
||||
organization: NameFilter = AllPassFilter,
|
||||
name: NameFilter = AllPassFilter,
|
||||
|
|
@ -15,6 +20,7 @@ trait DependencyFilterExtra {
|
|||
def apply(m: ModuleID): Boolean =
|
||||
organization.accept(m.organization) && name.accept(m.name) && revision.accept(m.revision)
|
||||
}
|
||||
|
||||
def artifactFilter(
|
||||
name: NameFilter = AllPassFilter,
|
||||
`type`: NameFilter = AllPassFilter,
|
||||
|
|
@ -26,11 +32,13 @@ trait DependencyFilterExtra {
|
|||
name.accept(a.name) && `type`.accept(a.`type`) && extension.accept(a.extension) && classifier
|
||||
.accept(a.classifier getOrElse "")
|
||||
}
|
||||
|
||||
def configurationFilter(name: NameFilter = AllPassFilter): ConfigurationFilter =
|
||||
new ConfigurationFilter {
|
||||
def apply(c: ConfigRef): Boolean = name.accept(c.name)
|
||||
}
|
||||
}
|
||||
|
||||
object DependencyFilter extends DependencyFilterExtra {
|
||||
def make(
|
||||
configuration: ConfigurationFilter = configurationFilter(),
|
||||
|
|
|
|||
|
|
@ -1,13 +1,28 @@
|
|||
package sbt.librarymanagement
|
||||
|
||||
abstract class LibraryManagementSyntax extends DependencyBuilders {
|
||||
type ExclusionRule = InclExclRule
|
||||
val ExclusionRule = InclExclRule
|
||||
|
||||
type InclusionRule = InclExclRule
|
||||
val InclusionRule = InclExclRule
|
||||
trait LibraryManagementSyntax0 {
|
||||
// See http://www.scala-lang.org/news/2.12.0#traits-compile-to-interfaces
|
||||
// Avoid defining fields (val or var, but a constant is ok – final val without result type)
|
||||
// Avoid calling super
|
||||
// Avoid initializer statements in the body
|
||||
|
||||
implicit def richUpdateReport(ur: UpdateReport): RichUpdateReport = new RichUpdateReport(ur)
|
||||
}
|
||||
|
||||
trait LibraryManagementSyntax
|
||||
extends LibraryManagementSyntax0
|
||||
with DependencyBuilders
|
||||
with DependencyFilterExtra {
|
||||
// See http://www.scala-lang.org/news/2.12.0#traits-compile-to-interfaces
|
||||
// Avoid defining fields (val or var, but a constant is ok – final val without result type)
|
||||
// Avoid calling super
|
||||
// Avoid initializer statements in the body
|
||||
|
||||
type ExclusionRule = InclExclRule
|
||||
final val ExclusionRule = InclExclRule
|
||||
|
||||
type InclusionRule = InclExclRule
|
||||
final val InclusionRule = InclExclRule
|
||||
|
||||
import sbt.librarymanagement.{ Configurations => C }
|
||||
final val Compile = C.Compile
|
||||
|
|
|
|||
Loading…
Reference in New Issue