Skip to content

Commit

Permalink
[FIX] Taskrunner: pass new taskutil options to determineRequiredDepen…
Browse files Browse the repository at this point in the history
…dencies hook
  • Loading branch information
flovogt committed Mar 30, 2023
1 parent 7ee6dde commit 94bcd99
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
14 changes: 8 additions & 6 deletions lib/build/TaskRunner.js
Original file line number Diff line number Diff line change
Expand Up @@ -302,13 +302,15 @@ class TaskRunner {
taskUtilInterface.getProject.bind(taskUtilInterface);
dependencyDeterminationParams.getDependencies =
taskUtilInterface.getDependencies.bind(taskUtilInterface);
dependencyDeterminationParams.options = {
projectName: project.getName(),
projectNamespace: project.getNamespace(),
configuration: taskDef.configuration,
taskName: newTaskName
};
}

dependencyDeterminationParams.options = {
projectName: project.getName(),
projectNamespace: project.getNamespace(),
configuration: taskDef.configuration,
taskName: newTaskName
};

requiredDependencies = await requiredDependenciesCallback(dependencyDeterminationParams);
if (!(requiredDependencies instanceof Set)) {
throw new Error(
Expand Down
8 changes: 7 additions & 1 deletion test/lib/build/TaskRunner.js
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,13 @@ test("Custom task with legacy spec version and requiredDependenciesCallback", as

t.is(requiredDependenciesCallbackStub.callCount, 1, "requiredDependenciesCallback got called once");
t.deepEqual(requiredDependenciesCallbackStub.getCall(0).args[0], {
availableDependencies: new Set(["dep.a", "dep.b"])
availableDependencies: new Set(["dep.a", "dep.b"]),
options: {
projectName: "project.b",
projectNamespace: "project/b",
configuration: "configuration",
taskName: "myTask"
}
}, "requiredDependenciesCallback got called with expected arguments");

const createDependencyReaderStub = sinon.stub(taskRunner, "_createDependenciesReader").resolves("dependencies");
Expand Down

0 comments on commit 94bcd99

Please sign in to comment.