@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,182 @@
|
|
|
1
|
+
/** The environment variable that chooses the test mode of a run (`DES-TEST-MODE`). */
|
|
2
|
+
export declare const testModeVariable = "NX_RUST_TEST_MODE";
|
|
3
|
+
/**
|
|
4
|
+
* cargo-affected's database in a workspace root, whatever the target
|
|
5
|
+
* directory is (`EVD-CARGO-AFFECTED-REPORT`).
|
|
6
|
+
*/
|
|
7
|
+
export declare const baselineDatabase: string;
|
|
8
|
+
/**
|
|
9
|
+
* Whether Nx detects CI in `env`: the rule of `isCI` in Nx 24.0.6
|
|
10
|
+
* (`nx/src/utils/is-ci`), which `nx` uses for its own defaults. The plugin
|
|
11
|
+
* keeps a copy, because the mode command runs in a process of its own,
|
|
12
|
+
* where loading Nx would cost more than the rest of the command; a test
|
|
13
|
+
* compares the copy with the installed Nx's function.
|
|
14
|
+
*/
|
|
15
|
+
export declare function nxDetectsCI(env: NodeJS.ProcessEnv): boolean;
|
|
16
|
+
/** The mode that a run asks for, before the baseline counts (steps 1 and 2 of `DES-TEST-MODE`). */
|
|
17
|
+
export type AskedTestMode = {
|
|
18
|
+
kind: "full";
|
|
19
|
+
reason: string;
|
|
20
|
+
} | {
|
|
21
|
+
kind: "affected";
|
|
22
|
+
reason: string;
|
|
23
|
+
} | {
|
|
24
|
+
kind: "invalid";
|
|
25
|
+
value: string;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* The mode that `env` asks for: `NX_RUST_TEST_MODE` set to `full` or
|
|
29
|
+
* `affected`, and without it `full` where Nx detects CI and `affected`
|
|
30
|
+
* elsewhere. Any other value, the empty one included, is invalid and fails
|
|
31
|
+
* the task.
|
|
32
|
+
*/
|
|
33
|
+
export declare function askedTestMode(env: NodeJS.ProcessEnv): AskedTestMode;
|
|
34
|
+
/** The commits of a coverage baseline, or why there is none that can be read. */
|
|
35
|
+
export type BaselineCommits = {
|
|
36
|
+
commits: string[];
|
|
37
|
+
} | {
|
|
38
|
+
problem: string;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* A step that a test runs between the reader's first look at the files and
|
|
42
|
+
* its open of the database ({@link baselineCommits}), so that what another
|
|
43
|
+
* process does in between can be checked without timing luck.
|
|
44
|
+
*/
|
|
45
|
+
export interface BaselineReadSteps {
|
|
46
|
+
beforeOpen?(): void;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The commits that cargo-affected's database in `workspaceRoot` holds
|
|
50
|
+
* coverage for, of every fingerprint, sorted and without repeats
|
|
51
|
+
* (`DES-TEST-MODE`, step 3). It reads `target/affected/coverage.db` with
|
|
52
|
+
* Node's SQLite and starts no cargo-affected, whose `status` builds the
|
|
53
|
+
* tests (`EVD-CARGO-AFFECTED-COST`).
|
|
54
|
+
*
|
|
55
|
+
* It never opens the database in a way that can write: only as immutable
|
|
56
|
+
* and read-only, which creates no file, since an ordinary read-only
|
|
57
|
+
* connection to a database in WAL mode creates `-wal` and `-shm` files and
|
|
58
|
+
* leaves them behind (`EVD-TEST-MODE-READING`). An immutable read ignores
|
|
59
|
+
* a `-wal` file and takes no lock, so it counts only where the database is
|
|
60
|
+
* whole and settled: a `-wal` file beside it before the read or after it,
|
|
61
|
+
* as while a collection runs or after one was interrupted, or a database
|
|
62
|
+
* file whose size, modification time or inode differs between the two
|
|
63
|
+
* looks, gives a problem and no commits. So do a missing database, a Node
|
|
64
|
+
* without `node:sqlite`, a database of another schema, as after
|
|
65
|
+
* cargo-affected changed it, one that cannot be read, one without coverage,
|
|
66
|
+
* and a commit that is not lower-case hexadecimal.
|
|
67
|
+
*
|
|
68
|
+
* @param workspaceRoot The workspace's root folder, absolute or relative to
|
|
69
|
+
* the current folder.
|
|
70
|
+
* @param steps For tests: a step between the first look and the open.
|
|
71
|
+
*/
|
|
72
|
+
export declare function baselineCommits(workspaceRoot: string, steps?: BaselineReadSteps): BaselineCommits;
|
|
73
|
+
/** The test mode of a run (`TERM-TEST-MODE`), with why it is that mode. */
|
|
74
|
+
export type TestMode = {
|
|
75
|
+
kind: "full";
|
|
76
|
+
reason: string;
|
|
77
|
+
} | {
|
|
78
|
+
kind: "affected";
|
|
79
|
+
commits: string[];
|
|
80
|
+
reason: string;
|
|
81
|
+
} | {
|
|
82
|
+
kind: "invalid";
|
|
83
|
+
value: string;
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* The test mode of a run in the workspace at `workspaceRoot`, by the rule
|
|
87
|
+
* that the mode command and the test executor share (`DES-TEST-MODE`): the
|
|
88
|
+
* mode that `env` asks for, where `affected` stays `affected` only with a
|
|
89
|
+
* baseline whose commits can be read, and becomes `full` otherwise, with
|
|
90
|
+
* the reason.
|
|
91
|
+
*/
|
|
92
|
+
export declare function testMode(env: NodeJS.ProcessEnv, workspaceRoot: string): TestMode;
|
|
93
|
+
/**
|
|
94
|
+
* What the mode command prints for `mode`, and with it what the key of a
|
|
95
|
+
* `test` task holds: `full`, `affected:<commits>` with the baseline's
|
|
96
|
+
* commits joined by `,`, or for an invalid `NX_RUST_TEST_MODE` a line that
|
|
97
|
+
* names the value, so that a failure that Nx stores with
|
|
98
|
+
* `NX_CACHE_FAILURES=true` is never restored for a valid mode.
|
|
99
|
+
*/
|
|
100
|
+
export declare function testModeText(mode: TestMode): string;
|
|
101
|
+
/**
|
|
102
|
+
* The message of a task that fails before cargo runs because
|
|
103
|
+
* `NX_RUST_TEST_MODE` has another value than `full` or `affected`.
|
|
104
|
+
*/
|
|
105
|
+
export declare function invalidTestModeMessage(task: string, value: string): string;
|
|
106
|
+
/**
|
|
107
|
+
* The line at the top of a `test` task's output in a workspace that uses
|
|
108
|
+
* selection, which says which suite the task runs and why (`DES-TEST-MODE`,
|
|
109
|
+
* `REQ-AFFECTED-TESTS`).
|
|
110
|
+
*
|
|
111
|
+
* @param optedOut Whether the task's `affectedTests` option is `false`, as a
|
|
112
|
+
* crate's table or `--affectedTests=false` sets it.
|
|
113
|
+
*/
|
|
114
|
+
export declare function testModeNote(task: string, mode: TestMode, optedOut: boolean): string | undefined;
|
|
115
|
+
/**
|
|
116
|
+
* The folder under the repository root in which the mode command and the
|
|
117
|
+
* test executor keep their record of one `nx` command (`DES-TEST-MODE`,
|
|
118
|
+
* "Between hashing and the run"), one folder per command and workspace.
|
|
119
|
+
* Nx leaves `.nx/workspace-data` out of its file map, and the plugin's
|
|
120
|
+
* `postTasksExecution` hook removes a command's folders when it ends.
|
|
121
|
+
*/
|
|
122
|
+
export declare const testModeRecordRoot = ".nx/workspace-data/nx-rust/test-mode";
|
|
123
|
+
/**
|
|
124
|
+
* The id that the plugin's `preTasksExecution` hook gives the `nx` command
|
|
125
|
+
* whose task has the environment `env`, with only the characters that a
|
|
126
|
+
* folder name keeps; `undefined` without one.
|
|
127
|
+
*/
|
|
128
|
+
export declare function commandIdOf(env: NodeJS.ProcessEnv): string | undefined;
|
|
129
|
+
/**
|
|
130
|
+
* The folder of the record of the command `commandId` for the workspace at
|
|
131
|
+
* `workspaceRoot` ({@link testModeRecordRoot}).
|
|
132
|
+
*
|
|
133
|
+
* @param workspaceRoot The workspace's root folder, relative to the repository root.
|
|
134
|
+
*/
|
|
135
|
+
export declare function testModeRecordFolder(repositoryRoot: string, workspaceRoot: string, commandId: string): string;
|
|
136
|
+
/** A value that no other evaluation prints, so that no stored result is ever restored under it. */
|
|
137
|
+
export declare function neverRestored(): string;
|
|
138
|
+
/**
|
|
139
|
+
* What the mode command prints for a task with the environment `env` in
|
|
140
|
+
* the workspace at `workspaceRoot` (`DES-TEST-MODE`, "Between hashing and the
|
|
141
|
+
* run"): the text of its test mode ({@link testModeText}), with two
|
|
142
|
+
* exceptions that keep a subset's result from being stored under a key that
|
|
143
|
+
* it does not satisfy. Where a task of the same `nx` command has run, or is
|
|
144
|
+
* about to run, a subset in another mode than this text, it prints a value
|
|
145
|
+
* that is never restored ({@link neverRestored}): Nx hashes some tasks again
|
|
146
|
+
* after they ran, and the key of such a task must not say `full` or name
|
|
147
|
+
* another baseline. And where it cannot add what it prints to the command's
|
|
148
|
+
* record, it prints such a value as well, since the executor could then not
|
|
149
|
+
* see it.
|
|
150
|
+
*
|
|
151
|
+
* Without a command id from the plugin's hook, as where Nx hashes outside a
|
|
152
|
+
* run, it prints the text and records nothing.
|
|
153
|
+
*
|
|
154
|
+
* @param workspaceRoot The workspace's root folder, relative to `repositoryRoot`.
|
|
155
|
+
*/
|
|
156
|
+
export declare function printedTestMode(env: NodeJS.ProcessEnv, repositoryRoot: string, workspaceRoot: string, steps?: BaselineReadSteps): string;
|
|
157
|
+
/**
|
|
158
|
+
* Why a task in affected mode must not run a subset, because the test mode
|
|
159
|
+
* that Nx hashed for it may differ from the one its executor reads
|
|
160
|
+
* (`DES-TEST-MODE`, "Between hashing and the run"; `RISK-SUBSET-AS-FULL`), or
|
|
161
|
+
* `undefined` where it may. Nx hands an executor neither the task's hash
|
|
162
|
+
* details nor the output of its runtime inputs, so the executor reads what
|
|
163
|
+
* the mode command recorded for the command: every value that it printed in
|
|
164
|
+
* this command for a task of the workspace, whatever mode the task asked
|
|
165
|
+
* for, has to be `text`, the executor's own reading, and at least one has
|
|
166
|
+
* to be there. The task's own evaluation is among them, since Nx hashes a
|
|
167
|
+
* task after the command's `preTasksExecution` hook and before the task
|
|
168
|
+
* runs, and nothing in the record tells it from another task's.
|
|
169
|
+
*
|
|
170
|
+
* @param workspaceRoot The workspace's root folder, relative to `repositoryRoot`.
|
|
171
|
+
* @param text The test mode as the executor reads it, `affected:<commits>`.
|
|
172
|
+
*/
|
|
173
|
+
export declare function hashedModeProblem(env: NodeJS.ProcessEnv, repositoryRoot: string, workspaceRoot: string, text: string): string | undefined;
|
|
174
|
+
/**
|
|
175
|
+
* Adds `text` to the command's record of the modes in which its tasks run a
|
|
176
|
+
* subset, before the subset runs, so that the mode command prints a value
|
|
177
|
+
* that is never restored wherever Nx hashes a task of the workspace again
|
|
178
|
+
* in this command with another mode ({@link printedTestMode}).
|
|
179
|
+
*
|
|
180
|
+
* @returns Whether the record holds it; where not, the task must run its full suite.
|
|
181
|
+
*/
|
|
182
|
+
export declare function recordSubset(env: NodeJS.ProcessEnv, repositoryRoot: string, workspaceRoot: string, text: string): boolean;
|
|
@@ -0,0 +1,391 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.testModeRecordRoot = exports.baselineDatabase = exports.testModeVariable = void 0;
|
|
4
|
+
exports.nxDetectsCI = nxDetectsCI;
|
|
5
|
+
exports.askedTestMode = askedTestMode;
|
|
6
|
+
exports.baselineCommits = baselineCommits;
|
|
7
|
+
exports.testMode = testMode;
|
|
8
|
+
exports.testModeText = testModeText;
|
|
9
|
+
exports.invalidTestModeMessage = invalidTestModeMessage;
|
|
10
|
+
exports.testModeNote = testModeNote;
|
|
11
|
+
exports.commandIdOf = commandIdOf;
|
|
12
|
+
exports.testModeRecordFolder = testModeRecordFolder;
|
|
13
|
+
exports.neverRestored = neverRestored;
|
|
14
|
+
exports.printedTestMode = printedTestMode;
|
|
15
|
+
exports.hashedModeProblem = hashedModeProblem;
|
|
16
|
+
exports.recordSubset = recordSubset;
|
|
17
|
+
const node_crypto_1 = require("node:crypto");
|
|
18
|
+
const node_fs_1 = require("node:fs");
|
|
19
|
+
const node_path_1 = require("node:path");
|
|
20
|
+
const node_url_1 = require("node:url");
|
|
21
|
+
const lockfile_task_1 = require("../graph/lockfile-task");
|
|
22
|
+
/** The environment variable that chooses the test mode of a run (`DES-TEST-MODE`). */
|
|
23
|
+
exports.testModeVariable = "NX_RUST_TEST_MODE";
|
|
24
|
+
/**
|
|
25
|
+
* cargo-affected's database in a workspace root, whatever the target
|
|
26
|
+
* directory is (`EVD-CARGO-AFFECTED-REPORT`).
|
|
27
|
+
*/
|
|
28
|
+
exports.baselineDatabase = (0, node_path_1.join)("target", "affected", "coverage.db");
|
|
29
|
+
/**
|
|
30
|
+
* Whether Nx detects CI in `env`: the rule of `isCI` in Nx 24.0.6
|
|
31
|
+
* (`nx/src/utils/is-ci`), which `nx` uses for its own defaults. The plugin
|
|
32
|
+
* keeps a copy, because the mode command runs in a process of its own,
|
|
33
|
+
* where loading Nx would cost more than the rest of the command; a test
|
|
34
|
+
* compares the copy with the installed Nx's function.
|
|
35
|
+
*/
|
|
36
|
+
// @mara implements DES-TEST-MODE
|
|
37
|
+
function nxDetectsCI(env) {
|
|
38
|
+
if (env.CI === "false") {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
return Boolean(env.CI ||
|
|
42
|
+
env.TF_BUILD === "true" ||
|
|
43
|
+
env.GITHUB_ACTIONS === "true" ||
|
|
44
|
+
env.BUILDKITE === "true" ||
|
|
45
|
+
env.CIRCLECI === "true" ||
|
|
46
|
+
env.CIRRUS_CI === "true" ||
|
|
47
|
+
env.TRAVIS === "true" ||
|
|
48
|
+
env["bamboo.buildKey"] ||
|
|
49
|
+
env.bamboo_buildKey ||
|
|
50
|
+
env.CODEBUILD_BUILD_ID ||
|
|
51
|
+
env.GITLAB_CI ||
|
|
52
|
+
env.HEROKU_TEST_RUN_ID ||
|
|
53
|
+
env.BUILD_ID ||
|
|
54
|
+
env.BUILD_NUMBER ||
|
|
55
|
+
env.BUILD_BUILDID ||
|
|
56
|
+
env.TEAMCITY_VERSION ||
|
|
57
|
+
env.JENKINS_URL ||
|
|
58
|
+
env.HUDSON_URL);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* The mode that `env` asks for: `NX_RUST_TEST_MODE` set to `full` or
|
|
62
|
+
* `affected`, and without it `full` where Nx detects CI and `affected`
|
|
63
|
+
* elsewhere. Any other value, the empty one included, is invalid and fails
|
|
64
|
+
* the task.
|
|
65
|
+
*/
|
|
66
|
+
// @mara implements DES-TEST-MODE
|
|
67
|
+
function askedTestMode(env) {
|
|
68
|
+
const value = env[exports.testModeVariable];
|
|
69
|
+
if (value === undefined) {
|
|
70
|
+
return nxDetectsCI(env)
|
|
71
|
+
? { kind: "full", reason: `Nx detects CI and ${exports.testModeVariable} is not set` }
|
|
72
|
+
: { kind: "affected", reason: `${exports.testModeVariable} is not set and Nx detects no CI` };
|
|
73
|
+
}
|
|
74
|
+
if (value === "full" || value === "affected") {
|
|
75
|
+
return { kind: value, reason: `${exports.testModeVariable} is "${value}"` };
|
|
76
|
+
}
|
|
77
|
+
return { kind: "invalid", value };
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* The commits that cargo-affected's database in `workspaceRoot` holds
|
|
81
|
+
* coverage for, of every fingerprint, sorted and without repeats
|
|
82
|
+
* (`DES-TEST-MODE`, step 3). It reads `target/affected/coverage.db` with
|
|
83
|
+
* Node's SQLite and starts no cargo-affected, whose `status` builds the
|
|
84
|
+
* tests (`EVD-CARGO-AFFECTED-COST`).
|
|
85
|
+
*
|
|
86
|
+
* It never opens the database in a way that can write: only as immutable
|
|
87
|
+
* and read-only, which creates no file, since an ordinary read-only
|
|
88
|
+
* connection to a database in WAL mode creates `-wal` and `-shm` files and
|
|
89
|
+
* leaves them behind (`EVD-TEST-MODE-READING`). An immutable read ignores
|
|
90
|
+
* a `-wal` file and takes no lock, so it counts only where the database is
|
|
91
|
+
* whole and settled: a `-wal` file beside it before the read or after it,
|
|
92
|
+
* as while a collection runs or after one was interrupted, or a database
|
|
93
|
+
* file whose size, modification time or inode differs between the two
|
|
94
|
+
* looks, gives a problem and no commits. So do a missing database, a Node
|
|
95
|
+
* without `node:sqlite`, a database of another schema, as after
|
|
96
|
+
* cargo-affected changed it, one that cannot be read, one without coverage,
|
|
97
|
+
* and a commit that is not lower-case hexadecimal.
|
|
98
|
+
*
|
|
99
|
+
* @param workspaceRoot The workspace's root folder, absolute or relative to
|
|
100
|
+
* the current folder.
|
|
101
|
+
* @param steps For tests: a step between the first look and the open.
|
|
102
|
+
*/
|
|
103
|
+
// @mara implements DES-TEST-MODE
|
|
104
|
+
function baselineCommits(workspaceRoot, steps = {}) {
|
|
105
|
+
var _a;
|
|
106
|
+
const database = (0, node_path_1.join)(workspaceRoot, exports.baselineDatabase);
|
|
107
|
+
const wal = `${database}-wal`;
|
|
108
|
+
const unsettled = `the coverage baseline in ${exports.baselineDatabase} has a -wal file beside it, as while a collection runs or after one was interrupted`;
|
|
109
|
+
const before = fileState(database);
|
|
110
|
+
if (before === undefined) {
|
|
111
|
+
return { problem: `there is no coverage baseline: ${exports.baselineDatabase} does not exist` };
|
|
112
|
+
}
|
|
113
|
+
if ((0, node_fs_1.existsSync)(wal)) {
|
|
114
|
+
return { problem: unsettled };
|
|
115
|
+
}
|
|
116
|
+
let sqlite;
|
|
117
|
+
try {
|
|
118
|
+
sqlite = require("node:sqlite");
|
|
119
|
+
}
|
|
120
|
+
catch (_b) {
|
|
121
|
+
return {
|
|
122
|
+
problem: `this Node.js has no node:sqlite, with which @convesoft/nx-rust reads the coverage baseline in ${exports.baselineDatabase}`,
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
(_a = steps.beforeOpen) === null || _a === void 0 ? void 0 : _a.call(steps);
|
|
126
|
+
let values;
|
|
127
|
+
try {
|
|
128
|
+
const location = (0, node_url_1.pathToFileURL)(database);
|
|
129
|
+
location.searchParams.set("immutable", "1");
|
|
130
|
+
const connection = new sqlite.DatabaseSync(location, { readOnly: true });
|
|
131
|
+
try {
|
|
132
|
+
values = connection
|
|
133
|
+
.prepare("SELECT DISTINCT collect_sha FROM test_regions")
|
|
134
|
+
.all()
|
|
135
|
+
.map((row) => row.collect_sha);
|
|
136
|
+
}
|
|
137
|
+
finally {
|
|
138
|
+
connection.close();
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
catch (error) {
|
|
142
|
+
return {
|
|
143
|
+
problem: `the coverage baseline in ${exports.baselineDatabase} could not be read (${error instanceof Error ? error.message : String(error)})`,
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
if ((0, node_fs_1.existsSync)(wal)) {
|
|
147
|
+
return { problem: unsettled };
|
|
148
|
+
}
|
|
149
|
+
if (fileState(database) !== before) {
|
|
150
|
+
return { problem: `the coverage baseline in ${exports.baselineDatabase} changed while it was read` };
|
|
151
|
+
}
|
|
152
|
+
const commits = [...new Set(values)];
|
|
153
|
+
if (commits.length === 0) {
|
|
154
|
+
return { problem: `the coverage baseline in ${exports.baselineDatabase} holds no coverage` };
|
|
155
|
+
}
|
|
156
|
+
if (!commits.every((commit) => typeof commit === "string" && /^[0-9a-f]+$/.test(commit))) {
|
|
157
|
+
return {
|
|
158
|
+
problem: `the coverage baseline in ${exports.baselineDatabase} names a commit that is no hexadecimal object name`,
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
return { commits: commits.sort((a, b) => (a < b ? -1 : a > b ? 1 : 0)) };
|
|
162
|
+
}
|
|
163
|
+
/** The size, modification time and inode of a file, or `undefined` where it is missing. */
|
|
164
|
+
function fileState(path) {
|
|
165
|
+
try {
|
|
166
|
+
const stat = (0, node_fs_1.statSync)(path);
|
|
167
|
+
return stat.isFile() ? `${stat.size}:${stat.mtimeMs}:${stat.ino}` : undefined;
|
|
168
|
+
}
|
|
169
|
+
catch (_a) {
|
|
170
|
+
return undefined;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* The test mode of a run in the workspace at `workspaceRoot`, by the rule
|
|
175
|
+
* that the mode command and the test executor share (`DES-TEST-MODE`): the
|
|
176
|
+
* mode that `env` asks for, where `affected` stays `affected` only with a
|
|
177
|
+
* baseline whose commits can be read, and becomes `full` otherwise, with
|
|
178
|
+
* the reason.
|
|
179
|
+
*/
|
|
180
|
+
// @mara implements DES-TEST-MODE
|
|
181
|
+
function testMode(env, workspaceRoot) {
|
|
182
|
+
return testModeAt(env, workspaceRoot);
|
|
183
|
+
}
|
|
184
|
+
function testModeAt(env, workspaceRoot, steps = {}) {
|
|
185
|
+
const asked = askedTestMode(env);
|
|
186
|
+
if (asked.kind !== "affected") {
|
|
187
|
+
return asked;
|
|
188
|
+
}
|
|
189
|
+
const baseline = baselineCommits(workspaceRoot, steps);
|
|
190
|
+
return "commits" in baseline
|
|
191
|
+
? { kind: "affected", commits: baseline.commits, reason: asked.reason }
|
|
192
|
+
: { kind: "full", reason: `${asked.reason}, but ${baseline.problem}` };
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* What the mode command prints for `mode`, and with it what the key of a
|
|
196
|
+
* `test` task holds: `full`, `affected:<commits>` with the baseline's
|
|
197
|
+
* commits joined by `,`, or for an invalid `NX_RUST_TEST_MODE` a line that
|
|
198
|
+
* names the value, so that a failure that Nx stores with
|
|
199
|
+
* `NX_CACHE_FAILURES=true` is never restored for a valid mode.
|
|
200
|
+
*/
|
|
201
|
+
// @mara implements DES-TEST-MODE
|
|
202
|
+
function testModeText(mode) {
|
|
203
|
+
switch (mode.kind) {
|
|
204
|
+
case "full":
|
|
205
|
+
return "full";
|
|
206
|
+
case "affected":
|
|
207
|
+
return `affected:${mode.commits.join(",")}`;
|
|
208
|
+
case "invalid":
|
|
209
|
+
return `invalid ${exports.testModeVariable}=${JSON.stringify(mode.value)}`;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* The message of a task that fails before cargo runs because
|
|
214
|
+
* `NX_RUST_TEST_MODE` has another value than `full` or `affected`.
|
|
215
|
+
*/
|
|
216
|
+
function invalidTestModeMessage(task, value) {
|
|
217
|
+
return `${task}: ${exports.testModeVariable} is ${JSON.stringify(value)}, but it can only be "full", which runs the whole suite, or "affected", which runs the tests that a change can affect. Set it to one of the two, or unset it: a run then selects on a developer's machine and runs the whole suite where Nx detects CI. The task does not run, so that Nx stores no result for it.`;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* The line at the top of a `test` task's output in a workspace that uses
|
|
221
|
+
* selection, which says which suite the task runs and why (`DES-TEST-MODE`,
|
|
222
|
+
* `REQ-AFFECTED-TESTS`).
|
|
223
|
+
*
|
|
224
|
+
* @param optedOut Whether the task's `affectedTests` option is `false`, as a
|
|
225
|
+
* crate's table or `--affectedTests=false` sets it.
|
|
226
|
+
*/
|
|
227
|
+
function testModeNote(task, mode, optedOut) {
|
|
228
|
+
if (mode.kind === "invalid") {
|
|
229
|
+
return undefined;
|
|
230
|
+
}
|
|
231
|
+
const text = testModeText(mode);
|
|
232
|
+
if (optedOut) {
|
|
233
|
+
return `${task}: runs the full suite, because its option affectedTests is false; the test mode is ${text}.`;
|
|
234
|
+
}
|
|
235
|
+
if (mode.kind === "full") {
|
|
236
|
+
return `${task}: runs the full suite in test mode full, because ${mode.reason}.`;
|
|
237
|
+
}
|
|
238
|
+
return `${task}: test mode ${text}, because ${mode.reason}.`;
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* The folder under the repository root in which the mode command and the
|
|
242
|
+
* test executor keep their record of one `nx` command (`DES-TEST-MODE`,
|
|
243
|
+
* "Between hashing and the run"), one folder per command and workspace.
|
|
244
|
+
* Nx leaves `.nx/workspace-data` out of its file map, and the plugin's
|
|
245
|
+
* `postTasksExecution` hook removes a command's folders when it ends.
|
|
246
|
+
*/
|
|
247
|
+
exports.testModeRecordRoot = ".nx/workspace-data/nx-rust/test-mode";
|
|
248
|
+
/** The record's file of the modes that the mode command printed, one line each. */
|
|
249
|
+
const printedFile = "printed";
|
|
250
|
+
/** The record's file of the modes in which a task of the command ran a subset, one line each. */
|
|
251
|
+
const subsetFile = "subsets";
|
|
252
|
+
/**
|
|
253
|
+
* The id that the plugin's `preTasksExecution` hook gives the `nx` command
|
|
254
|
+
* whose task has the environment `env`, with only the characters that a
|
|
255
|
+
* folder name keeps; `undefined` without one.
|
|
256
|
+
*/
|
|
257
|
+
function commandIdOf(env) {
|
|
258
|
+
var _a;
|
|
259
|
+
const id = ((_a = env[lockfile_task_1.commandIdVariable]) !== null && _a !== void 0 ? _a : "").replace(/[^A-Za-z0-9-]/g, "");
|
|
260
|
+
return id === "" ? undefined : id;
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* The folder of the record of the command `commandId` for the workspace at
|
|
264
|
+
* `workspaceRoot` ({@link testModeRecordRoot}).
|
|
265
|
+
*
|
|
266
|
+
* @param workspaceRoot The workspace's root folder, relative to the repository root.
|
|
267
|
+
*/
|
|
268
|
+
function testModeRecordFolder(repositoryRoot, workspaceRoot, commandId) {
|
|
269
|
+
return (0, node_path_1.join)(repositoryRoot, exports.testModeRecordRoot, commandId, (0, lockfile_task_1.workspaceSegment)(workspaceRoot === "" ? "." : workspaceRoot));
|
|
270
|
+
}
|
|
271
|
+
// The lines of a record's file; none where it does not exist.
|
|
272
|
+
function recordLines(file) {
|
|
273
|
+
try {
|
|
274
|
+
return (0, node_fs_1.readFileSync)(file, "utf8")
|
|
275
|
+
.split("\n")
|
|
276
|
+
.filter((line) => line !== "");
|
|
277
|
+
}
|
|
278
|
+
catch (error) {
|
|
279
|
+
return error.code === "ENOENT" ? [] : undefined;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
/** A value that no other evaluation prints, so that no stored result is ever restored under it. */
|
|
283
|
+
function neverRestored() {
|
|
284
|
+
return `unrestorable ${(0, node_crypto_1.randomBytes)(16).toString("hex")}`;
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* What the mode command prints for a task with the environment `env` in
|
|
288
|
+
* the workspace at `workspaceRoot` (`DES-TEST-MODE`, "Between hashing and the
|
|
289
|
+
* run"): the text of its test mode ({@link testModeText}), with two
|
|
290
|
+
* exceptions that keep a subset's result from being stored under a key that
|
|
291
|
+
* it does not satisfy. Where a task of the same `nx` command has run, or is
|
|
292
|
+
* about to run, a subset in another mode than this text, it prints a value
|
|
293
|
+
* that is never restored ({@link neverRestored}): Nx hashes some tasks again
|
|
294
|
+
* after they ran, and the key of such a task must not say `full` or name
|
|
295
|
+
* another baseline. And where it cannot add what it prints to the command's
|
|
296
|
+
* record, it prints such a value as well, since the executor could then not
|
|
297
|
+
* see it.
|
|
298
|
+
*
|
|
299
|
+
* Without a command id from the plugin's hook, as where Nx hashes outside a
|
|
300
|
+
* run, it prints the text and records nothing.
|
|
301
|
+
*
|
|
302
|
+
* @param workspaceRoot The workspace's root folder, relative to `repositoryRoot`.
|
|
303
|
+
*/
|
|
304
|
+
// @mara implements DES-TEST-MODE
|
|
305
|
+
function printedTestMode(env, repositoryRoot, workspaceRoot, steps = {}) {
|
|
306
|
+
const text = testModeText(testModeAt(env, (0, node_path_1.join)(repositoryRoot, workspaceRoot), steps));
|
|
307
|
+
const id = commandIdOf(env);
|
|
308
|
+
if (id === undefined) {
|
|
309
|
+
return text;
|
|
310
|
+
}
|
|
311
|
+
const folder = testModeRecordFolder(repositoryRoot, workspaceRoot, id);
|
|
312
|
+
const subsets = recordLines((0, node_path_1.join)(folder, subsetFile));
|
|
313
|
+
const printed = subsets === undefined || subsets.some((subset) => subset !== text) ? neverRestored() : text;
|
|
314
|
+
try {
|
|
315
|
+
(0, node_fs_1.mkdirSync)(folder, { recursive: true });
|
|
316
|
+
(0, node_fs_1.appendFileSync)((0, node_path_1.join)(folder, printedFile), `${askedTestMode(env).kind}\t${printed}\n`);
|
|
317
|
+
}
|
|
318
|
+
catch (_a) {
|
|
319
|
+
return neverRestored();
|
|
320
|
+
}
|
|
321
|
+
return printed;
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Why a task in affected mode must not run a subset, because the test mode
|
|
325
|
+
* that Nx hashed for it may differ from the one its executor reads
|
|
326
|
+
* (`DES-TEST-MODE`, "Between hashing and the run"; `RISK-SUBSET-AS-FULL`), or
|
|
327
|
+
* `undefined` where it may. Nx hands an executor neither the task's hash
|
|
328
|
+
* details nor the output of its runtime inputs, so the executor reads what
|
|
329
|
+
* the mode command recorded for the command: every value that it printed in
|
|
330
|
+
* this command for a task of the workspace, whatever mode the task asked
|
|
331
|
+
* for, has to be `text`, the executor's own reading, and at least one has
|
|
332
|
+
* to be there. The task's own evaluation is among them, since Nx hashes a
|
|
333
|
+
* task after the command's `preTasksExecution` hook and before the task
|
|
334
|
+
* runs, and nothing in the record tells it from another task's.
|
|
335
|
+
*
|
|
336
|
+
* @param workspaceRoot The workspace's root folder, relative to `repositoryRoot`.
|
|
337
|
+
* @param text The test mode as the executor reads it, `affected:<commits>`.
|
|
338
|
+
*/
|
|
339
|
+
// @mara implements DES-TEST-MODE
|
|
340
|
+
function hashedModeProblem(env, repositoryRoot, workspaceRoot, text) {
|
|
341
|
+
const id = commandIdOf(env);
|
|
342
|
+
if (id === undefined) {
|
|
343
|
+
return `this run has no command id from the preTasksExecution hook of @convesoft/nx-rust, so the plugin cannot see which test mode Nx put into the task's cache key`;
|
|
344
|
+
}
|
|
345
|
+
const lines = recordLines((0, node_path_1.join)(testModeRecordFolder(repositoryRoot, workspaceRoot, id), printedFile));
|
|
346
|
+
if (lines === undefined) {
|
|
347
|
+
return `the record of the test modes that Nx hashed for this nx command cannot be read`;
|
|
348
|
+
}
|
|
349
|
+
// Every evaluation counts, whatever mode its task asked for: Nx runs the
|
|
350
|
+
// command with an environment that names no task, so the record cannot
|
|
351
|
+
// tell this task's evaluation from another's (`EVD-TEST-MODE-GUARD`).
|
|
352
|
+
const hashed = [...new Set(lines.map((line) => { var _a; return (_a = line.split("\t")[1]) !== null && _a !== void 0 ? _a : ""; }))];
|
|
353
|
+
if (hashed.length === 0) {
|
|
354
|
+
return `the mode command recorded no test mode for this nx command, so the plugin cannot see which one Nx put into the task's cache key`;
|
|
355
|
+
}
|
|
356
|
+
const other = hashed.filter((value) => value !== text);
|
|
357
|
+
if (other.length > 0) {
|
|
358
|
+
return `the tasks of this workspace in this nx command were hashed in different test modes: Nx hashed one with ${describeHashed(other)}, while the baseline now gives ${text} to this task, as where the tasks' environments ask for different modes or a collection created or changed the baseline after hashing, and a subset must not be stored under a key that may say otherwise`;
|
|
359
|
+
}
|
|
360
|
+
return undefined;
|
|
361
|
+
}
|
|
362
|
+
function describeHashed(values) {
|
|
363
|
+
return values
|
|
364
|
+
.map((value) => (value.startsWith("unrestorable ") ? "that is never restored" : value))
|
|
365
|
+
.join(" and ");
|
|
366
|
+
}
|
|
367
|
+
/**
|
|
368
|
+
* Adds `text` to the command's record of the modes in which its tasks run a
|
|
369
|
+
* subset, before the subset runs, so that the mode command prints a value
|
|
370
|
+
* that is never restored wherever Nx hashes a task of the workspace again
|
|
371
|
+
* in this command with another mode ({@link printedTestMode}).
|
|
372
|
+
*
|
|
373
|
+
* @returns Whether the record holds it; where not, the task must run its full suite.
|
|
374
|
+
*/
|
|
375
|
+
// @mara implements DES-TEST-MODE
|
|
376
|
+
function recordSubset(env, repositoryRoot, workspaceRoot, text) {
|
|
377
|
+
const id = commandIdOf(env);
|
|
378
|
+
if (id === undefined) {
|
|
379
|
+
return false;
|
|
380
|
+
}
|
|
381
|
+
const folder = testModeRecordFolder(repositoryRoot, workspaceRoot, id);
|
|
382
|
+
try {
|
|
383
|
+
(0, node_fs_1.mkdirSync)(folder, { recursive: true });
|
|
384
|
+
(0, node_fs_1.appendFileSync)((0, node_path_1.join)(folder, subsetFile), `${text}\n`);
|
|
385
|
+
return true;
|
|
386
|
+
}
|
|
387
|
+
catch (_a) {
|
|
388
|
+
return false;
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
//# sourceMappingURL=test-mode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"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,CAAC,EAAE,CAAC;QACrB,OAAO,0GAA0G,cAAc,CAAC,KAAK,CAAC,kCAAkC,IAAI,2MAA2M,CAAC;IAC1X,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,cAAc,CAAC,MAAyB;IAC/C,OAAO,MAAM;SACV,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,wBAAwB,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;SACtF,IAAI,CAAC,OAAO,CAAC,CAAC;AACnB,CAAC;AAED;;;;;;;GAOG;AACH,iCAAiC;AACjC,SAAgB,YAAY,CAC1B,GAAsB,EACtB,cAAsB,EACtB,aAAqB,EACrB,IAAY;IAEZ,MAAM,EAAE,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;IAC5B,IAAI,EAAE,KAAK,SAAS,EAAE,CAAC;QACrB,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,MAAM,GAAG,oBAAoB,CAAC,cAAc,EAAE,aAAa,EAAE,EAAE,CAAC,CAAC;IACvE,IAAI,CAAC;QACH,IAAA,mBAAS,EAAC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACvC,IAAA,wBAAc,EAAC,IAAA,gBAAI,EAAC,MAAM,EAAE,UAAU,CAAC,EAAE,GAAG,IAAI,IAAI,CAAC,CAAC;QACtD,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,WAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/** The variable that names the group's packages, as `:a:b:`. */
|
|
2
|
+
export declare const packagesVariable = "NX_RUST_TEST_PACKAGES";
|
|
3
|
+
/** The variable that names the folder of the step's record. */
|
|
4
|
+
export declare const recordVariable = "NX_RUST_TEST_RECORD";
|
|
5
|
+
/** The status with which the runner ends where it cannot do its part. */
|
|
6
|
+
export declare const runnerFailureStatus = 125;
|
|
7
|
+
/** One entry of a record file, one JSON object per line. */
|
|
8
|
+
export type RecordEntry = {
|
|
9
|
+
start: {
|
|
10
|
+
package: string;
|
|
11
|
+
program: string;
|
|
12
|
+
};
|
|
13
|
+
} | {
|
|
14
|
+
skip: true;
|
|
15
|
+
} | {
|
|
16
|
+
error: string;
|
|
17
|
+
} | {
|
|
18
|
+
end: {
|
|
19
|
+
status: number;
|
|
20
|
+
} | {
|
|
21
|
+
signal: string;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
/** What {@link superviseChild} needs from a started program. */
|
|
25
|
+
export interface SupervisedChild {
|
|
26
|
+
kill(signal: NodeJS.Signals): unknown;
|
|
27
|
+
on(event: "error", listener: (error: Error) => void): unknown;
|
|
28
|
+
on(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): unknown;
|
|
29
|
+
}
|
|
30
|
+
/** How the runner ends: by a signal it raises on itself, or with a status. */
|
|
31
|
+
export interface RunnerEnding {
|
|
32
|
+
raise(signal: NodeJS.Signals): void;
|
|
33
|
+
exit(status: number): void;
|
|
34
|
+
}
|
|
35
|
+
/** The runner's own ending: the child's signal raised on the runner's own process. */
|
|
36
|
+
export declare const processEnding: RunnerEnding;
|
|
37
|
+
/**
|
|
38
|
+
* Forwards the signals that end a run to the started program and, once it
|
|
39
|
+
* has ended, adds the end entry to the record file `fd` and ends the runner
|
|
40
|
+
* the same way, through `ending`. Tests pass an ending of their own, so
|
|
41
|
+
* that a program ended by a signal that dumps core does not make the test
|
|
42
|
+
* process raise it on itself.
|
|
43
|
+
*/
|
|
44
|
+
export declare function superviseChild(child: SupervisedChild, fd: number, program: string, ending?: RunnerEnding): void;
|