mirror of https://github.com/sbt/sbt.git
Merge pull request #3994 from fmlrt/in_configuration_scope_filter_factories
Add more configuration axis ScopeFilter factory methods
This commit is contained in:
commit
a85d7606f3
|
|
@ -2709,6 +2709,17 @@ object Classpaths {
|
||||||
visit(projectRef, conf)
|
visit(projectRef, conf)
|
||||||
visited.toSeq
|
visited.toSeq
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def interSortConfigurations(
|
||||||
|
projectRef: ProjectRef,
|
||||||
|
conf: Configuration,
|
||||||
|
data: Settings[Scope],
|
||||||
|
deps: BuildDependencies
|
||||||
|
): Seq[(ProjectRef, ConfigRef)] =
|
||||||
|
interSort(projectRef, conf, data, deps).map {
|
||||||
|
case (projectRef, configName) => (projectRef, ConfigRef(configName))
|
||||||
|
}
|
||||||
|
|
||||||
private[sbt] def unmanagedDependencies0(projectRef: ProjectRef,
|
private[sbt] def unmanagedDependencies0(projectRef: ProjectRef,
|
||||||
conf: Configuration,
|
conf: Configuration,
|
||||||
data: Settings[Scope],
|
data: Settings[Scope],
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ package sbt
|
||||||
import sbt.internal.{ Load, LoadedBuildUnit }
|
import sbt.internal.{ Load, LoadedBuildUnit }
|
||||||
import sbt.internal.util.{ AttributeKey, Dag, Types }
|
import sbt.internal.util.{ AttributeKey, Dag, Types }
|
||||||
|
|
||||||
import sbt.librarymanagement.Configuration
|
import sbt.librarymanagement.{ Configuration, ConfigRef }
|
||||||
|
|
||||||
import Types.const
|
import Types.const
|
||||||
import Def.Initialize
|
import Def.Initialize
|
||||||
|
|
@ -154,6 +154,16 @@ object ScopeFilter {
|
||||||
selectAxis[ConfigKey](const(c => cs(c.name)))
|
selectAxis[ConfigKey](const(c => cs(c.name)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def inConfigurationsByKeys(keys: ConfigKey*): ConfigurationFilter = {
|
||||||
|
val cs = keys.toSet
|
||||||
|
selectAxis[ConfigKey](const(cs))
|
||||||
|
}
|
||||||
|
|
||||||
|
def inConfigurationsByRefs(refs: ConfigRef*): ConfigurationFilter = {
|
||||||
|
val cs = refs.map(r => ConfigKey(r.name)).toSet
|
||||||
|
selectAxis[ConfigKey](const(cs))
|
||||||
|
}
|
||||||
|
|
||||||
implicit def settingKeyAll[T](key: Initialize[T]): SettingKeyAll[T] = new SettingKeyAll[T](key)
|
implicit def settingKeyAll[T](key: Initialize[T]): SettingKeyAll[T] = new SettingKeyAll[T](key)
|
||||||
implicit def taskKeyAll[T](key: Initialize[Task[T]]): TaskKeyAll[T] = new TaskKeyAll[T](key)
|
implicit def taskKeyAll[T](key: Initialize[Task[T]]): TaskKeyAll[T] = new TaskKeyAll[T](key)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
### Improvements
|
||||||
|
|
||||||
|
- Adds factory methods for Configuration axis scope filters
|
||||||
|
|
||||||
|
### More ways to create ScopeFilter for Configuration axis
|
||||||
|
|
||||||
|
To create configuration axis `ScopeFilter` one has to provide actual configurations
|
||||||
|
to filter by. However it's not always possible to get hold of one. For example
|
||||||
|
`Classpaths.interSort` returns configuration names.
|
||||||
|
For cases like that there are now `inConfigurationsByKeys` and `inConfigurationsByRefs` to create `ScopeFilter`'s
|
||||||
Loading…
Reference in New Issue