@convesoft/nx-rust 0.0.0 → 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 +47 -1
- package/executors.json +35 -0
- package/generators.json +19 -0
- package/package.json +17 -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,284 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.collectBaseline = collectBaseline;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const node_child_process_1 = require("node:child_process");
|
|
6
|
+
const node_fs_1 = require("node:fs");
|
|
7
|
+
const node_os_1 = require("node:os");
|
|
8
|
+
const node_path_1 = require("node:path");
|
|
9
|
+
const collisions_1 = require("../graph/collisions");
|
|
10
|
+
const targets_1 = require("../graph/targets");
|
|
11
|
+
const optional_tools_1 = require("../tools/optional-tools");
|
|
12
|
+
const affected_1 = require("./affected");
|
|
13
|
+
const affected_inputs_1 = require("./affected-inputs");
|
|
14
|
+
const affected_run_1 = require("./affected-run");
|
|
15
|
+
const baseline_1 = require("./baseline");
|
|
16
|
+
const baseline_context_1 = require("./baseline-context");
|
|
17
|
+
const cargo_invocation_1 = require("./cargo-invocation");
|
|
18
|
+
const declared_options_1 = require("./declared-options");
|
|
19
|
+
const nx_task_files_1 = require("./nx-task-files");
|
|
20
|
+
const task_1 = require("./task");
|
|
21
|
+
const task_execution_1 = require("./task-execution");
|
|
22
|
+
const task_guards_1 = require("./task-guards");
|
|
23
|
+
const task_env_1 = require("./task-env");
|
|
24
|
+
const test_mode_1 = require("./test-mode");
|
|
25
|
+
// The executor, with the options of its schema, read where graph creation
|
|
26
|
+
// reads them (`declaredExecutorOptions`).
|
|
27
|
+
const executor = {
|
|
28
|
+
name: targets_1.lockfileExecutor,
|
|
29
|
+
shortName: "lockfile",
|
|
30
|
+
declared: (0, declared_options_1.declaredOptionsOf)(targets_1.lockfileExecutor),
|
|
31
|
+
serves: (target) => target === "coverage-baseline",
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* The coverage baseline target on the workspace project of a workspace with
|
|
35
|
+
* `affectedTests` (`REQ-BASELINE`, `DES-BASELINE`), which the lockfile
|
|
36
|
+
* executor, `@convesoft/nx-rust:lockfile`, runs: it has no batch
|
|
37
|
+
* implementation, so that a collection never joins a batch, and the empty
|
|
38
|
+
* entry that `init` adds for it in `targetDefaults` covers the target.
|
|
39
|
+
*
|
|
40
|
+
* In the workspace root, it computes the context that the collection runs
|
|
41
|
+
* in, the record that step 1 of `DES-TEST-RUN` compares
|
|
42
|
+
* (`ADR-AFFECTED-BASELINE-CONTEXT`), takes the workspace's collection lock,
|
|
43
|
+
* asks `cargo affected status` whether `collect --diff` can run
|
|
44
|
+
* ({@link collectionChoice}), removes the record, and for a full collection
|
|
45
|
+
* the database, runs `cargo affected collect` with git's `diff.relative`,
|
|
46
|
+
* and writes the record only after cargo-affected has ended successfully
|
|
47
|
+
* ("Order of writing"). A collection that fails or is interrupted leaves no
|
|
48
|
+
* record. Collection sets no Cargo directory of its own unless
|
|
49
|
+
* `separateBuildDir` is on.
|
|
50
|
+
*/
|
|
51
|
+
// @mara implements DES-BASELINE
|
|
52
|
+
// @mara implements REQ-BASELINE
|
|
53
|
+
function collectBaseline(options, context) {
|
|
54
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
55
|
+
var _a;
|
|
56
|
+
for (const warning of (0, task_guards_1.projectWarnings)(context)) {
|
|
57
|
+
console.warn(warning);
|
|
58
|
+
}
|
|
59
|
+
let env;
|
|
60
|
+
let prepared;
|
|
61
|
+
let collected;
|
|
62
|
+
try {
|
|
63
|
+
try {
|
|
64
|
+
env = (0, task_env_1.withoutUnloadedRootValues)((0, task_env_1.cargoTaskEnvironment)(process.env, (0, task_guards_1.singleTaskShape)(context)), context.root);
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
if (!(error instanceof task_env_1.TaskEnvironmentError)) {
|
|
68
|
+
throw error;
|
|
69
|
+
}
|
|
70
|
+
throw new task_guards_1.TaskError(`${context.projectName}:${context.targetName}: @convesoft/nx-rust cannot build this task's environment, because ${error.message}. The task does not run. Use an Nx version that @convesoft/nx-rust supports.`);
|
|
71
|
+
}
|
|
72
|
+
prepared = (0, task_1.prepareTask)(executor, options, context, env);
|
|
73
|
+
for (const warning of prepared.warnings) {
|
|
74
|
+
console.warn(warning);
|
|
75
|
+
}
|
|
76
|
+
// cargo-affected runs nextest and the LLVM tools; prepareTask has
|
|
77
|
+
// checked cargo-affected itself.
|
|
78
|
+
for (const tool of ["cargo-nextest", "llvm-tools"]) {
|
|
79
|
+
try {
|
|
80
|
+
(0, optional_tools_1.requireTool)(tool, `the coverage collection of the ${context.targetName} target of the Cargo workspace in ${(0, optional_tools_1.describeFolder)(prepared.workspaceRoot)}`, { workspaceRoot: context.root, workspaces: [], env, folder: prepared.cwd });
|
|
81
|
+
}
|
|
82
|
+
catch (error) {
|
|
83
|
+
throw error instanceof optional_tools_1.MissingToolError
|
|
84
|
+
? new task_guards_1.TaskError(`${prepared.task}: ${error.message}`)
|
|
85
|
+
: error;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
collected = yield collectionContext(prepared, context, env);
|
|
89
|
+
}
|
|
90
|
+
catch (error) {
|
|
91
|
+
if (error instanceof task_guards_1.TaskError) {
|
|
92
|
+
console.error(error.message);
|
|
93
|
+
return { success: false };
|
|
94
|
+
}
|
|
95
|
+
throw error;
|
|
96
|
+
}
|
|
97
|
+
const { task, cwd } = prepared;
|
|
98
|
+
const lock = (0, baseline_1.takeCollectionLock)(cwd);
|
|
99
|
+
if ("holder" in lock) {
|
|
100
|
+
console.error(`${task}: another collection of the coverage baseline runs in this checkout (process ${lock.holder}), which holds ${(0, node_path_1.join)(prepared.workspaceRoot, baseline_1.collectionLockFile)}. Two collections at once could leave the record of one beside the coverage of the other, so this one does not start, and the baseline and its record stay as they are. Run it again once the other has ended.`);
|
|
101
|
+
return { success: false };
|
|
102
|
+
}
|
|
103
|
+
if ("problem" in lock) {
|
|
104
|
+
console.error(`${task}: this collection does not start, and the baseline and its record stay as they are, because, in the Cargo workspace in ${(0, optional_tools_1.describeFolder)(prepared.workspaceRoot)}, ${lock.problem}.`);
|
|
105
|
+
return { success: false };
|
|
106
|
+
}
|
|
107
|
+
try {
|
|
108
|
+
const nextestArgs = (0, baseline_1.collectionNextestArguments)(prepared.options, {
|
|
109
|
+
locked: prepared.locked,
|
|
110
|
+
workspaceUnification: prepared.featureUnification === "cargo",
|
|
111
|
+
});
|
|
112
|
+
const verbose = (0, cargo_invocation_1.taskRunsVerbosely)(context);
|
|
113
|
+
const threshold = (_a = prepared.options.fullCollectThreshold) !== null && _a !== void 0 ? _a : targets_1.defaultFullCollectThreshold;
|
|
114
|
+
// The record that is there before the collection, read before it is
|
|
115
|
+
// removed: `--diff` keeps old rows, which the new record then vouches
|
|
116
|
+
// for, so it runs only where that record equals this collection's
|
|
117
|
+
// context (`DES-BASELINE`, `ADR-AFFECTED-BASELINE-CONTEXT`).
|
|
118
|
+
const previous = prepared.options.fullCollect === true ? undefined : (0, baseline_1.previousRecordProblem)(cwd, collected);
|
|
119
|
+
const choice = prepared.options.fullCollect === true
|
|
120
|
+
? { kind: "full", reason: "the option fullCollect asks for it" }
|
|
121
|
+
: previous !== undefined
|
|
122
|
+
? { kind: "full", reason: previous }
|
|
123
|
+
: yield statusChoice(prepared, env, nextestArgs, threshold, verbose);
|
|
124
|
+
if (choice.kind === "stopped") {
|
|
125
|
+
console.error(`${task}: cargo affected status was stopped by ${choice.signal}, so no collection started, and the baseline and the record of its context stay as they are.`);
|
|
126
|
+
return { success: false };
|
|
127
|
+
}
|
|
128
|
+
if (choice.kind === "full" &&
|
|
129
|
+
prepared.options.fullCollect !== true &&
|
|
130
|
+
prepared.options.diffOnly === true) {
|
|
131
|
+
console.warn(`${task}: collects nothing, because ${choice.reason}, which needs a full collection, and the option diffOnly leaves that to a run with --fullCollect. The baseline and the record of its context stay as they are.`);
|
|
132
|
+
return { success: true };
|
|
133
|
+
}
|
|
134
|
+
console.log(`${task}: ${choice.kind === "diff" ? "re-collects the coverage of the affected and new tests with cargo affected collect --diff" : "collects the coverage of every test into an empty database with cargo affected collect"}, because ${choice.reason}.`);
|
|
135
|
+
// Order of writing: the record goes first, and with a full collection
|
|
136
|
+
// the database; the new record follows only a successful collection.
|
|
137
|
+
(0, baseline_1.removeBeforeCollection)(cwd, choice.kind === "full");
|
|
138
|
+
const invocation = {
|
|
139
|
+
args: (0, baseline_1.collectArguments)(choice.kind === "diff", nextestArgs),
|
|
140
|
+
cwd,
|
|
141
|
+
env: Object.assign(Object.assign({}, (0, affected_1.diffRelativeVariables)(env)), (prepared.options.separateBuildDir === true
|
|
142
|
+
? { CARGO_BUILD_BUILD_DIR: (0, node_path_1.join)(cwd, "target", "affected", "build") }
|
|
143
|
+
: {})),
|
|
144
|
+
};
|
|
145
|
+
const succeeded = yield (0, task_execution_1.runCargo)(invocation, env, verbose ? task : undefined);
|
|
146
|
+
if (!succeeded) {
|
|
147
|
+
console.error(`${task}: cargo affected collect failed or was stopped, as its output above says, so the baseline has no record of its context (${baseline_context_1.contextRecordFile}) and every test run in affected mode runs its full suite until a collection succeeds. A failing test fails the collection too: fix it, commit, and run the target again.`);
|
|
148
|
+
return { success: false };
|
|
149
|
+
}
|
|
150
|
+
(0, baseline_context_1.writeContextRecord)(cwd, collected);
|
|
151
|
+
console.log(`${task}: the baseline ${(0, node_path_1.join)(prepared.workspaceRoot, test_mode_1.baselineDatabase)} is up to date, and ${(0, node_path_1.join)(prepared.workspaceRoot, baseline_context_1.contextRecordFile)} records the context it was collected in. Save both together.`);
|
|
152
|
+
return { success: true };
|
|
153
|
+
}
|
|
154
|
+
finally {
|
|
155
|
+
lock.release();
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* The context of the collection, as the record holds it
|
|
161
|
+
* (`ADR-AFFECTED-BASELINE-CONTEXT`, `DES-BASELINE`): its cargo options, the
|
|
162
|
+
* target triple that cargo builds for, and, from the inputs of the `test`
|
|
163
|
+
* tasks of the workspace's crates as Nx expands them, the hash of each
|
|
164
|
+
* environment input and of the output of each runtime input but the test
|
|
165
|
+
* mode's, evaluated in the collection task's environment as the `test`
|
|
166
|
+
* tasks' executor evaluates them (`baseline-context.ts`).
|
|
167
|
+
*/
|
|
168
|
+
function collectionContext(prepared, context, env) {
|
|
169
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
170
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
171
|
+
const { task } = prepared;
|
|
172
|
+
const graph = context.projectGraph;
|
|
173
|
+
if (graph === undefined) {
|
|
174
|
+
throw new task_guards_1.TaskError(`${task}: Nx gave the executor no project graph, so the plugin cannot read the inputs of the test tasks for the record of the baseline's context. The task does not run.`);
|
|
175
|
+
}
|
|
176
|
+
const own = (_b = (_a = context.projectsConfigurations) === null || _a === void 0 ? void 0 : _a.projects) === null || _b === void 0 ? void 0 : _b[(_c = context.projectName) !== null && _c !== void 0 ? _c : ""];
|
|
177
|
+
const manifest = own === undefined ? undefined : (_d = (0, collisions_1.cargoMetadataOf)(own)) === null || _d === void 0 ? void 0 : _d.workspaceManifest;
|
|
178
|
+
// The test target of each crate of the workspace, under the name that
|
|
179
|
+
// `targetNames` gives it.
|
|
180
|
+
const byTarget = new Map();
|
|
181
|
+
for (const [name, project] of Object.entries((_f = (_e = context.projectsConfigurations) === null || _e === void 0 ? void 0 : _e.projects) !== null && _f !== void 0 ? _f : {})) {
|
|
182
|
+
if (manifest === undefined || ((_g = (0, collisions_1.cargoMetadataOf)(project)) === null || _g === void 0 ? void 0 : _g.workspaceManifest) !== manifest) {
|
|
183
|
+
continue;
|
|
184
|
+
}
|
|
185
|
+
for (const [targetName, target] of Object.entries((_h = project.targets) !== null && _h !== void 0 ? _h : {})) {
|
|
186
|
+
const metadata = (_j = target.metadata) === null || _j === void 0 ? void 0 : _j[targets_1.targetCargoMetadataKey];
|
|
187
|
+
if ((metadata === null || metadata === void 0 ? void 0 : metadata.target) === "test") {
|
|
188
|
+
byTarget.set(targetName, [...((_k = byTarget.get(targetName)) !== null && _k !== void 0 ? _k : []), name]);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
const names = new Set();
|
|
193
|
+
const commands = new Set();
|
|
194
|
+
try {
|
|
195
|
+
for (const [target, projects] of byTarget) {
|
|
196
|
+
const placement = yield (0, affected_inputs_1.inputPlacement)(context.root, graph, context.nxJsonConfiguration, projects, target);
|
|
197
|
+
for (const inputs of placement.inputs.values()) {
|
|
198
|
+
for (const name of inputs.environment) {
|
|
199
|
+
names.add(name);
|
|
200
|
+
}
|
|
201
|
+
for (const command of inputs.runtime) {
|
|
202
|
+
commands.add(command);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
catch (error) {
|
|
208
|
+
if (error instanceof nx_task_files_1.NxTaskFilesError) {
|
|
209
|
+
throw new task_guards_1.TaskError(`${task}: @convesoft/nx-rust cannot read the inputs of the test tasks from the installed Nx (${error.message}), which the record of the baseline's context needs. The task does not run. Use an Nx version that @convesoft/nx-rust supports.`);
|
|
210
|
+
}
|
|
211
|
+
throw error;
|
|
212
|
+
}
|
|
213
|
+
const runtime = (0, baseline_context_1.runtimeContext)((0, baseline_context_1.contextRuntimeCommands)(commands), context.root, env);
|
|
214
|
+
if ("problem" in runtime) {
|
|
215
|
+
throw new task_guards_1.TaskError(`${task}: ${runtime.problem.replace("so the plugin cannot compare it with the baseline's", "so the plugin cannot record it for the baseline")}. The task does not run, and the baseline stays as it is. Make the command succeed in this environment.`);
|
|
216
|
+
}
|
|
217
|
+
return {
|
|
218
|
+
version: 2,
|
|
219
|
+
cargo: (0, baseline_context_1.cargoContext)(prepared.options),
|
|
220
|
+
triple: (0, affected_run_1.contextTriple)(prepared.cwd, env),
|
|
221
|
+
env: (0, baseline_context_1.environmentContext)((0, baseline_context_1.contextVariables)(names, env), env),
|
|
222
|
+
runtime: runtime.runtime,
|
|
223
|
+
};
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Runs `cargo affected status` in the workspace root, with the task's
|
|
228
|
+
* environment and git's `diff.relative`, into a report in a folder of its
|
|
229
|
+
* own under the system's temporary folder, which is removed afterwards, and
|
|
230
|
+
* gives the collection that its report asks for.
|
|
231
|
+
*/
|
|
232
|
+
function statusChoice(prepared, env, nextestArgs, threshold, verbose) {
|
|
233
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
234
|
+
const folder = (0, node_fs_1.mkdtempSync)((0, node_path_1.join)((0, node_os_1.tmpdir)(), "nx-rust-baseline-"));
|
|
235
|
+
const file = (0, node_path_1.join)(folder, "report.json");
|
|
236
|
+
const invocation = {
|
|
237
|
+
args: (0, baseline_1.baselineStatusArguments)(file, nextestArgs),
|
|
238
|
+
cwd: prepared.cwd,
|
|
239
|
+
env: (0, affected_1.diffRelativeVariables)(env),
|
|
240
|
+
};
|
|
241
|
+
try {
|
|
242
|
+
if (verbose) {
|
|
243
|
+
yield (0, cargo_invocation_1.printCommand)(prepared.task, invocation);
|
|
244
|
+
}
|
|
245
|
+
const run = yield new Promise((resolve) => {
|
|
246
|
+
const child = (0, node_child_process_1.spawn)("cargo", invocation.args, {
|
|
247
|
+
cwd: invocation.cwd,
|
|
248
|
+
env: Object.assign(Object.assign({}, env), invocation.env),
|
|
249
|
+
stdio: ["ignore", "ignore", "pipe"],
|
|
250
|
+
});
|
|
251
|
+
const stderr = [];
|
|
252
|
+
child.stderr.on("data", (chunk) => stderr.push(chunk));
|
|
253
|
+
const signals = ["SIGINT", "SIGTERM", "SIGHUP"];
|
|
254
|
+
const forward = (signal) => child.kill(signal);
|
|
255
|
+
for (const signal of signals) {
|
|
256
|
+
process.on(signal, forward);
|
|
257
|
+
}
|
|
258
|
+
const finish = (result) => {
|
|
259
|
+
for (const signal of signals) {
|
|
260
|
+
process.off(signal, forward);
|
|
261
|
+
}
|
|
262
|
+
resolve(Object.assign(Object.assign({}, result), { stderr: Buffer.concat(stderr).toString("utf8") }));
|
|
263
|
+
};
|
|
264
|
+
child.on("error", (error) => finish({ code: null, signal: null, failure: error.message }));
|
|
265
|
+
child.on("close", (code, signal) => finish({ code, signal }));
|
|
266
|
+
});
|
|
267
|
+
if (run.signal !== null) {
|
|
268
|
+
return { kind: "stopped", signal: run.signal };
|
|
269
|
+
}
|
|
270
|
+
let text;
|
|
271
|
+
try {
|
|
272
|
+
text = (0, node_fs_1.readFileSync)(file, "utf8");
|
|
273
|
+
}
|
|
274
|
+
catch (_a) {
|
|
275
|
+
text = undefined;
|
|
276
|
+
}
|
|
277
|
+
return (0, baseline_1.collectionChoice)(run, text, run.stderr, threshold);
|
|
278
|
+
}
|
|
279
|
+
finally {
|
|
280
|
+
(0, node_fs_1.rmSync)(folder, { recursive: true, force: true });
|
|
281
|
+
}
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
//# sourceMappingURL=coverage-baseline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coverage-baseline.js","sourceRoot":"","sources":["../../../../nx-rust/src/executors/coverage-baseline.ts"],"names":[],"mappings":";;AAgFA,0CAmIC;;AAlND,2DAA2C;AAC3C,qCAA4D;AAC5D,qCAAiC;AACjC,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AAM,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC;YACjD,CAAC;YACD,IAAI,IAAwB,CAAC;YAC7B,IAAI,CAAC;gBACH,IAAI,GAAG,IAAA,sBAAY,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;YACpC,CAAC;YAAC,WAAM,CAAC;gBACP,IAAI,GAAG,SAAS,CAAC;YACnB,CAAC;YACD,OAAO,IAAA,2BAAgB,EAAC,GAAG,EAAE,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;QAC5D,CAAC;gBAAS,CAAC;YACT,IAAA,gBAAM,EAAC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QACnD,CAAC;IACH,CAAC;CAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The options that the schema of each of the plugin's executors declares, by
|
|
3
|
+
* the executor's full name, such as `@convesoft/nx-rust:cargo`: the keys of
|
|
4
|
+
* the `properties` of the schema file that `executors.json` names for it,
|
|
5
|
+
* which is the file Nx checks a task's options against
|
|
6
|
+
* (`DES-UNKNOWN-OPTIONS`). The executors and the check of the target tables
|
|
7
|
+
* in Cargo metadata both take their options from here, so they cannot
|
|
8
|
+
* disagree.
|
|
9
|
+
*
|
|
10
|
+
* @throws {Error} When `executors.json` or a schema cannot be read, or a
|
|
11
|
+
* schema declares no properties.
|
|
12
|
+
*/
|
|
13
|
+
export declare function declaredExecutorOptions(): ReadonlyMap<string, ReadonlySet<string>>;
|
|
14
|
+
/**
|
|
15
|
+
* The options that the schema of one of the plugin's executors declares
|
|
16
|
+
* ({@link declaredExecutorOptions}).
|
|
17
|
+
*
|
|
18
|
+
* @param executor The executor's full name, such as `@convesoft/nx-rust:run`.
|
|
19
|
+
* @throws {Error} When `executors.json` does not list the executor.
|
|
20
|
+
*/
|
|
21
|
+
export declare function declaredOptionsOf(executor: string): ReadonlySet<string>;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.declaredExecutorOptions = declaredExecutorOptions;
|
|
4
|
+
exports.declaredOptionsOf = declaredOptionsOf;
|
|
5
|
+
const node_fs_1 = require("node:fs");
|
|
6
|
+
const node_path_1 = require("node:path");
|
|
7
|
+
// The package root, where `package.json` and `executors.json` lie, in the
|
|
8
|
+
// source tree and in the built package alike.
|
|
9
|
+
const packageRoot = (0, node_path_1.join)(__dirname, "..", "..");
|
|
10
|
+
let declared;
|
|
11
|
+
/**
|
|
12
|
+
* The options that the schema of each of the plugin's executors declares, by
|
|
13
|
+
* the executor's full name, such as `@convesoft/nx-rust:cargo`: the keys of
|
|
14
|
+
* the `properties` of the schema file that `executors.json` names for it,
|
|
15
|
+
* which is the file Nx checks a task's options against
|
|
16
|
+
* (`DES-UNKNOWN-OPTIONS`). The executors and the check of the target tables
|
|
17
|
+
* in Cargo metadata both take their options from here, so they cannot
|
|
18
|
+
* disagree.
|
|
19
|
+
*
|
|
20
|
+
* @throws {Error} When `executors.json` or a schema cannot be read, or a
|
|
21
|
+
* schema declares no properties.
|
|
22
|
+
*/
|
|
23
|
+
// @mara implements DES-UNKNOWN-OPTIONS
|
|
24
|
+
function declaredExecutorOptions() {
|
|
25
|
+
declared !== null && declared !== void 0 ? declared : (declared = readDeclaredOptions());
|
|
26
|
+
return declared;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The options that the schema of one of the plugin's executors declares
|
|
30
|
+
* ({@link declaredExecutorOptions}).
|
|
31
|
+
*
|
|
32
|
+
* @param executor The executor's full name, such as `@convesoft/nx-rust:run`.
|
|
33
|
+
* @throws {Error} When `executors.json` does not list the executor.
|
|
34
|
+
*/
|
|
35
|
+
function declaredOptionsOf(executor) {
|
|
36
|
+
const options = declaredExecutorOptions().get(executor);
|
|
37
|
+
if (options === undefined) {
|
|
38
|
+
throw new Error(`executors.json in ${packageRoot} does not list ${executor}.`);
|
|
39
|
+
}
|
|
40
|
+
return options;
|
|
41
|
+
}
|
|
42
|
+
function readDeclaredOptions() {
|
|
43
|
+
const { name } = readJson((0, node_path_1.join)(packageRoot, "package.json"));
|
|
44
|
+
const { executors } = readJson((0, node_path_1.join)(packageRoot, "executors.json"));
|
|
45
|
+
return new Map(Object.entries(executors).map(([executor, { schema }]) => {
|
|
46
|
+
var _a;
|
|
47
|
+
const file = (0, node_path_1.join)(packageRoot, schema);
|
|
48
|
+
const properties = (_a = readJson(file)) === null || _a === void 0 ? void 0 : _a.properties;
|
|
49
|
+
if (typeof properties !== "object" || properties === null || Array.isArray(properties)) {
|
|
50
|
+
throw new Error(`The executor schema ${file} declares no properties.`);
|
|
51
|
+
}
|
|
52
|
+
return [`${name}:${executor}`, new Set(Object.keys(properties))];
|
|
53
|
+
}));
|
|
54
|
+
}
|
|
55
|
+
function readJson(file) {
|
|
56
|
+
return JSON.parse((0, node_fs_1.readFileSync)(file, "utf8"));
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=declared-options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"declared-options.js","sourceRoot":"","sources":["../../../../nx-rust/src/executors/declared-options.ts"],"names":[],"mappings":";;AAsBA,0DAGC;AASD,8CAMC;AAxCD,qCAAuC;AACvC,yCAAiC;AAEjC,0EAA0E;AAC1E,8CAA8C;AAC9C,MAAM,WAAW,GAAG,IAAA,gBAAI,EAAC,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAEhD,IAAI,QAA8D,CAAC;AAEnE;;;;;;;;;;;GAWG;AACH,uCAAuC;AACvC,SAAgB,uBAAuB;IACrC,QAAQ,aAAR,QAAQ,cAAR,QAAQ,IAAR,QAAQ,GAAK,mBAAmB,EAAE,EAAC;IACnC,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,iBAAiB,CAAC,QAAgB;IAChD,MAAM,OAAO,GA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AC;AAChD,CAAC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { type PackageVersion } from "../cargo/lockfile";
|
|
2
|
+
/** What a task whose key holds digests checks after its cargo call. */
|
|
3
|
+
export interface DigestCheck {
|
|
4
|
+
/** The task as `nx show target` takes it, `<project>:<target>`. */
|
|
5
|
+
task: string;
|
|
6
|
+
/** The absolute path of the workspace's `Cargo.lock`. */
|
|
7
|
+
lockfile: string;
|
|
8
|
+
/** The absolute path of the workspace's digest folder, which Nx hashes. */
|
|
9
|
+
folder: string;
|
|
10
|
+
/**
|
|
11
|
+
* The absolute path of the folder of the private copies that the lockfile
|
|
12
|
+
* task of the task's own `nx` command wrote; `undefined` where the
|
|
13
|
+
* command has no id, so that no copy can exist.
|
|
14
|
+
*/
|
|
15
|
+
commandFolder: string | undefined;
|
|
16
|
+
/** The members whose digests the task's key holds. */
|
|
17
|
+
members: PackageVersion[];
|
|
18
|
+
/**
|
|
19
|
+
* Under `hakari`, every member of the workspace, the crate's own first:
|
|
20
|
+
* the digests that the task compares where it shared its cargo command
|
|
21
|
+
* with other crates, although its key holds its own
|
|
22
|
+
* (`DES-LOCKFILE-HASHING`, "Post-check"); absent under the other
|
|
23
|
+
* strategies, whose keys hold them already.
|
|
24
|
+
*/
|
|
25
|
+
sharedMembers?: PackageVersion[];
|
|
26
|
+
/** The workspace's root folder, relative to the repository root. */
|
|
27
|
+
workspace: string;
|
|
28
|
+
}
|
|
29
|
+
/** What the lockfile task writes ({@link writeDigests}). */
|
|
30
|
+
export interface DigestWrite {
|
|
31
|
+
/** The absolute path of the workspace's `Cargo.lock`. */
|
|
32
|
+
lockfile: string;
|
|
33
|
+
/** The absolute path of the workspace's digest folder. */
|
|
34
|
+
folder: string;
|
|
35
|
+
/**
|
|
36
|
+
* The absolute path of the folder of the private copies for the task's
|
|
37
|
+
* own `nx` command; `undefined` where the command has no id.
|
|
38
|
+
*/
|
|
39
|
+
commandFolder: string | undefined;
|
|
40
|
+
/** The members whose digests it writes. */
|
|
41
|
+
members: PackageVersion[];
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* The members whose digests a task's key holds, in the order the check
|
|
45
|
+
* after cargo's call compares them ({@link checkDigests}): those that the
|
|
46
|
+
* target's metadata names, the crate's own, and where the metadata says
|
|
47
|
+
* that the key holds every member's digest (`everyDigest`), each other
|
|
48
|
+
* member of the workspace as its lockfile task's metadata names them
|
|
49
|
+
* (`DES-LOCKFILE-HASHING`, "Post-check"). So the check names the crate's own
|
|
50
|
+
* digest where that changed, and another member's only where the crate's
|
|
51
|
+
* stayed the same.
|
|
52
|
+
*
|
|
53
|
+
* @param workspaceMembers The members that the lockfile task writes digests for.
|
|
54
|
+
* @returns `undefined` where the key holds every member's digest but the
|
|
55
|
+
* lockfile task names no member, so that the list cannot be known.
|
|
56
|
+
*/
|
|
57
|
+
export declare function heldMembers(own: readonly PackageVersion[], everyDigest: boolean, workspaceMembers: readonly PackageVersion[] | undefined): PackageVersion[] | undefined;
|
|
58
|
+
/** How old a private copy may get before a lockfile task removes it, in milliseconds. */
|
|
59
|
+
export declare const commandCopyLifetime: number;
|
|
60
|
+
/**
|
|
61
|
+
* The step of the lockfile task after `cargo update --workspace`: one file
|
|
62
|
+
* per member in the workspace's digest folder, named after its package
|
|
63
|
+
* name and holding its digest of the `Cargo.lock` that cargo left
|
|
64
|
+
* (`DES-LOCKFILE-HASHING`), which is what Nx hashes into the keys of the
|
|
65
|
+
* tasks that depend on the task; and the same files in a folder private to
|
|
66
|
+
* the task's `nx` command, which no other command writes, for the check
|
|
67
|
+
* after cargo's call ({@link checkDigests}). Other files in the digest
|
|
68
|
+
* folder, such as those of removed members, are deleted, so that the folder
|
|
69
|
+
* holds exactly the task's output, and so are the private folders of other
|
|
70
|
+
* commands that are older than a day, which a stopped command left. Each
|
|
71
|
+
* file is replaced in one step, so that a reader never sees part of one.
|
|
72
|
+
*
|
|
73
|
+
* @param task The task, `<project>:<target>`, for the message.
|
|
74
|
+
* @param now The current time, in milliseconds.
|
|
75
|
+
* @returns The message to fail the task with, or `undefined` once the
|
|
76
|
+
* digests are written.
|
|
77
|
+
*/
|
|
78
|
+
export declare function writeDigests(task: string, step: DigestWrite, now?: number): string | undefined;
|
|
79
|
+
/**
|
|
80
|
+
* The check of `DES-LOCKFILE-HASHING`, "Post-check", after the cargo call of
|
|
81
|
+
* a task whose key holds digests. For each member, three values must be
|
|
82
|
+
* equal: the digest that the lockfile task of the task's own `nx` command
|
|
83
|
+
* wrote to its private copy, the shared digest file, which Nx hashed into
|
|
84
|
+
* the key, as it is now, and the digest computed again from `Cargo.lock`
|
|
85
|
+
* now. A difference means that a manifest or `Cargo.lock` changed while the
|
|
86
|
+
* run went on, also through another `nx` command, whose lockfile task
|
|
87
|
+
* rewrites the shared file, so that cargo may have built with locked
|
|
88
|
+
* dependencies that the task's key does not describe. The task then fails,
|
|
89
|
+
* so that Nx stores nothing for it. A missing private copy fails it as
|
|
90
|
+
* well: the shared file alone cannot show what the key holds.
|
|
91
|
+
*
|
|
92
|
+
* @returns The message to fail the task with, or `undefined` when every digest matches.
|
|
93
|
+
*/
|
|
94
|
+
export declare function checkDigests(check: DigestCheck): string | undefined;
|