mirror of https://github.com/sbt/sbt.git
include lintBuild as part of reload command
This commit is contained in:
parent
765c451832
commit
3a96ffa2cf
|
|
@ -833,10 +833,10 @@ object BuiltinCommands {
|
||||||
checkSBTVersionChanged(s0)
|
checkSBTVersionChanged(s0)
|
||||||
val (s1, base) = Project.loadAction(SessionVar.clear(s0), action)
|
val (s1, base) = Project.loadAction(SessionVar.clear(s0), action)
|
||||||
IO.createDirectory(base)
|
IO.createDirectory(base)
|
||||||
val s = if (s1 has Keys.stateCompilerCache) s1 else registerCompilerCache(s1)
|
val s2 = if (s1 has Keys.stateCompilerCache) s1 else registerCompilerCache(s1)
|
||||||
|
|
||||||
val (eval, structure) =
|
val (eval, structure) =
|
||||||
try Load.defaultLoad(s, base, s.log, Project.inPluginProject(s), Project.extraBuilds(s))
|
try Load.defaultLoad(s2, base, s2.log, Project.inPluginProject(s2), Project.extraBuilds(s2))
|
||||||
catch {
|
catch {
|
||||||
case ex: compiler.EvalException =>
|
case ex: compiler.EvalException =>
|
||||||
s0.log.debug(ex.getMessage)
|
s0.log.debug(ex.getMessage)
|
||||||
|
|
@ -846,12 +846,13 @@ object BuiltinCommands {
|
||||||
}
|
}
|
||||||
|
|
||||||
val session = Load.initialSession(structure, eval, s0)
|
val session = Load.initialSession(structure, eval, s0)
|
||||||
SessionSettings.checkSession(session, s)
|
SessionSettings.checkSession(session, s2)
|
||||||
addCacheStoreFactoryFactory(
|
val s3 = addCacheStoreFactoryFactory(
|
||||||
Project
|
Project
|
||||||
.setProject(session, structure, s)
|
.setProject(session, structure, s2)
|
||||||
.put(sbt.nio.Keys.hasCheckedMetaBuild, new AtomicBoolean(false))
|
.put(sbt.nio.Keys.hasCheckedMetaBuild, new AtomicBoolean(false))
|
||||||
)
|
)
|
||||||
|
LintBuild.lintBuildFunc(s3)
|
||||||
}
|
}
|
||||||
|
|
||||||
private val addCacheStoreFactoryFactory: State => State = (s: State) => {
|
private val addCacheStoreFactoryFactory: State => State = (s: State) => {
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,7 @@ object LintBuild {
|
||||||
lintBuild := lintBuildTask.evaluated,
|
lintBuild := lintBuildTask.evaluated,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// input task version of the lintBuild
|
||||||
def lintBuildTask: Def.Initialize[InputTask[Unit]] = Def.inputTask {
|
def lintBuildTask: Def.Initialize[InputTask[Unit]] = Def.inputTask {
|
||||||
val _ = Def.spaceDelimited().parsed // not used yet
|
val _ = Def.spaceDelimited().parsed // not used yet
|
||||||
val state = Keys.state.value
|
val state = Keys.state.value
|
||||||
|
|
@ -49,6 +50,17 @@ object LintBuild {
|
||||||
else lintResultLines(result) foreach { log.warn(_) }
|
else lintResultLines(result) foreach { log.warn(_) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// function version of the lintBuild, based on just state
|
||||||
|
def lintBuildFunc(s: State): State = {
|
||||||
|
val log = s.log
|
||||||
|
val extracted = Project.extract(s)
|
||||||
|
val includeKeys = extracted.get(includeLintKeys in Global) map { _.scopedKey.key.label }
|
||||||
|
val excludeKeys = extracted.get(excludeLintKeys in Global) map { _.scopedKey.key.label }
|
||||||
|
val result = lint(s, includeKeys, excludeKeys)
|
||||||
|
lintResultLines(result) foreach { log.warn(_) }
|
||||||
|
s
|
||||||
|
}
|
||||||
|
|
||||||
def lintResultLines(
|
def lintResultLines(
|
||||||
result: Seq[(ScopedKey[_], String, Vector[SourcePosition])]
|
result: Seq[(ScopedKey[_], String, Vector[SourcePosition])]
|
||||||
): Vector[String] = {
|
): Vector[String] = {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue