@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,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.producesArtifact = producesArtifact;
|
|
4
|
+
exports.reportedArtifacts = reportedArtifacts;
|
|
5
|
+
exports.shellQuote = shellQuote;
|
|
6
|
+
/** The package that a crate depends on directly when it produces each kind of artifact. */
|
|
7
|
+
const artifactPackages = {
|
|
8
|
+
napi: "napi",
|
|
9
|
+
wasm: "wasm-bindgen",
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Whether a crate produces an artifact of the kind (`DES-ARTIFACT-STEPS`):
|
|
13
|
+
* its library target has the crate type `cdylib` and it depends directly,
|
|
14
|
+
* through a normal dependency, on `napi` for a Node addon or on
|
|
15
|
+
* `wasm-bindgen` for a wasm package, also one declared for one platform
|
|
16
|
+
* only. An `artifacts` list in the crate's `[package.metadata.nx]` replaces
|
|
17
|
+
* the inference.
|
|
18
|
+
*/
|
|
19
|
+
// @mara implements DES-ARTIFACT-STEPS
|
|
20
|
+
function producesArtifact(subject, kind) {
|
|
21
|
+
var _a;
|
|
22
|
+
const { pkg } = subject;
|
|
23
|
+
if (pkg === undefined) {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
const artifacts = (_a = subject.settings) === null || _a === void 0 ? void 0 : _a.artifacts;
|
|
27
|
+
if (artifacts !== undefined) {
|
|
28
|
+
return artifacts.includes(kind);
|
|
29
|
+
}
|
|
30
|
+
return (pkg.targets.some((target) => target.kind.includes("cdylib")) &&
|
|
31
|
+
pkg.dependencies.some((dependency) => dependency.name === artifactPackages[kind] && dependency.kind === null));
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The `artifacts` of a crate's `[package.metadata.nx]` as the `cargo
|
|
35
|
+
* metadata` report gives them, for code that reads a member without its
|
|
36
|
+
* settings, such as `init`'s table of tools: the strings of the list, or
|
|
37
|
+
* `undefined` where the table names none.
|
|
38
|
+
*/
|
|
39
|
+
function reportedArtifacts(pkg) {
|
|
40
|
+
var _a, _b;
|
|
41
|
+
const artifacts = (_b = (_a = pkg.metadata) === null || _a === void 0 ? void 0 : _a.nx) === null || _b === void 0 ? void 0 : _b.artifacts;
|
|
42
|
+
return Array.isArray(artifacts)
|
|
43
|
+
? artifacts.filter((kind) => kind === "napi" || kind === "wasm")
|
|
44
|
+
: undefined;
|
|
45
|
+
}
|
|
46
|
+
/** Quotes a value for `sh`, for the commands of `runtime` inputs. */
|
|
47
|
+
function shellQuote(value) {
|
|
48
|
+
return `'${value.split("'").join(`'"'"'`)}'`;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=artifact-kinds.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artifact-kinds.js","sourceRoot":"","sources":["../../../../nx-rust/src/graph/artifact-kinds.ts"],"names":[],"mappings":";;AA0BA,4CAeC;AAQD,8CAKC;AAGD,gCAEC;AAhDD,2FAA2F;AAC3F,MAAM,gBAAgB,GAA2C;IAC/D,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,cAAc;CACrB,CAAC;AAEF;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+1,97 @@
|
|
|
1
|
+
import type { CargoPackage } from "../cargo/metadata";
|
|
2
|
+
import type { ReportedWorkspace } from "./discovery";
|
|
3
|
+
/**
|
|
4
|
+
* Which crates' targets the plugin leaves uncached because another crate
|
|
5
|
+
* puts a file of the same name into their artifact directory, and the
|
|
6
|
+
* warnings that say so (`DES-OUTPUTS`, "Files of one name").
|
|
7
|
+
*/
|
|
8
|
+
export interface SharedArtifactNames {
|
|
9
|
+
/** Why the plugin leaves a crate's `build` uncached, by the crate's manifest path. */
|
|
10
|
+
build: ReadonlyMap<string, string>;
|
|
11
|
+
/** Why the plugin leaves a crate's `test` uncached, by the crate's manifest path. */
|
|
12
|
+
test: ReadonlyMap<string, string>;
|
|
13
|
+
/**
|
|
14
|
+
* For each crate whose library has the file name of another crate's
|
|
15
|
+
* `cdylib`, `dylib`, proc-macro or `staticlib` file, by the crate's manifest
|
|
16
|
+
* path: the shared name and the other crates, for the message with which
|
|
17
|
+
* its `napi-build` or `wasm-build` fails before cargo runs (`DES-NAPI`,
|
|
18
|
+
* "Library names"; `DES-WASM`).
|
|
19
|
+
*/
|
|
20
|
+
libraries: ReadonlyMap<string, string>;
|
|
21
|
+
/**
|
|
22
|
+
* One warning for each file name that crates of one artifact directory
|
|
23
|
+
* share, with the manifest paths of the crates that it names, in whose
|
|
24
|
+
* projects' warnings it belongs (`DES-DIAGNOSTICS`).
|
|
25
|
+
*/
|
|
26
|
+
warnings: readonly {
|
|
27
|
+
message: string;
|
|
28
|
+
manifests: readonly string[];
|
|
29
|
+
}[];
|
|
30
|
+
}
|
|
31
|
+
/** A final artifact that a crate's target puts into the folders of its artifact directory. */
|
|
32
|
+
export interface NamedArtifact {
|
|
33
|
+
/** The file's name on Linux, such as `cli`, `libshared.so` or `libshared.a`. */
|
|
34
|
+
file: string;
|
|
35
|
+
kind: "binary" | "library";
|
|
36
|
+
/** Whether the crate's `build` declares the file as an output (`targetOutputs` in `outputs.ts`). */
|
|
37
|
+
declared: boolean;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* The final artifacts that each crate puts into the folders of its
|
|
41
|
+
* artifact directory under a name of its target, not of the crate
|
|
42
|
+
* (`EVD-CARGO-ARTIFACT-WRITERS`): the executable of each binary, named
|
|
43
|
+
* after the binary; and the file of a library, `lib<name>` with each `-` as
|
|
44
|
+
* `_`, `.so` on Linux and `.dylib` on macOS for a `cdylib`, a `dylib` and a
|
|
45
|
+
* proc macro, and `.a` for a `staticlib`. Only the executables and the
|
|
46
|
+
* `cdylib` and `staticlib` files are outputs of `build`; cargo copies a
|
|
47
|
+
* `dylib` there also where it builds it as another crate's dependency, and a
|
|
48
|
+
* proc macro where a command selects its crate. A binary's name holds no
|
|
49
|
+
* `.`, which rustc refuses in a crate name, so it is never the name of a
|
|
50
|
+
* library's file. The file of a dynamic library is named here by its Linux
|
|
51
|
+
* name alone: its macOS name is shared exactly where that one is.
|
|
52
|
+
*/
|
|
53
|
+
export declare function namedArtifacts(pkg: CargoPackage): NamedArtifact[];
|
|
54
|
+
/**
|
|
55
|
+
* A file's name as a file system that ignores case and Unicode
|
|
56
|
+
* normalisation, such as macOS's default one, compares it, erring towards
|
|
57
|
+
* taking two names for one: upper case and then lower case, so that `ß`
|
|
58
|
+
* and `ss` agree, in one normal form.
|
|
59
|
+
*/
|
|
60
|
+
export declare function foldedFileName(name: string): string;
|
|
61
|
+
/**
|
|
62
|
+
* Finds the crates whose final artifacts share a file name in one artifact
|
|
63
|
+
* directory (`DES-OUTPUTS`, "Files of one name"). Cargo writes one file
|
|
64
|
+
* for them in every folder that both crates build into, that of the crate it
|
|
65
|
+
* wrote last, and warns of an output filename collision only where one
|
|
66
|
+
* call builds both (`EVD-CARGO-ARTIFACT-WRITERS`).
|
|
67
|
+
*
|
|
68
|
+
* The workspaces that share an artifact directory, as `sharers` gives them
|
|
69
|
+
* for `doc`, also through a third, are compared as one, with every member of
|
|
70
|
+
* each, those without a project too: workspaces whose artifact directory is
|
|
71
|
+
* the same folder, and those whose artifact directory lies inside
|
|
72
|
+
* another's, since a folder of a triple or a profile in one can be the
|
|
73
|
+
* other. Those of other entries of the plugin count as well. Names count as one where they differ
|
|
74
|
+
* only in case or Unicode normalisation ({@link foldedFileName}), on every
|
|
75
|
+
* host, so that the graph is the same on Linux and macOS. Triples and
|
|
76
|
+
* profiles play no part: the outputs interpolate the task's `targetTriple`
|
|
77
|
+
* and `profile` options, so that two crates of one artifact directory can
|
|
78
|
+
* always build into one folder. Two targets of one crate do not count: one
|
|
79
|
+
* command writes both, and a restore puts back what it left.
|
|
80
|
+
*
|
|
81
|
+
* Every crate that declares such a file as an output of its `build` gets
|
|
82
|
+
* that `build` left uncached, as a whole, because one cargo command writes
|
|
83
|
+
* all of its files; and so does its `test` where the file is the executable
|
|
84
|
+
* of a binary and `cargo test` builds the crate's binaries
|
|
85
|
+
* ({@link testReplacesExecutables}), because its tests run that file as
|
|
86
|
+
* `CARGO_BIN_EXE_<name>`, which another crate's command can replace first.
|
|
87
|
+
*
|
|
88
|
+
* @param directoryOf The artifact directory that a workspace's warnings name.
|
|
89
|
+
* @param repositoryRoot The repository root, against which the warnings name
|
|
90
|
+
* the crates' folders.
|
|
91
|
+
*/
|
|
92
|
+
export declare function sharedArtifactNames(workspaces: readonly ReportedWorkspace[], sharers: ReadonlyMap<ReportedWorkspace, readonly ReportedWorkspace[]>, directoryOf: (workspace: ReportedWorkspace) => string, repositoryRoot: string): SharedArtifactNames;
|
|
93
|
+
/**
|
|
94
|
+
* The workspaces that share an artifact directory, each group once: those
|
|
95
|
+
* that `sharers` links, also through a third.
|
|
96
|
+
*/
|
|
97
|
+
export declare function directoryGroups(workspaces: readonly ReportedWorkspace[], sharers: ReadonlyMap<ReportedWorkspace, readonly ReportedWorkspace[]>): ReportedWorkspace[][];
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.namedArtifacts = namedArtifacts;
|
|
4
|
+
exports.foldedFileName = foldedFileName;
|
|
5
|
+
exports.sharedArtifactNames = sharedArtifactNames;
|
|
6
|
+
exports.directoryGroups = directoryGroups;
|
|
7
|
+
const node_path_1 = require("node:path");
|
|
8
|
+
const real_path_1 = require("./real-path");
|
|
9
|
+
const targets_1 = require("./targets");
|
|
10
|
+
/**
|
|
11
|
+
* The final artifacts that each crate puts into the folders of its
|
|
12
|
+
* artifact directory under a name of its target, not of the crate
|
|
13
|
+
* (`EVD-CARGO-ARTIFACT-WRITERS`): the executable of each binary, named
|
|
14
|
+
* after the binary; and the file of a library, `lib<name>` with each `-` as
|
|
15
|
+
* `_`, `.so` on Linux and `.dylib` on macOS for a `cdylib`, a `dylib` and a
|
|
16
|
+
* proc macro, and `.a` for a `staticlib`. Only the executables and the
|
|
17
|
+
* `cdylib` and `staticlib` files are outputs of `build`; cargo copies a
|
|
18
|
+
* `dylib` there also where it builds it as another crate's dependency, and a
|
|
19
|
+
* proc macro where a command selects its crate. A binary's name holds no
|
|
20
|
+
* `.`, which rustc refuses in a crate name, so it is never the name of a
|
|
21
|
+
* library's file. The file of a dynamic library is named here by its Linux
|
|
22
|
+
* name alone: its macOS name is shared exactly where that one is.
|
|
23
|
+
*/
|
|
24
|
+
function namedArtifacts(pkg) {
|
|
25
|
+
return pkg.targets.flatMap((target) => {
|
|
26
|
+
if (target.kind.includes("bin")) {
|
|
27
|
+
return [{ file: target.name, kind: "binary", declared: true }];
|
|
28
|
+
}
|
|
29
|
+
const library = `lib${target.name.replace(/-/g, "_")}`;
|
|
30
|
+
const artifacts = [];
|
|
31
|
+
if (["cdylib", "dylib", "proc-macro"].some((kind) => target.kind.includes(kind))) {
|
|
32
|
+
artifacts.push({
|
|
33
|
+
file: `${library}.so`,
|
|
34
|
+
kind: "library",
|
|
35
|
+
declared: target.kind.includes("cdylib"),
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
if (target.kind.includes("staticlib")) {
|
|
39
|
+
artifacts.push({ file: `${library}.a`, kind: "library", declared: true });
|
|
40
|
+
}
|
|
41
|
+
return artifacts;
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* A file's name as a file system that ignores case and Unicode
|
|
46
|
+
* normalisation, such as macOS's default one, compares it, erring towards
|
|
47
|
+
* taking two names for one: upper case and then lower case, so that `ß`
|
|
48
|
+
* and `ss` agree, in one normal form.
|
|
49
|
+
*/
|
|
50
|
+
function foldedFileName(name) {
|
|
51
|
+
return name.normalize("NFD").toUpperCase().toLowerCase().normalize("NFD");
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Finds the crates whose final artifacts share a file name in one artifact
|
|
55
|
+
* directory (`DES-OUTPUTS`, "Files of one name"). Cargo writes one file
|
|
56
|
+
* for them in every folder that both crates build into, that of the crate it
|
|
57
|
+
* wrote last, and warns of an output filename collision only where one
|
|
58
|
+
* call builds both (`EVD-CARGO-ARTIFACT-WRITERS`).
|
|
59
|
+
*
|
|
60
|
+
* The workspaces that share an artifact directory, as `sharers` gives them
|
|
61
|
+
* for `doc`, also through a third, are compared as one, with every member of
|
|
62
|
+
* each, those without a project too: workspaces whose artifact directory is
|
|
63
|
+
* the same folder, and those whose artifact directory lies inside
|
|
64
|
+
* another's, since a folder of a triple or a profile in one can be the
|
|
65
|
+
* other. Those of other entries of the plugin count as well. Names count as one where they differ
|
|
66
|
+
* only in case or Unicode normalisation ({@link foldedFileName}), on every
|
|
67
|
+
* host, so that the graph is the same on Linux and macOS. Triples and
|
|
68
|
+
* profiles play no part: the outputs interpolate the task's `targetTriple`
|
|
69
|
+
* and `profile` options, so that two crates of one artifact directory can
|
|
70
|
+
* always build into one folder. Two targets of one crate do not count: one
|
|
71
|
+
* command writes both, and a restore puts back what it left.
|
|
72
|
+
*
|
|
73
|
+
* Every crate that declares such a file as an output of its `build` gets
|
|
74
|
+
* that `build` left uncached, as a whole, because one cargo command writes
|
|
75
|
+
* all of its files; and so does its `test` where the file is the executable
|
|
76
|
+
* of a binary and `cargo test` builds the crate's binaries
|
|
77
|
+
* ({@link testReplacesExecutables}), because its tests run that file as
|
|
78
|
+
* `CARGO_BIN_EXE_<name>`, which another crate's command can replace first.
|
|
79
|
+
*
|
|
80
|
+
* @param directoryOf The artifact directory that a workspace's warnings name.
|
|
81
|
+
* @param repositoryRoot The repository root, against which the warnings name
|
|
82
|
+
* the crates' folders.
|
|
83
|
+
*/
|
|
84
|
+
// @mara implements DES-OUTPUTS
|
|
85
|
+
function sharedArtifactNames(workspaces, sharers, directoryOf, repositoryRoot) {
|
|
86
|
+
var _a;
|
|
87
|
+
const build = new Map();
|
|
88
|
+
const test = new Map();
|
|
89
|
+
const libraries = new Map();
|
|
90
|
+
const warnings = [];
|
|
91
|
+
const folderOf = (pkg) => repositoryFolder((0, node_path_1.dirname)(pkg.manifest_path), repositoryRoot);
|
|
92
|
+
for (const group of directoryGroups(workspaces, sharers)) {
|
|
93
|
+
const byName = new Map();
|
|
94
|
+
for (const workspace of group) {
|
|
95
|
+
for (const pkg of workspace.report.packages) {
|
|
96
|
+
for (const artifact of namedArtifacts(pkg)) {
|
|
97
|
+
const name = foldedFileName(artifact.file);
|
|
98
|
+
byName.set(name, [...((_a = byName.get(name)) !== null && _a !== void 0 ? _a : []), Object.assign(Object.assign({}, artifact), { pkg, workspace })]);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
for (const [, writers] of [...byName].sort(([a], [b]) => compare(a, b))) {
|
|
103
|
+
const crates = uniqueCrates(writers).sort((a, b) => compare(folderOf(a), folderOf(b)));
|
|
104
|
+
if (crates.length < 2) {
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
const label = crateLabels(crates, folderOf);
|
|
108
|
+
const builds = crates.filter((pkg) => writers.some((writer) => writer.pkg === pkg && writer.declared));
|
|
109
|
+
const binary = writers[0].kind === "binary";
|
|
110
|
+
const tests = binary ? builds.filter(targets_1.testReplacesExecutables) : [];
|
|
111
|
+
if (!binary) {
|
|
112
|
+
for (const pkg of crates) {
|
|
113
|
+
add(libraries, pkg.manifest_path, sharedClause(pkg, writers, crates, folderOf));
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
for (const pkg of builds) {
|
|
117
|
+
const clause = sharedClause(pkg, writers, crates, folderOf);
|
|
118
|
+
add(build, pkg.manifest_path, clause);
|
|
119
|
+
if (tests.includes(pkg)) {
|
|
120
|
+
add(test, pkg.manifest_path, clause);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
warnings.push({
|
|
124
|
+
message: sharedNameWarning({
|
|
125
|
+
crates: crates.map((pkg) => `${pkg.name} in ${folderOf(pkg)}`),
|
|
126
|
+
files: [...new Set(writers.map((writer) => writer.file))].sort(compare),
|
|
127
|
+
binary,
|
|
128
|
+
directories: [
|
|
129
|
+
...new Set(group
|
|
130
|
+
.filter((workspace) => writers.some((writer) => writer.workspace === workspace))
|
|
131
|
+
.map(directoryOf)),
|
|
132
|
+
].sort(compare),
|
|
133
|
+
builds: builds.map(label),
|
|
134
|
+
tests: tests.map(label),
|
|
135
|
+
workspaces: new Set(writers
|
|
136
|
+
.filter((writer) => crates.includes(writer.pkg))
|
|
137
|
+
.map((writer) => writer.workspace)).size,
|
|
138
|
+
}),
|
|
139
|
+
manifests: crates.map((pkg) => pkg.manifest_path),
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return {
|
|
144
|
+
build: new Map([...build].map(([manifest, clauses]) => [
|
|
145
|
+
manifest,
|
|
146
|
+
`files that its build writes can lie at the paths of files that other crates write, in the same artifact directory or in one inside the other, where cargo keeps the file that it wrote last, so that a stored result could hold another crate's file: ${clauses.join("; ")}`,
|
|
147
|
+
])),
|
|
148
|
+
test: new Map([...test].map(([manifest, clauses]) => [
|
|
149
|
+
manifest,
|
|
150
|
+
`its integration tests or benches run its executables as CARGO_BIN_EXE_<name>, which can lie at the paths of files that other crates write, in the same artifact directory or in one inside the other, so that the tests could run another crate's executable: ${clauses.join("; ")}`,
|
|
151
|
+
])),
|
|
152
|
+
libraries: new Map([...libraries].map(([manifest, clauses]) => [manifest, clauses.join("; ")])),
|
|
153
|
+
warnings,
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* The workspaces that share an artifact directory, each group once: those
|
|
158
|
+
* that `sharers` links, also through a third.
|
|
159
|
+
*/
|
|
160
|
+
function directoryGroups(workspaces, sharers) {
|
|
161
|
+
var _a;
|
|
162
|
+
const seen = new Set();
|
|
163
|
+
const groups = [];
|
|
164
|
+
for (const workspace of workspaces) {
|
|
165
|
+
if (seen.has(workspace)) {
|
|
166
|
+
continue;
|
|
167
|
+
}
|
|
168
|
+
seen.add(workspace);
|
|
169
|
+
const group = [];
|
|
170
|
+
const queue = [workspace];
|
|
171
|
+
while (queue.length > 0) {
|
|
172
|
+
const next = queue.shift();
|
|
173
|
+
group.push(next);
|
|
174
|
+
for (const other of (_a = sharers.get(next)) !== null && _a !== void 0 ? _a : []) {
|
|
175
|
+
if (!seen.has(other)) {
|
|
176
|
+
seen.add(other);
|
|
177
|
+
queue.push(other);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
groups.push(group);
|
|
182
|
+
}
|
|
183
|
+
return groups;
|
|
184
|
+
}
|
|
185
|
+
// The crates of the writers, each once, by manifest path.
|
|
186
|
+
function uniqueCrates(writers) {
|
|
187
|
+
const crates = new Map();
|
|
188
|
+
for (const { pkg } of writers) {
|
|
189
|
+
if (!crates.has(pkg.manifest_path)) {
|
|
190
|
+
crates.set(pkg.manifest_path, pkg);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
return [...crates.values()];
|
|
194
|
+
}
|
|
195
|
+
// How the warning names each crate in its list of targets: by package name,
|
|
196
|
+
// and with its folder where two crates of the list share the name.
|
|
197
|
+
function crateLabels(crates, folderOf) {
|
|
198
|
+
var _a;
|
|
199
|
+
const counts = new Map();
|
|
200
|
+
for (const pkg of crates) {
|
|
201
|
+
counts.set(pkg.name, ((_a = counts.get(pkg.name)) !== null && _a !== void 0 ? _a : 0) + 1);
|
|
202
|
+
}
|
|
203
|
+
return (pkg) => { var _a; return (((_a = counts.get(pkg.name)) !== null && _a !== void 0 ? _a : 0) > 1 ? `${pkg.name} in ${folderOf(pkg)}` : pkg.name); };
|
|
204
|
+
}
|
|
205
|
+
// The crate's files of one shared name and the other crates that write it,
|
|
206
|
+
// for the reasons in the targets' metadata.
|
|
207
|
+
function sharedClause(pkg, writers, crates, folderOf) {
|
|
208
|
+
const own = [
|
|
209
|
+
...new Set(writers.filter((writer) => writer.pkg === pkg).map((writer) => writer.file)),
|
|
210
|
+
];
|
|
211
|
+
const others = crates.filter((other) => other !== pkg);
|
|
212
|
+
return `${list(own)}, which ${list(others.map((other) => `${other.name} in ${folderOf(other)}`))} ${others.length > 1 ? "write" : "writes"} too`;
|
|
213
|
+
}
|
|
214
|
+
// The warning of `DES-DIAGNOSTICS` for one file name that crates of one
|
|
215
|
+
// artifact directory share.
|
|
216
|
+
// @mara implements DES-DIAGNOSTICS
|
|
217
|
+
function sharedNameWarning(shared) {
|
|
218
|
+
const { crates, files, binary, directories, builds, tests, workspaces } = shared;
|
|
219
|
+
const what = binary
|
|
220
|
+
? `executables called ${list(files)}`
|
|
221
|
+
: files.every((file) => file.endsWith(".so"))
|
|
222
|
+
? `library files called ${list(files)}, ${list(files.map((file) => `${file.slice(0, -3)}.dylib`))} on macOS`
|
|
223
|
+
: `library files called ${list(files)}`;
|
|
224
|
+
const oneFile = files.length > 1
|
|
225
|
+
? ", which a file system that ignores case, as macOS's does by default, takes for one file,"
|
|
226
|
+
: "";
|
|
227
|
+
const uncached = [
|
|
228
|
+
builds.length === 0
|
|
229
|
+
? undefined
|
|
230
|
+
: `The build ${builds.length > 1 ? "targets" : "target"} of ${list(builds)} ${builds.length > 1 ? "run" : "runs"} uncached`,
|
|
231
|
+
tests.length === 0
|
|
232
|
+
? undefined
|
|
233
|
+
: `${tests.length > 1 ? "so do the test targets" : "so does the test target"} of ${list(tests)}, whose integration tests or benches run that executable`,
|
|
234
|
+
]
|
|
235
|
+
.filter((part) => part !== undefined)
|
|
236
|
+
.join(", and ");
|
|
237
|
+
const where = directories.length > 1
|
|
238
|
+
? `Cargo's artifact directories ${list(directories)}, which lie one inside the other, so that the folders of a triple or a profile in one can be those of the other, and where`
|
|
239
|
+
: `Cargo's artifact directory ${list(directories)}, where`;
|
|
240
|
+
const rename = binary
|
|
241
|
+
? "give one of the binaries another name, with the name key of its [[bin]] table in Cargo.toml"
|
|
242
|
+
: "give one of the libraries another name, with the name key of its [lib] table in Cargo.toml";
|
|
243
|
+
return [
|
|
244
|
+
`nx-rust: the crates ${list(crates)} put ${what}${oneFile} into ${where} cargo keeps the file of the crate that it wrote last, so that a cached build of one crate could hold another crate's file.`,
|
|
245
|
+
`${uncached}; their other targets stay cached.`,
|
|
246
|
+
workspaces > 1
|
|
247
|
+
? `To cache them, ${rename}, or give each Cargo workspace an artifact directory of its own, none inside another, with build.target-dir in its .cargo/config.toml.`
|
|
248
|
+
: `To cache them, ${rename}.`,
|
|
249
|
+
].join(" ");
|
|
250
|
+
}
|
|
251
|
+
// A folder relative to the repository root, `.` for the root itself, also
|
|
252
|
+
// where cargo reports it through the repository's real path; absolute
|
|
253
|
+
// outside the repository.
|
|
254
|
+
function repositoryFolder(folder, repositoryRoot) {
|
|
255
|
+
for (const root of [repositoryRoot, (0, real_path_1.realPath)(repositoryRoot)]) {
|
|
256
|
+
const path = (0, node_path_1.relative)(root, folder);
|
|
257
|
+
if (!path.startsWith("..") && !(0, node_path_1.isAbsolute)(path)) {
|
|
258
|
+
return path || ".";
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
return folder;
|
|
262
|
+
}
|
|
263
|
+
function add(map, key, value) {
|
|
264
|
+
var _a;
|
|
265
|
+
map.set(key, [...((_a = map.get(key)) !== null && _a !== void 0 ? _a : []), value]);
|
|
266
|
+
}
|
|
267
|
+
function list(items) {
|
|
268
|
+
var _a;
|
|
269
|
+
return items.length <= 1
|
|
270
|
+
? ((_a = items[0]) !== null && _a !== void 0 ? _a : "")
|
|
271
|
+
: `${items.slice(0, -1).join(", ")} and ${items[items.length - 1]}`;
|
|
272
|
+
}
|
|
273
|
+
function compare(a, b) {
|
|
274
|
+
return a < b ? -1 : a > b ? 1 : 0;
|
|
275
|
+
}
|
|
276
|
+
//# sourceMappingURL=artifact-names.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artifact-names.js","sourceRoot":"","sources":["../../../../nx-rust/src/graph/artifact-names.ts"],"names":[],"mappings":";;AA6DA,wCAmBC;AAQD,wCAEC;AAkCD,kDAqFC;AAMD,0CA0BC;AAjPD,yCAA0D;AAG1D,2CAAuC;AACvC,uCAAoD;AA2CpD;;;;;;;;;;;;;GAaG;AACH,SAAgB,cAAc,CAAC,GAAiB;IAC9C,OAAO,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAmB,EAAE;QACrD,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;YAChC,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;QACjE,CAAC;QACD,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,CAAC;QACvD,MAAM,SAAS,GAAoB,EAAE,CAAC;QACtC,IAAI,CAAC,QAAQ,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;YACjF,SAAS,CAAC,IAAI,CAAC;gBACb,IAAI,EAAE,GAAG,OAAO,KAAK;gBACrB,IAAI,EAAE,S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|
3
|
+
/**
|
|
4
|
+
* What the executor of `build` needs to name the dependency files that
|
|
5
|
+
* `cargo build -p <crate>` exports beside the crate's library and binaries,
|
|
6
|
+
* without asking cargo (`DES-BUILD-INPUT-CHECK`, points 1 and 2). Graph
|
|
7
|
+
* creation takes it from the `cargo metadata` report and puts it into the
|
|
8
|
+
* metadata of the crate's `build` target, which Nx keeps out of task hashes.
|
|
9
|
+
* Cargo's directories are not part of it: the executor asks cargo for them
|
|
10
|
+
* with the task's environment, which a dotenv file of the task can change.
|
|
11
|
+
*/
|
|
12
|
+
export interface BuildRecordSource {
|
|
13
|
+
/** The crate's library, if it has one. */
|
|
14
|
+
library?: {
|
|
15
|
+
/** The library's name as Cargo reports it. */
|
|
16
|
+
name: string;
|
|
17
|
+
/** Whether it is a proc macro, which cargo builds for the host whatever the triple. */
|
|
18
|
+
procMacro: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* The library's crate types, its `kind` in the report, such as `cdylib`
|
|
21
|
+
* and `rlib`; absent in a graph made before they were recorded, which
|
|
22
|
+
* names `lib<name>.d` for every triple.
|
|
23
|
+
*/
|
|
24
|
+
crateTypes?: string[];
|
|
25
|
+
};
|
|
26
|
+
/** The crate's binaries, with the features that each requires. */
|
|
27
|
+
binaries: {
|
|
28
|
+
name: string;
|
|
29
|
+
requiredFeatures: string[];
|
|
30
|
+
}[];
|
|
31
|
+
/** The crate's features, each with what it turns on, as the report lists them. */
|
|
32
|
+
features: Record<string, string[]>;
|
|
33
|
+
/**
|
|
34
|
+
* The names under which the crate lists its optional dependencies that
|
|
35
|
+
* no platform limits, sorted: a `<dependency>/<feature>` entry for one of
|
|
36
|
+
* them also turns on the crate's feature of the dependency's name.
|
|
37
|
+
*/
|
|
38
|
+
optionalDependencies?: string[];
|
|
39
|
+
/**
|
|
40
|
+
* The names of the crate's records that a target of another crate with
|
|
41
|
+
* the same artifact directory shares, such as `cli.d` for two binaries
|
|
42
|
+
* called `cli`. Cargo keeps one record for such a name, that of the crate
|
|
43
|
+
* it built last.
|
|
44
|
+
*/
|
|
45
|
+
shared: string[];
|
|
46
|
+
}
|
|
47
|
+
/** The name of the record that cargo exports for a library: `lib<name>.d`, with `-` as `_`. */
|
|
48
|
+
export declare function libraryRecordName(name: string): string;
|
|
49
|
+
/**
|
|
50
|
+
* The name of the record that cargo exports for a library's `cdylib` built
|
|
51
|
+
* for a triple whose dynamic libraries have no `lib` prefix, such as
|
|
52
|
+
* `wasm32-unknown-unknown`, where the library is `<name>.wasm`:
|
|
53
|
+
* `<name>.d`, with `-` as `_` (`EVD-WASM-POSTPROCESS`).
|
|
54
|
+
*/
|
|
55
|
+
export declare function unprefixedLibraryRecordName(name: string): string;
|
|
56
|
+
/** The name of the record that cargo exports for a binary: `<name>.d`. */
|
|
57
|
+
export declare function binaryRecordName(name: string): string;
|
|
58
|
+
/**
|
|
59
|
+
* The record names that targets of more than one crate with the same
|
|
60
|
+
* artifact directory give, for each workspace by its root folder
|
|
61
|
+
* (`DES-BUILD-INPUT-CHECK`, point 2, "A shared name"). Workspaces count as
|
|
62
|
+
* having the same artifact directory where `sharers` links them, also
|
|
63
|
+
* through a third, as for the files of `build` (`directoryGroups` in
|
|
64
|
+
* `artifact-names.ts`). Every member of every workspace counts, those
|
|
65
|
+
* without a project too.
|
|
66
|
+
*/
|
|
67
|
+
export declare function sharedRecordNames(workspaces: readonly ReportedWorkspace[], sharers: ReadonlyMap<ReportedWorkspace, readonly ReportedWorkspace[]>): Map<string, string[]>;
|
|
68
|
+
/**
|
|
69
|
+
* The {@link BuildRecordSource} of a crate.
|
|
70
|
+
*
|
|
71
|
+
* @param shared The record names that targets of several crates with the
|
|
72
|
+
* crate's artifact directory give ({@link sharedRecordNames}).
|
|
73
|
+
*/
|
|
74
|
+
export declare function buildRecordSource(pkg: CargoPackage, shared: readonly string[]): BuildRecordSource;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.libraryRecordName = libraryRecordName;
|
|
4
|
+
exports.unprefixedLibraryRecordName = unprefixedLibraryRecordName;
|
|
5
|
+
exports.binaryRecordName = binaryRecordName;
|
|
6
|
+
exports.sharedRecordNames = sharedRecordNames;
|
|
7
|
+
exports.buildRecordSource = buildRecordSource;
|
|
8
|
+
const artifact_names_1 = require("./artifact-names");
|
|
9
|
+
/** The `kind` values of a library target in the `cargo metadata` report. */
|
|
10
|
+
const libraryKinds = new Set(["lib", "rlib", "dylib", "cdylib", "staticlib", "proc-macro"]);
|
|
11
|
+
/** The name of the record that cargo exports for a library: `lib<name>.d`, with `-` as `_`. */
|
|
12
|
+
function libraryRecordName(name) {
|
|
13
|
+
return `lib${name.replace(/-/g, "_")}.d`;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* The name of the record that cargo exports for a library's `cdylib` built
|
|
17
|
+
* for a triple whose dynamic libraries have no `lib` prefix, such as
|
|
18
|
+
* `wasm32-unknown-unknown`, where the library is `<name>.wasm`:
|
|
19
|
+
* `<name>.d`, with `-` as `_` (`EVD-WASM-POSTPROCESS`).
|
|
20
|
+
*/
|
|
21
|
+
function unprefixedLibraryRecordName(name) {
|
|
22
|
+
return `${name.replace(/-/g, "_")}.d`;
|
|
23
|
+
}
|
|
24
|
+
/** The name of the record that cargo exports for a binary: `<name>.d`. */
|
|
25
|
+
function binaryRecordName(name) {
|
|
26
|
+
return `${name}.d`;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The record names that targets of more than one crate with the same
|
|
30
|
+
* artifact directory give, for each workspace by its root folder
|
|
31
|
+
* (`DES-BUILD-INPUT-CHECK`, point 2, "A shared name"). Workspaces count as
|
|
32
|
+
* having the same artifact directory where `sharers` links them, also
|
|
33
|
+
* through a third, as for the files of `build` (`directoryGroups` in
|
|
34
|
+
* `artifact-names.ts`). Every member of every workspace counts, those
|
|
35
|
+
* without a project too.
|
|
36
|
+
*/
|
|
37
|
+
// @mara implements DES-BUILD-INPUT-CHECK
|
|
38
|
+
function sharedRecordNames(workspaces, sharers) {
|
|
39
|
+
var _a;
|
|
40
|
+
const result = new Map();
|
|
41
|
+
for (const group of (0, artifact_names_1.directoryGroups)(workspaces, sharers)) {
|
|
42
|
+
const counts = new Map();
|
|
43
|
+
for (const workspace of group) {
|
|
44
|
+
for (const pkg of workspace.report.packages) {
|
|
45
|
+
for (const name of recordNames(pkg)) {
|
|
46
|
+
counts.set(name, ((_a = counts.get(name)) !== null && _a !== void 0 ? _a : 0) + 1);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
const shared = [...counts]
|
|
51
|
+
.filter(([, count]) => count > 1)
|
|
52
|
+
.map(([name]) => name)
|
|
53
|
+
.sort();
|
|
54
|
+
for (const workspace of group) {
|
|
55
|
+
result.set(workspace.root, shared);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return result;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* The {@link BuildRecordSource} of a crate.
|
|
62
|
+
*
|
|
63
|
+
* @param shared The record names that targets of several crates with the
|
|
64
|
+
* crate's artifact directory give ({@link sharedRecordNames}).
|
|
65
|
+
*/
|
|
66
|
+
// @mara implements DES-BUILD-INPUT-CHECK
|
|
67
|
+
function buildRecordSource(pkg, shared) {
|
|
68
|
+
var _a;
|
|
69
|
+
const library = pkg.targets.find(isLibrary);
|
|
70
|
+
const own = new Set(recordNames(pkg));
|
|
71
|
+
return Object.assign(Object.assign({}, (library === undefined
|
|
72
|
+
? {}
|
|
73
|
+
: {
|
|
74
|
+
library: {
|
|
75
|
+
name: library.name,
|
|
76
|
+
procMacro: library.kind.includes("proc-macro"),
|
|
77
|
+
crateTypes: [...library.kind],
|
|
78
|
+
},
|
|
79
|
+
})), { binaries: pkg.targets
|
|
80
|
+
.filter((target) => target.kind.includes("bin"))
|
|
81
|
+
.map((target) => {
|
|
82
|
+
var _a;
|
|
83
|
+
return ({
|
|
84
|
+
name: target.name,
|
|
85
|
+
requiredFeatures: [...((_a = target["required-features"]) !== null && _a !== void 0 ? _a : [])],
|
|
86
|
+
});
|
|
87
|
+
}), features: Object.fromEntries(Object.entries((_a = pkg.features) !== null && _a !== void 0 ? _a : {}).map(([name, enables]) => [name, [...enables]])), optionalDependencies: [
|
|
88
|
+
...new Set(pkg.dependencies
|
|
89
|
+
.filter((dependency) => dependency.optional === true && !dependency.target)
|
|
90
|
+
.map((dependency) => { var _a; return (_a = dependency.rename) !== null && _a !== void 0 ? _a : dependency.name; })),
|
|
91
|
+
].sort(), shared: shared.filter((name) => own.has(name)) });
|
|
92
|
+
}
|
|
93
|
+
// The names of the records that a package's library and binaries give.
|
|
94
|
+
function recordNames(pkg) {
|
|
95
|
+
return pkg.targets.flatMap((target) => isLibrary(target)
|
|
96
|
+
? [libraryRecordName(target.name)]
|
|
97
|
+
: target.kind.includes("bin")
|
|
98
|
+
? [binaryRecordName(target.name)]
|
|
99
|
+
: []);
|
|
100
|
+
}
|
|
101
|
+
function isLibrary(target) {
|
|
102
|
+
return target.kind.some((kind) => libraryKinds.has(kind));
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=build-records.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-records.js","sourceRoot":"","sources":["../../../../nx-rust/src/graph/build-records.ts"],"names":[],"mappings":";;AAkDA,8CAEC;AAQD,kEAEC;AAGD,4CAEC;AAYD,8CAuBC;AASD,8CA+BC;AA7ID,qDAAmD;AA6CnD,4EAA4E;AAC5E,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,YAAY,CAAC,CAAC,CAAC;AAE5F,+FAA+F;AAC/F,SAAgB,iBAAiB,CAAC,IAAY;IAC5C,OAAO,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC;AAC3C,CAAC;AAED;;;;;GAKG;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