Skip to content

Commit

Permalink
Fix issue where actions that fail on dependencies are not getting mar…
Browse files Browse the repository at this point in the history
…ked as complete
  • Loading branch information
sergiocampama committed Feb 21, 2021
1 parent c18e922 commit 180dd79
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 21 deletions.
20 changes: 10 additions & 10 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -51,44 +51,44 @@
"repositoryURL": "https://github.com/apple/swift-nio.git",
"state": {
"branch": null,
"revision": "43931b7a7daf8120a487601530c8bc03ce711992",
"version": "2.25.1"
"revision": "6d3ca7e54e06a69d0f2612c2ce8bb8b7319085a4",
"version": "2.26.0"
}
},
{
"package": "swift-nio-extras",
"repositoryURL": "https://github.com/apple/swift-nio-extras.git",
"state": {
"branch": null,
"revision": "e5b5d191a80667a14827bfeb0ae4a511f7677942",
"version": "1.7.0"
"revision": "de1c80ad1fdff1ba772bcef6b392c3ef735f39a6",
"version": "1.8.0"
}
},
{
"package": "swift-nio-http2",
"repositoryURL": "https://github.com/apple/swift-nio-http2.git",
"state": {
"branch": null,
"revision": "d4060ac4d056a48d946298f04968f6f6080cc618",
"version": "1.16.2"
"revision": "f4736a3b78a2bbe3feb7fc0f33f6683a8c27974c",
"version": "1.16.3"
}
},
{
"package": "swift-nio-ssl",
"repositoryURL": "https://github.com/apple/swift-nio-ssl.git",
"state": {
"branch": null,
"revision": "62bf5083df970e67c886210fa5b857eacf044b7c",
"version": "2.10.2"
"revision": "4c933e955b8797f5a5a90bd2a0fb411fdb11bb94",
"version": "2.10.3"
}
},
{
"package": "swift-nio-transport-services",
"repositoryURL": "https://github.com/apple/swift-nio-transport-services.git",
"state": {
"branch": null,
"revision": "5a352330c09a323e59ebd99afdf4ca3964c217bc",
"version": "1.9.1"
"revision": "1d28d48e071727f4558a8a4bb1894472abc47a58",
"version": "1.9.2"
}
},
{
Expand Down
27 changes: 16 additions & 11 deletions Sources/LLBBuildSystem/Functions/Execution/Action.swift
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,22 @@ final class ActionFunction: LLBBuildFunction<LLBActionKey, LLBActionValue> {
switch actionKey.actionType {
case let .command(commandKey):
ctx.buildEventDelegate?.actionScheduled(action: actionKey)
return evaluate(commandKey: commandKey, fi, ctx)
let resultFuture = evaluate(commandKey: commandKey, fi, ctx)
return LLBFuture.whenAllComplete([resultFuture], on: ctx.group.next()).flatMapThrowing { results in
switch results[0] {
case .success(let value):
ctx.buildEventDelegate?.actionCompleted(
action: actionKey,
result: .success(stdoutID: value.stdoutID)
)
case .failure(let error):
ctx.buildEventDelegate?.actionCompleted(
action: actionKey,
result: .failure(error: error)
)
}
return try results[0].get()
}
case let .mergeTrees(mergeTreesKey):
return evaluate(mergeTreesKey: mergeTreesKey, fi, ctx)
case .none:
Expand Down Expand Up @@ -158,17 +173,7 @@ final class ActionFunction: LLBBuildFunction<LLBActionKey, LLBActionValue> {
if actionExecutionValue.cachedFailure {
throw LLBActionExecutionError.actionExecutionError(actionExecutionValue.stdoutID)
}
ctx.buildEventDelegate?.actionCompleted(
action: actionExecutionKey,
result: .success(stdoutID: actionExecutionValue.stdoutID)
)
return LLBActionValue(actionExecutionValue: actionExecutionValue)
}.flatMapErrorThrowing { error in
ctx.buildEventDelegate?.actionCompleted(
action: actionExecutionKey,
result: .failure(error: error)
)
throw error
}
}
}
Expand Down

0 comments on commit 180dd79

Please sign in to comment.