Skip to content

Commit

Permalink
fix(core): create different dummy tasks for different parent tasks an… (
Browse files Browse the repository at this point in the history
#28923)

…d dependency targets

<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

Dummy tasks are given an ID containing the parent task's target.
Multiple parent tasks can create the same dummy task which overrides
other dummy tasks.

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

Dummy tasks are given an ID containing the dependency and the parent
tasks's name. This means different parent tasks will create different
dummy tasks instead of overriding other ones.

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #

(cherry picked from commit 7f4fc50)
  • Loading branch information
FrozenPandaz committed Nov 13, 2024
1 parent c1f068e commit 3d0568d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/nx/src/tasks-runner/create-task-graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,13 @@ export class ProcessTasks {
);
}
} else {
// Create a dummy task for task.target.project... which simulates if depProject had dependencyConfig.target
const dummyId = this.getId(
depProject.name,
task.target.target + DUMMY_TASK_TARGET,
task.target.project +
'__' +
dependencyConfig.target +
DUMMY_TASK_TARGET,
undefined
);
this.dependencies[task.id].push(dummyId);
Expand Down

0 comments on commit 3d0568d

Please sign in to comment.