@convesoft/nx-rust 0.0.0-stage → 1.0.0-rc.1
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/LICENSE-APACHE +201 -0
- package/LICENSE-MIT +21 -0
- package/README.md +48 -2
- package/executors.json +35 -0
- package/generators.json +19 -0
- package/package.json +26 -4
- package/src/cargo/build-settings.d.ts +54 -0
- package/src/cargo/build-settings.js +93 -0
- package/src/cargo/build-settings.js.map +1 -0
- package/src/cargo/configured-runner.d.ts +36 -0
- package/src/cargo/configured-runner.js +99 -0
- package/src/cargo/configured-runner.js.map +1 -0
- package/src/cargo/configured-tools.d.ts +35 -0
- package/src/cargo/configured-tools.js +46 -0
- package/src/cargo/configured-tools.js.map +1 -0
- package/src/cargo/dep-info-basedir.d.ts +18 -0
- package/src/cargo/dep-info-basedir.js +38 -0
- package/src/cargo/dep-info-basedir.js.map +1 -0
- package/src/cargo/directories.d.ts +40 -0
- package/src/cargo/directories.js +89 -0
- package/src/cargo/directories.js.map +1 -0
- package/src/cargo/host-triple.d.ts +7 -0
- package/src/cargo/host-triple.js +21 -0
- package/src/cargo/host-triple.js.map +1 -0
- package/src/cargo/lockfile.d.ts +63 -0
- package/src/cargo/lockfile.js +157 -0
- package/src/cargo/lockfile.js.map +1 -0
- package/src/cargo/metadata.d.ts +112 -0
- package/src/cargo/metadata.js +37 -0
- package/src/cargo/metadata.js.map +1 -0
- package/src/cargo/package-specs.d.ts +54 -0
- package/src/cargo/package-specs.js +109 -0
- package/src/cargo/package-specs.js.map +1 -0
- package/src/cargo/paths-crates.d.ts +27 -0
- package/src/cargo/paths-crates.js +69 -0
- package/src/cargo/paths-crates.js.map +1 -0
- package/src/cargo/print-artifact-folders.d.ts +1 -0
- package/src/cargo/print-artifact-folders.js +58 -0
- package/src/cargo/print-artifact-folders.js.map +1 -0
- package/src/cargo/redirections.d.ts +87 -0
- package/src/cargo/redirections.js +195 -0
- package/src/cargo/redirections.js.map +1 -0
- package/src/cargo/run-cargo.d.ts +31 -0
- package/src/cargo/run-cargo.js +75 -0
- package/src/cargo/run-cargo.js.map +1 -0
- package/src/cargo/target-triples.d.ts +98 -0
- package/src/cargo/target-triples.js +265 -0
- package/src/cargo/target-triples.js.map +1 -0
- package/src/cargo/version-req.d.ts +12 -0
- package/src/cargo/version-req.js +122 -0
- package/src/cargo/version-req.js.map +1 -0
- package/src/compatibility/cargo-version.d.ts +43 -0
- package/src/compatibility/cargo-version.js +83 -0
- package/src/compatibility/cargo-version.js.map +1 -0
- package/src/compatibility/nx-bridge.d.ts +312 -0
- package/src/compatibility/nx-bridge.js +407 -0
- package/src/compatibility/nx-bridge.js.map +1 -0
- package/src/compatibility/nx-version.d.ts +104 -0
- package/src/compatibility/nx-version.js +272 -0
- package/src/compatibility/nx-version.js.map +1 -0
- package/src/executors/affected-inputs.d.ts +29 -0
- package/src/executors/affected-inputs.js +259 -0
- package/src/executors/affected-inputs.js.map +1 -0
- package/src/executors/affected-run.d.ts +54 -0
- package/src/executors/affected-run.js +394 -0
- package/src/executors/affected-run.js.map +1 -0
- package/src/executors/affected.d.ts +239 -0
- package/src/executors/affected.js +589 -0
- package/src/executors/affected.js.map +1 -0
- package/src/executors/baseline-context.d.ts +85 -0
- package/src/executors/baseline-context.js +227 -0
- package/src/executors/baseline-context.js.map +1 -0
- package/src/executors/baseline.d.ts +123 -0
- package/src/executors/baseline.js +356 -0
- package/src/executors/baseline.js.map +1 -0
- package/src/executors/batch.d.ts +75 -0
- package/src/executors/batch.js +434 -0
- package/src/executors/batch.js.map +1 -0
- package/src/executors/build-records.d.ts +110 -0
- package/src/executors/build-records.js +267 -0
- package/src/executors/build-records.js.map +1 -0
- package/src/executors/cargo/executor.d.ts +28 -0
- package/src/executors/cargo/executor.js +58 -0
- package/src/executors/cargo/executor.js.map +1 -0
- package/src/executors/cargo/schema.json +54 -0
- package/src/executors/cargo-invocation.d.ts +81 -0
- package/src/executors/cargo-invocation.js +109 -0
- package/src/executors/cargo-invocation.js.map +1 -0
- package/src/executors/cargo-output.d.ts +212 -0
- package/src/executors/cargo-output.js +646 -0
- package/src/executors/cargo-output.js.map +1 -0
- package/src/executors/command.d.ts +318 -0
- package/src/executors/command.js +517 -0
- package/src/executors/command.js.map +1 -0
- package/src/executors/coverage-baseline.d.ts +23 -0
- package/src/executors/coverage-baseline.js +284 -0
- package/src/executors/coverage-baseline.js.map +1 -0
- package/src/executors/declared-options.d.ts +21 -0
- package/src/executors/declared-options.js +58 -0
- package/src/executors/declared-options.js.map +1 -0
- package/src/executors/digests.d.ts +94 -0
- package/src/executors/digests.js +190 -0
- package/src/executors/digests.js.map +1 -0
- package/src/executors/dotenv-check.d.ts +79 -0
- package/src/executors/dotenv-check.js +553 -0
- package/src/executors/dotenv-check.js.map +1 -0
- package/src/executors/group-invocations.d.ts +80 -0
- package/src/executors/group-invocations.js +253 -0
- package/src/executors/group-invocations.js.map +1 -0
- package/src/executors/group-run.d.ts +114 -0
- package/src/executors/group-run.js +591 -0
- package/src/executors/group-run.js.map +1 -0
- package/src/executors/groups.d.ts +113 -0
- package/src/executors/groups.js +285 -0
- package/src/executors/groups.js.map +1 -0
- package/src/executors/input-check.d.ts +52 -0
- package/src/executors/input-check.js +271 -0
- package/src/executors/input-check.js.map +1 -0
- package/src/executors/kept-files.d.ts +98 -0
- package/src/executors/kept-files.js +341 -0
- package/src/executors/kept-files.js.map +1 -0
- package/src/executors/lockfile/executor.d.ts +16 -0
- package/src/executors/lockfile/executor.js +37 -0
- package/src/executors/lockfile/executor.js.map +1 -0
- package/src/executors/lockfile/schema.json +50 -0
- package/src/executors/napi-build.d.ts +73 -0
- package/src/executors/napi-build.js +420 -0
- package/src/executors/napi-build.js.map +1 -0
- package/src/executors/nextest.d.ts +185 -0
- package/src/executors/nextest.js +498 -0
- package/src/executors/nextest.js.map +1 -0
- package/src/executors/nx-command.d.ts +95 -0
- package/src/executors/nx-command.js +205 -0
- package/src/executors/nx-command.js.map +1 -0
- package/src/executors/nx-task-files.d.ts +82 -0
- package/src/executors/nx-task-files.js +156 -0
- package/src/executors/nx-task-files.js.map +1 -0
- package/src/executors/print-test-mode.d.ts +1 -0
- package/src/executors/print-test-mode.js +25 -0
- package/src/executors/print-test-mode.js.map +1 -0
- package/src/executors/release-publish/executor.d.ts +24 -0
- package/src/executors/release-publish/executor.js +165 -0
- package/src/executors/release-publish/executor.js.map +1 -0
- package/src/executors/release-publish/schema.json +30 -0
- package/src/executors/run/executor.d.ts +12 -0
- package/src/executors/run/executor.js +27 -0
- package/src/executors/run/executor.js.map +1 -0
- package/src/executors/run/schema.json +45 -0
- package/src/executors/runner-script.d.ts +12 -0
- package/src/executors/runner-script.js +22 -0
- package/src/executors/runner-script.js.map +1 -0
- package/src/executors/runtime-input-check.d.ts +24 -0
- package/src/executors/runtime-input-check.js +87 -0
- package/src/executors/runtime-input-check.js.map +1 -0
- package/src/executors/shared-artifacts.d.ts +44 -0
- package/src/executors/shared-artifacts.js +132 -0
- package/src/executors/shared-artifacts.js.map +1 -0
- package/src/executors/split-words.d.ts +24 -0
- package/src/executors/split-words.js +111 -0
- package/src/executors/split-words.js.map +1 -0
- package/src/executors/stage.d.ts +163 -0
- package/src/executors/stage.js +526 -0
- package/src/executors/stage.js.map +1 -0
- package/src/executors/staged-run.d.ts +24 -0
- package/src/executors/staged-run.js +110 -0
- package/src/executors/staged-run.js.map +1 -0
- package/src/executors/task-env.d.ts +271 -0
- package/src/executors/task-env.js +494 -0
- package/src/executors/task-env.js.map +1 -0
- package/src/executors/task-execution.d.ts +61 -0
- package/src/executors/task-execution.js +122 -0
- package/src/executors/task-execution.js.map +1 -0
- package/src/executors/task-guards.d.ts +112 -0
- package/src/executors/task-guards.js +430 -0
- package/src/executors/task-guards.js.map +1 -0
- package/src/executors/task-options.d.ts +114 -0
- package/src/executors/task-options.js +258 -0
- package/src/executors/task-options.js.map +1 -0
- package/src/executors/task.d.ts +166 -0
- package/src/executors/task.js +520 -0
- package/src/executors/task.js.map +1 -0
- package/src/executors/test-mode.d.ts +182 -0
- package/src/executors/test-mode.js +391 -0
- package/src/executors/test-mode.js.map +1 -0
- package/src/executors/test-runner.d.ts +44 -0
- package/src/executors/test-runner.js +159 -0
- package/src/executors/test-runner.js.map +1 -0
- package/src/executors/test-steps.d.ts +109 -0
- package/src/executors/test-steps.js +535 -0
- package/src/executors/test-steps.js.map +1 -0
- package/src/executors/wasm-build.d.ts +56 -0
- package/src/executors/wasm-build.js +216 -0
- package/src/executors/wasm-build.js.map +1 -0
- package/src/generators/crate/binary.schema.json +28 -0
- package/src/generators/crate/crate.d.ts +24 -0
- package/src/generators/crate/crate.js +108 -0
- package/src/generators/crate/crate.js.map +1 -0
- package/src/generators/crate/enclosing-workspace.d.ts +25 -0
- package/src/generators/crate/enclosing-workspace.js +58 -0
- package/src/generators/crate/enclosing-workspace.js.map +1 -0
- package/src/generators/crate/library.schema.json +28 -0
- package/src/generators/init/graph-check.d.ts +81 -0
- package/src/generators/init/graph-check.js +299 -0
- package/src/generators/init/graph-check.js.map +1 -0
- package/src/generators/init/init.d.ts +23 -0
- package/src/generators/init/init.js +113 -0
- package/src/generators/init/init.js.map +1 -0
- package/src/generators/init/report.d.ts +19 -0
- package/src/generators/init/report.js +93 -0
- package/src/generators/init/report.js.map +1 -0
- package/src/generators/init/schema.json +9 -0
- package/src/graph/artifact-kinds.d.ts +29 -0
- package/src/graph/artifact-kinds.js +50 -0
- package/src/graph/artifact-kinds.js.map +1 -0
- package/src/graph/artifact-names.d.ts +97 -0
- package/src/graph/artifact-names.js +276 -0
- package/src/graph/artifact-names.js.map +1 -0
- package/src/graph/build-records.d.ts +74 -0
- package/src/graph/build-records.js +104 -0
- package/src/graph/build-records.js.map +1 -0
- package/src/graph/caching.d.ts +148 -0
- package/src/graph/caching.js +676 -0
- package/src/graph/caching.js.map +1 -0
- package/src/graph/collisions.d.ts +106 -0
- package/src/graph/collisions.js +156 -0
- package/src/graph/collisions.js.map +1 -0
- package/src/graph/computation-reports.d.ts +89 -0
- package/src/graph/computation-reports.js +216 -0
- package/src/graph/computation-reports.js.map +1 -0
- package/src/graph/declared-files.d.ts +190 -0
- package/src/graph/declared-files.js +600 -0
- package/src/graph/declared-files.js.map +1 -0
- package/src/graph/discovery.d.ts +175 -0
- package/src/graph/discovery.js +656 -0
- package/src/graph/discovery.js.map +1 -0
- package/src/graph/edges.d.ts +25 -0
- package/src/graph/edges.js +94 -0
- package/src/graph/edges.js.map +1 -0
- package/src/graph/entries.d.ts +83 -0
- package/src/graph/entries.js +259 -0
- package/src/graph/entries.js.map +1 -0
- package/src/graph/inputs.d.ts +420 -0
- package/src/graph/inputs.js +746 -0
- package/src/graph/inputs.js.map +1 -0
- package/src/graph/lockfile-task.d.ts +74 -0
- package/src/graph/lockfile-task.js +105 -0
- package/src/graph/lockfile-task.js.map +1 -0
- package/src/graph/names.d.ts +41 -0
- package/src/graph/names.js +34 -0
- package/src/graph/names.js.map +1 -0
- package/src/graph/napi.d.ts +107 -0
- package/src/graph/napi.js +206 -0
- package/src/graph/napi.js.map +1 -0
- package/src/graph/nx-glob.d.ts +36 -0
- package/src/graph/nx-glob.js +152 -0
- package/src/graph/nx-glob.js.map +1 -0
- package/src/graph/nx-internals.d.ts +57 -0
- package/src/graph/nx-internals.js +128 -0
- package/src/graph/nx-internals.js.map +1 -0
- package/src/graph/options.d.ts +32 -0
- package/src/graph/options.js +80 -0
- package/src/graph/options.js.map +1 -0
- package/src/graph/outputs.d.ts +75 -0
- package/src/graph/outputs.js +140 -0
- package/src/graph/outputs.js.map +1 -0
- package/src/graph/path-dependencies.d.ts +122 -0
- package/src/graph/path-dependencies.js +459 -0
- package/src/graph/path-dependencies.js.map +1 -0
- package/src/graph/plugin-package.d.ts +36 -0
- package/src/graph/plugin-package.js +132 -0
- package/src/graph/plugin-package.js.map +1 -0
- package/src/graph/plugin-version.d.ts +20 -0
- package/src/graph/plugin-version.js +153 -0
- package/src/graph/plugin-version.js.map +1 -0
- package/src/graph/projects.d.ts +141 -0
- package/src/graph/projects.js +182 -0
- package/src/graph/projects.js.map +1 -0
- package/src/graph/reached-projects.d.ts +46 -0
- package/src/graph/reached-projects.js +102 -0
- package/src/graph/reached-projects.js.map +1 -0
- package/src/graph/real-path.d.ts +47 -0
- package/src/graph/real-path.js +113 -0
- package/src/graph/real-path.js.map +1 -0
- package/src/graph/redirected-uses.d.ts +98 -0
- package/src/graph/redirected-uses.js +434 -0
- package/src/graph/redirected-uses.js.map +1 -0
- package/src/graph/registration.d.ts +121 -0
- package/src/graph/registration.js +233 -0
- package/src/graph/registration.js.map +1 -0
- package/src/graph/script-input.d.ts +46 -0
- package/src/graph/script-input.js +65 -0
- package/src/graph/script-input.js.map +1 -0
- package/src/graph/settings.d.ts +178 -0
- package/src/graph/settings.js +479 -0
- package/src/graph/settings.js.map +1 -0
- package/src/graph/target-defaults-causes.d.ts +33 -0
- package/src/graph/target-defaults-causes.js +202 -0
- package/src/graph/target-defaults-causes.js.map +1 -0
- package/src/graph/target-defaults-layers.d.ts +186 -0
- package/src/graph/target-defaults-layers.js +420 -0
- package/src/graph/target-defaults-layers.js.map +1 -0
- package/src/graph/target-defaults-meaning.d.ts +95 -0
- package/src/graph/target-defaults-meaning.js +292 -0
- package/src/graph/target-defaults-meaning.js.map +1 -0
- package/src/graph/target-defaults-report.d.ts +77 -0
- package/src/graph/target-defaults-report.js +242 -0
- package/src/graph/target-defaults-report.js.map +1 -0
- package/src/graph/target-defaults.d.ts +79 -0
- package/src/graph/target-defaults.js +425 -0
- package/src/graph/target-defaults.js.map +1 -0
- package/src/graph/target-fields.d.ts +16 -0
- package/src/graph/target-fields.js +134 -0
- package/src/graph/target-fields.js.map +1 -0
- package/src/graph/target-tables.d.ts +45 -0
- package/src/graph/target-tables.js +299 -0
- package/src/graph/target-tables.js.map +1 -0
- package/src/graph/targets.d.ts +367 -0
- package/src/graph/targets.js +404 -0
- package/src/graph/targets.js.map +1 -0
- package/src/graph/unification.d.ts +141 -0
- package/src/graph/unification.js +459 -0
- package/src/graph/unification.js.map +1 -0
- package/src/graph/unignored-directories.d.ts +25 -0
- package/src/graph/unignored-directories.js +89 -0
- package/src/graph/unignored-directories.js.map +1 -0
- package/src/graph/visibility.d.ts +17 -0
- package/src/graph/visibility.js +67 -0
- package/src/graph/visibility.js.map +1 -0
- package/src/graph/warnings.d.ts +38 -0
- package/src/graph/warnings.js +77 -0
- package/src/graph/warnings.js.map +1 -0
- package/src/graph/wasm.d.ts +56 -0
- package/src/graph/wasm.js +77 -0
- package/src/graph/wasm.js.map +1 -0
- package/src/index.d.ts +68 -0
- package/src/index.js +109 -0
- package/src/index.js.map +1 -0
- package/src/release/manifests.d.ts +95 -0
- package/src/release/manifests.js +164 -0
- package/src/release/manifests.js.map +1 -0
- package/src/release/places.d.ts +127 -0
- package/src/release/places.js +368 -0
- package/src/release/places.js.map +1 -0
- package/src/release/publish-cargo.d.ts +177 -0
- package/src/release/publish-cargo.js +351 -0
- package/src/release/publish-cargo.js.map +1 -0
- package/src/release/publish-crates.d.ts +124 -0
- package/src/release/publish-crates.js +242 -0
- package/src/release/publish-crates.js.map +1 -0
- package/src/release/publish-environments.d.ts +50 -0
- package/src/release/publish-environments.js +284 -0
- package/src/release/publish-environments.js.map +1 -0
- package/src/release/publish-messages.d.ts +66 -0
- package/src/release/publish-messages.js +273 -0
- package/src/release/publish-messages.js.map +1 -0
- package/src/release/publish-registry.d.ts +27 -0
- package/src/release/publish-registry.js +135 -0
- package/src/release/publish-registry.js.map +1 -0
- package/src/release/publish-settings.d.ts +26 -0
- package/src/release/publish-settings.js +56 -0
- package/src/release/publish-settings.js.map +1 -0
- package/src/release/publish.d.ts +59 -0
- package/src/release/publish.js +620 -0
- package/src/release/publish.js.map +1 -0
- package/src/release/repository.d.ts +73 -0
- package/src/release/repository.js +219 -0
- package/src/release/repository.js.map +1 -0
- package/src/release/requirements.d.ts +34 -0
- package/src/release/requirements.js +30 -0
- package/src/release/requirements.js.map +1 -0
- package/src/release/toml-edit.d.ts +67 -0
- package/src/release/toml-edit.js +453 -0
- package/src/release/toml-edit.js.map +1 -0
- package/src/release/version-actions.d.ts +133 -0
- package/src/release/version-actions.js +474 -0
- package/src/release/version-actions.js.map +1 -0
- package/src/release/version-checks.d.ts +21 -0
- package/src/release/version-checks.js +151 -0
- package/src/release/version-checks.js.map +1 -0
- package/src/release/version-lockfiles.d.ts +61 -0
- package/src/release/version-lockfiles.js +222 -0
- package/src/release/version-lockfiles.js.map +1 -0
- package/src/tools/napi-cli.d.ts +70 -0
- package/src/tools/napi-cli.js +63 -0
- package/src/tools/napi-cli.js.map +1 -0
- package/src/tools/optional-tools.d.ts +121 -0
- package/src/tools/optional-tools.js +303 -0
- package/src/tools/optional-tools.js.map +1 -0
- package/src/tools/print-napi-cli.d.ts +1 -0
- package/src/tools/print-napi-cli.js +24 -0
- package/src/tools/print-napi-cli.js.map +1 -0
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OptionError = void 0;
|
|
4
|
+
exports.taskOptions = taskOptions;
|
|
5
|
+
exports.ignoredOptionLine = ignoredOptionLine;
|
|
6
|
+
exports.passedOnCommandLine = passedOnCommandLine;
|
|
7
|
+
exports.forwardedArguments = forwardedArguments;
|
|
8
|
+
const node_util_1 = require("node:util");
|
|
9
|
+
const command_1 = require("./command");
|
|
10
|
+
const nx_command_1 = require("./nx-command");
|
|
11
|
+
const split_words_1 = require("./split-words");
|
|
12
|
+
/**
|
|
13
|
+
* An option's value that the task cannot use, such as an `args` that does
|
|
14
|
+
* not split into words; its message names the task and the option.
|
|
15
|
+
*/
|
|
16
|
+
class OptionError extends Error {
|
|
17
|
+
constructor(message) {
|
|
18
|
+
super(message);
|
|
19
|
+
this.name = "OptionError";
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.OptionError = OptionError;
|
|
23
|
+
/**
|
|
24
|
+
* Sorts a task's options into those its target takes and those it ignores,
|
|
25
|
+
* and gives `run` its binary's arguments (`DES-UNKNOWN-OPTIONS`).
|
|
26
|
+
*
|
|
27
|
+
* An option that the executor's schema does not declare, or that it declares
|
|
28
|
+
* but the target does not take ({@link targetTakes}), stays out of the
|
|
29
|
+
* command and gets one warning line ({@link ignoredOptionLine}). On `run`,
|
|
30
|
+
* the value of `args` and, when {@link forwardedArguments} finds them, the
|
|
31
|
+
* arguments after `--` on the command line go to the binary; none of the
|
|
32
|
+
* latter is taken as an option or gets a line.
|
|
33
|
+
*
|
|
34
|
+
* It looks at one task only, so that the batch implementation can call it
|
|
35
|
+
* for each task of a batch.
|
|
36
|
+
*
|
|
37
|
+
* @throws {OptionError} When `args` does not split into words.
|
|
38
|
+
*/
|
|
39
|
+
// @mara implements DES-UNKNOWN-OPTIONS
|
|
40
|
+
// @mara implements REQ-UNKNOWN-OPTIONS
|
|
41
|
+
function taskOptions(subject) {
|
|
42
|
+
const { executor, target } = subject;
|
|
43
|
+
const options = Object.assign({}, subject.options);
|
|
44
|
+
let forwarded = [];
|
|
45
|
+
if (target === "run") {
|
|
46
|
+
const found = forwardedArguments(subject);
|
|
47
|
+
if (found !== undefined) {
|
|
48
|
+
forwarded = found.words;
|
|
49
|
+
// Taken from the arguments, not as options: `run`'s own options keep
|
|
50
|
+
// their configured value, and other options are left out unseen.
|
|
51
|
+
for (const name of found.optionNames) {
|
|
52
|
+
if (executor.declared.has(name) && name in subject.configured) {
|
|
53
|
+
options[name] = subject.configured[name];
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
delete options[name];
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
const taken = {};
|
|
62
|
+
const warnings = [];
|
|
63
|
+
for (const [name, value] of Object.entries(options)) {
|
|
64
|
+
const declared = executor.declared.has(name);
|
|
65
|
+
if (declared && (0, command_1.targetTakes)(target, name)) {
|
|
66
|
+
taken[name] = value;
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
warnings.push(ignoredOptionLine(subject, name, value, declared ? "not-taken" : "unknown"));
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
const binaryArguments = target === "run" ? [...argsWords(subject.task, taken.args), ...forwarded] : [];
|
|
73
|
+
return { options: taken, binaryArguments, warnings };
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* The warning line for an option that a task ignores. It names the task and
|
|
77
|
+
* the option and says either that the option was passed on the command line,
|
|
78
|
+
* when {@link passedOnCommandLine} is sure of it, with what to do about the
|
|
79
|
+
* flag or words ({@link commandLineRemedy}), or that it comes from the
|
|
80
|
+
* workspace's configuration, with the command that shows where and the two
|
|
81
|
+
* fixes for a `targetDefaults` entry.
|
|
82
|
+
*
|
|
83
|
+
* Positional words, which Nx hands a task as the option `_`, are named as
|
|
84
|
+
* such.
|
|
85
|
+
*/
|
|
86
|
+
// @mara implements DES-UNKNOWN-OPTIONS
|
|
87
|
+
function ignoredOptionLine(subject, name, value, because) {
|
|
88
|
+
const { task, executor } = subject;
|
|
89
|
+
const words = name === "_" && Array.isArray(value);
|
|
90
|
+
const option = words
|
|
91
|
+
? `the positional arguments ${JSON.stringify(value.map(String))} (option \`_\`)`
|
|
92
|
+
: `option \`${name}\``;
|
|
93
|
+
const reason = because === "unknown"
|
|
94
|
+
? `which the ${executor.shortName} executor does not know`
|
|
95
|
+
: "which this target does not take";
|
|
96
|
+
if (passedOnCommandLine(subject, name, value)) {
|
|
97
|
+
const remedy = commandLineRemedy(subject.target, words ? "words" : because);
|
|
98
|
+
return because === "unknown"
|
|
99
|
+
? `${task}: ignoring ${option}, passed on the command line. ${remedy}`
|
|
100
|
+
: `${task}: ignoring ${option}, ${reason}, passed on the command line. ${remedy}`;
|
|
101
|
+
}
|
|
102
|
+
return [
|
|
103
|
+
`${task}: ignoring ${option}, ${reason}.`,
|
|
104
|
+
`It comes from the workspace's configuration: run \`nx show target ${task} --json\` and look under \`sourceMap\` for the file and entry.`,
|
|
105
|
+
`If it is a \`targetDefaults\` entry in nx.json, add a \`filter\` to it or add an empty entry keyed by "${executor.name}".`,
|
|
106
|
+
].join(" ");
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* What the line for a flag or words typed on the command line tells the user
|
|
110
|
+
* to do (`DES-UNKNOWN-OPTIONS`, paragraph "Source"): to remove an option that
|
|
111
|
+
* the executor does not know or check its spelling, to remove one that the
|
|
112
|
+
* target does not take, and to remove positional words. Only `run` passes
|
|
113
|
+
* arguments on, to its binary, so on `run` the line for an unknown option or
|
|
114
|
+
* for words also names the two ways to do that; `test` has no option for
|
|
115
|
+
* arguments of the test binary.
|
|
116
|
+
*/
|
|
117
|
+
function commandLineRemedy(target, what) {
|
|
118
|
+
switch (what) {
|
|
119
|
+
case "words":
|
|
120
|
+
return target === "run"
|
|
121
|
+
? "Remove them, or pass them to the binary after `--` or with `--args`."
|
|
122
|
+
: "Remove them.";
|
|
123
|
+
case "not-taken":
|
|
124
|
+
return "Remove it.";
|
|
125
|
+
case "unknown":
|
|
126
|
+
return target === "run"
|
|
127
|
+
? "Remove it or check its spelling, or pass it to the binary after `--` or with `--args`."
|
|
128
|
+
: "Remove it, or check its spelling.";
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Whether the option `name` with `value` was passed on the command line of
|
|
133
|
+
* the `nx` command, which holds only when three records agree
|
|
134
|
+
* (`DES-UNKNOWN-OPTIONS`, paragraph "Command line"):
|
|
135
|
+
*
|
|
136
|
+
* 1. The graph task holds the option among its overrides with the same value.
|
|
137
|
+
* 2. That task's own `__overrides_unparsed__` lists it as `--<name>`,
|
|
138
|
+
* `--<name>=<value>`, `--no-<name>` or, for a one-letter name,
|
|
139
|
+
* `-<name>`, before any `--` in that list.
|
|
140
|
+
* 3. The same flag is among the recorded arguments of the `nx` command.
|
|
141
|
+
*
|
|
142
|
+
* For `_`, the positional words, the list parsed as Nx parses it gives the
|
|
143
|
+
* same words, and each word of the list that can be positional is among the
|
|
144
|
+
* recorded arguments. Where Nx gave a declared option its camel-case name,
|
|
145
|
+
* the overrides and the flag may still have the spelling with dashes.
|
|
146
|
+
*/
|
|
147
|
+
// @mara implements DES-UNKNOWN-OPTIONS
|
|
148
|
+
function passedOnCommandLine(subject, name, value) {
|
|
149
|
+
const { graphTask, record } = subject;
|
|
150
|
+
const overrides = graphTask === null || graphTask === void 0 ? void 0 : graphTask.overrides;
|
|
151
|
+
const unparsed = overrides === null || overrides === void 0 ? void 0 : overrides.__overrides_unparsed__;
|
|
152
|
+
if (overrides === undefined || !isWordList(unparsed) || record === undefined) {
|
|
153
|
+
return false;
|
|
154
|
+
}
|
|
155
|
+
if (name === "_") {
|
|
156
|
+
return ((0, node_util_1.isDeepStrictEqual)(overrides._, value) &&
|
|
157
|
+
(0, node_util_1.isDeepStrictEqual)((0, nx_command_1.parseAsNx)(unparsed, subject.workspaceRoot)._, value) &&
|
|
158
|
+
positionalWords(unparsed).every((word) => record.includes(word)));
|
|
159
|
+
}
|
|
160
|
+
const flags = beforeDoubleDash(unparsed);
|
|
161
|
+
return Object.keys(overrides)
|
|
162
|
+
.filter((key) => key === name || (subject.executor.declared.has(name) && nxCamelCase(key) === name))
|
|
163
|
+
.some((key) => {
|
|
164
|
+
if (!(0, node_util_1.isDeepStrictEqual)(overrides[key], value)) {
|
|
165
|
+
return false;
|
|
166
|
+
}
|
|
167
|
+
const flag = flags.find((word) => isFlagFor(word, key));
|
|
168
|
+
return flag !== undefined && record.includes(flag);
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* The arguments after `--` on the command line that a `run` task passes to
|
|
173
|
+
* its binary, and the names under which the invocation's options hold what
|
|
174
|
+
* Nx parsed from them, or `undefined` when the task passes none. They are
|
|
175
|
+
* passed only when three conditions hold (`DES-UNKNOWN-OPTIONS`, paragraph
|
|
176
|
+
* "run"): the record has `--`; the graph task's own
|
|
177
|
+
* `__overrides_unparsed__` equals the recorded arguments after it; and the
|
|
178
|
+
* invocation's options hold every option that Nx parses from those
|
|
179
|
+
* arguments, apart from the executor's own, with the same value. A missing
|
|
180
|
+
* record counts as a command without `--`.
|
|
181
|
+
*/
|
|
182
|
+
// @mara implements DES-UNKNOWN-OPTIONS
|
|
183
|
+
// @mara implements DES-TARGET-COMMANDS
|
|
184
|
+
function forwardedArguments(subject) {
|
|
185
|
+
var _a, _b;
|
|
186
|
+
const { record, graphTask, executor } = subject;
|
|
187
|
+
const separator = (_a = record === null || record === void 0 ? void 0 : record.indexOf("--")) !== null && _a !== void 0 ? _a : -1;
|
|
188
|
+
if (record === undefined || separator === -1) {
|
|
189
|
+
return undefined;
|
|
190
|
+
}
|
|
191
|
+
const words = record.slice(separator + 1);
|
|
192
|
+
const unparsed = (_b = graphTask === null || graphTask === void 0 ? void 0 : graphTask.overrides) === null || _b === void 0 ? void 0 : _b.__overrides_unparsed__;
|
|
193
|
+
if (!isWordList(unparsed) || !(0, node_util_1.isDeepStrictEqual)(unparsed, words)) {
|
|
194
|
+
return undefined;
|
|
195
|
+
}
|
|
196
|
+
const optionNames = Object.entries((0, nx_command_1.parseAsNx)(words, subject.workspaceRoot)).map(([key, parsed]) => {
|
|
197
|
+
const name = executor.declared.has(nxCamelCase(key)) ? nxCamelCase(key) : key;
|
|
198
|
+
return { name, parsed };
|
|
199
|
+
});
|
|
200
|
+
const held = optionNames.every(({ name, parsed }) => executor.declared.has(name) || (0, node_util_1.isDeepStrictEqual)(subject.options[name], parsed));
|
|
201
|
+
return held ? { words, optionNames: optionNames.map(({ name }) => name) } : undefined;
|
|
202
|
+
}
|
|
203
|
+
// The words of `args`, for the binary.
|
|
204
|
+
function argsWords(task, args) {
|
|
205
|
+
if (typeof args !== "string") {
|
|
206
|
+
return [];
|
|
207
|
+
}
|
|
208
|
+
try {
|
|
209
|
+
return (0, split_words_1.splitWords)(args);
|
|
210
|
+
}
|
|
211
|
+
catch (error) {
|
|
212
|
+
if (!(error instanceof split_words_1.SplitError)) {
|
|
213
|
+
throw error;
|
|
214
|
+
}
|
|
215
|
+
const problem = error.problem === "unterminated-quote"
|
|
216
|
+
? "has a quote that is not closed. Close it, or put a backslash before a quote that is part of an argument."
|
|
217
|
+
: "ends in a backslash, which escapes nothing. Remove it, or write two backslashes for one.";
|
|
218
|
+
throw new OptionError(`${task}: the value of the \`args\` option, ${JSON.stringify(args)}, ${problem} The binary did not start.`);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
// Whether `word` names the option `key` as a flag.
|
|
222
|
+
function isFlagFor(word, key) {
|
|
223
|
+
return (word === `--${key}` ||
|
|
224
|
+
word.startsWith(`--${key}=`) ||
|
|
225
|
+
word === `--no-${key}` ||
|
|
226
|
+
(key.length === 1 && word === `-${key}`));
|
|
227
|
+
}
|
|
228
|
+
// The words of a list of arguments before its first `--`, which Nx parses as
|
|
229
|
+
// flags; after it every word is positional.
|
|
230
|
+
function beforeDoubleDash(words) {
|
|
231
|
+
const end = words.indexOf("--");
|
|
232
|
+
return end === -1 ? words : words.slice(0, end);
|
|
233
|
+
}
|
|
234
|
+
// The words of a list that Nx can take as positional: those that are no
|
|
235
|
+
// flag, and every word after the first `--`. Some of them may be values of
|
|
236
|
+
// flags, which is no matter here: they come from the same command line.
|
|
237
|
+
function positionalWords(words) {
|
|
238
|
+
const end = words.indexOf("--");
|
|
239
|
+
const before = end === -1 ? words : words.slice(0, end);
|
|
240
|
+
return [
|
|
241
|
+
...before.filter((word) => !word.startsWith("-")),
|
|
242
|
+
...(end === -1 ? [] : words.slice(end + 1)),
|
|
243
|
+
];
|
|
244
|
+
}
|
|
245
|
+
function isWordList(value) {
|
|
246
|
+
return Array.isArray(value) && value.every((word) => typeof word === "string");
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* The name under which Nx hands a task an option given with dashes, where
|
|
250
|
+
* the executor's schema declares that name (`camelCase` in `utils/params.js`
|
|
251
|
+
* of `nx` 24).
|
|
252
|
+
*/
|
|
253
|
+
function nxCamelCase(name) {
|
|
254
|
+
return name.indexOf("-") > 1
|
|
255
|
+
? name.toLowerCase().replace(/-(.)/g, (_match, letter) => letter.toUpperCase())
|
|
256
|
+
: name;
|
|
257
|
+
}
|
|
258
|
+
//# sourceMappingURL=task-options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task-options.js","sourceRoot":"","sources":["../../../../nx-rust/src/executors/task-options.ts"],"names":[],"mappings":";;;AAgFA,kCAgCC;AAiBD,8CA0BC;AA2CD,kDA0BC;AAeD,gDAwBC;AAtQD,yCAA8C;AAE9C,uCAAiE;AACjE,6CAAyC;AACzC,+CAAuD;AA8CvD;;;GAGG;AACH,MAAa,WAAY,SAAQ,KAAK;IACpC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;IAC5B,CAAC;CACF;AALD,kCAKC;AAED;;;;;;;;;;;;;;;GAeG;AACH,uCAAuC;AACvC,uCAAuC;AACvC,SAAgB,WAAW,CAAC,OAAsB;IAChD,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IACrC,MAAM,OAAO,qBAAiC,OAAO,CAAC,OAAO,CAAE,CAAC;IAChE,IAAI,SAAS,GAAa,EAAE,CAAC;IAC7B,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;QACrB,MAAM,KAAK,GAAG,kBAAkB,CAAC,OAAO,CAAC,CAAC;QAC1C,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,SAAS,GAAG,KAAK,CAAC,KAAK,CAAC;YACxB,qEAAqE;YACrE,iEAAiE;YACjE,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,WAAW,EAAE,CAAC;gBACrC,IAAI,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;oBAC9D,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,UAAU,C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,KAAc;IAChC,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC;AACjF,CAAC;AAED;;;;GAIG;AACH,SAAS,WAAW,CAAC,IAAY;IAC/B,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC;QAC1B,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,MAAM,EAAE,MAAc,EAAE,EAAE,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;QACvF,CAAC,CAAC,IAAI,CAAC;AACX,CAAC"}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import type { ExecutorContext } from "@nx/devkit";
|
|
2
|
+
import type { BuildRecordSource } from "../graph/build-records";
|
|
3
|
+
import type { TestRunner } from "../graph/settings";
|
|
4
|
+
import { type InferredTargetName, type TargetCargoMetadata } from "../graph/targets";
|
|
5
|
+
import { type CargoTargetOptions } from "./command";
|
|
6
|
+
import { type GroupInvocation, groupInvocations } from "./group-invocations";
|
|
7
|
+
import { type NapiTask } from "./napi-build";
|
|
8
|
+
import { checksAfterCargo } from "./task-execution";
|
|
9
|
+
import { type DigestStep, type PluginExecutor, projectWarnings, TaskError } from "./task-guards";
|
|
10
|
+
import { type TestMode } from "./test-mode";
|
|
11
|
+
import { type WasmTask } from "./wasm-build";
|
|
12
|
+
export { checksAfterCargo, type GroupInvocation, groupInvocations, type PluginExecutor, projectWarnings, TaskError, };
|
|
13
|
+
/**
|
|
14
|
+
* Runs one task of an inferred target that Nx runs on its own, as with
|
|
15
|
+
* `--batch=false`: as a group with one task (`TERM-GROUP`), in the root
|
|
16
|
+
* folder of the crate's workspace, with the environment that Nx gives the
|
|
17
|
+
* task and nothing added.
|
|
18
|
+
*
|
|
19
|
+
* A group that selects its crate, a group of one crate among them, runs one
|
|
20
|
+
* cargo command with cargo's standard streams as the task's own, so that Nx
|
|
21
|
+
* shows and stores what cargo prints, and the task succeeds when cargo exits
|
|
22
|
+
* with status 0. A group that selects the whole workspace, as `build`,
|
|
23
|
+
* `check`, `lint` and `test` do under `workspace-build` on the host, runs the
|
|
24
|
+
* steps that the same group runs in a batch, so that its crate compiles with
|
|
25
|
+
* the features of the whole workspace whatever else runs
|
|
26
|
+
* (`REQ-STABLE-FEATURES`), and prints its part of their output once they
|
|
27
|
+
* have ended, as its result in a batch holds it (`DES-BATCH`).
|
|
28
|
+
*
|
|
29
|
+
* A problem found before cargo starts fails the task with a message that
|
|
30
|
+
* names it and runs no cargo. An option that the task ignores gets a warning
|
|
31
|
+
* line at the top of its output, and so does the reason why a task runs its
|
|
32
|
+
* crate alone where the output names it. Before anything else, the task
|
|
33
|
+
* prints the warnings that graph creation found for its project, among them
|
|
34
|
+
* the one for an Nx major newer than the supported ones that
|
|
35
|
+
* `NX_RUST_ALLOW_UNSUPPORTED_NX` lets the plugin run with, which the Nx
|
|
36
|
+
* daemon keeps out of the terminal. The project's keys hold a digest of them,
|
|
37
|
+
* so that a cache hit replays the warnings of the graph that the command
|
|
38
|
+
* uses (`DES-DIAGNOSTICS`, "Warnings where they are seen"), apart from those
|
|
39
|
+
* about Cargo configuration that Nx does not hash, which no key holds. When
|
|
40
|
+
* the executor's context says that Nx runs verbosely, the task prints each
|
|
41
|
+
* cargo command right before cargo starts, after every warning
|
|
42
|
+
* (`DES-INVOCATION`, "Printing the command"); otherwise it prints nothing of
|
|
43
|
+
* it.
|
|
44
|
+
*/
|
|
45
|
+
export declare function runTask(executor: PluginExecutor, options: CargoTargetOptions, context: ExecutorContext): Promise<{
|
|
46
|
+
success: boolean;
|
|
47
|
+
}>;
|
|
48
|
+
/**
|
|
49
|
+
* A task whose checks before cargo have passed, waiting for the cargo
|
|
50
|
+
* command of its group (`TERM-GROUP`): what its command depends on, and
|
|
51
|
+
* what the task does after the command.
|
|
52
|
+
*/
|
|
53
|
+
export interface PreparedTask {
|
|
54
|
+
/** The task as messages name it, `<project>:<target>`. */
|
|
55
|
+
task: string;
|
|
56
|
+
/** The default name of the task's target, which decides the command. */
|
|
57
|
+
target: InferredTargetName;
|
|
58
|
+
/** The options that the target takes ({@link taskOptions}). */
|
|
59
|
+
options: CargoTargetOptions;
|
|
60
|
+
/** The binary's arguments, for `run`; empty for every other target. */
|
|
61
|
+
binaryArguments: string[];
|
|
62
|
+
/** One warning line per option that the task ignores (`DES-UNKNOWN-OPTIONS`). */
|
|
63
|
+
warnings: string[];
|
|
64
|
+
/** Whether the command runs in locked mode (`DES-INVOCATION`). */
|
|
65
|
+
locked: boolean;
|
|
66
|
+
/** The workspace's root folder, relative to the repository root. */
|
|
67
|
+
workspaceRoot: string;
|
|
68
|
+
/** The absolute path of the workspace root, where cargo starts. */
|
|
69
|
+
cwd: string;
|
|
70
|
+
/** The crate's package name; absent for a workspace project without a crate. */
|
|
71
|
+
crate?: string;
|
|
72
|
+
/** The crate's manifest, relative to the repository root. */
|
|
73
|
+
manifest?: string;
|
|
74
|
+
/** What the task does with the lockfile's digests after cargo (`TaskInvocation.digests`). */
|
|
75
|
+
digests?: DigestStep;
|
|
76
|
+
/**
|
|
77
|
+
* On a cached `build` or `doc` whose outputs name the artifact directory:
|
|
78
|
+
* the target's metadata, against which the group's directories are
|
|
79
|
+
* checked before cargo builds (`DES-OUTPUTS`).
|
|
80
|
+
*/
|
|
81
|
+
artifactCheck?: TargetCargoMetadata;
|
|
82
|
+
/**
|
|
83
|
+
* On a crate's `build`, `napi-build` and `wasm-build`: what graph creation
|
|
84
|
+
* reported for the records (`DES-BUILD-INPUT-CHECK`).
|
|
85
|
+
*/
|
|
86
|
+
records?: BuildRecordSource;
|
|
87
|
+
/** On `napi-build`: what its compile and post-processing need (`DES-NAPI`). */
|
|
88
|
+
napi?: NapiTask;
|
|
89
|
+
/** On `wasm-build`: what its post-processing needs (`DES-WASM`). */
|
|
90
|
+
wasm?: WasmTask;
|
|
91
|
+
/**
|
|
92
|
+
* Whether the target's own options, which the crate's table, a
|
|
93
|
+
* `project.json` or a `targetDefaults` entry give it, set a feature set:
|
|
94
|
+
* features, all features or no default features. Such a task forms a
|
|
95
|
+
* group of one crate whatever else runs ("Groups of one crate" in
|
|
96
|
+
* `DES-BATCH`); a feature set that a configuration or the command line
|
|
97
|
+
* gives every task of a run does not count.
|
|
98
|
+
*/
|
|
99
|
+
ownFeatureSet?: boolean;
|
|
100
|
+
/**
|
|
101
|
+
* On `test`: the workspace's test runner, from the target's metadata
|
|
102
|
+
* (`REQ-TEST-RUNNER`); absent means `cargo`.
|
|
103
|
+
*/
|
|
104
|
+
testRunner?: TestRunner;
|
|
105
|
+
/**
|
|
106
|
+
* The feature-unification strategy of the task's workspace, as graph
|
|
107
|
+
* creation recorded it in the project's metadata (`DES-UNIFICATION`);
|
|
108
|
+
* `workspace-build` where it recorded none, and where absent.
|
|
109
|
+
*/
|
|
110
|
+
featureUnification?: "hakari" | "cargo" | "workspace-build";
|
|
111
|
+
/**
|
|
112
|
+
* Under `hakari`, the triples of `platforms` that graph creation recorded:
|
|
113
|
+
* a task that builds for another triple, or on another host, forms a
|
|
114
|
+
* group of one crate ("Triples that `platforms` does not list").
|
|
115
|
+
*/
|
|
116
|
+
hakariPlatforms?: string[];
|
|
117
|
+
/**
|
|
118
|
+
* On `test` in a workspace that uses selection: the test mode, decided
|
|
119
|
+
* from the task's environment by the rule of the target's mode input
|
|
120
|
+
* (`DES-TEST-MODE`), and the line that says at the top of the task's
|
|
121
|
+
* output which suite it runs and why.
|
|
122
|
+
*/
|
|
123
|
+
testMode?: {
|
|
124
|
+
mode: TestMode;
|
|
125
|
+
/**
|
|
126
|
+
* Whether the task selects: it is in affected mode with a baseline and
|
|
127
|
+
* does not opt out with `affectedTests = false`.
|
|
128
|
+
*/
|
|
129
|
+
selects: boolean;
|
|
130
|
+
note?: string;
|
|
131
|
+
};
|
|
132
|
+
/** Under `hakari`, the hack crate's package name (`DES-NAPI`). */
|
|
133
|
+
hakariPackage?: string;
|
|
134
|
+
/** The task's environment, with which its checks ran and its cargo runs. */
|
|
135
|
+
env: NodeJS.ProcessEnv;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* The checks of a task before cargo runs, and what its command depends on,
|
|
139
|
+
* apart from what a group asks cargo once for all its tasks: the crates'
|
|
140
|
+
* package ID specifications and Cargo's directories ({@link groupInvocations}).
|
|
141
|
+
*
|
|
142
|
+
* @param env The task's environment, with `NX_RUST_LOCKED`, `NX_RUST_RUN_ID`
|
|
143
|
+
* and the record of the `nx` command ({@link recordedNxCommand}).
|
|
144
|
+
* @throws {TaskError} When the target is no inferred target of this
|
|
145
|
+
* executor, when its configuration caches a target that the plugin leaves
|
|
146
|
+
* uncached in this project, when `build` or `doc` gets the profile `dev`,
|
|
147
|
+
* `test` or `bench`, or is cached while its options name no triple and
|
|
148
|
+
* the task's environment and Cargo's configuration pick a triple whose
|
|
149
|
+
* folder the plugin cannot name or other triples than its outputs name,
|
|
150
|
+
* or is cached while its `targetTriple` option is `host-tuple` or a
|
|
151
|
+
* target specification file (`DES-OUTPUTS`), when `NX_RUST_LOCKED` is
|
|
152
|
+
* neither `true` nor `false`, when `args` does not split into words, when
|
|
153
|
+
* the run gives `pluginVersion` another value than the target's
|
|
154
|
+
* (`DES-PLUGIN-OPTIONS`), when a task whose target hashes digests does not
|
|
155
|
+
* depend on its workspace's lockfile task in a run that does not exclude
|
|
156
|
+
* task dependencies (`DES-LOCKFILE-HASHING`), when the run holds the
|
|
157
|
+
* `build` of a crate whose `test` replaces its executables without an
|
|
158
|
+
* order between the two (`DES-TARGETS`), or when the tool that the target
|
|
159
|
+
* runs besides cargo is not installed where `env` and the workspace root
|
|
160
|
+
* say (`DES-DIAGNOSTICS`), or when `NX_RUST_TEST_MODE` has another value
|
|
161
|
+
* than `full` or `affected` for a `test` in a workspace that uses
|
|
162
|
+
* selection (`DES-TEST-MODE`). The checks of what reaches the task's key, the
|
|
163
|
+
* cache guard, `pluginVersion` and the lockfile dependency, and the check
|
|
164
|
+
* of the order of `test` and `build` all run before the check for the tool.
|
|
165
|
+
*/
|
|
166
|
+
export declare function prepareTask(executor: PluginExecutor, options: CargoTargetOptions, context: ExecutorContext, env: NodeJS.ProcessEnv): PreparedTask;
|