@convesoft/nx-rust 0.0.0-stage → 1.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE-APACHE +201 -0
- package/LICENSE-MIT +21 -0
- package/README.md +48 -2
- package/executors.json +35 -0
- package/generators.json +19 -0
- package/package.json +26 -4
- package/src/cargo/build-settings.d.ts +54 -0
- package/src/cargo/build-settings.js +93 -0
- package/src/cargo/build-settings.js.map +1 -0
- package/src/cargo/configured-runner.d.ts +36 -0
- package/src/cargo/configured-runner.js +99 -0
- package/src/cargo/configured-runner.js.map +1 -0
- package/src/cargo/configured-tools.d.ts +35 -0
- package/src/cargo/configured-tools.js +46 -0
- package/src/cargo/configured-tools.js.map +1 -0
- package/src/cargo/dep-info-basedir.d.ts +18 -0
- package/src/cargo/dep-info-basedir.js +38 -0
- package/src/cargo/dep-info-basedir.js.map +1 -0
- package/src/cargo/directories.d.ts +40 -0
- package/src/cargo/directories.js +89 -0
- package/src/cargo/directories.js.map +1 -0
- package/src/cargo/host-triple.d.ts +7 -0
- package/src/cargo/host-triple.js +21 -0
- package/src/cargo/host-triple.js.map +1 -0
- package/src/cargo/lockfile.d.ts +63 -0
- package/src/cargo/lockfile.js +157 -0
- package/src/cargo/lockfile.js.map +1 -0
- package/src/cargo/metadata.d.ts +112 -0
- package/src/cargo/metadata.js +37 -0
- package/src/cargo/metadata.js.map +1 -0
- package/src/cargo/package-specs.d.ts +54 -0
- package/src/cargo/package-specs.js +109 -0
- package/src/cargo/package-specs.js.map +1 -0
- package/src/cargo/paths-crates.d.ts +27 -0
- package/src/cargo/paths-crates.js +69 -0
- package/src/cargo/paths-crates.js.map +1 -0
- package/src/cargo/print-artifact-folders.d.ts +1 -0
- package/src/cargo/print-artifact-folders.js +58 -0
- package/src/cargo/print-artifact-folders.js.map +1 -0
- package/src/cargo/redirections.d.ts +87 -0
- package/src/cargo/redirections.js +195 -0
- package/src/cargo/redirections.js.map +1 -0
- package/src/cargo/run-cargo.d.ts +31 -0
- package/src/cargo/run-cargo.js +75 -0
- package/src/cargo/run-cargo.js.map +1 -0
- package/src/cargo/target-triples.d.ts +98 -0
- package/src/cargo/target-triples.js +265 -0
- package/src/cargo/target-triples.js.map +1 -0
- package/src/cargo/version-req.d.ts +12 -0
- package/src/cargo/version-req.js +122 -0
- package/src/cargo/version-req.js.map +1 -0
- package/src/compatibility/cargo-version.d.ts +43 -0
- package/src/compatibility/cargo-version.js +83 -0
- package/src/compatibility/cargo-version.js.map +1 -0
- package/src/compatibility/nx-bridge.d.ts +312 -0
- package/src/compatibility/nx-bridge.js +407 -0
- package/src/compatibility/nx-bridge.js.map +1 -0
- package/src/compatibility/nx-version.d.ts +104 -0
- package/src/compatibility/nx-version.js +272 -0
- package/src/compatibility/nx-version.js.map +1 -0
- package/src/executors/affected-inputs.d.ts +29 -0
- package/src/executors/affected-inputs.js +259 -0
- package/src/executors/affected-inputs.js.map +1 -0
- package/src/executors/affected-run.d.ts +54 -0
- package/src/executors/affected-run.js +394 -0
- package/src/executors/affected-run.js.map +1 -0
- package/src/executors/affected.d.ts +239 -0
- package/src/executors/affected.js +589 -0
- package/src/executors/affected.js.map +1 -0
- package/src/executors/baseline-context.d.ts +85 -0
- package/src/executors/baseline-context.js +227 -0
- package/src/executors/baseline-context.js.map +1 -0
- package/src/executors/baseline.d.ts +123 -0
- package/src/executors/baseline.js +356 -0
- package/src/executors/baseline.js.map +1 -0
- package/src/executors/batch.d.ts +75 -0
- package/src/executors/batch.js +434 -0
- package/src/executors/batch.js.map +1 -0
- package/src/executors/build-records.d.ts +110 -0
- package/src/executors/build-records.js +267 -0
- package/src/executors/build-records.js.map +1 -0
- package/src/executors/cargo/executor.d.ts +28 -0
- package/src/executors/cargo/executor.js +58 -0
- package/src/executors/cargo/executor.js.map +1 -0
- package/src/executors/cargo/schema.json +54 -0
- package/src/executors/cargo-invocation.d.ts +81 -0
- package/src/executors/cargo-invocation.js +109 -0
- package/src/executors/cargo-invocation.js.map +1 -0
- package/src/executors/cargo-output.d.ts +212 -0
- package/src/executors/cargo-output.js +646 -0
- package/src/executors/cargo-output.js.map +1 -0
- package/src/executors/command.d.ts +318 -0
- package/src/executors/command.js +517 -0
- package/src/executors/command.js.map +1 -0
- package/src/executors/coverage-baseline.d.ts +23 -0
- package/src/executors/coverage-baseline.js +284 -0
- package/src/executors/coverage-baseline.js.map +1 -0
- package/src/executors/declared-options.d.ts +21 -0
- package/src/executors/declared-options.js +58 -0
- package/src/executors/declared-options.js.map +1 -0
- package/src/executors/digests.d.ts +94 -0
- package/src/executors/digests.js +190 -0
- package/src/executors/digests.js.map +1 -0
- package/src/executors/dotenv-check.d.ts +79 -0
- package/src/executors/dotenv-check.js +553 -0
- package/src/executors/dotenv-check.js.map +1 -0
- package/src/executors/group-invocations.d.ts +80 -0
- package/src/executors/group-invocations.js +253 -0
- package/src/executors/group-invocations.js.map +1 -0
- package/src/executors/group-run.d.ts +114 -0
- package/src/executors/group-run.js +591 -0
- package/src/executors/group-run.js.map +1 -0
- package/src/executors/groups.d.ts +113 -0
- package/src/executors/groups.js +285 -0
- package/src/executors/groups.js.map +1 -0
- package/src/executors/input-check.d.ts +52 -0
- package/src/executors/input-check.js +271 -0
- package/src/executors/input-check.js.map +1 -0
- package/src/executors/kept-files.d.ts +98 -0
- package/src/executors/kept-files.js +341 -0
- package/src/executors/kept-files.js.map +1 -0
- package/src/executors/lockfile/executor.d.ts +16 -0
- package/src/executors/lockfile/executor.js +37 -0
- package/src/executors/lockfile/executor.js.map +1 -0
- package/src/executors/lockfile/schema.json +50 -0
- package/src/executors/napi-build.d.ts +73 -0
- package/src/executors/napi-build.js +420 -0
- package/src/executors/napi-build.js.map +1 -0
- package/src/executors/nextest.d.ts +185 -0
- package/src/executors/nextest.js +498 -0
- package/src/executors/nextest.js.map +1 -0
- package/src/executors/nx-command.d.ts +95 -0
- package/src/executors/nx-command.js +205 -0
- package/src/executors/nx-command.js.map +1 -0
- package/src/executors/nx-task-files.d.ts +82 -0
- package/src/executors/nx-task-files.js +156 -0
- package/src/executors/nx-task-files.js.map +1 -0
- package/src/executors/print-test-mode.d.ts +1 -0
- package/src/executors/print-test-mode.js +25 -0
- package/src/executors/print-test-mode.js.map +1 -0
- package/src/executors/release-publish/executor.d.ts +24 -0
- package/src/executors/release-publish/executor.js +165 -0
- package/src/executors/release-publish/executor.js.map +1 -0
- package/src/executors/release-publish/schema.json +30 -0
- package/src/executors/run/executor.d.ts +12 -0
- package/src/executors/run/executor.js +27 -0
- package/src/executors/run/executor.js.map +1 -0
- package/src/executors/run/schema.json +45 -0
- package/src/executors/runner-script.d.ts +12 -0
- package/src/executors/runner-script.js +22 -0
- package/src/executors/runner-script.js.map +1 -0
- package/src/executors/runtime-input-check.d.ts +24 -0
- package/src/executors/runtime-input-check.js +87 -0
- package/src/executors/runtime-input-check.js.map +1 -0
- package/src/executors/shared-artifacts.d.ts +44 -0
- package/src/executors/shared-artifacts.js +132 -0
- package/src/executors/shared-artifacts.js.map +1 -0
- package/src/executors/split-words.d.ts +24 -0
- package/src/executors/split-words.js +111 -0
- package/src/executors/split-words.js.map +1 -0
- package/src/executors/stage.d.ts +163 -0
- package/src/executors/stage.js +526 -0
- package/src/executors/stage.js.map +1 -0
- package/src/executors/staged-run.d.ts +24 -0
- package/src/executors/staged-run.js +110 -0
- package/src/executors/staged-run.js.map +1 -0
- package/src/executors/task-env.d.ts +271 -0
- package/src/executors/task-env.js +494 -0
- package/src/executors/task-env.js.map +1 -0
- package/src/executors/task-execution.d.ts +61 -0
- package/src/executors/task-execution.js +122 -0
- package/src/executors/task-execution.js.map +1 -0
- package/src/executors/task-guards.d.ts +112 -0
- package/src/executors/task-guards.js +430 -0
- package/src/executors/task-guards.js.map +1 -0
- package/src/executors/task-options.d.ts +114 -0
- package/src/executors/task-options.js +258 -0
- package/src/executors/task-options.js.map +1 -0
- package/src/executors/task.d.ts +166 -0
- package/src/executors/task.js +520 -0
- package/src/executors/task.js.map +1 -0
- package/src/executors/test-mode.d.ts +182 -0
- package/src/executors/test-mode.js +391 -0
- package/src/executors/test-mode.js.map +1 -0
- package/src/executors/test-runner.d.ts +44 -0
- package/src/executors/test-runner.js +159 -0
- package/src/executors/test-runner.js.map +1 -0
- package/src/executors/test-steps.d.ts +109 -0
- package/src/executors/test-steps.js +535 -0
- package/src/executors/test-steps.js.map +1 -0
- package/src/executors/wasm-build.d.ts +56 -0
- package/src/executors/wasm-build.js +216 -0
- package/src/executors/wasm-build.js.map +1 -0
- package/src/generators/crate/binary.schema.json +28 -0
- package/src/generators/crate/crate.d.ts +24 -0
- package/src/generators/crate/crate.js +108 -0
- package/src/generators/crate/crate.js.map +1 -0
- package/src/generators/crate/enclosing-workspace.d.ts +25 -0
- package/src/generators/crate/enclosing-workspace.js +58 -0
- package/src/generators/crate/enclosing-workspace.js.map +1 -0
- package/src/generators/crate/library.schema.json +28 -0
- package/src/generators/init/graph-check.d.ts +81 -0
- package/src/generators/init/graph-check.js +299 -0
- package/src/generators/init/graph-check.js.map +1 -0
- package/src/generators/init/init.d.ts +23 -0
- package/src/generators/init/init.js +113 -0
- package/src/generators/init/init.js.map +1 -0
- package/src/generators/init/report.d.ts +19 -0
- package/src/generators/init/report.js +93 -0
- package/src/generators/init/report.js.map +1 -0
- package/src/generators/init/schema.json +9 -0
- package/src/graph/artifact-kinds.d.ts +29 -0
- package/src/graph/artifact-kinds.js +50 -0
- package/src/graph/artifact-kinds.js.map +1 -0
- package/src/graph/artifact-names.d.ts +97 -0
- package/src/graph/artifact-names.js +276 -0
- package/src/graph/artifact-names.js.map +1 -0
- package/src/graph/build-records.d.ts +74 -0
- package/src/graph/build-records.js +104 -0
- package/src/graph/build-records.js.map +1 -0
- package/src/graph/caching.d.ts +148 -0
- package/src/graph/caching.js +676 -0
- package/src/graph/caching.js.map +1 -0
- package/src/graph/collisions.d.ts +106 -0
- package/src/graph/collisions.js +156 -0
- package/src/graph/collisions.js.map +1 -0
- package/src/graph/computation-reports.d.ts +89 -0
- package/src/graph/computation-reports.js +216 -0
- package/src/graph/computation-reports.js.map +1 -0
- package/src/graph/declared-files.d.ts +190 -0
- package/src/graph/declared-files.js +600 -0
- package/src/graph/declared-files.js.map +1 -0
- package/src/graph/discovery.d.ts +175 -0
- package/src/graph/discovery.js +656 -0
- package/src/graph/discovery.js.map +1 -0
- package/src/graph/edges.d.ts +25 -0
- package/src/graph/edges.js +94 -0
- package/src/graph/edges.js.map +1 -0
- package/src/graph/entries.d.ts +83 -0
- package/src/graph/entries.js +259 -0
- package/src/graph/entries.js.map +1 -0
- package/src/graph/inputs.d.ts +420 -0
- package/src/graph/inputs.js +746 -0
- package/src/graph/inputs.js.map +1 -0
- package/src/graph/lockfile-task.d.ts +74 -0
- package/src/graph/lockfile-task.js +105 -0
- package/src/graph/lockfile-task.js.map +1 -0
- package/src/graph/names.d.ts +41 -0
- package/src/graph/names.js +34 -0
- package/src/graph/names.js.map +1 -0
- package/src/graph/napi.d.ts +107 -0
- package/src/graph/napi.js +206 -0
- package/src/graph/napi.js.map +1 -0
- package/src/graph/nx-glob.d.ts +36 -0
- package/src/graph/nx-glob.js +152 -0
- package/src/graph/nx-glob.js.map +1 -0
- package/src/graph/nx-internals.d.ts +57 -0
- package/src/graph/nx-internals.js +128 -0
- package/src/graph/nx-internals.js.map +1 -0
- package/src/graph/options.d.ts +32 -0
- package/src/graph/options.js +80 -0
- package/src/graph/options.js.map +1 -0
- package/src/graph/outputs.d.ts +75 -0
- package/src/graph/outputs.js +140 -0
- package/src/graph/outputs.js.map +1 -0
- package/src/graph/path-dependencies.d.ts +122 -0
- package/src/graph/path-dependencies.js +459 -0
- package/src/graph/path-dependencies.js.map +1 -0
- package/src/graph/plugin-package.d.ts +36 -0
- package/src/graph/plugin-package.js +132 -0
- package/src/graph/plugin-package.js.map +1 -0
- package/src/graph/plugin-version.d.ts +20 -0
- package/src/graph/plugin-version.js +153 -0
- package/src/graph/plugin-version.js.map +1 -0
- package/src/graph/projects.d.ts +141 -0
- package/src/graph/projects.js +182 -0
- package/src/graph/projects.js.map +1 -0
- package/src/graph/reached-projects.d.ts +46 -0
- package/src/graph/reached-projects.js +102 -0
- package/src/graph/reached-projects.js.map +1 -0
- package/src/graph/real-path.d.ts +47 -0
- package/src/graph/real-path.js +113 -0
- package/src/graph/real-path.js.map +1 -0
- package/src/graph/redirected-uses.d.ts +98 -0
- package/src/graph/redirected-uses.js +434 -0
- package/src/graph/redirected-uses.js.map +1 -0
- package/src/graph/registration.d.ts +121 -0
- package/src/graph/registration.js +233 -0
- package/src/graph/registration.js.map +1 -0
- package/src/graph/script-input.d.ts +46 -0
- package/src/graph/script-input.js +65 -0
- package/src/graph/script-input.js.map +1 -0
- package/src/graph/settings.d.ts +178 -0
- package/src/graph/settings.js +479 -0
- package/src/graph/settings.js.map +1 -0
- package/src/graph/target-defaults-causes.d.ts +33 -0
- package/src/graph/target-defaults-causes.js +202 -0
- package/src/graph/target-defaults-causes.js.map +1 -0
- package/src/graph/target-defaults-layers.d.ts +186 -0
- package/src/graph/target-defaults-layers.js +420 -0
- package/src/graph/target-defaults-layers.js.map +1 -0
- package/src/graph/target-defaults-meaning.d.ts +95 -0
- package/src/graph/target-defaults-meaning.js +292 -0
- package/src/graph/target-defaults-meaning.js.map +1 -0
- package/src/graph/target-defaults-report.d.ts +77 -0
- package/src/graph/target-defaults-report.js +242 -0
- package/src/graph/target-defaults-report.js.map +1 -0
- package/src/graph/target-defaults.d.ts +79 -0
- package/src/graph/target-defaults.js +425 -0
- package/src/graph/target-defaults.js.map +1 -0
- package/src/graph/target-fields.d.ts +16 -0
- package/src/graph/target-fields.js +134 -0
- package/src/graph/target-fields.js.map +1 -0
- package/src/graph/target-tables.d.ts +45 -0
- package/src/graph/target-tables.js +299 -0
- package/src/graph/target-tables.js.map +1 -0
- package/src/graph/targets.d.ts +367 -0
- package/src/graph/targets.js +404 -0
- package/src/graph/targets.js.map +1 -0
- package/src/graph/unification.d.ts +141 -0
- package/src/graph/unification.js +459 -0
- package/src/graph/unification.js.map +1 -0
- package/src/graph/unignored-directories.d.ts +25 -0
- package/src/graph/unignored-directories.js +89 -0
- package/src/graph/unignored-directories.js.map +1 -0
- package/src/graph/visibility.d.ts +17 -0
- package/src/graph/visibility.js +67 -0
- package/src/graph/visibility.js.map +1 -0
- package/src/graph/warnings.d.ts +38 -0
- package/src/graph/warnings.js +77 -0
- package/src/graph/warnings.js.map +1 -0
- package/src/graph/wasm.d.ts +56 -0
- package/src/graph/wasm.js +77 -0
- package/src/graph/wasm.js.map +1 -0
- package/src/index.d.ts +68 -0
- package/src/index.js +109 -0
- package/src/index.js.map +1 -0
- package/src/release/manifests.d.ts +95 -0
- package/src/release/manifests.js +164 -0
- package/src/release/manifests.js.map +1 -0
- package/src/release/places.d.ts +127 -0
- package/src/release/places.js +368 -0
- package/src/release/places.js.map +1 -0
- package/src/release/publish-cargo.d.ts +177 -0
- package/src/release/publish-cargo.js +351 -0
- package/src/release/publish-cargo.js.map +1 -0
- package/src/release/publish-crates.d.ts +124 -0
- package/src/release/publish-crates.js +242 -0
- package/src/release/publish-crates.js.map +1 -0
- package/src/release/publish-environments.d.ts +50 -0
- package/src/release/publish-environments.js +284 -0
- package/src/release/publish-environments.js.map +1 -0
- package/src/release/publish-messages.d.ts +66 -0
- package/src/release/publish-messages.js +273 -0
- package/src/release/publish-messages.js.map +1 -0
- package/src/release/publish-registry.d.ts +27 -0
- package/src/release/publish-registry.js +135 -0
- package/src/release/publish-registry.js.map +1 -0
- package/src/release/publish-settings.d.ts +26 -0
- package/src/release/publish-settings.js +56 -0
- package/src/release/publish-settings.js.map +1 -0
- package/src/release/publish.d.ts +59 -0
- package/src/release/publish.js +620 -0
- package/src/release/publish.js.map +1 -0
- package/src/release/repository.d.ts +73 -0
- package/src/release/repository.js +219 -0
- package/src/release/repository.js.map +1 -0
- package/src/release/requirements.d.ts +34 -0
- package/src/release/requirements.js +30 -0
- package/src/release/requirements.js.map +1 -0
- package/src/release/toml-edit.d.ts +67 -0
- package/src/release/toml-edit.js +453 -0
- package/src/release/toml-edit.js.map +1 -0
- package/src/release/version-actions.d.ts +133 -0
- package/src/release/version-actions.js +474 -0
- package/src/release/version-actions.js.map +1 -0
- package/src/release/version-checks.d.ts +21 -0
- package/src/release/version-checks.js +151 -0
- package/src/release/version-checks.js.map +1 -0
- package/src/release/version-lockfiles.d.ts +61 -0
- package/src/release/version-lockfiles.js +222 -0
- package/src/release/version-lockfiles.js.map +1 -0
- package/src/tools/napi-cli.d.ts +70 -0
- package/src/tools/napi-cli.js +63 -0
- package/src/tools/napi-cli.js.map +1 -0
- package/src/tools/optional-tools.d.ts +121 -0
- package/src/tools/optional-tools.js +303 -0
- package/src/tools/optional-tools.js.map +1 -0
- package/src/tools/print-napi-cli.d.ts +1 -0
- package/src/tools/print-napi-cli.js +24 -0
- package/src/tools/print-napi-cli.js.map +1 -0
|
@@ -0,0 +1,676 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.cacheContext = cacheContext;
|
|
4
|
+
exports.configureCaching = configureCaching;
|
|
5
|
+
exports.projectWarnings = projectWarnings;
|
|
6
|
+
const tslib_1 = require("tslib");
|
|
7
|
+
const node_path_1 = require("node:path");
|
|
8
|
+
const target_triples_1 = require("../cargo/target-triples");
|
|
9
|
+
const directories_1 = require("../cargo/directories");
|
|
10
|
+
const artifact_names_1 = require("./artifact-names");
|
|
11
|
+
const build_records_1 = require("./build-records");
|
|
12
|
+
const entries_1 = require("./entries");
|
|
13
|
+
const inputs_1 = require("./inputs");
|
|
14
|
+
const lockfile_task_1 = require("./lockfile-task");
|
|
15
|
+
const outputs_1 = require("./outputs");
|
|
16
|
+
const napi_1 = require("./napi");
|
|
17
|
+
const wasm_1 = require("./wasm");
|
|
18
|
+
const path_dependencies_1 = require("./path-dependencies");
|
|
19
|
+
const plugin_package_1 = require("./plugin-package");
|
|
20
|
+
const real_path_1 = require("./real-path");
|
|
21
|
+
const redirected_uses_1 = require("./redirected-uses");
|
|
22
|
+
const targets_1 = require("./targets");
|
|
23
|
+
const unignored_directories_1 = require("./unignored-directories");
|
|
24
|
+
/**
|
|
25
|
+
* Works out what the inputs and outputs of the projects that `discovery`
|
|
26
|
+
* found need beyond each project: how the plugin's version reaches the keys,
|
|
27
|
+
* the crates without a project that path dependencies and redirections
|
|
28
|
+
* reach, the redirected crates whose edges are left out with the crates
|
|
29
|
+
* that cargo builds with them, the path crates outside each workspace that
|
|
30
|
+
* a build of the whole workspace compiles, and where each
|
|
31
|
+
* workspace's artifact directory lies; and the warnings of `DES-DIAGNOSTICS`
|
|
32
|
+
* that these give, together with those about Cargo directories that Nx reads
|
|
33
|
+
* ({@link unignoredDirectoryWarnings}), which it also prints, each once. A
|
|
34
|
+
* path dependency whose report cargo refused adds its warning to the crates
|
|
35
|
+
* that reach it, and the warnings about a workspace's redirections
|
|
36
|
+
* ({@link CargoWorkspace.warnings}) go to every project of the workspace;
|
|
37
|
+
* discovery has printed those already.
|
|
38
|
+
*
|
|
39
|
+
* The redirected uses come from `redirectedUses`, which `createDependencies`
|
|
40
|
+
* asks again with the projects of every plugin and entry. Here it knows only
|
|
41
|
+
* the projects of this entry, so a crate that another entry gives a project
|
|
42
|
+
* counts as one without a project, and its folder joins the inputs beside
|
|
43
|
+
* the edge that `createDependencies` adds.
|
|
44
|
+
*
|
|
45
|
+
* Artifact directories are compared with those of the workspaces that the
|
|
46
|
+
* other entries of the plugin receive as well ({@link otherEntriesWorkspaces}),
|
|
47
|
+
* so that every entry reaches the same verdict (`DES-OUTPUTS`).
|
|
48
|
+
*
|
|
49
|
+
* @param everyProject Warnings that concern every project and have been
|
|
50
|
+
* printed already, such as the one for an Nx major newer than the
|
|
51
|
+
* supported ones (`checkNxForGraph` in `nx-version.ts`); they come first.
|
|
52
|
+
* @param reports The reports of the graph computation, which the other
|
|
53
|
+
* entries in this process share.
|
|
54
|
+
* @param view Where this entry stands among the entries of the plugin: a
|
|
55
|
+
* warning that names crates of several entries is printed by the first
|
|
56
|
+
* of them ({@link warnsHere}), so that it is printed once.
|
|
57
|
+
* @param strategies The feature-unification strategy of each workspace
|
|
58
|
+
* (`workspaceStrategies` in `unification.ts`), whose warnings go to every
|
|
59
|
+
* project of the workspace.
|
|
60
|
+
*/
|
|
61
|
+
function cacheContext(discovery_1, nxJson_1) {
|
|
62
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* (discovery, nxJson, everyProject = [], reports, view, strategies = new Map()) {
|
|
63
|
+
var _a, _b, _c, _d, _e, _f;
|
|
64
|
+
const { workspaceRoot } = discovery;
|
|
65
|
+
const uses = (0, redirected_uses_1.redirectedUses)({ discovery, projects: [] }, projectRoots(discovery));
|
|
66
|
+
const [plugin, folders] = yield Promise.all([
|
|
67
|
+
(0, plugin_package_1.pluginInput)(workspaceRoot, nxJson),
|
|
68
|
+
(0, path_dependencies_1.findCrateFolders)(discovery, uses),
|
|
69
|
+
]);
|
|
70
|
+
const warnings = new Map();
|
|
71
|
+
const warn = (key, message) => {
|
|
72
|
+
var _a;
|
|
73
|
+
warnings.set(key, [...((_a = warnings.get(key)) !== null && _a !== void 0 ? _a : []), message]);
|
|
74
|
+
};
|
|
75
|
+
for (const workspace of discovery.workspaces) {
|
|
76
|
+
for (const manifest of workspaceManifests(workspace)) {
|
|
77
|
+
for (const message of everyProject) {
|
|
78
|
+
warn(manifest, message);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
const pathDependencyInputs = new Map();
|
|
83
|
+
const redirectedInputs = new Map();
|
|
84
|
+
const outsideCrateInputs = new Map();
|
|
85
|
+
for (const [key, crates] of folders.outsideWorkspace) {
|
|
86
|
+
outsideCrateInputs.set(key, uniqueInputs(crates.flatMap(path_dependencies_1.crateInputs)));
|
|
87
|
+
}
|
|
88
|
+
const repositoryRoot = (0, real_path_1.realPath)(workspaceRoot);
|
|
89
|
+
for (const workspace of discovery.workspaces) {
|
|
90
|
+
for (const crate of workspace.members) {
|
|
91
|
+
const dependencies = (_a = folders.withoutProject.get(crate.manifest_path)) !== null && _a !== void 0 ? _a : [];
|
|
92
|
+
const leftOut = (_b = folders.leftOutEdges.get(crate.manifest_path)) !== null && _b !== void 0 ? _b : [];
|
|
93
|
+
for (const dependency of [...dependencies, ...leftOut]) {
|
|
94
|
+
// Its folder relative to the repository's real path, or absolute.
|
|
95
|
+
const folder = (0, node_path_1.isAbsolute)(dependency.folder)
|
|
96
|
+
? dependency.folder
|
|
97
|
+
: (0, node_path_1.join)(repositoryRoot, dependency.folder);
|
|
98
|
+
const message = discovery.unreportedPathDependencies.get(folder);
|
|
99
|
+
if (message !== undefined) {
|
|
100
|
+
warn(crate.manifest_path, message);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
pathDependencyInputs.set(crate.manifest_path, [
|
|
104
|
+
...uniqueInputs(dependencies.flatMap(path_dependencies_1.crateInputs)),
|
|
105
|
+
]);
|
|
106
|
+
redirectedInputs.set(crate.manifest_path, [...uniqueInputs(leftOut.flatMap(path_dependencies_1.crateInputs))]);
|
|
107
|
+
for (const dependency of [...dependencies, ...leftOut].filter((dependency) => !dependency.seen)) {
|
|
108
|
+
warn(crate.manifest_path, (0, path_dependencies_1.unseenPathDependencyWarning)(crate.name, (0, node_path_1.relative)(workspaceRoot, crate.manifest_path), dependency));
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
const compared = [
|
|
113
|
+
...discovery.workspaces,
|
|
114
|
+
...(yield (0, entries_1.otherEntriesWorkspaces)(discovery, view, reports)),
|
|
115
|
+
];
|
|
116
|
+
const reached = reachedArtifactDirectories(compared);
|
|
117
|
+
const sharers = artifactDirectorySharers(compared, reached);
|
|
118
|
+
const artifactDirectories = locateArtifactDirectories(compared, workspaceRoot, sharers);
|
|
119
|
+
const directoryOf = (workspace) => {
|
|
120
|
+
var _a;
|
|
121
|
+
const artifacts = artifactDirectories.get(workspace.root);
|
|
122
|
+
return (artifacts === null || artifacts === void 0 ? void 0 : artifacts.inside) === true
|
|
123
|
+
? artifacts.path
|
|
124
|
+
: ((_a = reached.get(workspace)) !== null && _a !== void 0 ? _a : workspace.report.target_directory);
|
|
125
|
+
};
|
|
126
|
+
const directoryWarnings = (0, unignored_directories_1.unignoredDirectoryWarnings)(discovery.workspaces, workspaceRoot);
|
|
127
|
+
const withoutLockfileTask = new Set(discovery.workspaces
|
|
128
|
+
.filter((workspace) => !workspace.rootManifestHanded)
|
|
129
|
+
.map((workspace) => workspace.root));
|
|
130
|
+
const sharedNames = (0, artifact_names_1.sharedArtifactNames)(compared, sharers, directoryOf, workspaceRoot);
|
|
131
|
+
for (const workspace of discovery.workspaces) {
|
|
132
|
+
const messages = [
|
|
133
|
+
...workspace.warnings,
|
|
134
|
+
artifactDirectoryWarning(workspace, artifactDirectories, reached, sharers, directoryOf),
|
|
135
|
+
tripleWarning(workspace, workspaceRoot),
|
|
136
|
+
...((_c = directoryWarnings.get(workspace)) !== null && _c !== void 0 ? _c : []),
|
|
137
|
+
withoutLockfileTask.has(workspace.root) ? noLockfileTaskWarning(workspace) : undefined,
|
|
138
|
+
...((_e = (_d = strategies.get(workspace.root)) === null || _d === void 0 ? void 0 : _d.warnings) !== null && _e !== void 0 ? _e : []),
|
|
139
|
+
];
|
|
140
|
+
for (const message of messages.filter((message) => message !== undefined)) {
|
|
141
|
+
for (const manifest of workspaceManifests(workspace)) {
|
|
142
|
+
warn(manifest, message);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
for (const { message, manifests } of sharedNames.warnings) {
|
|
147
|
+
for (const manifest of manifests) {
|
|
148
|
+
warn(manifest, message);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
// Each warning once, from the first entry of the plugin that receives a
|
|
152
|
+
// crate it concerns, also where it names crates of several entries.
|
|
153
|
+
const concerned = new Map();
|
|
154
|
+
for (const [manifest, messages] of warnings) {
|
|
155
|
+
for (const message of messages) {
|
|
156
|
+
concerned.set(message, [
|
|
157
|
+
...((_f = concerned.get(message)) !== null && _f !== void 0 ? _f : []),
|
|
158
|
+
(0, node_path_1.relative)(workspaceRoot, manifest),
|
|
159
|
+
]);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
const printed = new Set([...everyProject, ...discovery.warnings]);
|
|
163
|
+
for (const [message, manifests] of concerned) {
|
|
164
|
+
if (!printed.has(message) && (view === undefined || (0, entries_1.warnsHere)(view, manifests))) {
|
|
165
|
+
console.warn(message);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
return {
|
|
169
|
+
repositoryRoot: workspaceRoot,
|
|
170
|
+
plugin,
|
|
171
|
+
repositoryDefault: (0, inputs_1.repositoryDefaultInputs)(nxJson === null || nxJson === void 0 ? void 0 : nxJson.namedInputs),
|
|
172
|
+
pathDependencyInputs,
|
|
173
|
+
redirectedInputs,
|
|
174
|
+
outsideCrateInputs,
|
|
175
|
+
declaredFileProblems: folders.problems,
|
|
176
|
+
declaredPatterns: folders.patterns,
|
|
177
|
+
pathPackageManifests: pathPackageManifests(discovery),
|
|
178
|
+
artifactDirectories,
|
|
179
|
+
warnings,
|
|
180
|
+
withoutLockfileTask,
|
|
181
|
+
sharedRecordNames: (0, build_records_1.sharedRecordNames)(compared, sharers),
|
|
182
|
+
sharedArtifactNames: sharedNames,
|
|
183
|
+
strategies,
|
|
184
|
+
};
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
// The inputs once each, in order: a declared fileset of a workspace's table
|
|
188
|
+
// comes with every crate of the workspace that the crate reaches.
|
|
189
|
+
function uniqueInputs(inputs) {
|
|
190
|
+
const seen = new Set();
|
|
191
|
+
return inputs.filter((input) => {
|
|
192
|
+
const key = JSON.stringify(input);
|
|
193
|
+
if (seen.has(key)) {
|
|
194
|
+
return false;
|
|
195
|
+
}
|
|
196
|
+
seen.add(key);
|
|
197
|
+
return true;
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
// The warning of `DES-LOCKFILE-HASHING` for a workspace without a lockfile
|
|
201
|
+
// task, whose crates' targets that would read a digest run uncached.
|
|
202
|
+
// @mara implements DES-DIAGNOSTICS
|
|
203
|
+
function noLockfileTaskWarning(workspace) {
|
|
204
|
+
return [
|
|
205
|
+
`nx-rust: Nx hands the root manifest ${workspace.rootManifest} of ${describeWorkspace(workspace)} to no entry of @convesoft/nx-rust, so the workspace has no project and no lockfile task, which keys its crates' cached targets on their locked dependencies.`,
|
|
206
|
+
`The build, check, lint and test targets of its crates therefore run uncached; fmt-check stays cached.`,
|
|
207
|
+
`To cache them, let Nx hand ${workspace.rootManifest} to the plugin: remove what keeps it out, such as the "include" or "exclude" of the plugin's entry in nx.json, .gitignore or .nxignore.`,
|
|
208
|
+
].join(" ");
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Why the plugin leaves a target uncached because its workspace has no
|
|
212
|
+
* lockfile task (`DES-LOCKFILE-HASHING`): the targets that would read a
|
|
213
|
+
* digest, the cached ones but `fmt-check`, where Nx hands the workspace's
|
|
214
|
+
* root manifest to no entry of the plugin. `undefined` otherwise.
|
|
215
|
+
*/
|
|
216
|
+
// @mara implements DES-LOCKFILE-HASHING
|
|
217
|
+
function noLockfileTaskReason(name, subject, context) {
|
|
218
|
+
var _a;
|
|
219
|
+
return ((_a = context.withoutLockfileTask) === null || _a === void 0 ? void 0 : _a.has(subject.workspace.root)) &&
|
|
220
|
+
targets_1.cachedTargets.has(name) &&
|
|
221
|
+
name !== "fmt-check"
|
|
222
|
+
? `its Cargo workspace has no lockfile task, because Nx hands the workspace's root manifest ${subject.workspace.rootManifest} to no entry of the plugin, so the plugin cannot key the target on the crate's locked dependencies`
|
|
223
|
+
: undefined;
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Why the plugin leaves a crate's `build` or `test` uncached because
|
|
227
|
+
* another crate puts a file of the same name into its artifact directory
|
|
228
|
+
* (`DES-OUTPUTS`, "Files of one name"), or `undefined`.
|
|
229
|
+
*/
|
|
230
|
+
// @mara implements DES-OUTPUTS
|
|
231
|
+
function sharedArtifactNameReason(name, subject, context) {
|
|
232
|
+
const shared = context.sharedArtifactNames;
|
|
233
|
+
if (shared === undefined || subject.pkg === undefined) {
|
|
234
|
+
return undefined;
|
|
235
|
+
}
|
|
236
|
+
return name === "build"
|
|
237
|
+
? shared.build.get(subject.pkg.manifest_path)
|
|
238
|
+
: name === "test"
|
|
239
|
+
? shared.test.get(subject.pkg.manifest_path)
|
|
240
|
+
: undefined;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Gives each of a project's inferred targets its caching: whether it is
|
|
244
|
+
* cached, its inputs and its outputs (`DES-INPUTS`, `DES-OUTPUTS`), and the
|
|
245
|
+
* plugin's version as the option `pluginVersion` where no npm node carries
|
|
246
|
+
* it. A target arrives cached where `cachedTargets` names it, and stays so
|
|
247
|
+
* unless {@link uncachedReason} gives a reason for this project, its
|
|
248
|
+
* workspace has no lockfile task, or another crate puts a file of the same
|
|
249
|
+
* name into its artifact directory ({@link sharedArtifactNameReason}). Every
|
|
250
|
+
* inferred target gets `cache` and `outputs`, and an uncached one the
|
|
251
|
+
* reason in `metadata.cargo.uncached`, from which the executor fails a task
|
|
252
|
+
* that the configuration caches anyway. The targets that `DES-INPUTS`
|
|
253
|
+
* covers get their inputs, the lockfile task those of
|
|
254
|
+
* `DES-WORKSPACE-TARGETS` and its digest folder as its output, and `audit`,
|
|
255
|
+
* `deny` and `update` keep the inputs that `inferTargets` gave them, with
|
|
256
|
+
* the plugin's input added, which every inferred target has.
|
|
257
|
+
*
|
|
258
|
+
* A target that stays cached, other than `fmt-check`, depends on the
|
|
259
|
+
* lockfile task of its workspace, the project at the workspace's root
|
|
260
|
+
* folder, and under `hakari` on its `hakari-check` as well, which depends
|
|
261
|
+
* on the lockfile task and has the lockfile task's inputs with cargo-hakari's
|
|
262
|
+
* configuration file (`DES-UNIFICATION`, "Drift"), and hashes the digests it
|
|
263
|
+
* writes; where the workspace has no
|
|
264
|
+
* lockfile task, such a target is left uncached instead. Its metadata names
|
|
265
|
+
* the crate's own member and, with `everyDigest`, says that its key holds
|
|
266
|
+
* every member's digest, as `holdsEveryDigest` decides, for the executor's
|
|
267
|
+
* check after cargo's call, which compares each of them, the other members
|
|
268
|
+
* as the lockfile task's metadata names them (`DES-LOCKFILE-HASHING`,
|
|
269
|
+
* "Post-check"). It is the one dependency of a
|
|
270
|
+
* crate's target on a task of another project (`REQ-NO-RUST-TASK-DEPS`);
|
|
271
|
+
* the one on a task of the crate itself, of `test` on `build`, comes from
|
|
272
|
+
* `inferTargets` in `targets.ts`.
|
|
273
|
+
*/
|
|
274
|
+
// @mara implements DES-INPUTS
|
|
275
|
+
// @mara implements DES-OUTPUTS
|
|
276
|
+
// @mara implements DES-LOCKFILE-HASHING
|
|
277
|
+
// @mara implements REQ-NO-RUST-TASK-DEPS
|
|
278
|
+
function configureCaching(targets, subject, context, options = { settings: inputs_1.defaultInputSettings }) {
|
|
279
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
280
|
+
const { settings } = options;
|
|
281
|
+
const artifacts = (_a = context.artifactDirectories.get(subject.workspace.root)) !== null && _a !== void 0 ? _a : { inside: false };
|
|
282
|
+
const triples = (_b = subject.workspace.triples) !== null && _b !== void 0 ? _b : { kind: "none" };
|
|
283
|
+
const tripleProblem = triples.kind === "unnamed" ? (0, target_triples_1.unnamedTripleProblem)(triples, context.repositoryRoot) : undefined;
|
|
284
|
+
const place = { artifacts, tripleProblem };
|
|
285
|
+
const workspaceRoot = workspaceFolder(subject, context);
|
|
286
|
+
const members = workspaceMembers(subject);
|
|
287
|
+
// The addon's file, which the outputs of `napi-build` name (`DES-NAPI`).
|
|
288
|
+
const napi = targets.has("napi-build") ? (0, napi_1.napiAddon)(subject, context) : undefined;
|
|
289
|
+
// The header file of the addon's type definitions (`DES-NAPI`).
|
|
290
|
+
const header = targets.has("napi-build") && subject.pkg !== undefined
|
|
291
|
+
? (0, napi_1.napiHeaderFile)((0, node_path_1.dirname)(subject.pkg.manifest_path), context.repositoryRoot)
|
|
292
|
+
: undefined;
|
|
293
|
+
for (const [name, target] of targets) {
|
|
294
|
+
const reason = target.cache === true
|
|
295
|
+
? ((_g = (_f = (_e = (0, outputs_1.uncachedReason)(name, place, alwaysNamesTriple([target, ...((_d = (_c = options.targetTables) === null || _c === void 0 ? void 0 : _c.call(options, name)) !== null && _d !== void 0 ? _d : [])]))) !== null && _e !== void 0 ? _e : noLockfileTaskReason(name, subject, context)) !== null && _f !== void 0 ? _f : sharedArtifactNameReason(name, subject, context)) !== null && _g !== void 0 ? _g : (name === "napi-build" && (napi === null || napi === void 0 ? void 0 : napi.addon) === undefined
|
|
296
|
+
? "rustc -vV names no host triple in the workspace root, so the plugin cannot name the addon's file among the outputs"
|
|
297
|
+
: undefined))
|
|
298
|
+
: ((_h = outputs_1.uncachedByDesign[name]) !== null && _h !== void 0 ? _h : "the plugin does not cache this target");
|
|
299
|
+
target.cache = reason === undefined;
|
|
300
|
+
const metadata = (_j = target.metadata) === null || _j === void 0 ? void 0 : _j[targets_1.targetCargoMetadataKey];
|
|
301
|
+
if (metadata !== undefined && reason !== undefined) {
|
|
302
|
+
metadata.uncached = reason;
|
|
303
|
+
}
|
|
304
|
+
if (metadata !== undefined && (name === "build" || name === "doc")) {
|
|
305
|
+
if (triples.kind === "triples") {
|
|
306
|
+
metadata.triples = triples.triples;
|
|
307
|
+
}
|
|
308
|
+
if (tripleProblem !== undefined) {
|
|
309
|
+
metadata.tripleProblem = tripleProblem;
|
|
310
|
+
}
|
|
311
|
+
const configuredPick = (0, target_triples_1.pickText)((_k = subject.workspace.configuredTriples) !== null && _k !== void 0 ? _k : { kind: "none" });
|
|
312
|
+
if (configuredPick !== "none") {
|
|
313
|
+
metadata.configuredPick = configuredPick;
|
|
314
|
+
}
|
|
315
|
+
if (artifacts.inside) {
|
|
316
|
+
metadata.artifactDirectory = artifacts.path;
|
|
317
|
+
}
|
|
318
|
+
const variables = (0, directories_1.directoryVariables)(process.env);
|
|
319
|
+
if (Object.keys(variables).length > 0) {
|
|
320
|
+
metadata.directoryVariables = variables;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
if (metadata !== undefined && name === "build" && subject.pkg !== undefined) {
|
|
324
|
+
metadata.artifactFiles = (0, artifact_names_1.namedArtifacts)(subject.pkg);
|
|
325
|
+
metadata.records = (0, build_records_1.buildRecordSource)(subject.pkg, (_m = (_l = context.sharedRecordNames) === null || _l === void 0 ? void 0 : _l.get(subject.workspace.root)) !== null && _m !== void 0 ? _m : []);
|
|
326
|
+
}
|
|
327
|
+
if (metadata !== undefined &&
|
|
328
|
+
(name === "napi-build" || name === "wasm-build") &&
|
|
329
|
+
subject.pkg !== undefined) {
|
|
330
|
+
metadata.records = (0, build_records_1.buildRecordSource)(subject.pkg, (_p = (_o = context.sharedRecordNames) === null || _o === void 0 ? void 0 : _o.get(subject.workspace.root)) !== null && _p !== void 0 ? _p : []);
|
|
331
|
+
const shared = (_q = context.sharedArtifactNames) === null || _q === void 0 ? void 0 : _q.libraries.get(subject.pkg.manifest_path);
|
|
332
|
+
if (shared !== undefined) {
|
|
333
|
+
metadata.sharedLibrary = shared;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
if (metadata !== undefined && name === "napi-build" && subject.pkg !== undefined) {
|
|
337
|
+
if ((napi === null || napi === void 0 ? void 0 : napi.addon) !== undefined) {
|
|
338
|
+
metadata.napiAddon = napi.addon;
|
|
339
|
+
metadata.napiHost = napi.host;
|
|
340
|
+
}
|
|
341
|
+
if (header !== undefined) {
|
|
342
|
+
metadata.napiHeaderFile = header;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
const readsDigest = target.cache && targets_1.cachedTargets.has(name) && name !== "fmt-check";
|
|
346
|
+
const lockfile = (0, lockfile_task_1.lockfileDependency)(workspaceRoot, (_r = options.lockfileTarget) !== null && _r !== void 0 ? _r : "lockfile");
|
|
347
|
+
const hakariCheck = settings.featureUnification === "hakari"
|
|
348
|
+
? (0, lockfile_task_1.lockfileDependency)(workspaceRoot, (_s = options.hakariCheckTarget) !== null && _s !== void 0 ? _s : "hakari-check")
|
|
349
|
+
: undefined;
|
|
350
|
+
if (name === "hakari-check") {
|
|
351
|
+
target.dependsOn = [lockfile];
|
|
352
|
+
}
|
|
353
|
+
if (readsDigest) {
|
|
354
|
+
target.dependsOn = [lockfile, ...(hakariCheck === undefined ? [] : [hakariCheck])];
|
|
355
|
+
if (metadata !== undefined) {
|
|
356
|
+
metadata.digests = subject.pkg === undefined ? [] : [packageVersion(subject.pkg)];
|
|
357
|
+
if (subject.pkg === undefined || (0, inputs_1.holdsEveryDigest)(name, subject, settings)) {
|
|
358
|
+
metadata.everyDigest = true;
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
const inputs = name === "lockfile"
|
|
363
|
+
? (0, inputs_1.lockfileInputs)(subject, context)
|
|
364
|
+
: name === "hakari-check"
|
|
365
|
+
? [
|
|
366
|
+
...(0, inputs_1.lockfileInputs)(subject, context),
|
|
367
|
+
...(settings.hakari === undefined
|
|
368
|
+
? []
|
|
369
|
+
: [`{workspaceRoot}/${settings.hakari.configFile}`]),
|
|
370
|
+
]
|
|
371
|
+
: (0, inputs_1.targetInputs)(name, subject, context, settings, readsDigest);
|
|
372
|
+
target.inputs = inputs !== null && inputs !== void 0 ? inputs : [...((_t = target.inputs) !== null && _t !== void 0 ? _t : []), (0, inputs_1.pluginVersionInput)(context.plugin)];
|
|
373
|
+
if (target.cache && (name === "build" || name === "doc")) {
|
|
374
|
+
target.inputs = [...target.inputs, { runtime: (0, inputs_1.artifactFoldersCommand)(workspaceRoot) }];
|
|
375
|
+
}
|
|
376
|
+
if (name === "napi-build") {
|
|
377
|
+
target.inputs = [...target.inputs, ...(0, napi_1.napiInputs)(subject.root, header)];
|
|
378
|
+
}
|
|
379
|
+
if (name === "wasm-build") {
|
|
380
|
+
target.inputs = [...target.inputs, ...(0, wasm_1.wasmInputs)(workspaceRoot)];
|
|
381
|
+
}
|
|
382
|
+
if (name === "lockfile") {
|
|
383
|
+
target.outputs = [`{workspaceRoot}/${(0, lockfile_task_1.digestFolder)(workspaceRoot)}`];
|
|
384
|
+
if (metadata !== undefined) {
|
|
385
|
+
metadata.members = members;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
else if (name === "napi-build") {
|
|
389
|
+
// The files in the crate's folder, wherever the artifact directory lies.
|
|
390
|
+
target.outputs =
|
|
391
|
+
target.cache && napi !== undefined
|
|
392
|
+
? (0, napi_1.napiOutputFiles)(napi).map((file) => `{projectRoot}/${file}`)
|
|
393
|
+
: [];
|
|
394
|
+
}
|
|
395
|
+
else if (name === "wasm-build") {
|
|
396
|
+
// The package folder in the crate's folder, wherever the artifact
|
|
397
|
+
// directory lies (`DES-WASM`).
|
|
398
|
+
target.outputs = target.cache ? [`{projectRoot}/${wasm_1.wasmPackageFolder}`] : [];
|
|
399
|
+
}
|
|
400
|
+
else {
|
|
401
|
+
target.outputs = (0, outputs_1.targetOutputs)(name, subject.pkg, artifacts, target.cache, triples);
|
|
402
|
+
}
|
|
403
|
+
if (context.plugin.kind === "option") {
|
|
404
|
+
target.options = Object.assign(Object.assign({}, target.options), { pluginVersion: context.plugin.version });
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
/** The workspace's root folder relative to the repository root, `.` for the root itself. */
|
|
409
|
+
function workspaceFolder(subject, context) {
|
|
410
|
+
return (0, node_path_1.relative)(context.repositoryRoot, subject.workspace.report.workspace_root) || ".";
|
|
411
|
+
}
|
|
412
|
+
/** The members of the project's workspace, those without a project included, by package name. */
|
|
413
|
+
function workspaceMembers(subject) {
|
|
414
|
+
const ids = new Set(subject.workspace.report.workspace_members);
|
|
415
|
+
return subject.workspace.report.packages
|
|
416
|
+
.filter((pkg) => ids.has(pkg.id))
|
|
417
|
+
.map(packageVersion)
|
|
418
|
+
.sort((a, b) => (a.name < b.name ? -1 : a.name > b.name ? 1 : 0));
|
|
419
|
+
}
|
|
420
|
+
function packageVersion(pkg) {
|
|
421
|
+
return { name: pkg.name, version: pkg.version };
|
|
422
|
+
}
|
|
423
|
+
/**
|
|
424
|
+
* The manifests inside the repository of the path packages that each
|
|
425
|
+
* workspace's members reach, by the workspace's root folder relative to the
|
|
426
|
+
* repository root, as `{workspaceRoot}` paths ({@link CacheContext}): the
|
|
427
|
+
* crates of path dependencies, with a project or without, directly or
|
|
428
|
+
* through other path packages, and the crates of the workspace's `[patch]`
|
|
429
|
+
* and `[replace]` entries with those behind them. A crate without a report
|
|
430
|
+
* counts with its manifest alone. A `paths` override leaves no trace in the
|
|
431
|
+
* lockfile and is not read. A path names the crate at the real path of its
|
|
432
|
+
* folder, and its manifest is named there, also where the path passes a
|
|
433
|
+
* symbolic link.
|
|
434
|
+
*/
|
|
435
|
+
function pathPackageManifests(discovery) {
|
|
436
|
+
var _a, _b;
|
|
437
|
+
const folderOf = (manifest) => (0, real_path_1.realPath)((0, node_path_1.dirname)(manifest));
|
|
438
|
+
const known = new Map();
|
|
439
|
+
for (const report of [
|
|
440
|
+
...discovery.workspaces.map((workspace) => workspace.report),
|
|
441
|
+
...discovery.pathDependencyReports.map((entry) => entry.report),
|
|
442
|
+
]) {
|
|
443
|
+
for (const pkg of report.packages) {
|
|
444
|
+
if (!known.has(folderOf(pkg.manifest_path))) {
|
|
445
|
+
known.set(folderOf(pkg.manifest_path), pkg);
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
const repositoryRoot = (0, real_path_1.realPath)(discovery.workspaceRoot);
|
|
450
|
+
const result = new Map();
|
|
451
|
+
for (const workspace of discovery.workspaces) {
|
|
452
|
+
const ids = new Set(workspace.report.workspace_members);
|
|
453
|
+
// Real folders of crates.
|
|
454
|
+
const visited = new Set();
|
|
455
|
+
const queue = [
|
|
456
|
+
...workspace.report.packages
|
|
457
|
+
.filter((pkg) => ids.has(pkg.id))
|
|
458
|
+
.map((pkg) => folderOf(pkg.manifest_path)),
|
|
459
|
+
...workspace.redirections
|
|
460
|
+
.filter((redirection) => redirection.table !== "paths")
|
|
461
|
+
.map((redirection) => (0, real_path_1.realPath)(redirection.folder)),
|
|
462
|
+
];
|
|
463
|
+
while (queue.length > 0) {
|
|
464
|
+
const folder = queue.shift();
|
|
465
|
+
if (visited.has(folder)) {
|
|
466
|
+
continue;
|
|
467
|
+
}
|
|
468
|
+
visited.add(folder);
|
|
469
|
+
for (const dependency of (_b = (_a = known.get(folder)) === null || _a === void 0 ? void 0 : _a.dependencies) !== null && _b !== void 0 ? _b : []) {
|
|
470
|
+
if (typeof dependency.path === "string") {
|
|
471
|
+
queue.push((0, real_path_1.realPath)(dependency.path));
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
const root = (0, node_path_1.relative)(discovery.workspaceRoot, workspace.report.workspace_root) || ".";
|
|
476
|
+
result.set(root, [...visited]
|
|
477
|
+
.map((folder) => (0, node_path_1.relative)(repositoryRoot, (0, node_path_1.join)(folder, "Cargo.toml")))
|
|
478
|
+
.filter((path) => path !== "" && !path.startsWith("..") && !(0, node_path_1.isAbsolute)(path))
|
|
479
|
+
.map((path) => `{workspaceRoot}/${path}`)
|
|
480
|
+
.sort());
|
|
481
|
+
}
|
|
482
|
+
return result;
|
|
483
|
+
}
|
|
484
|
+
/** The warnings that concern a project, for its crate's manifest path or its workspace's root manifest. */
|
|
485
|
+
function projectWarnings(subject, context) {
|
|
486
|
+
var _a, _b, _c;
|
|
487
|
+
const key = (_b = (_a = subject.pkg) === null || _a === void 0 ? void 0 : _a.manifest_path) !== null && _b !== void 0 ? _b : rootManifestPath(subject.workspace);
|
|
488
|
+
return [...new Set((_c = context.warnings.get(key)) !== null && _c !== void 0 ? _c : [])];
|
|
489
|
+
}
|
|
490
|
+
// The roots of the projects that this entry creates (`inferProjects` in
|
|
491
|
+
// `projects.ts`): each member's folder, and the folder of each root manifest
|
|
492
|
+
// that Nx hands to the plugin.
|
|
493
|
+
function projectRoots(discovery) {
|
|
494
|
+
const root = (path) => (0, node_path_1.relative)(discovery.workspaceRoot, path) || ".";
|
|
495
|
+
return [
|
|
496
|
+
...new Set(discovery.workspaces.flatMap((workspace) => [
|
|
497
|
+
...workspace.members.map((pkg) => root((0, node_path_1.dirname)(pkg.manifest_path))),
|
|
498
|
+
...(workspace.rootManifestHanded ? [workspace.root] : []),
|
|
499
|
+
])),
|
|
500
|
+
];
|
|
501
|
+
}
|
|
502
|
+
// The warning of `DES-OUTPUTS` for a workspace whose Cargo configuration or
|
|
503
|
+
// graph environment picks a triple whose folder the plugin cannot name,
|
|
504
|
+
// which leaves `build` and `doc` uncached unless their options name a
|
|
505
|
+
// triple.
|
|
506
|
+
// @mara implements DES-DIAGNOSTICS
|
|
507
|
+
function tripleWarning(workspace, repositoryRoot) {
|
|
508
|
+
var _a;
|
|
509
|
+
const triples = (_a = workspace.triples) !== null && _a !== void 0 ? _a : { kind: "none" };
|
|
510
|
+
if (triples.kind !== "unnamed") {
|
|
511
|
+
return undefined;
|
|
512
|
+
}
|
|
513
|
+
return [
|
|
514
|
+
`nx-rust: ${(0, target_triples_1.unnamedTripleProblem)(triples, repositoryRoot)}.`,
|
|
515
|
+
`The build and doc targets of ${describeWorkspace(workspace)} run uncached where their options name no triple, and its other targets stay cached.`,
|
|
516
|
+
`To cache them, give the triple as the targetTriple option in the options of their target tables, in the crate's or the workspace's Cargo metadata; a triple only in a configuration or on the command line leaves them uncached.`,
|
|
517
|
+
].join(" ");
|
|
518
|
+
}
|
|
519
|
+
// Whether every run of a target names a triple, as the layers give it, the
|
|
520
|
+
// inferred target first and then each target table laid over it: the
|
|
521
|
+
// options, merged key by key, name one, and no configuration, merged by name
|
|
522
|
+
// and key, sets the option to anything else. Nx's `cache` belongs to the
|
|
523
|
+
// target and not to a configuration, so a triple in a configuration that a
|
|
524
|
+
// run need not select does not count (`DES-OUTPUTS`).
|
|
525
|
+
function alwaysNamesTriple(layers) {
|
|
526
|
+
var _a;
|
|
527
|
+
const isTriple = (value) => typeof value === "string" && value !== "";
|
|
528
|
+
let triple;
|
|
529
|
+
const configured = new Map();
|
|
530
|
+
for (const layer of layers) {
|
|
531
|
+
if (layer.options !== undefined && layer.options !== null && "targetTriple" in layer.options) {
|
|
532
|
+
triple = layer.options.targetTriple;
|
|
533
|
+
}
|
|
534
|
+
for (const [configuration, options] of Object.entries((_a = layer.configurations) !== null && _a !== void 0 ? _a : {})) {
|
|
535
|
+
if (typeof options === "object" && options !== null && "targetTriple" in options) {
|
|
536
|
+
configured.set(configuration, options.targetTriple);
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
return isTriple(triple) && [...configured.values()].every(isTriple);
|
|
541
|
+
}
|
|
542
|
+
// The folder that each workspace's artifact directory is, as the system
|
|
543
|
+
// reaches it through the path that cargo reports ({@link physicalPath}).
|
|
544
|
+
// Cargo reports the directory as the configuration or `CARGO_TARGET_DIR`
|
|
545
|
+
// spells it, `..`, symbolic links and a trailing separator included, and
|
|
546
|
+
// writes to the folder that the system reaches; where a link comes before a
|
|
547
|
+
// `..`, that is not the folder that the path names as text (`DES-OUTPUTS`).
|
|
548
|
+
// @mara implements DES-OUTPUTS
|
|
549
|
+
function reachedArtifactDirectories(workspaces) {
|
|
550
|
+
return new Map(workspaces.map((workspace) => [workspace, (0, real_path_1.physicalPath)(workspace.report.target_directory)]));
|
|
551
|
+
}
|
|
552
|
+
// How the artifact directory of `workspace` lies to that of `other`, or
|
|
553
|
+
// `undefined` where neither is the other or inside it. Each is spelt with
|
|
554
|
+
// `.` and `..` taken as text and with symbolic links followed (`reached`),
|
|
555
|
+
// and either spelling counts, as do names that differ only in case or
|
|
556
|
+
// Unicode normalisation ({@link foldedFileName}): two folders taken for
|
|
557
|
+
// one only cost caching, while one folder taken for two lets a cache entry
|
|
558
|
+
// hold another workspace's files (`DES-OUTPUTS`).
|
|
559
|
+
function directoryRelation(workspace, other, reached) {
|
|
560
|
+
const spellings = (of) => {
|
|
561
|
+
var _a;
|
|
562
|
+
const directory = of.report.target_directory;
|
|
563
|
+
return [(0, node_path_1.resolve)(directory), (_a = reached.get(of)) !== null && _a !== void 0 ? _a : (0, node_path_1.resolve)(directory)].map((path) => (0, artifact_names_1.foldedFileName)(path.replace(/\/+$/, "")));
|
|
564
|
+
};
|
|
565
|
+
const own = spellings(workspace);
|
|
566
|
+
const theirs = spellings(other);
|
|
567
|
+
const relations = own.flatMap((a) => theirs.map((b) => a === b
|
|
568
|
+
? "same"
|
|
569
|
+
: a.startsWith(`${b}/`)
|
|
570
|
+
? "inside"
|
|
571
|
+
: b.startsWith(`${a}/`)
|
|
572
|
+
? "around"
|
|
573
|
+
: undefined));
|
|
574
|
+
return ["same", "inside", "around"].find((relation) => relations.includes(relation));
|
|
575
|
+
}
|
|
576
|
+
// The workspaces with which each workspace shares its artifact directory:
|
|
577
|
+
// those whose artifact directory is the same folder, lies inside it or
|
|
578
|
+
// holds it ({@link directoryRelation}). Outputs of `build` and `doc` lie
|
|
579
|
+
// one or two folder names, of a triple and a profile, below the artifact
|
|
580
|
+
// directory, so those of two different directories can coincide only
|
|
581
|
+
// where one lies inside the other, and a `doc` folder restored into one
|
|
582
|
+
// can hold or replace the other (`DES-OUTPUTS`).
|
|
583
|
+
// @mara implements DES-OUTPUTS
|
|
584
|
+
function artifactDirectorySharers(workspaces, reached) {
|
|
585
|
+
return new Map(workspaces.map((workspace) => [
|
|
586
|
+
workspace,
|
|
587
|
+
workspaces.filter((other) => other !== workspace && directoryRelation(workspace, other, reached) !== undefined),
|
|
588
|
+
]));
|
|
589
|
+
}
|
|
590
|
+
// Where each workspace's artifact directory lies, by the workspace's root
|
|
591
|
+
// folder: outside the repository, or inside it and shared with another
|
|
592
|
+
// workspace or not. The folder that the system reaches decides, relative to
|
|
593
|
+
// the repository's real path, and is the path that the outputs name
|
|
594
|
+
// ({@link repositoryFolder}, which the executor uses as well).
|
|
595
|
+
function locateArtifactDirectories(workspaces, repositoryRoot, sharers) {
|
|
596
|
+
var _a;
|
|
597
|
+
const located = new Map();
|
|
598
|
+
for (const workspace of workspaces) {
|
|
599
|
+
const folder = (0, real_path_1.repositoryFolder)(workspace.report.target_directory, repositoryRoot);
|
|
600
|
+
located.set(workspace.root, folder.inside
|
|
601
|
+
? { inside: true, path: folder.path, shared: ((_a = sharers.get(workspace)) !== null && _a !== void 0 ? _a : []).length > 0 }
|
|
602
|
+
: { inside: false });
|
|
603
|
+
}
|
|
604
|
+
return located;
|
|
605
|
+
}
|
|
606
|
+
// What the warning about artifact directories that lie one inside the other
|
|
607
|
+
// adds, inside the repository or outside it: two cargo commands that create
|
|
608
|
+
// such directories at once can fail in cargo itself (`DES-OUTPUTS`, "Nested
|
|
609
|
+
// artifact directories").
|
|
610
|
+
const nestedFirstBuild = `A first build, while these directories do not exist yet, can fail in cargo with "No such file or directory"; run the command again.`;
|
|
611
|
+
// The warning of `DES-OUTPUTS` for a workspace whose artifact directory lies
|
|
612
|
+
// outside the repository or is shared with another workspace: the same
|
|
613
|
+
// folder, or one inside the other. Where it lies one inside another
|
|
614
|
+
// workspace's, wherever both lie, the warning names that directory and adds
|
|
615
|
+
// that a first build can fail in cargo ({@link nestedFirstBuild}); one
|
|
616
|
+
// shared folder cannot make it fail. A directory inside the repository can
|
|
617
|
+
// lie inside one outside it only where that one holds the repository, and
|
|
618
|
+
// never the other way round.
|
|
619
|
+
// @mara implements DES-DIAGNOSTICS
|
|
620
|
+
function artifactDirectoryWarning(workspace, located, reached, sharers, directoryOf) {
|
|
621
|
+
var _a, _b;
|
|
622
|
+
const artifacts = located.get(workspace.root);
|
|
623
|
+
const directory = (_a = reached.get(workspace)) !== null && _a !== void 0 ? _a : workspace.report.target_directory;
|
|
624
|
+
const where = describeWorkspace(workspace);
|
|
625
|
+
const others = (_b = sharers.get(workspace)) !== null && _b !== void 0 ? _b : [];
|
|
626
|
+
const relations = others.map((other) => ({
|
|
627
|
+
other,
|
|
628
|
+
relation: directoryRelation(workspace, other, reached),
|
|
629
|
+
}));
|
|
630
|
+
const nested = relations.some(({ relation }) => relation === "inside" || relation === "around");
|
|
631
|
+
const described = relations.map(({ other, relation }) => relation === "same"
|
|
632
|
+
? `is that of ${describeWorkspace(other)} as well`
|
|
633
|
+
: relation === "inside"
|
|
634
|
+
? `lies inside ${directoryOf(other)}, that of ${describeWorkspace(other)}`
|
|
635
|
+
: `holds ${directoryOf(other)}, that of ${describeWorkspace(other)}`);
|
|
636
|
+
if (artifacts === undefined || !artifacts.inside) {
|
|
637
|
+
return [
|
|
638
|
+
`nx-rust: Cargo's artifact directory of ${where} is ${directory}, outside the repository, where Nx cannot store files.`,
|
|
639
|
+
`Its build and doc targets run uncached, and its other targets stay cached.`,
|
|
640
|
+
`To cache them, set build.target-dir in a .cargo/config.toml of the workspace to a folder inside the repository, or unset CARGO_TARGET_DIR.`,
|
|
641
|
+
...(nested ? [`The directory ${described.join(", and ")}.`, nestedFirstBuild] : []),
|
|
642
|
+
].join(" ");
|
|
643
|
+
}
|
|
644
|
+
if (!artifacts.shared) {
|
|
645
|
+
return undefined;
|
|
646
|
+
}
|
|
647
|
+
if (!nested) {
|
|
648
|
+
return [
|
|
649
|
+
`nx-rust: ${where} shares Cargo's artifact directory ${artifacts.path} with ${others.map(describeWorkspace).join(" and ")}.`,
|
|
650
|
+
`Its doc target runs uncached, because restoring one workspace's doc folder from the cache would delete the pages of the others; its other targets stay cached.`,
|
|
651
|
+
`To cache it, give each workspace an artifact directory of its own with build.target-dir in its .cargo/config.toml.`,
|
|
652
|
+
].join(" ");
|
|
653
|
+
}
|
|
654
|
+
return [
|
|
655
|
+
`nx-rust: Cargo's artifact directory ${artifacts.path} of ${where} ${described.join(", and ")}, so that the folders of a triple or a profile in one can be those of the other.`,
|
|
656
|
+
`Its doc target runs uncached, because restoring one workspace's doc folder from the cache could delete or replace files of the others; its other targets stay cached.`,
|
|
657
|
+
`To cache it, give each workspace an artifact directory of its own, none inside another, with build.target-dir in its .cargo/config.toml.`,
|
|
658
|
+
nestedFirstBuild,
|
|
659
|
+
].join(" ");
|
|
660
|
+
}
|
|
661
|
+
function describeWorkspace(workspace) {
|
|
662
|
+
return workspace.root === "."
|
|
663
|
+
? "the Cargo workspace at the repository root"
|
|
664
|
+
: `the Cargo workspace in ${workspace.root}`;
|
|
665
|
+
}
|
|
666
|
+
// The keys of {@link CacheContext.warnings} for the projects of a workspace:
|
|
667
|
+
// its members' manifests and its root manifest.
|
|
668
|
+
function workspaceManifests(workspace) {
|
|
669
|
+
return [
|
|
670
|
+
...new Set([...workspace.members.map((pkg) => pkg.manifest_path), rootManifestPath(workspace)]),
|
|
671
|
+
];
|
|
672
|
+
}
|
|
673
|
+
function rootManifestPath(workspace) {
|
|
674
|
+
return `${workspace.report.workspace_root}/Cargo.toml`;
|
|
675
|
+
}
|
|
676
|
+
//# sourceMappingURL=caching.js.map
|