すべてのsbtSetting[T]のマップ、またはすべての設定の依存関係と競合するコンテナーにアクセスするにはどうすればよいですか?
それらすべてとそれらの依存関係も印刷したいと思います。出力は次のようになります。
setting(ScopedKey(Scope(Select(ThisBuild),Global,Global,Global),managed-directory))
ScopedKey(Scope(Select(ThisBuild),Global,Global,Global),base-directory)
ScopedKey(Scope(Select(ThisBuild),Global,Global,Global),this-project)
...
以下は、これを行うために使用しているSBTビルド定義です。
this-project
キーがすべての設定に含まれているわけではありません。どこに保管されていますか?
import sbt._
import sbt.Logger
import Keys._
import PlayProject._
object TheBuild extends Build {
lazy val howItWorksProject = Project(
id = "howItWorks",
base = file("./modules/howItWorks")
)
val projDef: ProjectDefinition[_] = howItWorksProject
var count = 0
def printSettingsDependencies(setting: Setting[_], settings: Seq[Setting[_]], indent: String): Unit = {
println("debug printSettingsDependencies start" + (count+=1))
println(setting)
println("debug setting =" + setting)
println("debug setting.dependencies = " + setting.dependencies)
setting.dependencies.foreach {
n =>
println("debug it = " + n)
println("debug finding ...")
val settingOption = settings.find {
it =>
println("\t"+it.key.key.label + "?=" + n.key.label)
it.key.key.label == n.key.label
}
println("debug found = "+settingOption)
println(indent + settingOption)
printSettingsDependencies(settingOption.get, settings, indent + indent)
}
}
}
inspect this-project
出力:
> inspect this-project
[info] Setting: sbt.ResolvedProject = Project(id: howItWorks, base: C:\Users\pawel\workspace\kody\ria-template\modules\howItWorks, aggregate: List(), dependencies: List(), delegates: List(), configurations: List(compile, runtime, test, provided, optional))
[info] Description:
[info] Provides the current project for the referencing scope.
[info] Provided by:
[info] {file:/C:/Users/pawel/workspace/kody/ria-template/}howItWorks/*:this-project
[info] Reverse dependencies:
[info] *:ivy-configurations
[info] *:base-directory
[info] *:name
[info] Delegates:
[info] *:this-project
[info] {.}/*:this-project
[info] */*:this-project
inspect base-directory
出力:
> inspect base-directory
[info] Setting: java.io.File = C:\Users\pawel\workspace\kody\ria-template\modules\howItWorks
[info] Description:
[info] The base directory. Depending on the scope, this is the base directory for the build, project, configuration, or task.
[info] Provided by:
[info] {file:/C:/Users/pawel/workspace/kody/ria-template/}howItWorks/*:base-directory
[info] Dependencies:
[info] *:this-project
[info] Reverse dependencies:
[info] *:ivy-paths
[info] *:target
[info] *:unmanaged-base
[info] *:runner
[info] *:source-directory
[info] Delegates:
[info] *:base-directory
[info] {.}/*:base-directory
[info] */*:base-directory
[info] Related:
[info] {.}/*:base-directory
show sbt-version
> show sbt-version
[info] 0.11.3