mirror of https://github.com/sbt/sbt.git
Internal usage of inputTaskDyn
This commit is contained in:
parent
11cd58daa7
commit
711df2cbf2
|
|
@ -4705,22 +4705,20 @@ trait BuildExtra extends BuildCommon with DefExtra {
|
|||
baseArguments: String*
|
||||
): Vector[Setting[?]] = {
|
||||
Vector(
|
||||
scoped := Def
|
||||
.input(_ => Def.spaceDelimited())
|
||||
.flatMapTask { result =>
|
||||
initScoped(
|
||||
scoped.scopedKey,
|
||||
ClassLoaders.runner.mapReferenced(Project.mapScope(_.rescope(config))),
|
||||
).zipWith(Def.task {
|
||||
((config / fullClasspath).value, streams.value, fileConverter.value, result)
|
||||
}) { (rTask, t) =>
|
||||
(t, rTask) mapN { case ((cp, s, converter, args), r) =>
|
||||
given FileConverter = converter
|
||||
r.run(mainClass, cp.files, baseArguments ++ args, s.log).get
|
||||
}
|
||||
scoped := Def.inputTaskDyn {
|
||||
val result = Def.spaceDelimited().parsed
|
||||
initScoped(
|
||||
scoped.scopedKey,
|
||||
ClassLoaders.runner.mapReferenced(Project.mapScope(_.rescope(config))),
|
||||
).zipWith(Def.task {
|
||||
((config / fullClasspath).value, streams.value, fileConverter.value, result)
|
||||
}) { (rTask, t) =>
|
||||
(t, rTask) mapN { case ((cp, s, converter, args), r) =>
|
||||
given FileConverter = converter
|
||||
r.run(mainClass, cp.files, baseArguments ++ args, s.log).get
|
||||
}
|
||||
}
|
||||
.evaluated
|
||||
}.evaluated
|
||||
) ++ inTask(scoped)((config / forkOptions) := forkOptionsTask.value)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -747,13 +747,12 @@ object BuildServerProtocol {
|
|||
private inline def bspInputTask[T](
|
||||
inline taskImpl: (BspFullWorkspace, ScopeFilter) => T
|
||||
): Def.Initialize[InputTask[T]] =
|
||||
Def
|
||||
.input(_ => targetIdentifierParser)
|
||||
.flatMapTask { targets =>
|
||||
val workspace: BspFullWorkspace = bspFullWorkspace.value.filter(targets)
|
||||
val filter = ScopeFilter.in(workspace.scopes.values.toList)
|
||||
Def.task(taskImpl(workspace, filter))
|
||||
}
|
||||
Def.inputTaskDyn {
|
||||
val targets = targetIdentifierParser.parsed
|
||||
val workspace: BspFullWorkspace = bspFullWorkspace.value.filter(targets)
|
||||
val filter = ScopeFilter.in(workspace.scopes.values.toList)
|
||||
Def.task(taskImpl(workspace, filter))
|
||||
}
|
||||
|
||||
private def jvmEnvironmentItem(): Initialize[Task[JvmEnvironmentItem]] = Def.task {
|
||||
val target = Keys.bspTargetIdentifier.value
|
||||
|
|
@ -866,7 +865,8 @@ object BuildServerProtocol {
|
|||
.map(JsonParser.parseFromString)
|
||||
|
||||
private def bspRunTask: Def.Initialize[InputTask[Unit]] =
|
||||
Def.input(_ => jsonParser).flatMapTask { json =>
|
||||
Def.inputTaskDyn {
|
||||
val json = jsonParser.parsed
|
||||
val runParams = json.flatMap(Converter.fromJson[RunParams]).get
|
||||
val defaultClass = Keys.mainClass.value
|
||||
val defaultJvmOptions = Keys.javaOptions.value
|
||||
|
|
@ -909,7 +909,8 @@ object BuildServerProtocol {
|
|||
}
|
||||
|
||||
private def bspTestTask: Def.Initialize[InputTask[Unit]] =
|
||||
Def.input(_ => jsonParser).flatMapTask { json =>
|
||||
Def.inputTaskDyn {
|
||||
val json = jsonParser.parsed
|
||||
val testParams = json.flatMap(Converter.fromJson[TestParams]).get
|
||||
val workspace = bspFullWorkspace.value
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue