Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(core): createTaskGraph should accept extraTargetDependencies #28542

Merged
merged 1 commit into from
Oct 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 6 additions & 23 deletions packages/nx/src/command-line/graph/graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,9 @@ import {
createProjectGraphAsync,
handleProjectGraphError,
} from '../../project-graph/project-graph';
import {
createTaskGraph,
mapTargetDefaultsToDependencies,
} from '../../tasks-runner/create-task-graph';
import { createTaskGraph } from '../../tasks-runner/create-task-graph';
import { allFileData } from '../../utils/all-file-data';
import { splitArgsIntoNxArgsAndOverrides } from '../../utils/command-line-utils';
import { NxJsonConfiguration } from '../../config/nx-json';
import { HashPlanner, transferProjectGraph } from '../../native';
import { transformProjectGraphForRust } from '../../native/transform-objects';
import { getAffectedGraphNodes } from '../affected/affected';
Expand Down Expand Up @@ -887,7 +883,7 @@ async function createTaskGraphClientResponse(
const nxJson = readNxJson();

performance.mark('task graph generation:start');
const taskGraphs = getAllTaskGraphsForWorkspace(nxJson, graph);
const taskGraphs = getAllTaskGraphsForWorkspace(graph);
performance.mark('task graph generation:end');

const planner = new HashPlanner(
Expand Down Expand Up @@ -957,17 +953,10 @@ async function createExpandedTaskInputResponse(
return response;
}

function getAllTaskGraphsForWorkspace(
nxJson: NxJsonConfiguration,
projectGraph: ProjectGraph
): {
function getAllTaskGraphsForWorkspace(projectGraph: ProjectGraph): {
taskGraphs: Record<string, TaskGraph>;
errors: Record<string, string>;
} {
const defaultDependencyConfigs = mapTargetDefaultsToDependencies(
nxJson.targetDefaults
);

const taskGraphs: Record<string, TaskGraph> = {};
const taskGraphErrors: Record<string, string> = {};

Expand All @@ -981,7 +970,7 @@ function getAllTaskGraphsForWorkspace(
try {
taskGraphs[taskId] = createTaskGraph(
projectGraph,
defaultDependencyConfigs,
{},
[projectName],
[target],
undefined,
Expand All @@ -1007,7 +996,7 @@ function getAllTaskGraphsForWorkspace(
try {
taskGraphs[taskId] = createTaskGraph(
projectGraph,
defaultDependencyConfigs,
{},
[projectName],
[target],
configuration,
Expand Down Expand Up @@ -1221,15 +1210,9 @@ async function createJsonOutput(
};

if (targets?.length) {
const nxJson = readNxJson();

const defaultDependencyConfigs = mapTargetDefaultsToDependencies(
nxJson.targetDefaults
);

const taskGraph = createTaskGraph(
rawGraph,
defaultDependencyConfigs,
{},
projects,
targets,
undefined,
Expand Down