@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,165 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = releasePublish;
|
|
4
|
+
exports.batch = batch;
|
|
5
|
+
const tslib_1 = require("tslib");
|
|
6
|
+
const publish_1 = require("../../release/publish");
|
|
7
|
+
const cargo_invocation_1 = require("../cargo-invocation");
|
|
8
|
+
const dotenv_check_1 = require("../dotenv-check");
|
|
9
|
+
const task_guards_1 = require("../task-guards");
|
|
10
|
+
const task_env_1 = require("../task-env");
|
|
11
|
+
/**
|
|
12
|
+
* The executor of `nx-release-publish`, `@convesoft/nx-rust:release-publish`,
|
|
13
|
+
* for a task that Nx runs on its own, as with `NX_BATCH_MODE=false`: the task
|
|
14
|
+
* runs the same checks as in a batch and one `cargo publish --locked -p
|
|
15
|
+
* <crate>` for its own crate, with its target registry (`DES-RELEASE`,
|
|
16
|
+
* "Without a batch"), after the dotenv check of the cargo executors
|
|
17
|
+
* (`DES-RELEASE`, "Dotenv files").
|
|
18
|
+
*/
|
|
19
|
+
// @mara implements DES-RELEASE
|
|
20
|
+
function releasePublish(options, context) {
|
|
21
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
var _a, e_1, _b, _c;
|
|
23
|
+
var _d, _e, _f;
|
|
24
|
+
const project = (_d = context.projectName) !== null && _d !== void 0 ? _d : "";
|
|
25
|
+
const target = (_e = context.targetName) !== null && _e !== void 0 ? _e : "";
|
|
26
|
+
const task = (_f = (0, task_guards_1.graphTaskOf)(context)) !== null && _f !== void 0 ? _f : {
|
|
27
|
+
id: `${project}:${target}`,
|
|
28
|
+
target: Object.assign({ project,
|
|
29
|
+
target }, (context.configurationName === undefined
|
|
30
|
+
? {}
|
|
31
|
+
: { configuration: context.configurationName })),
|
|
32
|
+
overrides: {},
|
|
33
|
+
outputs: [],
|
|
34
|
+
cache: false,
|
|
35
|
+
parallelism: true,
|
|
36
|
+
};
|
|
37
|
+
let env;
|
|
38
|
+
try {
|
|
39
|
+
env = checkedEnvironment(withProjectRoot(task, context), context.projectGraph, context.root, (0, task_env_1.withoutUnloadedRootValues)((0, task_env_1.cargoTaskEnvironment)(process.env, (0, task_guards_1.singleTaskShape)(context)), context.root));
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
if (!(error instanceof task_env_1.TaskEnvironmentError)) {
|
|
43
|
+
throw error;
|
|
44
|
+
}
|
|
45
|
+
env = {
|
|
46
|
+
failure: `${task.target.project}:${task.target.target}: @convesoft/nx-rust cannot build this task's environment, because ${error.message}. Nothing was published. Use an Nx version that @convesoft/nx-rust supports.`,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
let success = false;
|
|
50
|
+
try {
|
|
51
|
+
for (var _g = true, _h = tslib_1.__asyncValues((0, publish_1.publishTasks)([{ id: task.id, task, options, env }], Object.assign({ context }, ((0, cargo_invocation_1.taskRunsVerbosely)(context) ? { announce: cargo_invocation_1.printCommand } : {})))), _j; _j = yield _h.next(), _a = _j.done, !_a; _g = true) {
|
|
52
|
+
_c = _j.value;
|
|
53
|
+
_g = false;
|
|
54
|
+
const report = _c;
|
|
55
|
+
success = report.result.success;
|
|
56
|
+
const stream = success ? process.stdout : process.stderr;
|
|
57
|
+
yield new Promise((resolve) => stream.write(report.result.terminalOutput, () => resolve()));
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
61
|
+
finally {
|
|
62
|
+
try {
|
|
63
|
+
if (!_g && !_a && (_b = _h.return)) yield _b.call(_h);
|
|
64
|
+
}
|
|
65
|
+
finally { if (e_1) throw e_1.error; }
|
|
66
|
+
}
|
|
67
|
+
return { success };
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* The batch implementation of `@convesoft/nx-rust:release-publish`, which
|
|
72
|
+
* receives the runnable `nx-release-publish` tasks of one release group
|
|
73
|
+
* (`EVD-NX-24-PUBLISH-BATCHES`) and publishes the crates of each Cargo
|
|
74
|
+
* workspace and registry with one `cargo publish` (`DES-RELEASE`, "Batch";
|
|
75
|
+
* `ADR-BATCHED-PUBLISH`). Each task gets the environment that it gets when
|
|
76
|
+
* it runs on its own (`DES-BATCH`), checked as there (`DES-RELEASE`,
|
|
77
|
+
* "Dotenv files"), and a result of its own, also where its environment cannot
|
|
78
|
+
* be rebuilt.
|
|
79
|
+
*/
|
|
80
|
+
// @mara implements DES-RELEASE
|
|
81
|
+
// @mara implements DES-BATCH
|
|
82
|
+
function batch(taskGraph, inputs, _overrides, context) {
|
|
83
|
+
return tslib_1.__asyncGenerator(this, arguments, function* batch_1() {
|
|
84
|
+
const ids = Object.keys(taskGraph.tasks);
|
|
85
|
+
let environmentOf;
|
|
86
|
+
try {
|
|
87
|
+
if (context.projectGraph === undefined) {
|
|
88
|
+
throw new task_env_1.TaskEnvironmentError("Nx gave the batch no project graph");
|
|
89
|
+
}
|
|
90
|
+
const graph = context.projectGraph;
|
|
91
|
+
environmentOf = (0, task_env_1.taskEnvironments)(context.root, graph, (task) => (0, dotenv_check_1.dotenvDefinitions)(task, graph, context.root).filter((name) => Object.prototype.hasOwnProperty.call(task_env_1.runDependentVariables, name)));
|
|
92
|
+
}
|
|
93
|
+
catch (error) {
|
|
94
|
+
environmentOf = { failure: reason(error) };
|
|
95
|
+
}
|
|
96
|
+
const publishInputs = ids.map((id) => {
|
|
97
|
+
var _a;
|
|
98
|
+
const task = taskGraph.tasks[id];
|
|
99
|
+
const label = `${task.target.project}:${task.target.target}`;
|
|
100
|
+
let env;
|
|
101
|
+
if ("failure" in environmentOf) {
|
|
102
|
+
env = {
|
|
103
|
+
failure: `${label}: @convesoft/nx-rust cannot rebuild this task's environment in a batch, because ${environmentOf.failure}. Nothing was published. Run the tasks with NX_BATCH_MODE=false, or use an Nx version that @convesoft/nx-rust supports.`,
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
const shaped = withProjectRoot(task, context);
|
|
108
|
+
try {
|
|
109
|
+
env = checkedEnvironment(shaped, context.projectGraph, context.root, environmentOf(shaped));
|
|
110
|
+
}
|
|
111
|
+
catch (error) {
|
|
112
|
+
env = {
|
|
113
|
+
failure: `${label}: @convesoft/nx-rust cannot rebuild this task's environment in a batch, because ${reason(error)}. Nothing was published. Run the tasks with NX_BATCH_MODE=false, or use an Nx version that @convesoft/nx-rust supports.`,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return { id, task, options: (_a = inputs[id]) !== null && _a !== void 0 ? _a : {}, env };
|
|
118
|
+
});
|
|
119
|
+
// Decided once for the batch, from the batch process's own environment
|
|
120
|
+
// (`DES-INVOCATION`, "Printing the command").
|
|
121
|
+
const verbose = (0, cargo_invocation_1.batchRunsVerbosely)(process.env);
|
|
122
|
+
yield tslib_1.__await(yield* tslib_1.__asyncDelegator(tslib_1.__asyncValues((0, publish_1.publishTasks)(publishInputs, Object.assign({ context }, (verbose ? { announce: cargo_invocation_1.printCommand } : {}))))));
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* The task's environment, or why its dotenv files fail the check that the
|
|
127
|
+
* cargo executors run on a task's environment before cargo runs
|
|
128
|
+
* (`DES-RELEASE`, "Dotenv files"; `DES-BATCH`, "Dotenv files").
|
|
129
|
+
*/
|
|
130
|
+
function checkedEnvironment(task, graph, root, env) {
|
|
131
|
+
const label = `${task.target.project}:${task.target.target}`;
|
|
132
|
+
let problem;
|
|
133
|
+
try {
|
|
134
|
+
if (graph === undefined) {
|
|
135
|
+
throw new task_env_1.TaskEnvironmentError("Nx gave the task no project graph");
|
|
136
|
+
}
|
|
137
|
+
problem = (0, dotenv_check_1.dotenvProblem)(task, graph, root, env);
|
|
138
|
+
}
|
|
139
|
+
catch (error) {
|
|
140
|
+
if (!(error instanceof task_env_1.TaskEnvironmentError)) {
|
|
141
|
+
throw error;
|
|
142
|
+
}
|
|
143
|
+
return {
|
|
144
|
+
failure: `${label}: @convesoft/nx-rust cannot check the dotenv files of this task, because ${error.message}. Nothing was published. Use an Nx version that @convesoft/nx-rust supports.`,
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
return problem === undefined ? env : { failure: `${label}: ${problem}` };
|
|
148
|
+
}
|
|
149
|
+
// The task with the root of its project, which Nx's dotenv files of the task
|
|
150
|
+
// depend on, where the task graph leaves it out.
|
|
151
|
+
function withProjectRoot(task, context) {
|
|
152
|
+
var _a, _b, _c;
|
|
153
|
+
return task.projectRoot === undefined
|
|
154
|
+
? Object.assign(Object.assign({}, task), { projectRoot: (_c = (_b = (_a = context.projectsConfigurations) === null || _a === void 0 ? void 0 : _a.projects) === null || _b === void 0 ? void 0 : _b[task.target.project]) === null || _c === void 0 ? void 0 : _c.root }) : task;
|
|
155
|
+
}
|
|
156
|
+
// Why the environment cannot be rebuilt: the reason of the plugin's own
|
|
157
|
+
// error, or the whole error of an unexpected one.
|
|
158
|
+
function reason(error) {
|
|
159
|
+
var _a;
|
|
160
|
+
if (error instanceof task_env_1.TaskEnvironmentError) {
|
|
161
|
+
return error.message;
|
|
162
|
+
}
|
|
163
|
+
return error instanceof Error ? ((_a = error.stack) !== null && _a !== void 0 ? _a : error.message) : String(error);
|
|
164
|
+
}
|
|
165
|
+
//# sourceMappingURL=executor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../../nx-rust/src/executors/release-publish/executor.ts"],"names":[],"mappings":";;AAsBA,iCAmDC;AAcD,sBA6CC;;AAnID,mDAA4F;AAC5F,0DAA0F;AAC1F,kDAAmE;AACnE,gDAA8D;AAC9D,0CAMqB;AAErB;;;;;;;GAOG;AACH,+BAA+B;AAC/B,SAA8B,cAAc,CAC1C,OAAgC,EAChC,OAAwB;;;;QAExB,MAAM,OAAO,GAAG,MAAA,OAAO,CAAC,WAAW,mCAAI,EAAE,CAAC;QAC1C,MAAM,MAAM,GAAG,MAAA,OA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OAAwB;;IAC3D,OAAO,IAAI,CAAC,WAAW,KAAK,SAAS;QACnC,CAAC,iCACM,IAAI,KACP,WAAW,EAAE,MAAA,MAAA,MAAA,OAAO,CAAC,sBAAsB,0CAAE,QAAQ,0CAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,0CAAE,IAAI,IAEtF,CAAC,CAAC,IAAI,CAAC;AACX,CAAC;AAED,wEAAwE;AACxE,kDAAkD;AAClD,SAAS,MAAM,CAAC,KAAc;;IAC5B,IAAI,KAAK,YAAY,+BAAoB,EAAE,CAAC;QAC1C,OAAO,KAAK,CAAC,OAAO,CAAC;IACvB,CAAC;IACD,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,MAAA,KAAK,CAAC,KAAK,mCAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACjF,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
|
+
"version": 2,
|
|
4
|
+
"outputCapture": "pipe",
|
|
5
|
+
"title": "release-publish",
|
|
6
|
+
"description": "Publishes a crate with cargo publish for nx release publish, with one call for the crates of each Cargo workspace and registry in a batch, after the checks that the release design asks for.",
|
|
7
|
+
"type": "object",
|
|
8
|
+
"properties": {
|
|
9
|
+
"dryRun": {
|
|
10
|
+
"type": "boolean",
|
|
11
|
+
"description": "Verify the crates without uploading them, passed as --dry-run. nx release publish --dry-run sets it."
|
|
12
|
+
},
|
|
13
|
+
"registry": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"description": "Nx's npm registry option, which nx-rust does not map to a Cargo registry: a task that receives it fails before cargo runs and says how Cargo chooses a registry."
|
|
16
|
+
},
|
|
17
|
+
"firstRelease": {
|
|
18
|
+
"type": "boolean",
|
|
19
|
+
"description": "Set by nx release publish --first-release. It changes nothing: the executor still leaves out versions that the registry has."
|
|
20
|
+
},
|
|
21
|
+
"nxReleaseVersionData": {
|
|
22
|
+
"type": "object",
|
|
23
|
+
"description": "The versions that nx release passes to its publish step. It changes nothing."
|
|
24
|
+
},
|
|
25
|
+
"pluginVersion": {
|
|
26
|
+
"type": "string",
|
|
27
|
+
"description": "The plugin's version, which the plugin sets. Not meant to be set by hand."
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ExecutorContext } from "@nx/devkit";
|
|
2
|
+
import type { CargoTargetOptions } from "../command";
|
|
3
|
+
/**
|
|
4
|
+
* The executor of `run`, `@convesoft/nx-rust:run`, which has no batch
|
|
5
|
+
* implementation: `cargo run` accepts one package only, and Nx would hand
|
|
6
|
+
* every task of an executor with one to a single batch (`DES-TARGET-COMMANDS`).
|
|
7
|
+
* The binary gets the words of the `args` option and the arguments after
|
|
8
|
+
* `--` on the command line (`DES-UNKNOWN-OPTIONS`).
|
|
9
|
+
*/
|
|
10
|
+
export default function run(options: CargoTargetOptions, context: ExecutorContext): Promise<{
|
|
11
|
+
success: boolean;
|
|
12
|
+
}>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = run;
|
|
4
|
+
const targets_1 = require("../../graph/targets");
|
|
5
|
+
const task_1 = require("../task");
|
|
6
|
+
const declared_options_1 = require("../declared-options");
|
|
7
|
+
// The executor, with the options of its schema, read where graph creation
|
|
8
|
+
// reads them (`declaredExecutorOptions`).
|
|
9
|
+
const executor = {
|
|
10
|
+
name: targets_1.runExecutor,
|
|
11
|
+
shortName: "run",
|
|
12
|
+
declared: (0, declared_options_1.declaredOptionsOf)(targets_1.runExecutor),
|
|
13
|
+
serves: (target) => target === "run",
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* The executor of `run`, `@convesoft/nx-rust:run`, which has no batch
|
|
17
|
+
* implementation: `cargo run` accepts one package only, and Nx would hand
|
|
18
|
+
* every task of an executor with one to a single batch (`DES-TARGET-COMMANDS`).
|
|
19
|
+
* The binary gets the words of the `args` option and the arguments after
|
|
20
|
+
* `--` on the command line (`DES-UNKNOWN-OPTIONS`).
|
|
21
|
+
*/
|
|
22
|
+
// @mara implements DES-TARGETS
|
|
23
|
+
// @mara implements DES-TARGET-COMMANDS
|
|
24
|
+
function run(options, context) {
|
|
25
|
+
return (0, task_1.runTask)(executor, options, context);
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=executor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../../nx-rust/src/executors/run/executor.ts"],"names":[],"mappings":";;AAyBA,sBAKC;AA7BD,iDAAkD;AAElD,kCAAkC;AAElC,0DAAwD;AAExD,0EAA0E;AAC1E,0CAA0C;AAC1C,MAAM,QAAQ,GAAmB;IAC/B,IAAI,EAAE,qBAAW;IACjB,SAAS,EAAE,KAAK;IAChB,QAAQ,EAAE,IAAA,oCAAiB,EAAC,qBAAW,CAAC;IACxC,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,KAAK,KAAK;CACrC,CAAC;AAEF;;;;;;GAMG;AACH,+BAA+B;AAC/B,uCAAuC;AACvC,SAAwB,GAAG,CACzB,OAA2B,EAC3B,OAAwB;IAExB,OAAO,IAAA,cAAO,EAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;AAC7C,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
|
+
"version": 2,
|
|
4
|
+
"outputCapture": "pipe",
|
|
5
|
+
"title": "cargo run",
|
|
6
|
+
"description": "Runs a binary of a crate with cargo run, in the root folder of the Cargo workspace.",
|
|
7
|
+
"type": "object",
|
|
8
|
+
"properties": {
|
|
9
|
+
"features": {
|
|
10
|
+
"type": "array",
|
|
11
|
+
"items": {
|
|
12
|
+
"type": "string"
|
|
13
|
+
},
|
|
14
|
+
"description": "Features to activate, passed as --features. Taken by build, check, lint, test, bench, run and doc."
|
|
15
|
+
},
|
|
16
|
+
"allFeatures": {
|
|
17
|
+
"type": "boolean",
|
|
18
|
+
"description": "Activate all features, passed as --all-features. Taken by build, check, lint, test, bench, run and doc."
|
|
19
|
+
},
|
|
20
|
+
"noDefaultFeatures": {
|
|
21
|
+
"type": "boolean",
|
|
22
|
+
"description": "Do not activate the default features, passed as --no-default-features. Taken by build, check, lint, test, bench, run and doc."
|
|
23
|
+
},
|
|
24
|
+
"profile": {
|
|
25
|
+
"type": "string",
|
|
26
|
+
"description": "The Cargo profile to build with, passed as --profile. Taken by build, check, lint, test, bench, run and doc."
|
|
27
|
+
},
|
|
28
|
+
"targetTriple": {
|
|
29
|
+
"type": "string",
|
|
30
|
+
"description": "The platform triple to build for, passed as --target. Taken by build, check, lint, bench, run and doc; test runs on the host triple only."
|
|
31
|
+
},
|
|
32
|
+
"bin": {
|
|
33
|
+
"type": "string",
|
|
34
|
+
"description": "The binary to run, passed as --bin, for a crate with several binaries and no default-run."
|
|
35
|
+
},
|
|
36
|
+
"args": {
|
|
37
|
+
"type": "string",
|
|
38
|
+
"description": "Arguments for the binary, after those of cargo: a string split into words at blanks, where quotes and backslashes group and escape as in a POSIX shell and nothing is expanded. Arguments after -- on the nx command line follow them."
|
|
39
|
+
},
|
|
40
|
+
"pluginVersion": {
|
|
41
|
+
"type": "string",
|
|
42
|
+
"description": "The plugin's version, which the plugin sets for the cache key. Not meant to be set by hand."
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The absolute path of the selecting runner's script in the plugin's
|
|
3
|
+
* package, `test-runner.js` beside this module (`DES-TEST-RUN`, "The runner
|
|
4
|
+
* program").
|
|
5
|
+
*/
|
|
6
|
+
export declare function runnerScript(): string;
|
|
7
|
+
/**
|
|
8
|
+
* The selecting runner's command, `["<node>", "<script>"]`: the Node that
|
|
9
|
+
* runs the batch implementation, or the task, and the script, by absolute
|
|
10
|
+
* paths (`DES-TEST-RUN`, "The runner program").
|
|
11
|
+
*/
|
|
12
|
+
export declare function runnerCommand(): string[];
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.runnerScript = runnerScript;
|
|
4
|
+
exports.runnerCommand = runnerCommand;
|
|
5
|
+
const node_path_1 = require("node:path");
|
|
6
|
+
/**
|
|
7
|
+
* The absolute path of the selecting runner's script in the plugin's
|
|
8
|
+
* package, `test-runner.js` beside this module (`DES-TEST-RUN`, "The runner
|
|
9
|
+
* program").
|
|
10
|
+
*/
|
|
11
|
+
function runnerScript() {
|
|
12
|
+
return (0, node_path_1.join)(__dirname, "test-runner.js");
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* The selecting runner's command, `["<node>", "<script>"]`: the Node that
|
|
16
|
+
* runs the batch implementation, or the task, and the script, by absolute
|
|
17
|
+
* paths (`DES-TEST-RUN`, "The runner program").
|
|
18
|
+
*/
|
|
19
|
+
function runnerCommand() {
|
|
20
|
+
return [process.execPath, runnerScript()];
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=runner-script.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runner-script.js","sourceRoot":"","sources":["../../../../nx-rust/src/executors/runner-script.ts"],"names":[],"mappings":";;AAOA,oCAEC;AAOD,sCAEC;AAlBD,yCAAiC;AAEjC;;;;GAIG;AACH,SAAgB,YAAY;IAC1B,OAAO,IAAA,gBAAI,EAAC,SAAS,EAAE,gBAAgB,CAAC,CAAC;AAC3C,CAAC;AAED;;;;GAIG;AACH,SAAgB,aAAa;IAC3B,OAAO,CAAC,OAAO,CAAC,QAAQ,EAAE,YAAY,EAAE,CAAC,CAAC;AAC5C,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One warning for each runtime input of the task's target that runs one of
|
|
3
|
+
* the plugin's Node scripts and fails when the executor runs its command
|
|
4
|
+
* again, in the repository root with the task's environment, as Nx runs it
|
|
5
|
+
* when it hashes the task (`DES-INPUTS`, "Failing runtime inputs"). Nx shows
|
|
6
|
+
* nothing of a runtime input, neither its status nor its standard error, and
|
|
7
|
+
* keys the task on what it prints (`EVD-RUNTIME-INPUT-SCRIPTS`), so where
|
|
8
|
+
* the script fails, the command prints a value that never repeats and Nx
|
|
9
|
+
* never restores the task. The executor cannot see what Nx hashed, so the
|
|
10
|
+
* warning says what this run of the command gave, the command and what the
|
|
11
|
+
* script wrote to its standard error, and that a failure the same way when
|
|
12
|
+
* Nx computed the key keeps the result from being restored.
|
|
13
|
+
*
|
|
14
|
+
* The commands are recognised by the line they print when they fail
|
|
15
|
+
* ({@link failedInputLine}). The environment leaves out the command id of
|
|
16
|
+
* the plugin's hook, so that the mode command of `DES-TEST-MODE` adds
|
|
17
|
+
* nothing to the command's record. A failure that is gone by the time the
|
|
18
|
+
* task runs gives no warning.
|
|
19
|
+
*
|
|
20
|
+
* @param inputs The `inputs` of the task's target, as Nx resolved them.
|
|
21
|
+
* @param root The repository root.
|
|
22
|
+
* @param env The task's environment.
|
|
23
|
+
*/
|
|
24
|
+
export declare function failedInputWarnings(task: string, inputs: readonly unknown[] | undefined, root: string, env: NodeJS.ProcessEnv): string[];
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.failedInputWarnings = failedInputWarnings;
|
|
4
|
+
const node_child_process_1 = require("node:child_process");
|
|
5
|
+
const lockfile_task_1 = require("../graph/lockfile-task");
|
|
6
|
+
const script_input_1 = require("../graph/script-input");
|
|
7
|
+
/**
|
|
8
|
+
* What each command gave in this process, by its text and environment, so
|
|
9
|
+
* that the tasks of a batch with the same command and environment run it
|
|
10
|
+
* once.
|
|
11
|
+
*/
|
|
12
|
+
const outcomes = new Map();
|
|
13
|
+
/**
|
|
14
|
+
* One warning for each runtime input of the task's target that runs one of
|
|
15
|
+
* the plugin's Node scripts and fails when the executor runs its command
|
|
16
|
+
* again, in the repository root with the task's environment, as Nx runs it
|
|
17
|
+
* when it hashes the task (`DES-INPUTS`, "Failing runtime inputs"). Nx shows
|
|
18
|
+
* nothing of a runtime input, neither its status nor its standard error, and
|
|
19
|
+
* keys the task on what it prints (`EVD-RUNTIME-INPUT-SCRIPTS`), so where
|
|
20
|
+
* the script fails, the command prints a value that never repeats and Nx
|
|
21
|
+
* never restores the task. The executor cannot see what Nx hashed, so the
|
|
22
|
+
* warning says what this run of the command gave, the command and what the
|
|
23
|
+
* script wrote to its standard error, and that a failure the same way when
|
|
24
|
+
* Nx computed the key keeps the result from being restored.
|
|
25
|
+
*
|
|
26
|
+
* The commands are recognised by the line they print when they fail
|
|
27
|
+
* ({@link failedInputLine}). The environment leaves out the command id of
|
|
28
|
+
* the plugin's hook, so that the mode command of `DES-TEST-MODE` adds
|
|
29
|
+
* nothing to the command's record. A failure that is gone by the time the
|
|
30
|
+
* task runs gives no warning.
|
|
31
|
+
*
|
|
32
|
+
* @param inputs The `inputs` of the task's target, as Nx resolved them.
|
|
33
|
+
* @param root The repository root.
|
|
34
|
+
* @param env The task's environment.
|
|
35
|
+
*/
|
|
36
|
+
// @mara implements DES-INPUTS
|
|
37
|
+
function failedInputWarnings(task, inputs, root, env) {
|
|
38
|
+
const commands = (inputs !== null && inputs !== void 0 ? inputs : []).flatMap((input) => typeof input === "object" &&
|
|
39
|
+
input !== null &&
|
|
40
|
+
"runtime" in input &&
|
|
41
|
+
typeof input.runtime === "string" &&
|
|
42
|
+
input.runtime.includes(script_input_1.failedInputLine)
|
|
43
|
+
? [input.runtime]
|
|
44
|
+
: []);
|
|
45
|
+
const warnings = [];
|
|
46
|
+
for (const command of new Set(commands)) {
|
|
47
|
+
const error = failure(command, root, env);
|
|
48
|
+
if (error !== undefined) {
|
|
49
|
+
warnings.push([
|
|
50
|
+
`${task}: a runtime input that @convesoft/nx-rust gives this task failed when the executor ran it for this task, in the repository root with the task's environment. The command`,
|
|
51
|
+
` ${command}`,
|
|
52
|
+
error === ""
|
|
53
|
+
? "printed the line that says so, and its script wrote nothing to standard error."
|
|
54
|
+
: `printed the line that says so, and its script wrote to standard error:\n${error}`,
|
|
55
|
+
"If it failed the same way when Nx computed the task's cache key, that key repeats in no other run, and Nx does not restore this result from its cache.",
|
|
56
|
+
].join("\n"));
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return warnings;
|
|
60
|
+
}
|
|
61
|
+
// What the script of `command` wrote to its standard error where the
|
|
62
|
+
// command prints the line of a failure, and `undefined` where it does not.
|
|
63
|
+
function failure(command, root, env) {
|
|
64
|
+
const runEnv = Object.assign(Object.assign({}, env), { [script_input_1.inputErrorsVariable]: "2" });
|
|
65
|
+
delete runEnv[lockfile_task_1.commandIdVariable];
|
|
66
|
+
const key = JSON.stringify([
|
|
67
|
+
command,
|
|
68
|
+
root,
|
|
69
|
+
Object.entries(runEnv).sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0)),
|
|
70
|
+
]);
|
|
71
|
+
if (outcomes.has(key)) {
|
|
72
|
+
return outcomes.get(key);
|
|
73
|
+
}
|
|
74
|
+
const run = (0, node_child_process_1.spawnSync)("sh", ["-c", command], {
|
|
75
|
+
cwd: root,
|
|
76
|
+
env: runEnv,
|
|
77
|
+
encoding: "utf8",
|
|
78
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
79
|
+
});
|
|
80
|
+
// Where no shell starts, the executor cannot tell, and says nothing.
|
|
81
|
+
const outcome = run.error === undefined && run.stdout.split("\n").includes(script_input_1.failedInputLine)
|
|
82
|
+
? run.stderr.trim()
|
|
83
|
+
: undefined;
|
|
84
|
+
outcomes.set(key, outcome);
|
|
85
|
+
return outcome;
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=runtime-input-check.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-input-check.js","sourceRoot":"","sources":["../../../../nx-rust/src/executors/runtime-input-check.ts"],"names":[],"mappings":";;AAmCA,kDAgCC;AAnED,2DAA+C;AAC/C,0DAA2D;AAC3D,wDAA6E;AAE7E;;;;GAIG;AACH,MAAM,QAAQ,GAAG,IAAI,GAAG,EAA8B,CAAC;AAEvD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,8BAA8B;AAC9B,SAAgB,mBAAmB,CACjC,IAAY,EACZ,MAAsC,EACtC,IAAY,EACZ,GAAsB;IAEtB,MAAM,QAAQ,GAAG,CAAC,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAChD,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,SAAS,IAAI,KAAK;QAClB,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ;QACjC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,8BAAe,CAAC;QACrC,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC;QACjB,CAAC,CAAC,EAAE,CACP,CAAC;IACF,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,KAAK,MAAM,OAAO,IAAI,IAAI,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;QACxC,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;QAC1C,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,QAAQ,CAAC,IAAI,CACX;gBACE,GAAG,IAAI,0KAA0K;gBACjL,KAAK,OAAO,EAAE;gBACd,KAAK,KAAK,EAAE;oBACV,CAAC,CAAC,gFAAgF;oBAClF,CAAC,CAAC,2EAA2E,KAAK,EAAE;gBACtF,wJAAwJ;aACzJ,CAAC,IAAI,CAAC,IAAI,CA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B,CAAC,CAAC,SAAS,CAAC;IAChB,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IAC3B,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { ProjectConfiguration } from "@nx/devkit";
|
|
2
|
+
/** What a task of the plugin is about to cache, as far as the check needs it. */
|
|
3
|
+
export interface CachedTask {
|
|
4
|
+
/** The task, as `project:target`. */
|
|
5
|
+
task: string;
|
|
6
|
+
/** The task's project. */
|
|
7
|
+
project: string;
|
|
8
|
+
/** The task's target by its default name. */
|
|
9
|
+
target: "build" | "doc" | "test";
|
|
10
|
+
}
|
|
11
|
+
/** A target of another project whose files can lie where the task's do. */
|
|
12
|
+
export interface SharedArtifact {
|
|
13
|
+
/** The other target, as `project:target`. */
|
|
14
|
+
other: string;
|
|
15
|
+
/** The file that both write, or for `doc` the `doc` folder. */
|
|
16
|
+
file: string;
|
|
17
|
+
/** The task's artifact directory, relative to the repository's real path. */
|
|
18
|
+
directory: string;
|
|
19
|
+
/** The other target's artifact directory, relative to the repository's real path. */
|
|
20
|
+
otherDirectory: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* The backstop of `DES-OUTPUTS` ("Files of one name") for what graph
|
|
24
|
+
* creation could not see, such as projects that another installation of the
|
|
25
|
+
* plugin, registered in `nx.json` under another name, creates: a target of
|
|
26
|
+
* another project in `projects`, the whole project graph that Nx hands the
|
|
27
|
+
* executor, whose artifact directory is the task's or lies inside it or
|
|
28
|
+
* holds it, and which writes a file of a name that the task declares, the
|
|
29
|
+
* names compared as graph creation compares them ({@link foldedFileName});
|
|
30
|
+
* for `doc`, another `doc` target with such an artifact directory. For a
|
|
31
|
+
* `test`, the files are the executables of the crate's `build`, which its
|
|
32
|
+
* integration tests and benches run. `undefined` where there is none.
|
|
33
|
+
*
|
|
34
|
+
* Graph creation leaves every such target uncached among the projects that
|
|
35
|
+
* it sees, and a run of the check matches no pair that it would not, so a
|
|
36
|
+
* cached task of a repository without such a pair never fails it: the
|
|
37
|
+
* check reads only artifact directories inside the repository, which the
|
|
38
|
+
* metadata of `build` and `doc` records, and the files that each crate's
|
|
39
|
+
* `build` records, falling back to the binaries of its build records where
|
|
40
|
+
* a graph of an older version of the plugin recorded no files.
|
|
41
|
+
*/
|
|
42
|
+
export declare function sharedArtifact(projects: Readonly<Record<string, ProjectConfiguration>>, cached: CachedTask): SharedArtifact | undefined;
|
|
43
|
+
/** The message with which the executor fails a cached task for a {@link SharedArtifact}. */
|
|
44
|
+
export declare function sharedArtifactMessage(cached: CachedTask, shared: SharedArtifact): string;
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sharedArtifact = sharedArtifact;
|
|
4
|
+
exports.sharedArtifactMessage = sharedArtifactMessage;
|
|
5
|
+
const artifact_names_1 = require("../graph/artifact-names");
|
|
6
|
+
const targets_1 = require("../graph/targets");
|
|
7
|
+
/**
|
|
8
|
+
* The backstop of `DES-OUTPUTS` ("Files of one name") for what graph
|
|
9
|
+
* creation could not see, such as projects that another installation of the
|
|
10
|
+
* plugin, registered in `nx.json` under another name, creates: a target of
|
|
11
|
+
* another project in `projects`, the whole project graph that Nx hands the
|
|
12
|
+
* executor, whose artifact directory is the task's or lies inside it or
|
|
13
|
+
* holds it, and which writes a file of a name that the task declares, the
|
|
14
|
+
* names compared as graph creation compares them ({@link foldedFileName});
|
|
15
|
+
* for `doc`, another `doc` target with such an artifact directory. For a
|
|
16
|
+
* `test`, the files are the executables of the crate's `build`, which its
|
|
17
|
+
* integration tests and benches run. `undefined` where there is none.
|
|
18
|
+
*
|
|
19
|
+
* Graph creation leaves every such target uncached among the projects that
|
|
20
|
+
* it sees, and a run of the check matches no pair that it would not, so a
|
|
21
|
+
* cached task of a repository without such a pair never fails it: the
|
|
22
|
+
* check reads only artifact directories inside the repository, which the
|
|
23
|
+
* metadata of `build` and `doc` records, and the files that each crate's
|
|
24
|
+
* `build` records, falling back to the binaries of its build records where
|
|
25
|
+
* a graph of an older version of the plugin recorded no files.
|
|
26
|
+
*/
|
|
27
|
+
// @mara implements DES-OUTPUTS
|
|
28
|
+
function sharedArtifact(projects, cached) {
|
|
29
|
+
var _a;
|
|
30
|
+
const own = cargoTargets(projects[cached.project]);
|
|
31
|
+
const kind = cached.target === "doc" ? "doc" : "build";
|
|
32
|
+
const source = (_a = own.find((target) => target.metadata.target === kind)) === null || _a === void 0 ? void 0 : _a.metadata;
|
|
33
|
+
const directory = source === null || source === void 0 ? void 0 : source.artifactDirectory;
|
|
34
|
+
if (source === undefined || directory === undefined) {
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
const files = cached.target === "doc"
|
|
38
|
+
? []
|
|
39
|
+
: artifactFiles(source).filter((file) => cached.target === "test" ? file.binary : file.declared);
|
|
40
|
+
const names = new Map(files.map((file) => [(0, artifact_names_1.foldedFileName)(file.file), file.file]));
|
|
41
|
+
if (cached.target !== "doc" && names.size === 0) {
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
for (const [name, project] of Object.entries(projects)) {
|
|
45
|
+
if (name === cached.project) {
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
for (const { name: targetName, metadata } of cargoTargets(project)) {
|
|
49
|
+
const otherDirectory = metadata.artifactDirectory;
|
|
50
|
+
if (metadata.target !== kind ||
|
|
51
|
+
otherDirectory === undefined ||
|
|
52
|
+
!nested(directory, otherDirectory)) {
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
const other = `${name}:${targetName}`;
|
|
56
|
+
if (kind === "doc") {
|
|
57
|
+
return { other, file: "doc", directory, otherDirectory };
|
|
58
|
+
}
|
|
59
|
+
const shared = artifactFiles(metadata).find((file) => names.has((0, artifact_names_1.foldedFileName)(file.file)));
|
|
60
|
+
if (shared !== undefined) {
|
|
61
|
+
return {
|
|
62
|
+
other,
|
|
63
|
+
file: names.get((0, artifact_names_1.foldedFileName)(shared.file)),
|
|
64
|
+
directory,
|
|
65
|
+
otherDirectory,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return undefined;
|
|
71
|
+
}
|
|
72
|
+
/** The message with which the executor fails a cached task for a {@link SharedArtifact}. */
|
|
73
|
+
function sharedArtifactMessage(cached, shared) {
|
|
74
|
+
const { task } = cached;
|
|
75
|
+
const where = shared.directory === shared.otherDirectory
|
|
76
|
+
? `the same artifact directory, ${shared.directory}`
|
|
77
|
+
: `the artifact directory ${shared.otherDirectory}, which lies inside ${task}'s, ${shared.directory}, or holds it`;
|
|
78
|
+
const unseen = `@convesoft/nx-rust left ${task} cached because it did not see ${shared.other} when it created the graph, as where another installation of the plugin, registered in nx.json under another name, creates it. The task does not run, so that Nx stores no result for it.`;
|
|
79
|
+
if (cached.target === "doc") {
|
|
80
|
+
return [
|
|
81
|
+
`${task}: ${shared.other} has ${where}, so that restoring one workspace's doc folder from the cache could delete or replace files of the other.`,
|
|
82
|
+
unseen,
|
|
83
|
+
`Give each Cargo workspace an artifact directory of its own, none inside another, with build.target-dir in its .cargo/config.toml, or register both workspaces through one installation of the plugin, which then leaves both doc targets uncached.`,
|
|
84
|
+
].join("\n");
|
|
85
|
+
}
|
|
86
|
+
const harm = cached.target === "test"
|
|
87
|
+
? "the tests could run the other crate's executable"
|
|
88
|
+
: `a result stored for ${task} could hold the other crate's file`;
|
|
89
|
+
return [
|
|
90
|
+
`${task}: ${shared.other} writes ${shared.file} into ${where}, where cargo keeps one file for both crates, that of the one it built last, so that ${harm}.`,
|
|
91
|
+
unseen,
|
|
92
|
+
`Give one of the binaries another name, with the name key of its [[bin]] table in Cargo.toml, or for a library of its [lib] table, or register both Cargo workspaces through one installation of the plugin, which then leaves both builds uncached.`,
|
|
93
|
+
].join("\n");
|
|
94
|
+
}
|
|
95
|
+
// The targets of a project that carry the plugin's metadata, whichever
|
|
96
|
+
// installation of the plugin created them.
|
|
97
|
+
function cargoTargets(project) {
|
|
98
|
+
var _a;
|
|
99
|
+
return Object.entries((_a = project === null || project === void 0 ? void 0 : project.targets) !== null && _a !== void 0 ? _a : {}).flatMap(([name, target]) => {
|
|
100
|
+
var _a;
|
|
101
|
+
const metadata = (_a = target === null || target === void 0 ? void 0 : target.metadata) === null || _a === void 0 ? void 0 : _a[targets_1.targetCargoMetadataKey];
|
|
102
|
+
return typeof (metadata === null || metadata === void 0 ? void 0 : metadata.target) === "string"
|
|
103
|
+
? [{ name, metadata: metadata }]
|
|
104
|
+
: [];
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
// The files that a crate's `build` records, or the binaries of its build
|
|
108
|
+
// records where a graph of an older version of the plugin recorded none.
|
|
109
|
+
function artifactFiles(metadata) {
|
|
110
|
+
var _a;
|
|
111
|
+
if (Array.isArray(metadata.artifactFiles)) {
|
|
112
|
+
return metadata.artifactFiles
|
|
113
|
+
.filter((file) => typeof (file === null || file === void 0 ? void 0 : file.file) === "string")
|
|
114
|
+
.map((file) => ({
|
|
115
|
+
file: file.file,
|
|
116
|
+
binary: file.kind === "binary",
|
|
117
|
+
declared: file.declared === true,
|
|
118
|
+
}));
|
|
119
|
+
}
|
|
120
|
+
const binaries = Array.isArray((_a = metadata.records) === null || _a === void 0 ? void 0 : _a.binaries) ? metadata.records.binaries : [];
|
|
121
|
+
return binaries
|
|
122
|
+
.filter((binary) => typeof (binary === null || binary === void 0 ? void 0 : binary.name) === "string")
|
|
123
|
+
.map((binary) => ({ file: binary.name, binary: true, declared: true }));
|
|
124
|
+
}
|
|
125
|
+
// Whether two artifact directories, relative to the repository's real
|
|
126
|
+
// path, are one folder or one lies inside the other, compared as graph
|
|
127
|
+
// creation compares them.
|
|
128
|
+
function nested(a, b) {
|
|
129
|
+
const [x, y] = [a, b].map((path) => (0, artifact_names_1.foldedFileName)(path.replace(/\/+$/, "")));
|
|
130
|
+
return x === y || x === "." || y === "." || x.startsWith(`${y}/`) || y.startsWith(`${x}/`);
|
|
131
|
+
}
|
|
132
|
+
//# sourceMappingURL=shared-artifacts.js.map
|