|
13 | 13 | import com.google.inject.Key; |
14 | 14 | import jakarta.inject.Inject; |
15 | 15 | import jakarta.inject.Singleton; |
16 | | -import java.util.function.Supplier; |
17 | 16 | import org.smoothbuild.common.collect.List; |
18 | 17 | import org.smoothbuild.common.collect.Maybe; |
19 | 18 | import org.smoothbuild.common.concurrent.MutablePromise; |
@@ -258,20 +257,19 @@ private static List<Promise<? extends Maybe<?>>> concatenate( |
258 | 257 |
|
259 | 258 | private class Execution<R> implements Runnable { |
260 | 259 | private final MutablePromise<Maybe<R>> result; |
261 | | - private final Supplier<Output<R>> taskResultSupplier; |
| 260 | + private final Task0<R> task; |
262 | 261 |
|
263 | | - private Execution(Supplier<Output<R>> taskResultSupplier) { |
264 | | - this.taskResultSupplier = taskResultSupplier; |
| 262 | + private Execution(Task0<R> task) { |
| 263 | + this.task = task; |
265 | 264 | this.result = promise(); |
266 | 265 | } |
267 | 266 |
|
268 | 267 | @Override |
269 | 268 | public void run() { |
270 | 269 | try { |
271 | | - var taskResult = taskResultSupplier.get(); |
272 | | - var report = taskResult.report(); |
273 | | - reporter.submit(report); |
274 | | - taskResult.result().addConsumer(result); |
| 270 | + var output = task.execute(); |
| 271 | + reporter.submit(output.report()); |
| 272 | + output.result().addConsumer(result); |
275 | 273 | } catch (Exception e) { |
276 | 274 | var fatal = fatal("Task execution failed with exception:", e); |
277 | 275 | reporter.submit(report(LABEL, list(fatal))); |
|
0 commit comments