@ohos-ports/nx 23.3.0-beta.2 → 24.0.2-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -6
- package/dist/bin/nx.js +2 -2
- package/dist/bin/post-install.js +5 -3
- package/dist/nx-cloud-internals.d.ts +1 -0
- package/dist/nx-cloud-internals.js +7 -1
- package/dist/src/adapter/ngcli-adapter.js +2 -2
- package/dist/src/ai/clone-ai-config-repo.js +49 -12
- package/dist/src/command-line/add/add.d.ts +2 -0
- package/dist/src/command-line/add/add.js +23 -5
- package/dist/src/command-line/affected/affected.js +2 -2
- package/dist/src/command-line/configure-ai-agents/configure-ai-agents.js +0 -12
- package/dist/src/command-line/graph/graph.js +38 -10
- package/dist/src/command-line/init/command-object.js +0 -12
- package/dist/src/command-line/init/implementation/add-nx-to-nest.js +21 -62
- package/dist/src/command-line/init/init-v2.js +0 -2
- package/dist/src/command-line/migrate/agentic/close-agent-session.d.ts +1 -1
- package/dist/src/command-line/migrate/agentic/close-agent-session.js +4 -3
- package/dist/src/command-line/migrate/agentic/definitions.d.ts +1 -3
- package/dist/src/command-line/migrate/agentic/definitions.js +5 -97
- package/dist/src/command-line/migrate/agentic/handoff-gitignore.d.ts +7 -45
- package/dist/src/command-line/migrate/agentic/handoff-gitignore.js +9 -51
- package/dist/src/command-line/migrate/agentic/handoff.d.ts +1 -43
- package/dist/src/command-line/migrate/agentic/handoff.js +3 -119
- package/dist/src/command-line/migrate/agentic/instruction-files.d.ts +0 -21
- package/dist/src/command-line/migrate/agentic/instruction-files.js +6 -27
- package/dist/src/command-line/migrate/agentic/master/run-master-session.d.ts +19 -1
- package/dist/src/command-line/migrate/agentic/master/run-master-session.js +88 -49
- package/dist/src/command-line/migrate/agentic/master/spawn-master.d.ts +1 -0
- package/dist/src/command-line/migrate/agentic/master/spawn-master.js +86 -24
- package/dist/src/command-line/migrate/agentic/print-dropped-agent-context.d.ts +2 -2
- package/dist/src/command-line/migrate/agentic/print-dropped-agent-context.js +2 -2
- package/dist/src/command-line/migrate/agentic/prompts/fragments.d.ts +1 -12
- package/dist/src/command-line/migrate/agentic/prompts/fragments.js +8 -17
- package/dist/src/command-line/migrate/agentic/prompts/shared-rendering.d.ts +0 -15
- package/dist/src/command-line/migrate/agentic/prompts/shared-rendering.js +3 -100
- package/dist/src/command-line/migrate/agentic/select.d.ts +12 -6
- package/dist/src/command-line/migrate/agentic/select.js +38 -8
- package/dist/src/command-line/migrate/agentic/types.d.ts +9 -68
- package/dist/src/command-line/migrate/agentic/types.js +6 -8
- package/dist/src/command-line/migrate/command-object.js +6 -10
- package/dist/src/command-line/migrate/execute-migration.d.ts +6 -6
- package/dist/src/command-line/migrate/execute-migration.js +25 -15
- package/dist/src/command-line/migrate/migrate-analytics.d.ts +18 -1
- package/dist/src/command-line/migrate/migrate-analytics.js +38 -0
- package/dist/src/command-line/migrate/migrate-commits.d.ts +29 -17
- package/dist/src/command-line/migrate/migrate-commits.js +86 -32
- package/dist/src/command-line/migrate/migrate-config.d.ts +6 -6
- package/dist/src/command-line/migrate/migrate-config.js +12 -6
- package/dist/src/command-line/migrate/migrate-output.d.ts +1 -6
- package/dist/src/command-line/migrate/migrate-output.js +1 -10
- package/dist/src/command-line/migrate/migrate.d.ts +6 -30
- package/dist/src/command-line/migrate/migrate.js +257 -255
- package/dist/src/command-line/migrate/resolve-package-version.d.ts +2 -4
- package/dist/src/command-line/migrate/resolve-package-version.js +2 -35
- package/dist/src/command-line/migrate/run/agent-output.d.ts +2 -0
- package/dist/src/command-line/migrate/run/agent-output.js +9 -0
- package/dist/src/command-line/migrate/run/broker.d.ts +14 -5
- package/dist/src/command-line/migrate/run/broker.js +69 -21
- package/dist/src/command-line/migrate/run/clean-retry.js +4 -2
- package/dist/src/command-line/migrate/run/existing-run-report.d.ts +1 -1
- package/dist/src/command-line/migrate/run/existing-run-report.js +7 -5
- package/dist/src/command-line/migrate/run/give-up.d.ts +4 -3
- package/dist/src/command-line/migrate/run/give-up.js +8 -5
- package/dist/src/command-line/migrate/run/index.d.ts +7 -5
- package/dist/src/command-line/migrate/run/index.js +16 -1
- package/dist/src/command-line/migrate/run/issues.js +7 -2
- package/dist/src/command-line/migrate/run/orchestrator.d.ts +61 -4
- package/dist/src/command-line/migrate/run/orchestrator.js +397 -133
- package/dist/src/command-line/migrate/run/run-state.d.ts +17 -1
- package/dist/src/command-line/migrate/run/run-state.js +41 -2
- package/dist/src/command-line/migrate/run/runbook.d.ts +1 -0
- package/dist/src/command-line/migrate/run/runbook.js +115 -18
- package/dist/src/command-line/migrate/run/state-lock.d.ts +29 -4
- package/dist/src/command-line/migrate/run/state-lock.js +102 -10
- package/dist/src/command-line/migrate/run/state-machine.js +4 -1
- package/dist/src/command-line/migrate/run/util.d.ts +7 -2
- package/dist/src/command-line/migrate/run/util.js +30 -3
- package/dist/src/command-line/migrate/run/worker.d.ts +1 -1
- package/dist/src/command-line/migrate/run/worker.js +252 -250
- package/dist/src/command-line/migrate/sort-migrations.d.ts +1 -7
- package/dist/src/command-line/migrate/sort-migrations.js +1 -12
- package/dist/src/command-line/nx-cloud/connect/connect-to-nx-cloud.js +17 -12
- package/dist/src/command-line/release/changelog.js +9 -6
- package/dist/src/command-line/release/config/config.d.ts +1 -0
- package/dist/src/command-line/release/config/config.js +48 -9
- package/dist/src/command-line/release/release.js +2 -2
- package/dist/src/command-line/release/utils/git.js +8 -7
- package/dist/src/command-line/release/utils/interpolate-release-config.d.ts +6 -0
- package/dist/src/command-line/release/utils/interpolate-release-config.js +39 -0
- package/dist/src/command-line/release/utils/release-graph.d.ts +5 -0
- package/dist/src/command-line/release/utils/release-graph.js +1 -0
- package/dist/src/command-line/release/utils/remote-release-clients/github.js +5 -6
- package/dist/src/command-line/release/utils/remote-release-clients/gitlab.js +5 -6
- package/dist/src/command-line/release/utils/resolve-changelog-renderer.js +2 -2
- package/dist/src/command-line/release/utils/shared.js +10 -10
- package/dist/src/command-line/release/utils/version-plan-utils.d.ts +3 -12
- package/dist/src/command-line/release/utils/version-plan-utils.js +33 -55
- package/dist/src/command-line/release/version/version-actions.js +2 -1
- package/dist/src/command-line/release/version.js +5 -2
- package/dist/src/command-line/reset/reset.js +58 -62
- package/dist/src/command-line/run/executor-utils.js +1 -0
- package/dist/src/command-line/run/run-one.d.ts +20 -1
- package/dist/src/command-line/run/run-one.js +153 -5
- package/dist/src/command-line/run/run.js +2 -1
- package/dist/src/command-line/show/projects.js +5 -3
- package/dist/src/command-line/show/show-target/info.d.ts +10 -1
- package/dist/src/command-line/show/show-target/info.js +100 -15
- package/dist/src/command-line/show/show-target/inputs.js +10 -2
- package/dist/src/command-line/show/show-target/utils.js +1 -0
- package/dist/src/command-line/watch/command-object.js +3 -22
- package/dist/src/command-line/watch/watch.d.ts +0 -7
- package/dist/src/command-line/watch/watch.js +1 -1
- package/dist/src/command-line/yargs-utils/shared-options.js +1 -1
- package/dist/src/config/misc-interfaces.d.ts +18 -0
- package/dist/src/config/nx-json.d.ts +22 -11
- package/dist/src/config/task-graph.d.ts +1 -1
- package/dist/src/config/workspace-json-project-json.d.ts +88 -0
- package/dist/src/core/graph/main.js +1 -1
- package/dist/src/core/graph/runtime.js +1 -1
- package/dist/src/core/graph/styles.css +1 -1
- package/dist/src/core/graph/styles.js +1 -1
- package/dist/src/daemon/client/client.d.ts +15 -0
- package/dist/src/daemon/client/client.js +181 -71
- package/dist/src/daemon/client/daemon-socket-messenger.d.ts +1 -1
- package/dist/src/daemon/client/daemon-socket-messenger.js +2 -2
- package/dist/src/daemon/server/client-socket-context.js +1 -1
- package/dist/src/daemon/server/handle-process-in-background.js +21 -9
- package/dist/src/daemon/server/handle-select-affected-tasks.d.ts +2 -1
- package/dist/src/daemon/server/handle-select-affected-tasks.js +21 -13
- package/dist/src/daemon/server/native-js-loader.d.ts +1 -0
- package/dist/src/daemon/server/native-js-loader.js +21 -0
- package/dist/src/daemon/server/project-graph-incremental-recomputation.js +4 -8
- package/dist/src/daemon/server/server.d.ts +2 -1
- package/dist/src/daemon/server/server.js +17 -4
- package/dist/src/daemon/server/shutdown-utils.js +0 -3
- package/dist/src/daemon/server/start.d.ts +1 -0
- package/dist/src/daemon/server/start.js +2 -0
- package/dist/src/daemon/socket-utils.d.ts +11 -9
- package/dist/src/daemon/socket-utils.js +31 -61
- package/dist/src/daemon/tmp-dir.d.ts +19 -14
- package/dist/src/daemon/tmp-dir.js +142 -354
- package/dist/src/devkit-exports.d.ts +9 -1
- package/dist/src/devkit-exports.js +12 -1
- package/dist/src/devkit-internals.d.ts +6 -5
- package/dist/src/devkit-internals.js +13 -4
- package/dist/src/executors/run-commands/run-commands.impl.d.ts +4 -2
- package/dist/src/executors/run-commands/run-commands.impl.js +53 -27
- package/dist/src/executors/run-commands/running-tasks.d.ts +13 -4
- package/dist/src/executors/run-commands/running-tasks.js +148 -95
- package/dist/src/executors/run-commands/schema.json +1 -1
- package/dist/src/hasher/check-task-files.js +5 -8
- package/dist/src/hasher/file-hasher.js +9 -7
- package/dist/src/hasher/hash-task.js +4 -0
- package/dist/src/hasher/native-task-hasher-impl.js +3 -1
- package/dist/src/hasher/task-hasher.d.ts +2 -0
- package/dist/src/hasher/task-hasher.js +4 -1
- package/dist/src/migrations/update-23-2-0/set-cache-on-executor-target-defaults.d.ts +1 -2
- package/dist/src/migrations/update-23-2-0/set-cache-on-executor-target-defaults.js +6 -11
- package/dist/src/migrations/update-23-2-0/set-cache-on-executor-target-defaults.md +2 -2
- package/dist/src/migrations/update-24-0-0/enable-legacy-affected.d.ts +4 -0
- package/dist/src/migrations/update-24-0-0/enable-legacy-affected.js +15 -0
- package/dist/src/migrations/update-24-0-0/enable-legacy-affected.md +30 -0
- package/dist/src/migrations/update-24-0-0/find-custom-hashers.d.ts +3 -0
- package/dist/src/migrations/update-24-0-0/find-custom-hashers.js +100 -0
- package/dist/src/migrations/update-24-0-0/find-custom-hashers.md +63 -0
- package/dist/src/migrations/update-24-0-0/move-custom-hashers-to-inputs.md +146 -0
- package/dist/src/migrations/update-24-0-0/rename-ultracache-ignore-options.d.ts +3 -0
- package/dist/src/migrations/update-24-0-0/rename-ultracache-ignore-options.js +130 -0
- package/dist/src/migrations/update-24-0-0/rename-ultracache-ignore-options.md +62 -0
- package/dist/src/native/assert-supported-platform.js +1 -1
- package/dist/src/native/index.d.ts +238 -18
- package/dist/src/native/index.js +6 -1
- package/dist/src/native/native-bindings.js +15 -6
- package/dist/src/native/nx.openharmony-arm64.node +0 -0
- package/dist/src/native/nx.wasi-browser.js +1 -0
- package/dist/src/native/nx.wasi.cjs +1 -0
- package/dist/src/native/nx.wasm32-wasi.debug.wasm +0 -0
- package/dist/src/native/nx.wasm32-wasi.wasm +0 -0
- package/dist/src/nx-cloud/update-manager.d.ts +14 -0
- package/dist/src/nx-cloud/update-manager.js +237 -50
- package/dist/src/plugins/js/lock-file/pnpm-parser.js +3 -4
- package/dist/src/plugins/js/lock-file/pruned-output.d.ts +2 -2
- package/dist/src/plugins/js/lock-file/pruned-output.js +4 -4
- package/dist/src/plugins/js/utils/register.js +9 -4
- package/dist/src/project-graph/affected/affected-tasks.d.ts +9 -6
- package/dist/src/project-graph/affected/affected-tasks.js +31 -7
- package/dist/src/project-graph/plugins/isolation/isolated-plugin.js +7 -0
- package/dist/src/project-graph/plugins/loaded-nx-plugin.js +49 -6
- package/dist/src/project-graph/utils/project-configuration/target-merging.js +1 -1
- package/dist/src/project-graph/utils/project-configuration/target-normalization.js +12 -133
- package/dist/src/project-graph/utils/project-configuration-utils.js +2 -2
- package/dist/src/project-graph/utils/retrieve-workspace-files.js +27 -6
- package/dist/src/tasks-runner/create-task-graph.d.ts +8 -7
- package/dist/src/tasks-runner/create-task-graph.js +50 -27
- package/dist/src/tasks-runner/default-tasks-runner.js +1 -1
- package/dist/src/tasks-runner/init-tasks-runner.js +116 -59
- package/dist/src/tasks-runner/life-cycle.d.ts +4 -1
- package/dist/src/tasks-runner/life-cycle.js +7 -0
- package/dist/src/tasks-runner/life-cycles/performance-analysis.d.ts +5 -2
- package/dist/src/tasks-runner/life-cycles/performance-analysis.js +13 -7
- package/dist/src/tasks-runner/life-cycles/performance-life-cycle.d.ts +4 -3
- package/dist/src/tasks-runner/life-cycles/performance-life-cycle.js +9 -2
- package/dist/src/tasks-runner/life-cycles/static-run-many-terminal-output-life-cycle.js +5 -2
- package/dist/src/tasks-runner/life-cycles/static-run-one-terminal-output-life-cycle.js +4 -1
- package/dist/src/tasks-runner/life-cycles/summary-terminal-output-life-cycle.js +5 -1
- package/dist/src/tasks-runner/pseudo-ipc.d.ts +1 -0
- package/dist/src/tasks-runner/pseudo-ipc.js +4 -0
- package/dist/src/tasks-runner/pseudo-terminal.d.ts +1 -1
- package/dist/src/tasks-runner/pseudo-terminal.js +2 -2
- package/dist/src/tasks-runner/readiness/executor-ready-signal.d.ts +7 -0
- package/dist/src/tasks-runner/readiness/executor-ready-signal.js +43 -0
- package/dist/src/tasks-runner/readiness/probes.d.ts +14 -0
- package/dist/src/tasks-runner/readiness/probes.js +101 -0
- package/dist/src/tasks-runner/readiness/ready-signal-server.d.ts +18 -0
- package/dist/src/tasks-runner/readiness/ready-signal-server.js +72 -0
- package/dist/src/tasks-runner/readiness/ready-signal.d.ts +33 -0
- package/dist/src/tasks-runner/readiness/ready-signal.js +92 -0
- package/dist/src/tasks-runner/readiness/ready-when.d.ts +84 -0
- package/dist/src/tasks-runner/readiness/ready-when.js +371 -0
- package/dist/src/tasks-runner/readiness/startup-host.d.ts +1 -0
- package/dist/src/tasks-runner/readiness/startup-host.js +32 -0
- package/dist/src/tasks-runner/run-command.d.ts +6 -2
- package/dist/src/tasks-runner/run-command.js +21 -31
- package/dist/src/tasks-runner/run-outcome.d.ts +16 -0
- package/dist/src/tasks-runner/run-outcome.js +39 -0
- package/dist/src/tasks-runner/running-tasks/batch-process.js +6 -0
- package/dist/src/tasks-runner/running-tasks/node-child-process.js +5 -4
- package/dist/src/tasks-runner/running-tasks/running-task.d.ts +1 -1
- package/dist/src/tasks-runner/task-env.d.ts +10 -0
- package/dist/src/tasks-runner/task-env.js +37 -5
- package/dist/src/tasks-runner/task-graph-utils.d.ts +9 -6
- package/dist/src/tasks-runner/task-graph-utils.js +17 -12
- package/dist/src/tasks-runner/task-orchestrator.d.ts +62 -18
- package/dist/src/tasks-runner/task-orchestrator.js +750 -150
- package/dist/src/tasks-runner/tasks-runner.d.ts +1 -1
- package/dist/src/tasks-runner/tasks-schedule.d.ts +18 -1
- package/dist/src/tasks-runner/tasks-schedule.js +63 -6
- package/dist/src/tasks-runner/tokens.d.ts +54 -0
- package/dist/src/tasks-runner/tokens.js +161 -0
- package/dist/src/tasks-runner/utils.d.ts +35 -6
- package/dist/src/tasks-runner/utils.js +149 -68
- package/dist/src/ultracache/ci-status.d.ts +24 -0
- package/dist/src/ultracache/ci-status.js +87 -0
- package/dist/src/ultracache/config.d.ts +3 -3
- package/dist/src/ultracache/config.js +4 -4
- package/dist/src/ultracache/fetch.d.ts +2 -0
- package/dist/src/ultracache/fetch.js +1 -0
- package/dist/src/ultracache/overrides.js +4 -0
- package/dist/src/utils/acknowledge-build-scripts.d.ts +34 -1
- package/dist/src/utils/acknowledge-build-scripts.js +171 -32
- package/dist/src/utils/child-process.js +2 -1
- package/dist/src/utils/find-matching-projects.js +9 -6
- package/dist/src/utils/git-utils.d.ts +12 -5
- package/dist/src/utils/git-utils.js +69 -11
- package/dist/src/utils/long-running-target.d.ts +1 -3
- package/dist/src/utils/long-running-target.js +1 -3
- package/dist/src/utils/output.d.ts +4 -3
- package/dist/src/utils/output.js +4 -3
- package/dist/src/utils/owned-private-dir.d.ts +1 -17
- package/dist/src/utils/owned-private-dir.js +10 -62
- package/dist/src/utils/package-manager.d.ts +8 -0
- package/dist/src/utils/package-manager.js +65 -8
- package/dist/src/utils/perf-hooks.d.ts +1 -0
- package/dist/src/utils/plugins/core-plugins.js +5 -1
- package/dist/src/utils/progress-topics.d.ts +1 -0
- package/dist/src/utils/progress-topics.js +1 -0
- package/dist/src/utils/safe-spawn.js +1 -5
- package/dist/src/utils/shell-quoting.d.ts +8 -1
- package/dist/src/utils/shell-quoting.js +12 -1
- package/dist/src/utils/spawn-without-terminal.d.ts +27 -0
- package/dist/src/utils/spawn-without-terminal.js +110 -0
- package/dist/src/utils/string-similarity.d.ts +38 -0
- package/dist/src/utils/string-similarity.js +108 -0
- package/migrations.json +20 -6
- package/package.json +15 -24
- package/schemas/migrations-schema.json +11 -0
- package/schemas/nx-schema.json +133 -11
- package/schemas/project-schema.json +114 -4
- package/dist/src/command-line/migrate/agentic/prompts/generic-validation.d.ts +0 -56
- package/dist/src/command-line/migrate/agentic/prompts/generic-validation.js +0 -67
- package/dist/src/command-line/migrate/agentic/prompts/hybrid-prompt-migration.d.ts +0 -49
- package/dist/src/command-line/migrate/agentic/prompts/hybrid-prompt-migration.js +0 -53
- package/dist/src/command-line/migrate/agentic/prompts/prompt-migration.d.ts +0 -26
- package/dist/src/command-line/migrate/agentic/prompts/prompt-migration.js +0 -27
- package/dist/src/command-line/migrate/agentic/prompts/system-prompt.d.ts +0 -70
- package/dist/src/command-line/migrate/agentic/prompts/system-prompt.js +0 -113
- package/dist/src/command-line/migrate/agentic/run-step.d.ts +0 -68
- package/dist/src/command-line/migrate/agentic/run-step.js +0 -148
- package/dist/src/command-line/migrate/agentic/runner.d.ts +0 -21
- package/dist/src/command-line/migrate/agentic/runner.js +0 -262
- package/dist/src/migrations/update-23-0-0/consolidate-release-tag-config.d.ts +0 -9
- package/dist/src/migrations/update-23-0-0/consolidate-release-tag-config.js +0 -18
- package/dist/src/tasks-runner/legacy-depends-on-warning.d.ts +0 -18
- package/dist/src/tasks-runner/legacy-depends-on-warning.js +0 -109
|
@@ -24,7 +24,7 @@ export interface TaskSelection {
|
|
|
24
24
|
ultracacheConfigurationOutcome?: UltracacheConfigurationOutcome | null;
|
|
25
25
|
}
|
|
26
26
|
import { LifeCycle, TaskResult, TaskResults } from './life-cycle';
|
|
27
|
-
import { TasksRunner } from './tasks-runner';
|
|
27
|
+
import { TasksRunner, TaskStatus } from './tasks-runner';
|
|
28
28
|
/**
|
|
29
29
|
* `targets` on whole projects, as `run-many` runs them: every task of the
|
|
30
30
|
* projects' targets and what they depend on, with those tasks initiating.
|
|
@@ -43,6 +43,7 @@ export declare function runTasksForCommand(taskSelection: TaskSelection, current
|
|
|
43
43
|
loadDotEnvFiles: boolean;
|
|
44
44
|
}): Promise<{
|
|
45
45
|
taskResults: TaskResults;
|
|
46
|
+
taskStatuses?: Record<string, TaskStatus>;
|
|
46
47
|
completed: boolean;
|
|
47
48
|
}>;
|
|
48
49
|
export declare function setEnvVarsBasedOnArgs(nxArgs: NxArgs, loadDotEnvFiles: boolean): void;
|
|
@@ -60,7 +61,10 @@ export declare function invokeTasksRunner({ tasks, projectGraph, taskGraph, life
|
|
|
60
61
|
/** Already loaded for this command; `undefined` loads it here. */
|
|
61
62
|
ultracacheConfigurationOutcome?: UltracacheConfigurationOutcome | null;
|
|
62
63
|
}): Promise<{
|
|
63
|
-
|
|
64
|
+
taskResults: {
|
|
65
|
+
[id: string]: TaskResult;
|
|
66
|
+
};
|
|
67
|
+
taskStatuses?: Record<string, TaskStatus>;
|
|
64
68
|
}>;
|
|
65
69
|
export declare function constructLifeCycles(lifeCycle: LifeCycle, taskGraph: TaskGraph, nxJson?: NxJsonConfiguration, skipNxCache?: boolean): LifeCycle[];
|
|
66
70
|
/**
|
|
@@ -50,9 +50,10 @@ const task_results_life_cycle_1 = require("./life-cycles/task-results-life-cycle
|
|
|
50
50
|
const task_telemetry_life_cycle_1 = require("./life-cycles/task-telemetry-life-cycle");
|
|
51
51
|
const task_timings_life_cycle_1 = require("./life-cycles/task-timings-life-cycle");
|
|
52
52
|
const tui_summary_life_cycle_1 = require("./life-cycles/tui-summary-life-cycle");
|
|
53
|
+
const ready_when_1 = require("./readiness/ready-when");
|
|
53
54
|
const task_graph_utils_1 = require("./task-graph-utils");
|
|
54
55
|
const utils_1 = require("./utils");
|
|
55
|
-
const
|
|
56
|
+
const run_outcome_1 = require("./run-outcome");
|
|
56
57
|
const handle_import_1 = require("../utils/handle-import");
|
|
57
58
|
const pc = tslib_1.__importStar(require("picocolors"));
|
|
58
59
|
const originalStdoutWrite = process.stdout.write.bind(process.stdout);
|
|
@@ -80,7 +81,7 @@ const SYNC_SKIPPED_FIX_MESSAGE_LINES = [
|
|
|
80
81
|
'',
|
|
81
82
|
'Run `nx sync` (no flags) later to sync the workspace.',
|
|
82
83
|
];
|
|
83
|
-
async function getTerminalOutputLifeCycle(initiatingProject, initiatingTasks, projectNames, tasks, taskGraph, nxArgs, nxJson, overrides) {
|
|
84
|
+
async function getTerminalOutputLifeCycle(initiatingProject, initiatingTasks, projectNames, tasks, taskGraph, projectGraph, nxArgs, nxJson, overrides) {
|
|
84
85
|
const overridesWithoutHidden = { ...overrides };
|
|
85
86
|
delete overridesWithoutHidden['__overrides_unparsed__'];
|
|
86
87
|
const isRunOne = initiatingProject != null;
|
|
@@ -133,7 +134,7 @@ async function getTerminalOutputLifeCycle(initiatingProject, initiatingTasks, pr
|
|
|
133
134
|
pinnedTasks.push(mainTaskId);
|
|
134
135
|
const mainContinuousDependencies = taskGraph.continuousDependencies[mainTaskId];
|
|
135
136
|
if (mainContinuousDependencies.length > 0) {
|
|
136
|
-
pinnedTasks.push(mainContinuousDependencies[0]);
|
|
137
|
+
pinnedTasks.push(mainContinuousDependencies[0].id);
|
|
137
138
|
}
|
|
138
139
|
const [, target] = mainTaskId.split(':');
|
|
139
140
|
titleText = `1 ${target} task`;
|
|
@@ -179,7 +180,7 @@ async function getTerminalOutputLifeCycle(initiatingProject, initiatingTasks, pr
|
|
|
179
180
|
const lifeCycles = [tsLifeCycle];
|
|
180
181
|
// Only run the TUI if there are tasks to run
|
|
181
182
|
if (tasks.length > 0) {
|
|
182
|
-
appLifeCycle = new AppLifeCycle(tasks, initiatingTasks.map((t) => t.id), isRunOne ? 0 /* RunMode.RunOne */ : 1 /* RunMode.RunMany */, pinnedTasks, nxArgs ?? {}, nxJson.tui ?? {}, titleText, workspace_root_1.workspaceRoot, taskGraph, (0, nx_cloud_utils_1.isNxCloudUsed)(nxJson));
|
|
183
|
+
appLifeCycle = new AppLifeCycle(tasks, initiatingTasks.map((t) => t.id), isRunOne ? 0 /* RunMode.RunOne */ : 1 /* RunMode.RunMany */, pinnedTasks, nxArgs ?? {}, nxJson.tui ?? {}, titleText, workspace_root_1.workspaceRoot, taskGraph, (0, ready_when_1.getReadyDependencies)(taskGraph, projectGraph), (0, nx_cloud_utils_1.isNxCloudUsed)(nxJson));
|
|
183
184
|
// The native endCommand renders the perf report in the exit popup; the runner
|
|
184
185
|
// sources the payload and CompositeLifeCycle forwards it here.
|
|
185
186
|
lifeCycles.unshift(appLifeCycle);
|
|
@@ -361,19 +362,14 @@ async function runCommand(taskSelection, currentProjectGraph, { nxJson }, nxArgs
|
|
|
361
362
|
argv: process.argv,
|
|
362
363
|
});
|
|
363
364
|
const startTime = Date.now();
|
|
364
|
-
const { taskResults, completed } = await runTasksForCommand(taskSelection, currentProjectGraph, { nxJson }, {
|
|
365
|
+
const { taskResults, taskStatuses, completed } = await runTasksForCommand(taskSelection, currentProjectGraph, { nxJson }, {
|
|
365
366
|
...nxArgs,
|
|
366
367
|
skipNxCache: nxArgs.skipNxCache ||
|
|
367
368
|
process.env.NX_SKIP_NX_CACHE === 'true' ||
|
|
368
369
|
process.env.NX_DISABLE_NX_CACHE === 'true',
|
|
369
370
|
}, overrides, initiatingProject, extraTargetDependencies, extraOptions);
|
|
370
371
|
const endTime = Date.now();
|
|
371
|
-
const exitCode =
|
|
372
|
-
? (0, exit_codes_1.signalToCode)('SIGINT')
|
|
373
|
-
: Object.values(taskResults).some((taskResult) => taskResult.status === 'failure' ||
|
|
374
|
-
taskResult.status === 'skipped')
|
|
375
|
-
? 1
|
|
376
|
-
: 0;
|
|
372
|
+
const exitCode = (0, run_outcome_1.getRunExitCode)(completed, taskResults, taskStatuses);
|
|
377
373
|
await (0, tasks_execution_hooks_1.runPostTasksExecution)({
|
|
378
374
|
id,
|
|
379
375
|
taskResults,
|
|
@@ -401,9 +397,9 @@ async function runTasksForCommand(taskSelection, currentProjectGraph, { nxJson }
|
|
|
401
397
|
const projectNames = [
|
|
402
398
|
...new Set(initiatingTasks.map((t) => t.target.project)),
|
|
403
399
|
];
|
|
404
|
-
const { lifeCycle, renderIsDone, printSummary, restoreTerminal } = await getTerminalOutputLifeCycle(initiatingProject, initiatingTasks, projectNames, tasks, taskGraph, nxArgs, nxJson, overrides);
|
|
400
|
+
const { lifeCycle, renderIsDone, printSummary, restoreTerminal } = await getTerminalOutputLifeCycle(initiatingProject, initiatingTasks, projectNames, tasks, taskGraph, projectGraph, nxArgs, nxJson, overrides);
|
|
405
401
|
try {
|
|
406
|
-
const taskResults = await invokeTasksRunner({
|
|
402
|
+
const { taskResults, taskStatuses } = await invokeTasksRunner({
|
|
407
403
|
tasks,
|
|
408
404
|
projectGraph,
|
|
409
405
|
taskGraph,
|
|
@@ -426,7 +422,8 @@ async function runTasksForCommand(taskSelection, currentProjectGraph, { nxJson }
|
|
|
426
422
|
logger_1.logger.log((0, nx_key_1.createNxKeyLicenseeInformation)(nxKey));
|
|
427
423
|
return {
|
|
428
424
|
taskResults,
|
|
429
|
-
|
|
425
|
+
taskStatuses,
|
|
426
|
+
completed: (0, run_outcome_1.didCommandComplete)(tasks, taskResults, taskStatuses),
|
|
430
427
|
};
|
|
431
428
|
}
|
|
432
429
|
catch (e) {
|
|
@@ -458,19 +455,6 @@ async function printConfigureAiAgentsDisclaimer() {
|
|
|
458
455
|
// Silently ignore errors
|
|
459
456
|
}
|
|
460
457
|
}
|
|
461
|
-
function didCommandComplete(tasks, taskResults) {
|
|
462
|
-
if (tasks.length === 0)
|
|
463
|
-
return true;
|
|
464
|
-
for (const task of tasks) {
|
|
465
|
-
if (!task.continuous) {
|
|
466
|
-
// Discrete task must have a result (was started and finished)
|
|
467
|
-
if (!taskResults[task.id])
|
|
468
|
-
return false;
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
// Any stopped task means the run was interrupted
|
|
472
|
-
return !Object.values(taskResults).some((r) => r.status === 'stopped');
|
|
473
|
-
}
|
|
474
458
|
async function ensureWorkspaceIsInSyncAndGetGraphs(projectGraph, nxJson, nxArgs, overrides, extraTargetDependencies, extraOptions, taskSelection) {
|
|
475
459
|
let taskGraph = runValidations(projectGraph, taskSelection.taskGraph, nxArgs);
|
|
476
460
|
if (nxArgs.skipSync || (0, is_ci_1.isCI)()) {
|
|
@@ -719,7 +703,7 @@ async function invokeTasksRunner({ tasks, projectGraph, taskGraph, lifeCycle, nx
|
|
|
719
703
|
// this is used for two reasons: to fetch all remote cache hits AND
|
|
720
704
|
// to submit everything that is known in advance to Nx Cloud to run in
|
|
721
705
|
// a distributed fashion
|
|
722
|
-
const
|
|
706
|
+
const hashingDeferredTaskIds = await (0, hash_task_1.hashTasksThatDoNotDependOnOutputsOfOtherTasks)(hasher, projectGraph, taskGraph, nxJson, taskDetails, ultracacheConfigurations);
|
|
723
707
|
reportUltracacheConfigurations(ultracacheConfigurationOutcome, projectGraph, taskGraph, nxArgs);
|
|
724
708
|
const taskResultsLifecycle = new task_results_life_cycle_1.TaskResultsLifeCycle();
|
|
725
709
|
const compositedLifeCycle = new life_cycle_1.CompositeLifeCycle([
|
|
@@ -790,13 +774,19 @@ async function invokeTasksRunner({ tasks, projectGraph, taskGraph, lifeCycle, nx
|
|
|
790
774
|
},
|
|
791
775
|
},
|
|
792
776
|
daemon: client_1.daemonClient,
|
|
793
|
-
|
|
777
|
+
hashingDeferredTaskIds,
|
|
794
778
|
});
|
|
795
779
|
if (promiseOrObservable.subscribe) {
|
|
796
780
|
promiseOrObservable = convertObservableToPromise(promiseOrObservable);
|
|
797
781
|
}
|
|
798
|
-
await promiseOrObservable;
|
|
799
|
-
return
|
|
782
|
+
const taskStatuses = await promiseOrObservable;
|
|
783
|
+
return {
|
|
784
|
+
taskResults: taskResultsLifecycle.getTaskResults(),
|
|
785
|
+
// Custom runners are not guaranteed to resolve to a status map.
|
|
786
|
+
taskStatuses: taskStatuses && typeof taskStatuses === 'object'
|
|
787
|
+
? taskStatuses
|
|
788
|
+
: undefined,
|
|
789
|
+
};
|
|
800
790
|
}
|
|
801
791
|
function constructLifeCycles(lifeCycle, taskGraph, nxJson, skipNxCache) {
|
|
802
792
|
const lifeCycles = [];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Task } from '../config/task-graph';
|
|
2
|
+
import type { TaskResults } from './life-cycle';
|
|
3
|
+
import type { TaskStatus } from './tasks-runner';
|
|
4
|
+
/**
|
|
5
|
+
* Whether the run got to the end, as opposed to being interrupted.
|
|
6
|
+
*
|
|
7
|
+
* A discrete task skipped because a dependency failed has no `TaskResult`,
|
|
8
|
+
* but the runner still settled it, so it must not make the run look
|
|
9
|
+
* interrupted.
|
|
10
|
+
*/
|
|
11
|
+
export declare function didCommandComplete(tasks: Task[], taskResults: TaskResults, taskStatuses?: Record<string, TaskStatus>): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Exit code for a run: 130 (SIGINT) when it was interrupted, 1 when any task
|
|
14
|
+
* failed or was skipped, 0 otherwise.
|
|
15
|
+
*/
|
|
16
|
+
export declare function getRunExitCode(completed: boolean, taskResults: TaskResults, taskStatuses?: Record<string, TaskStatus>): number;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.didCommandComplete = didCommandComplete;
|
|
4
|
+
exports.getRunExitCode = getRunExitCode;
|
|
5
|
+
const exit_codes_1 = require("../utils/exit-codes");
|
|
6
|
+
/**
|
|
7
|
+
* Whether the run got to the end, as opposed to being interrupted.
|
|
8
|
+
*
|
|
9
|
+
* A discrete task skipped because a dependency failed has no `TaskResult`,
|
|
10
|
+
* but the runner still settled it, so it must not make the run look
|
|
11
|
+
* interrupted.
|
|
12
|
+
*/
|
|
13
|
+
function didCommandComplete(tasks, taskResults, taskStatuses) {
|
|
14
|
+
if (tasks.length === 0)
|
|
15
|
+
return true;
|
|
16
|
+
for (const task of tasks) {
|
|
17
|
+
if (!task.continuous) {
|
|
18
|
+
// Discrete task must have been settled by the runner
|
|
19
|
+
if (!taskResults[task.id] && !taskStatuses?.[task.id])
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
// Any stopped task means the run was interrupted
|
|
24
|
+
return (!Object.values(taskResults).some((r) => r.status === 'stopped') &&
|
|
25
|
+
!Object.values(taskStatuses ?? {}).some((s) => s === 'stopped'));
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Exit code for a run: 130 (SIGINT) when it was interrupted, 1 when any task
|
|
29
|
+
* failed or was skipped, 0 otherwise.
|
|
30
|
+
*/
|
|
31
|
+
function getRunExitCode(completed, taskResults, taskStatuses) {
|
|
32
|
+
if (!completed)
|
|
33
|
+
return (0, exit_codes_1.signalToCode)('SIGINT');
|
|
34
|
+
const failedOrSkipped = (status) => status === 'failure' || status === 'skipped';
|
|
35
|
+
return Object.values(taskResults).some((r) => failedOrSkipped(r.status)) ||
|
|
36
|
+
Object.values(taskStatuses ?? {}).some(failedOrSkipped)
|
|
37
|
+
? 1
|
|
38
|
+
: 0;
|
|
39
|
+
}
|
|
@@ -80,6 +80,12 @@ class BatchProcess {
|
|
|
80
80
|
for (const cb of this.batchResultsCallbacks) {
|
|
81
81
|
cb(message.results);
|
|
82
82
|
}
|
|
83
|
+
// The worker runs a single batch. Its IPC channel would otherwise
|
|
84
|
+
// keep it alive until cleanup kills it, which waits out the grace
|
|
85
|
+
// period on Windows, where SIGTERM is a no-op.
|
|
86
|
+
if (this.childProcess.connected) {
|
|
87
|
+
this.childProcess.disconnect();
|
|
88
|
+
}
|
|
83
89
|
break;
|
|
84
90
|
}
|
|
85
91
|
case batch_messages_1.BatchMessageType.RunTasks: {
|
|
@@ -14,6 +14,9 @@ class NodeChildProcessWithNonDirectOutput {
|
|
|
14
14
|
this.terminalOutputChunks = [];
|
|
15
15
|
this.exitCallbacks = [];
|
|
16
16
|
this.outputCallbacks = [];
|
|
17
|
+
// Decode as a stream so a code point split across chunks stays intact
|
|
18
|
+
this.childProcess.stdout.setEncoding('utf8');
|
|
19
|
+
this.childProcess.stderr.setEncoding('utf8');
|
|
17
20
|
if (streamOutput) {
|
|
18
21
|
if (process.env.NX_PREFIX_OUTPUT === 'true') {
|
|
19
22
|
const color = (0, output_prefix_1.getColor)(prefix);
|
|
@@ -54,16 +57,14 @@ class NodeChildProcessWithNonDirectOutput {
|
|
|
54
57
|
process.send(message);
|
|
55
58
|
}
|
|
56
59
|
});
|
|
57
|
-
this.childProcess.stdout.on('data', (
|
|
58
|
-
const output = chunk.toString();
|
|
60
|
+
this.childProcess.stdout.on('data', (output) => {
|
|
59
61
|
this.terminalOutputChunks.push(output);
|
|
60
62
|
// Stream output to TUI via callbacks
|
|
61
63
|
for (const cb of this.outputCallbacks) {
|
|
62
64
|
cb(output);
|
|
63
65
|
}
|
|
64
66
|
});
|
|
65
|
-
this.childProcess.stderr.on('data', (
|
|
66
|
-
const output = chunk.toString();
|
|
67
|
+
this.childProcess.stderr.on('data', (output) => {
|
|
67
68
|
this.terminalOutputChunks.push(output);
|
|
68
69
|
// Stream output to TUI via callbacks
|
|
69
70
|
for (const cb of this.outputCallbacks) {
|
|
@@ -6,6 +6,6 @@ export declare abstract class RunningTask {
|
|
|
6
6
|
}>;
|
|
7
7
|
abstract onExit(cb: (code: number) => void): void;
|
|
8
8
|
abstract kill(signal?: NodeJS.Signals): Promise<void> | void;
|
|
9
|
-
abstract onOutput?(cb: (output: string) => void): void;
|
|
9
|
+
abstract onOutput?(cb: (output: string, isCommandHeader?: boolean) => void): void;
|
|
10
10
|
abstract send?(message: Serializable): void;
|
|
11
11
|
}
|
|
@@ -37,6 +37,16 @@ export declare function getTaskSpecificEnv(task: Task, graph: ProjectGraph): Nod
|
|
|
37
37
|
*/
|
|
38
38
|
export declare function getGraphTimeDotEnvForTask(projectRoot: string, target: string, configuration?: string, nonAtomizedTarget?: string, baseEnv?: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
|
|
39
39
|
export declare function getEnvVariablesForTask(task: Task, taskSpecificEnv: NodeJS.ProcessEnv, forceColor: string, skipNxCache: boolean, captureStderr: boolean, outputPath: string, streamOutput: boolean): NodeJS.ProcessEnv;
|
|
40
|
+
/**
|
|
41
|
+
* Pids of the nx processes this one is nested inside, outermost first. Empty
|
|
42
|
+
* for a root invocation.
|
|
43
|
+
*/
|
|
44
|
+
export declare function getInvocationAncestorPids(): number[];
|
|
45
|
+
/**
|
|
46
|
+
* Pid of the outermost nx process in this tree, which is this process when it
|
|
47
|
+
* is the root.
|
|
48
|
+
*/
|
|
49
|
+
export declare function getInvocationRootPid(): number;
|
|
40
50
|
/**
|
|
41
51
|
* This function loads one or more .env files and expands the variables in them.
|
|
42
52
|
* When multiple files are provided, all files are loaded first, then variable
|
|
@@ -5,9 +5,12 @@ exports.getEnvVariablesForBatchProcess = getEnvVariablesForBatchProcess;
|
|
|
5
5
|
exports.getTaskSpecificEnv = getTaskSpecificEnv;
|
|
6
6
|
exports.getGraphTimeDotEnvForTask = getGraphTimeDotEnvForTask;
|
|
7
7
|
exports.getEnvVariablesForTask = getEnvVariablesForTask;
|
|
8
|
+
exports.getInvocationAncestorPids = getInvocationAncestorPids;
|
|
9
|
+
exports.getInvocationRootPid = getInvocationRootPid;
|
|
8
10
|
exports.loadAndExpandDotEnvFile = loadAndExpandDotEnvFile;
|
|
9
11
|
exports.unloadDotEnvFile = unloadDotEnvFile;
|
|
10
12
|
exports.getEnvFilesForTask = getEnvFilesForTask;
|
|
13
|
+
const ready_signal_1 = require("./readiness/ready-signal");
|
|
11
14
|
const dotenv_1 = require("dotenv");
|
|
12
15
|
const dotenv_expand_1 = require("dotenv-expand");
|
|
13
16
|
const node_path_1 = require("node:path");
|
|
@@ -39,6 +42,11 @@ function getEnvVariablesForBatchProcess(skipNxCache, captureStderr) {
|
|
|
39
42
|
};
|
|
40
43
|
// NX_ORIGINAL_FORCE_COLOR is an internal signal and should not leak into child processes
|
|
41
44
|
delete res.NX_ORIGINAL_FORCE_COLOR;
|
|
45
|
+
// The orchestrator sets these for the one task they are meant for, so an
|
|
46
|
+
// Nx run inside that task must not pass them on
|
|
47
|
+
delete res[ready_signal_1.READY_SIGNAL_SOCKET_ENV];
|
|
48
|
+
delete res[ready_signal_1.READY_SIGNAL_TASK_ENV];
|
|
49
|
+
delete res[ready_signal_1.READY_URL_ENV];
|
|
42
50
|
return res;
|
|
43
51
|
}
|
|
44
52
|
// The orchestrator now calls this eagerly during the coordinator pre-hash
|
|
@@ -121,6 +129,11 @@ function getEnvVariablesForTask(task, taskSpecificEnv, forceColor, skipNxCache,
|
|
|
121
129
|
// NX_ORIGINAL_FORCE_COLOR is an internal signal used by getForceColorForChild()
|
|
122
130
|
// and should not leak into child processes
|
|
123
131
|
delete res.NX_ORIGINAL_FORCE_COLOR;
|
|
132
|
+
// The orchestrator sets these for the one task they are meant for, so an
|
|
133
|
+
// Nx run inside that task must not pass them on
|
|
134
|
+
delete res[ready_signal_1.READY_SIGNAL_SOCKET_ENV];
|
|
135
|
+
delete res[ready_signal_1.READY_SIGNAL_TASK_ENV];
|
|
136
|
+
delete res[ready_signal_1.READY_URL_ENV];
|
|
124
137
|
return res;
|
|
125
138
|
}
|
|
126
139
|
function getNxEnvVariablesForForkedProcess(forceColor, skipNxCache, captureStderr, outputPath, streamOutput) {
|
|
@@ -128,6 +141,10 @@ function getNxEnvVariablesForForkedProcess(forceColor, skipNxCache, captureStder
|
|
|
128
141
|
FORCE_COLOR: forceColor,
|
|
129
142
|
NX_WORKSPACE_ROOT: workspace_root_1.workspaceRoot,
|
|
130
143
|
NX_SKIP_NX_CACHE: skipNxCache ? 'true' : undefined,
|
|
144
|
+
// pids of the forked process's ancestor nx processes, outermost first.
|
|
145
|
+
// Only an ancestor re-invoking a task is a loop — sibling nx processes
|
|
146
|
+
// running the same task are legitimate.
|
|
147
|
+
NX_INVOCATION_ANCESTOR_PIDS: appendAncestorPid(process.env.NX_INVOCATION_ANCESTOR_PIDS),
|
|
131
148
|
};
|
|
132
149
|
if (outputPath) {
|
|
133
150
|
env.NX_TERMINAL_OUTPUT_PATH = outputPath;
|
|
@@ -140,6 +157,26 @@ function getNxEnvVariablesForForkedProcess(forceColor, skipNxCache, captureStder
|
|
|
140
157
|
}
|
|
141
158
|
return env;
|
|
142
159
|
}
|
|
160
|
+
function appendAncestorPid(inherited) {
|
|
161
|
+
return inherited ? `${inherited},${process.pid}` : String(process.pid);
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Pids of the nx processes this one is nested inside, outermost first. Empty
|
|
165
|
+
* for a root invocation.
|
|
166
|
+
*/
|
|
167
|
+
function getInvocationAncestorPids() {
|
|
168
|
+
return (process.env.NX_INVOCATION_ANCESTOR_PIDS ?? '')
|
|
169
|
+
.split(',')
|
|
170
|
+
.map((pid) => Number(pid))
|
|
171
|
+
.filter((pid) => Number.isInteger(pid) && pid > 0);
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Pid of the outermost nx process in this tree, which is this process when it
|
|
175
|
+
* is the root.
|
|
176
|
+
*/
|
|
177
|
+
function getInvocationRootPid() {
|
|
178
|
+
return getInvocationAncestorPids()[0] ?? process.pid;
|
|
179
|
+
}
|
|
143
180
|
function getNxEnvVariablesForTask(task, forceColor, skipNxCache, captureStderr, outputPath, streamOutput) {
|
|
144
181
|
const env = {
|
|
145
182
|
NX_TASK_TARGET_PROJECT: task.target.project,
|
|
@@ -153,16 +190,11 @@ function getNxEnvVariablesForTask(task, forceColor, skipNxCache, captureStderr,
|
|
|
153
190
|
if (task.target.target === 'test') {
|
|
154
191
|
env.NX_TERMINAL_CAPTURE_STDERR = 'true';
|
|
155
192
|
}
|
|
156
|
-
// Pass the root Nx process PID to nested processes for DB-based loop detection.
|
|
157
|
-
// The root PID is used as a key in the task_invocations table to track which tasks
|
|
158
|
-
// have been invoked across nested Nx processes.
|
|
159
193
|
return {
|
|
160
194
|
...getNxEnvVariablesForForkedProcess(forceColor, skipNxCache, captureStderr, outputPath, streamOutput),
|
|
161
195
|
...env,
|
|
162
196
|
// Ensure the TUI does not get spawned within the TUI if ever tasks invoke Nx again
|
|
163
197
|
NX_TUI: 'false',
|
|
164
|
-
// tracks the root PID for child nx tasks, used to verify nx is infinitely recursing through the same tasks
|
|
165
|
-
NX_INVOCATION_ROOT_PID: process.env.NX_INVOCATION_ROOT_PID ?? String(process.pid),
|
|
166
198
|
};
|
|
167
199
|
}
|
|
168
200
|
/**
|
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
import { ProjectGraph } from '../config/project-graph';
|
|
2
|
-
import { TaskGraph } from '../config/task-graph';
|
|
2
|
+
import { TaskGraph, TaskGraphEdge } from '../config/task-graph';
|
|
3
|
+
/** Task graph edges, or the project ids of the command graph. */
|
|
4
|
+
type Edge = string | TaskGraphEdge;
|
|
3
5
|
/**
|
|
4
6
|
* This function finds a cycle in the graph.
|
|
5
7
|
* @returns the first cycle found, or null if no cycle is found.
|
|
6
8
|
*/
|
|
7
9
|
export declare function findCycle(graph: {
|
|
8
|
-
dependencies: Record<string,
|
|
9
|
-
continuousDependencies?: Record<string,
|
|
10
|
+
dependencies: Record<string, Edge[]>;
|
|
11
|
+
continuousDependencies?: Record<string, Edge[]>;
|
|
10
12
|
}): string[] | null;
|
|
11
13
|
/**
|
|
12
14
|
* This function finds all cycles in the graph.
|
|
13
15
|
* @returns a list of unique task ids in all cycles found, or null if no cycle is found.
|
|
14
16
|
*/
|
|
15
17
|
export declare function findCycles(graph: {
|
|
16
|
-
dependencies: Record<string,
|
|
17
|
-
continuousDependencies?: Record<string,
|
|
18
|
+
dependencies: Record<string, Edge[]>;
|
|
19
|
+
continuousDependencies?: Record<string, Edge[]>;
|
|
18
20
|
}): Set<string> | null;
|
|
19
21
|
export declare function makeAcyclic(graph: {
|
|
20
22
|
roots: string[];
|
|
21
|
-
dependencies: Record<string,
|
|
23
|
+
dependencies: Record<string, Edge[]>;
|
|
22
24
|
}): void;
|
|
23
25
|
export declare function validateNoAtomizedTasks(taskGraph: TaskGraph, projectGraph: ProjectGraph): void;
|
|
24
26
|
export declare function assertTaskGraphDoesNotContainInvalidTargets(taskGraph: TaskGraph): void;
|
|
@@ -28,3 +30,4 @@ export declare function getLeafTasks(taskGraph: TaskGraph): Set<string>;
|
|
|
28
30
|
* Considers both dependencies and continuousDependencies.
|
|
29
31
|
*/
|
|
30
32
|
export declare function walkTaskGraph(taskGraph: TaskGraph, walkFn: (rootTaskIds: string[]) => Promise<void>): Promise<void>;
|
|
33
|
+
export {};
|
|
@@ -8,6 +8,9 @@ exports.assertTaskGraphDoesNotContainInvalidTargets = assertTaskGraphDoesNotCont
|
|
|
8
8
|
exports.getLeafTasks = getLeafTasks;
|
|
9
9
|
exports.walkTaskGraph = walkTaskGraph;
|
|
10
10
|
const output_1 = require("../utils/output");
|
|
11
|
+
function edgeId(edge) {
|
|
12
|
+
return typeof edge === 'string' ? edge : edge.id;
|
|
13
|
+
}
|
|
11
14
|
function _findCycle(graph, id, visited, path) {
|
|
12
15
|
if (visited[id])
|
|
13
16
|
return null;
|
|
@@ -15,7 +18,7 @@ function _findCycle(graph, id, visited, path) {
|
|
|
15
18
|
for (const d of [
|
|
16
19
|
...graph.dependencies[id],
|
|
17
20
|
...(graph.continuousDependencies?.[id] ?? []),
|
|
18
|
-
]) {
|
|
21
|
+
].map(edgeId)) {
|
|
19
22
|
if (path.includes(d))
|
|
20
23
|
return [...path, d];
|
|
21
24
|
const cycle = _findCycle(graph, d, visited, [...path, d]);
|
|
@@ -64,13 +67,13 @@ function _makeAcyclic(graph, id, visited, path) {
|
|
|
64
67
|
visited[id] = true;
|
|
65
68
|
const deps = graph.dependencies[id];
|
|
66
69
|
const continuousDeps = graph.continuousDependencies?.[id] ?? [];
|
|
67
|
-
for (const d of [...deps, ...continuousDeps]) {
|
|
70
|
+
for (const d of [...deps, ...continuousDeps].map(edgeId)) {
|
|
68
71
|
if (path.includes(d)) {
|
|
69
|
-
const depsIdx = deps.
|
|
72
|
+
const depsIdx = deps.findIndex((edge) => edgeId(edge) === d);
|
|
70
73
|
if (depsIdx >= 0) {
|
|
71
74
|
deps.splice(depsIdx, 1);
|
|
72
75
|
}
|
|
73
|
-
const continuousIdx = continuousDeps.
|
|
76
|
+
const continuousIdx = continuousDeps.findIndex((edge) => edgeId(edge) === d);
|
|
74
77
|
if (continuousIdx >= 0) {
|
|
75
78
|
continuousDeps.splice(continuousIdx, 1);
|
|
76
79
|
}
|
|
@@ -131,7 +134,7 @@ function assertTaskGraphDoesNotContainInvalidTargets(taskGraph) {
|
|
|
131
134
|
taskGraph.continuousDependencies[task.id].length > 0) {
|
|
132
135
|
nonParallelTasksThatDependOnContinuousTasks.push(task);
|
|
133
136
|
}
|
|
134
|
-
for (const dependency of taskGraph.continuousDependencies[task.id]) {
|
|
137
|
+
for (const { id: dependency } of taskGraph.continuousDependencies[task.id]) {
|
|
135
138
|
if (taskGraph.tasks[dependency].parallelism === false) {
|
|
136
139
|
nonParallelContinuousTasksThatAreDependedOn.push(taskGraph.tasks[dependency]);
|
|
137
140
|
}
|
|
@@ -148,7 +151,9 @@ class NonParallelTaskDependsOnContinuousTasksError extends Error {
|
|
|
148
151
|
constructor(invalidTasks, taskGraph) {
|
|
149
152
|
let message = 'The following tasks do not support parallelism but depend on continuous tasks:';
|
|
150
153
|
for (const task of invalidTasks) {
|
|
151
|
-
message += `\n - ${task.id} -> ${taskGraph.continuousDependencies[task.id]
|
|
154
|
+
message += `\n - ${task.id} -> ${taskGraph.continuousDependencies[task.id]
|
|
155
|
+
.map((edge) => edge.id)
|
|
156
|
+
.join(', ')}`;
|
|
152
157
|
}
|
|
153
158
|
super(message);
|
|
154
159
|
this.invalidTasks = invalidTasks;
|
|
@@ -159,7 +164,7 @@ class DependingOnNonParallelContinuousTaskError extends Error {
|
|
|
159
164
|
constructor(invalidTasks, taskGraph) {
|
|
160
165
|
let message = 'The following continuous tasks do not support parallelism but are depended on:';
|
|
161
166
|
for (const task of invalidTasks) {
|
|
162
|
-
const dependents = Object.keys(taskGraph.continuousDependencies).filter((parentTaskId) => taskGraph.continuousDependencies[parentTaskId].
|
|
167
|
+
const dependents = Object.keys(taskGraph.continuousDependencies).filter((parentTaskId) => taskGraph.continuousDependencies[parentTaskId].some((edge) => edge.id === task.id));
|
|
163
168
|
message += `\n - ${task.id} <- ${dependents.join(', ')}`;
|
|
164
169
|
}
|
|
165
170
|
message +=
|
|
@@ -185,13 +190,13 @@ function reverseTaskGraph(taskGraph) {
|
|
|
185
190
|
dependencies: Object.fromEntries(Object.entries(taskGraph.tasks).map(([taskId]) => [taskId, []])),
|
|
186
191
|
};
|
|
187
192
|
for (const [taskId, dependencies] of Object.entries(taskGraph.dependencies)) {
|
|
188
|
-
for (const dependency of dependencies) {
|
|
189
|
-
reversed.dependencies[dependency].push(taskId);
|
|
193
|
+
for (const { id: dependency } of dependencies) {
|
|
194
|
+
reversed.dependencies[dependency].push({ id: taskId });
|
|
190
195
|
}
|
|
191
196
|
}
|
|
192
197
|
for (const [taskId, dependencies] of Object.entries(taskGraph.continuousDependencies)) {
|
|
193
|
-
for (const dependency of dependencies) {
|
|
194
|
-
reversed.dependencies[dependency].push(taskId);
|
|
198
|
+
for (const { id: dependency } of dependencies) {
|
|
199
|
+
reversed.dependencies[dependency].push({ id: taskId });
|
|
195
200
|
}
|
|
196
201
|
}
|
|
197
202
|
return reversed;
|
|
@@ -213,7 +218,7 @@ async function walkTaskGraph(taskGraph, walkFn) {
|
|
|
213
218
|
await walkFn(currentRoots);
|
|
214
219
|
const nextRoots = [];
|
|
215
220
|
for (const id of currentRoots) {
|
|
216
|
-
for (const depId of reversed.dependencies[id] ?? []) {
|
|
221
|
+
for (const { id: depId } of reversed.dependencies[id] ?? []) {
|
|
217
222
|
inDegree[depId]--;
|
|
218
223
|
if (inDegree[depId] === 0) {
|
|
219
224
|
nextRoots.push(depId);
|