@convesoft/nx-rust 0.0.0 → 1.0.0-rc.2
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/PLUGIN.md +106 -0
- package/README.md +51 -1
- package/docs/artifacts.mara.md +374 -0
- package/docs/caching.mara.md +999 -0
- package/docs/ci.mara.md +308 -0
- package/docs/configuration.mara.md +508 -0
- package/docs/decisions.mara.md +3267 -0
- package/docs/execution.mara.md +533 -0
- package/docs/index.mara.md +51 -0
- package/docs/product.mara.md +366 -0
- package/docs/release.mara.md +493 -0
- package/docs/setup.mara.md +486 -0
- package/docs/targets.mara.md +704 -0
- package/docs/testing.mara.md +431 -0
- package/docs/verification.mara.md +465 -0
- package/docs/workspaces.mara.md +445 -0
- package/executors.json +35 -0
- package/generators.json +19 -0
- package/package.json +17 -4
- package/src/cargo/build-settings.d.ts +61 -0
- package/src/cargo/build-settings.js +103 -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 +114 -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 +90 -0
- package/src/cargo/redirections.js +200 -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/cargo/warnings-setting.d.ts +24 -0
- package/src/cargo/warnings-setting.js +81 -0
- package/src/cargo/warnings-setting.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 +58 -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 +218 -0
- package/src/executors/cargo-output.js +660 -0
- package/src/executors/cargo-output.js.map +1 -0
- package/src/executors/command.d.ts +331 -0
- package/src/executors/command.js +547 -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/denied-warnings.d.ts +99 -0
- package/src/executors/denied-warnings.js +188 -0
- package/src/executors/denied-warnings.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 +601 -0
- package/src/executors/group-run.js.map +1 -0
- package/src/executors/groups.d.ts +118 -0
- package/src/executors/groups.js +304 -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 +189 -0
- package/src/executors/nextest.js +504 -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 +435 -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 +527 -0
- package/src/executors/task.js.map +1 -0
- package/src/executors/test-mode.d.ts +185 -0
- package/src/executors/test-mode.js +397 -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 +121 -0
- package/src/executors/test-steps.js +566 -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 +681 -0
- package/src/graph/caching.js.map +1 -0
- package/src/graph/clippy-input.d.ts +53 -0
- package/src/graph/clippy-input.js +107 -0
- package/src/graph/clippy-input.js.map +1 -0
- package/src/graph/collisions.d.ts +113 -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 +190 -0
- package/src/graph/discovery.js +661 -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 +422 -0
- package/src/graph/inputs.js +756 -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 +193 -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/rustfmt-config.d.ts +42 -0
- package/src/graph/rustfmt-config.js +173 -0
- package/src/graph/rustfmt-config.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 +371 -0
- package/src/graph/targets.js +408 -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,188 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.warnedPackages = warnedPackages;
|
|
4
|
+
exports.withDeniedWarnings = withDeniedWarnings;
|
|
5
|
+
exports.readTestStepWithWarnings = readTestStepWithWarnings;
|
|
6
|
+
exports.deniedWarningsLine = deniedWarningsLine;
|
|
7
|
+
exports.stoppedByWarnings = stoppedByWarnings;
|
|
8
|
+
exports.describeWarnedPackages = describeWarnedPackages;
|
|
9
|
+
exports.describeStoppedByWarnings = describeStoppedByWarnings;
|
|
10
|
+
exports.fixOfStoppedByWarnings = fixOfStoppedByWarnings;
|
|
11
|
+
const cargo_output_1 = require("./cargo-output");
|
|
12
|
+
/**
|
|
13
|
+
* The packages for which a command's JSON messages report a warning: a
|
|
14
|
+
* `compiler-message` whose level is `warning`, by the package ID
|
|
15
|
+
* specification that the message names.
|
|
16
|
+
*/
|
|
17
|
+
function warnedPackages(output) {
|
|
18
|
+
var _a;
|
|
19
|
+
const warned = new Set();
|
|
20
|
+
for (const line of output.split("\n")) {
|
|
21
|
+
if (!line.startsWith('{"reason":"compiler-message"')) {
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
try {
|
|
25
|
+
const message = JSON.parse(line);
|
|
26
|
+
if (((_a = message.message) === null || _a === void 0 ? void 0 : _a.level) === "warning" && typeof message.package_id === "string") {
|
|
27
|
+
warned.add(message.package_id);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
catch (_b) {
|
|
31
|
+
// A line cut short fails every crate already (`readJsonStep`).
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return warned;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Fails every task that passed a step of `build`, `check`, `lint`,
|
|
38
|
+
* `napi-build` or `wasm-build` with JSON messages where the messages report
|
|
39
|
+
* a warning and Cargo denies warnings for the command (`DES-BATCH`, "Denied
|
|
40
|
+
* warnings"). Under `--message-format=json` cargo neither fails on them nor
|
|
41
|
+
* says which crates a warning would fail (`EVD-CARGO-TARGET-COMMANDS`); had
|
|
42
|
+
* it applied the setting, the step's command would have failed as a whole.
|
|
43
|
+
*
|
|
44
|
+
* @param tasks The step's tasks, as `<project>:<target>`, in the order of
|
|
45
|
+
* `outcomes`.
|
|
46
|
+
* @param denied Whether Cargo denies warnings for the command, asked only
|
|
47
|
+
* where the messages report a warning and a task passed.
|
|
48
|
+
* @returns The outcomes, with each task that passed failed where warnings
|
|
49
|
+
* are denied.
|
|
50
|
+
*/
|
|
51
|
+
// @mara implements DES-BATCH
|
|
52
|
+
function withDeniedWarnings(outcomes, output, tasks, denied) {
|
|
53
|
+
if (outcomes.every((outcome) => !outcome.passed)) {
|
|
54
|
+
return [...outcomes];
|
|
55
|
+
}
|
|
56
|
+
const warned = warnedPackages(output);
|
|
57
|
+
if (warned.size === 0) {
|
|
58
|
+
return [...outcomes];
|
|
59
|
+
}
|
|
60
|
+
const denial = denied();
|
|
61
|
+
if (denial === undefined) {
|
|
62
|
+
return [...outcomes];
|
|
63
|
+
}
|
|
64
|
+
const names = [...new Set([...warned].map((id) => `\`${(0, cargo_output_1.packageName)(id)}\``))].sort();
|
|
65
|
+
return outcomes.map((outcome, index) => {
|
|
66
|
+
if (!outcome.passed) {
|
|
67
|
+
return outcome;
|
|
68
|
+
}
|
|
69
|
+
const message = `${tasks[index]}: cargo reported warnings in ${(0, cargo_output_1.describeList)(names)}, and warnings are denied: ${denial.source}. Under the JSON messages that this command reads, cargo does not fail on them and does not say which crates they would fail, while the command would have failed as a whole without those messages, so every task of the command that passed fails.`;
|
|
70
|
+
return {
|
|
71
|
+
passed: false,
|
|
72
|
+
output: outcome.output,
|
|
73
|
+
message: outcome.message === undefined ? message : `${outcome.message}\n${message}`,
|
|
74
|
+
};
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Reads a `cargo test` that selects its crates with `-p` ({@link readTestStep}),
|
|
79
|
+
* naming, where cargo failed and says that it denies warnings, the packages
|
|
80
|
+
* with warnings and what denies them (`DES-TEST-RUN`, "Denied warnings in a
|
|
81
|
+
* test step").
|
|
82
|
+
*/
|
|
83
|
+
// @mara implements DES-TEST-RUN
|
|
84
|
+
function readTestStepWithWarnings(output, end, crates, setting) {
|
|
85
|
+
const stopped = end.kind === "failed" ? stoppedByWarnings(output.split("\n"), setting) : undefined;
|
|
86
|
+
return (0, cargo_output_1.readTestStep)(output, end, crates, stopped === undefined
|
|
87
|
+
? undefined
|
|
88
|
+
: {
|
|
89
|
+
cause: describeStoppedByWarnings(stopped, (names) => describeWarnedPackages(names, crates, undefined)),
|
|
90
|
+
fix: fixOfStoppedByWarnings(stopped),
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
// Cargo's progress bar, without escape sequences, as it writes it before a
|
|
94
|
+
// carriage return where CARGO_TERM_PROGRESS_WHEN=always asks for it:
|
|
95
|
+
// ` Building [========> ] 1/3: d(test)` padded with spaces.
|
|
96
|
+
const progressBar = /^\s*Building \[[ =>]*\] \d+\/\d+(?:: .*)?$/;
|
|
97
|
+
/**
|
|
98
|
+
* A line of cargo's output as the reading of denied warnings matches it
|
|
99
|
+
* (`DES-TEST-RUN`, "Denied warnings in a test step"): {@link plainLine},
|
|
100
|
+
* and without cargo's progress bars before its last carriage return, where
|
|
101
|
+
* everything before that carriage return is such a bar; any other line is
|
|
102
|
+
* read as {@link plainLine} reads it. Only the denial line, cargo's
|
|
103
|
+
* summaries of denied warnings and the warning blocks that every task gets
|
|
104
|
+
* are read this way, so that text that a test prints after a carriage
|
|
105
|
+
* return is read as before everywhere else.
|
|
106
|
+
*/
|
|
107
|
+
function deniedWarningsLine(line) {
|
|
108
|
+
const plain = (0, cargo_output_1.plainLine)(line).replace(/\r+$/, "");
|
|
109
|
+
const segments = plain.split("\r");
|
|
110
|
+
const last = segments.pop();
|
|
111
|
+
return segments.every((segment) => segment === "" || progressBar.test(segment)) ? last : plain;
|
|
112
|
+
}
|
|
113
|
+
// Cargo's line after the summary of a unit whose warnings it denies.
|
|
114
|
+
const deniedLine = /^error: warnings are denied by `build\.warnings` configuration$/;
|
|
115
|
+
// Cargo's summary of a unit's warnings, which starts with `error:` where it
|
|
116
|
+
// denies them and with `warning:` otherwise.
|
|
117
|
+
const deniedSummary = /^error: `([^`]+)` \([^)]*\) generated \d+ warnings?\b/;
|
|
118
|
+
// Cargo's lines that name a crate that did not compile.
|
|
119
|
+
const notCompiledLine = /^error: (?:could not compile `|failed to run custom build command for `)/;
|
|
120
|
+
/**
|
|
121
|
+
* Reads from a test step's text, which cargo prints without JSON messages
|
|
122
|
+
* or with `json-render-diagnostics`, whether cargo stopped because it denies
|
|
123
|
+
* warnings: where a line says `warnings are denied by \`build.warnings\`
|
|
124
|
+
* configuration`. The packages are those of cargo's summaries that start
|
|
125
|
+
* with `error:`, as `` error: `d` (lib) generated 1 warning ``; cargo starts
|
|
126
|
+
* no new job after the first, so it names only the packages that it compiled
|
|
127
|
+
* before it stopped. Those two kinds of lines are read as
|
|
128
|
+
* {@link deniedWarningsLine} gives them, without escape sequences and
|
|
129
|
+
* cargo's progress bars. The plugin decides nothing itself: it
|
|
130
|
+
* reads cargo's verdict, and `setting` only names what denies the warnings.
|
|
131
|
+
*
|
|
132
|
+
* @returns `undefined` where cargo does not say that warnings are denied.
|
|
133
|
+
*/
|
|
134
|
+
// @mara implements DES-TEST-RUN
|
|
135
|
+
function stoppedByWarnings(lines, setting) {
|
|
136
|
+
const denials = lines.map(deniedWarningsLine);
|
|
137
|
+
if (!denials.some((line) => deniedLine.test(line))) {
|
|
138
|
+
return undefined;
|
|
139
|
+
}
|
|
140
|
+
const packages = [...new Set(denials.flatMap((line) => { var _a, _b; return (_b = (_a = deniedSummary.exec(line)) === null || _a === void 0 ? void 0 : _a[1]) !== null && _b !== void 0 ? _b : []; }))];
|
|
141
|
+
const plain = lines.map(cargo_output_1.plainLine);
|
|
142
|
+
const furtherErrors = !plain.some((line) => notCompiledLine.test(line)) &&
|
|
143
|
+
plain.some((line) => /^error(?:\[|:)/.test(line) && !deniedLine.test(line) && !deniedSummary.test(line));
|
|
144
|
+
return { packages, source: setting(), furtherErrors };
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* The packages with warnings, as a test step's message names them: each in
|
|
148
|
+
* backquotes, and each that is no crate of the group marked as outside the
|
|
149
|
+
* selection of the run, with why cargo compiled it. In a step that selects
|
|
150
|
+
* the whole workspace, `outsideMembers` holds the names of the members
|
|
151
|
+
* outside the group, which the step compiles as members, while it compiles
|
|
152
|
+
* any other package for a crate of the workspace; in a step that selects its
|
|
153
|
+
* crates (`outsideMembers` undefined), cargo compiles it for one of those.
|
|
154
|
+
*/
|
|
155
|
+
function describeWarnedPackages(names, crates, outsideMembers) {
|
|
156
|
+
const inGroup = new Set(crates.map((crate) => crate.name));
|
|
157
|
+
const why = (name) => outsideMembers === undefined
|
|
158
|
+
? "cargo compiles it for a crate that this run selects"
|
|
159
|
+
: outsideMembers.has(name)
|
|
160
|
+
? "under workspace-build, cargo test compiles the tests and libraries of every crate of the workspace"
|
|
161
|
+
: "cargo compiles it for a crate of the workspace";
|
|
162
|
+
return (0, cargo_output_1.describeList)(names.map((name) => inGroup.has(name)
|
|
163
|
+
? `\`${name}\``
|
|
164
|
+
: `\`${name}\`, which is outside the selection of this run (${why(name)})`));
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* The cause of a test step's stop by denied warnings, as a message names
|
|
168
|
+
* it: the packages with warnings, as `describe` names them, and what denies
|
|
169
|
+
* them, worded as the JSON compile steps' message words it
|
|
170
|
+
* ({@link withDeniedWarnings}), and, where cargo reported further errors,
|
|
171
|
+
* that it did.
|
|
172
|
+
*/
|
|
173
|
+
function describeStoppedByWarnings(stopped, describe) {
|
|
174
|
+
const setting = stopped.source === undefined
|
|
175
|
+
? "warnings are denied by Cargo's build.warnings setting, as cargo says"
|
|
176
|
+
: `warnings are denied: ${stopped.source}`;
|
|
177
|
+
const cause = stopped.packages.length === 0
|
|
178
|
+
? `${setting}, and cargo's output names no package with warnings; its diagnostics above show them`
|
|
179
|
+
: `cargo reported warnings in ${describe(stopped.packages)}, and ${setting}`;
|
|
180
|
+
return stopped.furtherErrors
|
|
181
|
+
? `${cause}, and because cargo reported further errors above`
|
|
182
|
+
: cause;
|
|
183
|
+
}
|
|
184
|
+
/** What a message about a stop by denied warnings asks to fix. */
|
|
185
|
+
function fixOfStoppedByWarnings(stopped) {
|
|
186
|
+
return stopped.furtherErrors ? "the warnings and the errors above" : "the warnings";
|
|
187
|
+
}
|
|
188
|
+
//# sourceMappingURL=denied-warnings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"denied-warnings.js","sourceRoot":"","sources":["../../../../nx-rust/src/executors/denied-warnings.ts"],"names":[],"mappings":";;AAgBA,wCAgBC;AAkBD,gDA6BC;AAiBD,4DAqBC;AAiCD,gDAKC;AAyBD,8CAgBC;AAWD,wDAmBC;AASD,8DAeC;AAGD,wDAEC;AA9PD,iDAQwB;AAExB;;;;GAIG;AACH,SAAgB,cAAc,CAAC,MAAc;;IAC3C,MAAM,MAAM,GAAG,IAAI,GAAG,EAAU,CAAC;IACjC,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;QACtC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,8BAA8B,CAAC,EAAE,CAAC;YACrD,SAAS;QACX,CAAC;QACD,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAA4D,CAAC;YAC5F,IAAI,CAAA,MAAA,OAAO,CAAC,OAAO,0CAAE,KAAK,MAAK,SAAS,IAAI,OAAO,OAAO,CAAC,UAAU,KAAK,QAAQ,EAAE,CAAC;gBACnF,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;YACjC,CAAC;QACH,CAAC;QAAC,WAAM,CAAC;YACP,+D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AmD;QAC7D,CAAC,CAAC,KAAK,CAAC;AACZ,CAAC;AAED,kEAAkE;AAClE,SAAgB,sBAAsB,CAAC,OAA0B;IAC/D,OAAO,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,mCAAmC,CAAC,CAAC,CAAC,cAAc,CAAC;AACtF,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;
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.commandCopyLifetime = void 0;
|
|
4
|
+
exports.heldMembers = heldMembers;
|
|
5
|
+
exports.writeDigests = writeDigests;
|
|
6
|
+
exports.checkDigests = checkDigests;
|
|
7
|
+
const node_fs_1 = require("node:fs");
|
|
8
|
+
const node_path_1 = require("node:path");
|
|
9
|
+
const lockfile_1 = require("../cargo/lockfile");
|
|
10
|
+
const lockfile_task_1 = require("../graph/lockfile-task");
|
|
11
|
+
/**
|
|
12
|
+
* The members whose digests a task's key holds, in the order the check
|
|
13
|
+
* after cargo's call compares them ({@link checkDigests}): those that the
|
|
14
|
+
* target's metadata names, the crate's own, and where the metadata says
|
|
15
|
+
* that the key holds every member's digest (`everyDigest`), each other
|
|
16
|
+
* member of the workspace as its lockfile task's metadata names them
|
|
17
|
+
* (`DES-LOCKFILE-HASHING`, "Post-check"). So the check names the crate's own
|
|
18
|
+
* digest where that changed, and another member's only where the crate's
|
|
19
|
+
* stayed the same.
|
|
20
|
+
*
|
|
21
|
+
* @param workspaceMembers The members that the lockfile task writes digests for.
|
|
22
|
+
* @returns `undefined` where the key holds every member's digest but the
|
|
23
|
+
* lockfile task names no member, so that the list cannot be known.
|
|
24
|
+
*/
|
|
25
|
+
// @mara implements DES-LOCKFILE-HASHING
|
|
26
|
+
function heldMembers(own, everyDigest, workspaceMembers) {
|
|
27
|
+
if (!everyDigest) {
|
|
28
|
+
return [...own];
|
|
29
|
+
}
|
|
30
|
+
if (workspaceMembers === undefined || workspaceMembers.length === 0) {
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
const names = new Set(own.map((member) => member.name));
|
|
34
|
+
return [...own, ...workspaceMembers.filter((member) => !names.has(member.name))];
|
|
35
|
+
}
|
|
36
|
+
/** How old a private copy may get before a lockfile task removes it, in milliseconds. */
|
|
37
|
+
exports.commandCopyLifetime = 24 * 60 * 60 * 1000;
|
|
38
|
+
/**
|
|
39
|
+
* The step of the lockfile task after `cargo update --workspace`: one file
|
|
40
|
+
* per member in the workspace's digest folder, named after its package
|
|
41
|
+
* name and holding its digest of the `Cargo.lock` that cargo left
|
|
42
|
+
* (`DES-LOCKFILE-HASHING`), which is what Nx hashes into the keys of the
|
|
43
|
+
* tasks that depend on the task; and the same files in a folder private to
|
|
44
|
+
* the task's `nx` command, which no other command writes, for the check
|
|
45
|
+
* after cargo's call ({@link checkDigests}). Other files in the digest
|
|
46
|
+
* folder, such as those of removed members, are deleted, so that the folder
|
|
47
|
+
* holds exactly the task's output, and so are the private folders of other
|
|
48
|
+
* commands that are older than a day, which a stopped command left. Each
|
|
49
|
+
* file is replaced in one step, so that a reader never sees part of one.
|
|
50
|
+
*
|
|
51
|
+
* @param task The task, `<project>:<target>`, for the message.
|
|
52
|
+
* @param now The current time, in milliseconds.
|
|
53
|
+
* @returns The message to fail the task with, or `undefined` once the
|
|
54
|
+
* digests are written.
|
|
55
|
+
*/
|
|
56
|
+
// @mara implements DES-LOCKFILE-HASHING
|
|
57
|
+
function writeDigests(task, step, now = Date.now()) {
|
|
58
|
+
let digests;
|
|
59
|
+
try {
|
|
60
|
+
const lockfile = readLockfile(step.lockfile);
|
|
61
|
+
digests = new Map(step.members.map((member) => [fileName(member), (0, lockfile_1.memberDigest)(lockfile, member)]));
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
if (error instanceof lockfile_1.LockfileError) {
|
|
65
|
+
return `${task}: nx-rust cannot read the digests of the workspace's members from ${step.lockfile}, which cargo update left: ${error.message}.`;
|
|
66
|
+
}
|
|
67
|
+
throw error;
|
|
68
|
+
}
|
|
69
|
+
removeOldCommandFolders((0, node_path_1.join)(step.folder, lockfile_task_1.commandsFolderName), now);
|
|
70
|
+
for (const folder of [step.commandFolder, step.folder]) {
|
|
71
|
+
if (folder === undefined) {
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
(0, node_fs_1.mkdirSync)(folder, { recursive: true });
|
|
75
|
+
for (const [file, digest] of digests) {
|
|
76
|
+
const temporary = (0, node_path_1.join)(folder, `.${file}.${process.pid}.tmp`);
|
|
77
|
+
(0, node_fs_1.writeFileSync)(temporary, `${digest}\n`);
|
|
78
|
+
(0, node_fs_1.renameSync)(temporary, (0, node_path_1.join)(folder, file));
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
for (const file of (0, node_fs_1.readdirSync)(step.folder)) {
|
|
82
|
+
if (!digests.has(file) && file !== lockfile_task_1.commandsFolderName) {
|
|
83
|
+
(0, node_fs_1.rmSync)((0, node_path_1.join)(step.folder, file), { recursive: true, force: true });
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return undefined;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* The check of `DES-LOCKFILE-HASHING`, "Post-check", after the cargo call of
|
|
90
|
+
* a task whose key holds digests. For each member, three values must be
|
|
91
|
+
* equal: the digest that the lockfile task of the task's own `nx` command
|
|
92
|
+
* wrote to its private copy, the shared digest file, which Nx hashed into
|
|
93
|
+
* the key, as it is now, and the digest computed again from `Cargo.lock`
|
|
94
|
+
* now. A difference means that a manifest or `Cargo.lock` changed while the
|
|
95
|
+
* run went on, also through another `nx` command, whose lockfile task
|
|
96
|
+
* rewrites the shared file, so that cargo may have built with locked
|
|
97
|
+
* dependencies that the task's key does not describe. The task then fails,
|
|
98
|
+
* so that Nx stores nothing for it. A missing private copy fails it as
|
|
99
|
+
* well: the shared file alone cannot show what the key holds.
|
|
100
|
+
*
|
|
101
|
+
* @returns The message to fail the task with, or `undefined` when every digest matches.
|
|
102
|
+
*/
|
|
103
|
+
// @mara implements DES-LOCKFILE-HASHING
|
|
104
|
+
// @mara implements DES-DIAGNOSTICS
|
|
105
|
+
function checkDigests(check) {
|
|
106
|
+
const where = check.workspace === "." ? "at the repository root" : `in ${check.workspace}`;
|
|
107
|
+
const failure = (reason) => [
|
|
108
|
+
`${check.task}: ${reason}`,
|
|
109
|
+
`Cargo.lock of the Cargo workspace ${where}, or its digest, changed while the run went on, such as through an edit of a Cargo.toml or through another nx command that ran at the same time, so that cargo may have built with locked dependencies that the task's cache key does not describe. The task fails, so that Nx stores no result for it; run it again.`,
|
|
110
|
+
].join("\n");
|
|
111
|
+
if (check.commandFolder === undefined) {
|
|
112
|
+
return failure("this nx command has no id from the plugin's preTasksExecution hook, so nx-rust cannot tell which digests its lockfile task wrote.");
|
|
113
|
+
}
|
|
114
|
+
let lockfile;
|
|
115
|
+
try {
|
|
116
|
+
lockfile = readLockfile(check.lockfile);
|
|
117
|
+
}
|
|
118
|
+
catch (error) {
|
|
119
|
+
if (error instanceof lockfile_1.LockfileError) {
|
|
120
|
+
return failure(`nx-rust cannot read ${check.lockfile} after cargo's call: ${error.message}.`);
|
|
121
|
+
}
|
|
122
|
+
throw error;
|
|
123
|
+
}
|
|
124
|
+
for (const member of check.members) {
|
|
125
|
+
let current;
|
|
126
|
+
try {
|
|
127
|
+
current = (0, lockfile_1.memberDigest)(lockfile, member);
|
|
128
|
+
}
|
|
129
|
+
catch (error) {
|
|
130
|
+
if (error instanceof lockfile_1.LockfileError) {
|
|
131
|
+
return failure(`after cargo's call, ${check.lockfile} no longer gives the locked dependencies of ${member.name}: ${error.message}.`);
|
|
132
|
+
}
|
|
133
|
+
throw error;
|
|
134
|
+
}
|
|
135
|
+
const own = readDigest((0, node_path_1.join)(check.commandFolder, fileName(member)));
|
|
136
|
+
if (own === undefined) {
|
|
137
|
+
return failure(`the digest of the locked dependencies of ${member.name} that this command's lockfile task wrote is missing from ${check.commandFolder}.`);
|
|
138
|
+
}
|
|
139
|
+
const shared = readDigest((0, node_path_1.join)(check.folder, fileName(member)));
|
|
140
|
+
if (shared !== own || current !== own) {
|
|
141
|
+
return failure(`the locked dependencies of ${member.name} had the digest ${own} when this command's lockfile task ran; now Cargo.lock gives ${current}, and the digest file that Nx hashed holds ${shared !== null && shared !== void 0 ? shared : "nothing"}.`);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
return undefined;
|
|
145
|
+
}
|
|
146
|
+
function fileName(member) {
|
|
147
|
+
return (0, lockfile_task_1.digestFileName)(member.name);
|
|
148
|
+
}
|
|
149
|
+
// The digest in a file, or `undefined` where it cannot be read.
|
|
150
|
+
function readDigest(file) {
|
|
151
|
+
try {
|
|
152
|
+
return (0, node_fs_1.readFileSync)(file, "utf8").trim();
|
|
153
|
+
}
|
|
154
|
+
catch (_a) {
|
|
155
|
+
return undefined;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
// Removes the private folders of commands that were last written more than
|
|
159
|
+
// a day ago.
|
|
160
|
+
function removeOldCommandFolders(commands, now) {
|
|
161
|
+
let names;
|
|
162
|
+
try {
|
|
163
|
+
names = (0, node_fs_1.readdirSync)(commands);
|
|
164
|
+
}
|
|
165
|
+
catch (_a) {
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
for (const name of names) {
|
|
169
|
+
const folder = (0, node_path_1.join)(commands, name);
|
|
170
|
+
try {
|
|
171
|
+
if (now - (0, node_fs_1.statSync)(folder).mtimeMs > exports.commandCopyLifetime) {
|
|
172
|
+
(0, node_fs_1.rmSync)(folder, { recursive: true, force: true });
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
catch (_b) {
|
|
176
|
+
// Removed by another command meanwhile.
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
function readLockfile(path) {
|
|
181
|
+
let text;
|
|
182
|
+
try {
|
|
183
|
+
text = (0, node_fs_1.readFileSync)(path, "utf8");
|
|
184
|
+
}
|
|
185
|
+
catch (error) {
|
|
186
|
+
throw new lockfile_1.LockfileError(`it cannot be read (${error.message})`);
|
|
187
|
+
}
|
|
188
|
+
return (0, lockfile_1.parseLockfile)(text);
|
|
189
|
+
}
|
|
190
|
+
//# sourceMappingURL=digests.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"digests.js","sourceRoot":"","sources":["../../../../nx-rust/src/executors/digests.ts"],"names":[],"mappings":";;;AA6EA,kCAaC;AAwBD,oCAmCC;AAmBD,oCA+CC;AAvND,qCAQiB;AACjB,yCAAiC;AACjC,gDAM2B;AAC3B,0DAA4E;AA6C5E;;;;;;;;;;;;;GAaG;AACH,wCAAwC;AACxC,SAAgB,WAAW,CACzB,GAA8B,EAC9B,WAAoB,EACpB,gBAAuD;IAEvD,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,OAAO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ACpC,IAAI,CAAC;YACH,IAAI,GAAG,GAAG,IAAA,kBAAQ,EAAC,MAAM,CAAC,CAAC,OAAO,GAAG,2BAAmB,EAAE,CAAC;gBACzD,IAAA,gBAAM,EAAC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;YACnD,CAAC;QACH,CAAC;QAAC,WAAM,CAAC;YACP,wCAAwC;QAC1C,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAS,YAAY,CAAC,IAAY;IAChC,IAAI,IAAY,CAAC;IACjB,IAAI,CAAC;QACH,IAAI,GAAG,IAAA,sBAAY,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACpC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,wBAAa,CAAC,sBAAuB,KAAe,CAAC,OAAO,GAAG,CAAC,CAAC;IAC7E,CAAC;IACD,OAAO,IAAA,wBAAa,EAAC,IAAI,CAAC,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { ProjectGraph, Task } from "@nx/devkit";
|
|
2
|
+
/** The task that {@link dotenvProblem} checks, as Nx's `getEnvFilesForTask` reads it. */
|
|
3
|
+
export type DotenvTask = Pick<Task, "id" | "projectRoot"> & {
|
|
4
|
+
target: {
|
|
5
|
+
project: string;
|
|
6
|
+
target: string;
|
|
7
|
+
configuration?: string;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
/** A task's dotenv files as dotenv reads them for Nx. */
|
|
11
|
+
export interface TaskDotenv {
|
|
12
|
+
/** The paths, relative to the repository root, of the files that exist. */
|
|
13
|
+
existing: string[];
|
|
14
|
+
/** Each variable's value from the first file that defines it, as dotenv merges them. */
|
|
15
|
+
raw: Record<string, string>;
|
|
16
|
+
/** The file that gives each variable of {@link raw}. */
|
|
17
|
+
origin: Map<string, string>;
|
|
18
|
+
/** The files that define `NX_LOAD_DOT_ENV_FILES`. */
|
|
19
|
+
loadSwitches: string[];
|
|
20
|
+
/** The vaults that dotenv would read where `DOTENV_KEY` is set. */
|
|
21
|
+
vaults: string[];
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* The dotenv files that Nx loads for `task` and what they define, read with
|
|
25
|
+
* the installed Nx's `getEnvFilesForTask` and dotenv's own parser; files that
|
|
26
|
+
* do not exist are not read.
|
|
27
|
+
*
|
|
28
|
+
* @throws {TaskEnvironmentError} When the installed Nx lacks what it reads.
|
|
29
|
+
*/
|
|
30
|
+
export declare function readTaskDotenv(task: DotenvTask, graph: ProjectGraph, root: string): TaskDotenv;
|
|
31
|
+
/**
|
|
32
|
+
* Every name that one of the dotenv files that Nx loads for `task` defines,
|
|
33
|
+
* in any of them.
|
|
34
|
+
*
|
|
35
|
+
* @throws {TaskEnvironmentError} When the installed Nx lacks what it reads.
|
|
36
|
+
*/
|
|
37
|
+
export declare function dotenvDefinitions(task: DotenvTask, graph: ProjectGraph, root: string): string[];
|
|
38
|
+
/**
|
|
39
|
+
* Why a task's dotenv files cannot be shown to give cargo the same values in
|
|
40
|
+
* every way of running the task, or `undefined` where they can (`DES-BATCH`,
|
|
41
|
+
* "Dotenv files"). The same check runs for a task run on its own and for a
|
|
42
|
+
* task of a batch, before any cargo command, and reads the files that Nx loads
|
|
43
|
+
* for the task and nothing else; without any, it reads nothing.
|
|
44
|
+
*
|
|
45
|
+
* A vault that dotenv would read because `DOTENV_KEY` is set fails the task
|
|
46
|
+
* first, whether or not a plain file exists beside it and whether or not Nx
|
|
47
|
+
* loads the task's files, since Nx reads the root vaults when it removes the
|
|
48
|
+
* root files' values from the task.
|
|
49
|
+
*
|
|
50
|
+
* Whether Nx loads the files, the `nx` process's `NX_LOAD_DOT_ENV_FILES`
|
|
51
|
+
* decides, which a file that defines the variable could change in the
|
|
52
|
+
* environment that the task ends with: a task whose files define it fails,
|
|
53
|
+
* and otherwise the task's environment has the value that decided.
|
|
54
|
+
*
|
|
55
|
+
* Nx expands the dotenv files of a task run on its own in the `nx` process
|
|
56
|
+
* and a batch expands them in its own process, where the variables of
|
|
57
|
+
* {@link runDependentVariables} can have other values; the plugin checks them
|
|
58
|
+
* in the task's or the batch's process, where they can differ again. Every
|
|
59
|
+
* other variable has the same value in all of these processes. From every
|
|
60
|
+
* variable that the files define and that is not in
|
|
61
|
+
* {@link runDependentVariables}, the check walks `$VAR`, `${VAR...}` and
|
|
62
|
+
* `$$VAR` references statically as the installed `dotenv-expand` matches,
|
|
63
|
+
* splits (including `split(null)` on `"null"`), escapes (`(?<!\\)`), and
|
|
64
|
+
* replaces them, through the raw definitions and the values in `env` of every
|
|
65
|
+
* variable reached, following both branches of every `:-`, `-`, `:+` and `+`
|
|
66
|
+
* with a visited set for cycles, and fails the task where a variable of
|
|
67
|
+
* {@link runDependentVariables} is reached or where a value holds a form from
|
|
68
|
+
* which a variable name could be assembled. A source-text tripwire test guards
|
|
69
|
+
* those `dotenv-expand` behaviours instead of a run-time version pin.
|
|
70
|
+
* Diagnostics never include text from any variable's value.
|
|
71
|
+
*
|
|
72
|
+
* @param env The environment that the plugin gives cargo for the task: the
|
|
73
|
+
* values that the files gave it, and every other variable as the process
|
|
74
|
+
* that expanded them had it, apart from those of the set.
|
|
75
|
+
* @throws {TaskEnvironmentError} When the installed Nx lacks what the check
|
|
76
|
+
* reads.
|
|
77
|
+
*/
|
|
78
|
+
export declare function dotenvProblem(task: DotenvTask, graph: ProjectGraph, root: string, env: NodeJS.ProcessEnv): string | undefined;
|
|
79
|
+
export declare function nxDependency(nxFile: string, name: string): Record<string, unknown>;
|