@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,420 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NapiTaskError = void 0;
|
|
4
|
+
exports.prepareNapiTask = prepareNapiTask;
|
|
5
|
+
exports.runNapiGroup = runNapiGroup;
|
|
6
|
+
exports.reportedLibraries = reportedLibraries;
|
|
7
|
+
const tslib_1 = require("tslib");
|
|
8
|
+
const node_child_process_1 = require("node:child_process");
|
|
9
|
+
const node_crypto_1 = require("node:crypto");
|
|
10
|
+
const node_fs_1 = require("node:fs");
|
|
11
|
+
const node_path_1 = require("node:path");
|
|
12
|
+
const host_triple_1 = require("../cargo/host-triple");
|
|
13
|
+
const target_triples_1 = require("../cargo/target-triples");
|
|
14
|
+
const napi_1 = require("../graph/napi");
|
|
15
|
+
const napi_cli_1 = require("../tools/napi-cli");
|
|
16
|
+
const optional_tools_1 = require("../tools/optional-tools");
|
|
17
|
+
const cargo_invocation_1 = require("./cargo-invocation");
|
|
18
|
+
const cargo_output_1 = require("./cargo-output");
|
|
19
|
+
const group_run_1 = require("./group-run");
|
|
20
|
+
/** Thrown by {@link prepareNapiTask} with the message with which the task fails before cargo. */
|
|
21
|
+
class NapiTaskError extends Error {
|
|
22
|
+
constructor(message) {
|
|
23
|
+
super(message);
|
|
24
|
+
this.name = "NapiTaskError";
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.NapiTaskError = NapiTaskError;
|
|
28
|
+
/**
|
|
29
|
+
* The checks of a `napi-build` task before cargo runs (`DES-NAPI`, "What
|
|
30
|
+
* the step needs", "Library names"; `DES-DIAGNOSTICS`), in this order:
|
|
31
|
+
*
|
|
32
|
+
* - the crate's library has the file name of another crate's file, which
|
|
33
|
+
* graph creation records ({@link TargetCargoMetadata.sharedLibrary});
|
|
34
|
+
* - the crate's folder has no `package.json`, from which the napi CLI reads
|
|
35
|
+
* the crate's `napi` settings;
|
|
36
|
+
* - for a cached task, the settings' `dtsHeaderFile` lies outside the
|
|
37
|
+
* repository, where Nx cannot hash it, or is not the one that the graph's
|
|
38
|
+
* inputs hold;
|
|
39
|
+
* - Node resolves no `@napi-rs/cli` from the crate's folder, or one of
|
|
40
|
+
* another major than 3 or older than 3.4.0 (`ADR-NAPI-RS-3`);
|
|
41
|
+
* - `rustc -vV` names no host triple in the workspace root, or Cargo's
|
|
42
|
+
* configuration or `CARGO_BUILD_TARGET` picks another triple there:
|
|
43
|
+
* `napi-build` builds for the host only (`ADR-V1-SCOPE`);
|
|
44
|
+
* - the installed CLI names the addon's file otherwise than the outputs that
|
|
45
|
+
* graph creation declared, where the target is cached.
|
|
46
|
+
*
|
|
47
|
+
* @param crateFolder The absolute path of the crate's folder.
|
|
48
|
+
* @param cwd The absolute path of the workspace root, where cargo runs.
|
|
49
|
+
* @param cached Whether Nx caches the task, so that its outputs must name the addon.
|
|
50
|
+
* @throws {NapiTaskError} With the message of the first check that fails.
|
|
51
|
+
*/
|
|
52
|
+
// @mara implements DES-NAPI
|
|
53
|
+
// @mara implements DES-DIAGNOSTICS
|
|
54
|
+
function prepareNapiTask(task, crate, metadata, crateFolder, cwd, env, cached, repositoryRoot = cwd) {
|
|
55
|
+
var _a, _b;
|
|
56
|
+
if (metadata.sharedLibrary !== undefined) {
|
|
57
|
+
throw new NapiTaskError(`${task}: the library of ${crate} has the file name of another crate's library: ${metadata.sharedLibrary}. Cargo builds one file for crates whose libraries share a file name, so that the addon could hold the other crate's functions. The task does not run, so that Nx stores no result for it. Give the crates different [lib] names in their Cargo.toml.`);
|
|
58
|
+
}
|
|
59
|
+
if (!(0, node_fs_1.existsSync)((0, node_path_1.join)(crateFolder, "package.json"))) {
|
|
60
|
+
throw new NapiTaskError(`${task}: the folder of ${crate} has no package.json, from which @napi-rs/cli reads the addon's napi settings, its binaryName among them, as napi build does. Add one, as the napi-rs templates have it, with the package's name and version.`);
|
|
61
|
+
}
|
|
62
|
+
// The header of the type definitions, which the key holds only where it
|
|
63
|
+
// lies inside the repository and the graph names it as the settings do now.
|
|
64
|
+
const header = (0, napi_1.napiHeaderFile)(crateFolder, repositoryRoot);
|
|
65
|
+
if (cached && header !== undefined && (0, node_path_1.isAbsolute)(header)) {
|
|
66
|
+
throw new NapiTaskError(`${task}: the napi settings in the package.json of ${crate} name the dtsHeaderFile ${header}, which lies outside the repository, so that Nx cannot hash it and could restore index.d.ts with an older header. The task does not run, so that Nx stores no result for it. Move the header file into the repository, or write the header into dtsHeader.`);
|
|
67
|
+
}
|
|
68
|
+
if (cached && header !== metadata.napiHeaderFile) {
|
|
69
|
+
throw new NapiTaskError(`${task}: the napi settings in the package.json of ${crate} name the dtsHeaderFile ${header !== null && header !== void 0 ? header : "none"}, but the inputs of the cached napi-build hold ${(_a = metadata.napiHeaderFile) !== null && _a !== void 0 ? _a : "none"}, so that its key could miss the header of index.d.ts. The task does not run, so that Nx stores no result for it. Run \`nx reset\` so that Nx creates the project graph again.`);
|
|
70
|
+
}
|
|
71
|
+
const cli = (0, napi_cli_1.installedNapiCli)(crateFolder);
|
|
72
|
+
if (cli === undefined) {
|
|
73
|
+
const tool = optional_tools_1.optionalTools.find((candidate) => candidate.id === "napi");
|
|
74
|
+
throw new NapiTaskError(`${task}: ${tool === undefined ? "@napi-rs/cli is not installed." : (0, optional_tools_1.missingToolMessage)(tool, [`the napi-build target of the crate ${crate}`])}`);
|
|
75
|
+
}
|
|
76
|
+
if (!(0, napi_cli_1.supportedNapiCli)(cli.version)) {
|
|
77
|
+
throw new NapiTaskError(`${task}: the installed @napi-rs/cli is ${cli.version}, but napi-build post-processes Node addons with @napi-rs/cli 3, from 3.4.0, the first release that exports every function it calls. Install @napi-rs/cli 3.4.0 or a later 3.x release.`);
|
|
78
|
+
}
|
|
79
|
+
const host = (0, host_triple_1.hostTriple)(cwd, env);
|
|
80
|
+
if (host === undefined) {
|
|
81
|
+
throw new NapiTaskError(`${task}: \`rustc -vV\` names no host triple in the workspace root, and napi-build builds the addon for the host. Make sure that the toolchain that the workspace root selects is installed.`);
|
|
82
|
+
}
|
|
83
|
+
const picked = (0, target_triples_1.pickedTriples)(cwd, env);
|
|
84
|
+
if (picked.kind === "unnamed" ||
|
|
85
|
+
(picked.kind === "triples" && picked.triples.some((triple) => triple !== host))) {
|
|
86
|
+
throw new NapiTaskError(`${task}: napi-build builds Node addons for the host, ${host}, only, but Cargo's configuration or CARGO_BUILD_TARGET picks ${(0, target_triples_1.describeTriples)(picked)} in the workspace root. Cross-compiling Node addons is not part of @convesoft/nx-rust 1; remove the setting for the workspace, or build the addon for other platforms with napi build outside Nx.`);
|
|
87
|
+
}
|
|
88
|
+
let platform;
|
|
89
|
+
try {
|
|
90
|
+
platform = (0, napi_cli_1.loadNapiCli)(cli).parseTriple(host).platformArchABI;
|
|
91
|
+
}
|
|
92
|
+
catch (error) {
|
|
93
|
+
throw new NapiTaskError(`${task}: @convesoft/nx-rust cannot load @napi-rs/cli ${cli.version} from ${cli.manifest}: ${error instanceof Error ? error.message : String(error)}.`);
|
|
94
|
+
}
|
|
95
|
+
const addon = `${(0, napi_1.napiBinaryName)(crateFolder)}.${platform}.node`;
|
|
96
|
+
if (cached && metadata.napiAddon !== addon) {
|
|
97
|
+
throw new NapiTaskError(`${task}: the installed @napi-rs/cli names the addon ${addon}, but the outputs of the cached napi-build name ${(_b = metadata.napiAddon) !== null && _b !== void 0 ? _b : "no addon"}, so that Nx would not store the addon. The task does not run, so that Nx stores no result for it. Run \`nx reset\` so that Nx creates the project graph again.`);
|
|
98
|
+
}
|
|
99
|
+
return { crateFolder, cli, host, addon };
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Runs a group of `napi-build` tasks (`DES-NAPI`): asks `cargo tree` for the
|
|
103
|
+
* crates that the group's command compiles for each addon through normal
|
|
104
|
+
* dependencies, with the group's selection and feature flags; fails the
|
|
105
|
+
* tasks whose closure holds a crate that depends on `napi-derive` of
|
|
106
|
+
* another major than 3; empties the type-definition folder of the group's
|
|
107
|
+
* configuration in Cargo's build directory; runs the group's compile with
|
|
108
|
+
* `NAPI_TYPE_DEF_TMP_FOLDER` set to that folder and `NAPI_FORCE_BUILD_<CRATE>`
|
|
109
|
+
* set to a value of this compile's own for every crate of the closures that
|
|
110
|
+
* depends on `napi-derive` ({@link runGroup}, which runs the checks after
|
|
111
|
+
* cargo of `build`); then, for each task whose crate passed, checks that
|
|
112
|
+
* every crate of its closure that the compile forced wrote its file, and
|
|
113
|
+
* post-processes the library into the addon, its JS loader and its type
|
|
114
|
+
* definitions with the functions of the installed `@napi-rs/cli`.
|
|
115
|
+
*
|
|
116
|
+
* Only this step sets those variables; `build`, `test`, `check` and `lint`
|
|
117
|
+
* run without them, as plain cargo does (`REQ-CARGO-UNCHANGED`,
|
|
118
|
+
* `ADR-NAPI-SHARED-BUILD-DIR`).
|
|
119
|
+
*
|
|
120
|
+
* @returns One result per member, in order.
|
|
121
|
+
*/
|
|
122
|
+
// @mara implements DES-NAPI
|
|
123
|
+
// @mara implements DES-ARTIFACT-STEPS
|
|
124
|
+
function runNapiGroup(members_1) {
|
|
125
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* (members, verbose = false, live = "none") {
|
|
126
|
+
var _a, _b, _c, _d, _e;
|
|
127
|
+
const [first] = members;
|
|
128
|
+
if (first === undefined) {
|
|
129
|
+
return [];
|
|
130
|
+
}
|
|
131
|
+
const { cwd } = first.invocation;
|
|
132
|
+
const env = first.prepared.env;
|
|
133
|
+
const results = members.map(() => undefined);
|
|
134
|
+
const directories = first.invocation.directories;
|
|
135
|
+
if (directories === undefined) {
|
|
136
|
+
return members.map((member) => ({
|
|
137
|
+
success: false,
|
|
138
|
+
output: `${member.prepared.task}: @convesoft/nx-rust has no report of Cargo's directories for this napi-build group.`,
|
|
139
|
+
}));
|
|
140
|
+
}
|
|
141
|
+
// The compile's arguments without a stage's flags, which change on every
|
|
142
|
+
// run and are no part of the configuration (`DES-BATCH`, "Staged builds").
|
|
143
|
+
const compile = (_a = first.invocation.unstagedArgs) !== null && _a !== void 0 ? _a : first.invocation.args;
|
|
144
|
+
const tree = cargoTree(compile, cwd, (0, cargo_invocation_1.cargoEnvironment)(first.invocation, env));
|
|
145
|
+
if (typeof tree === "string") {
|
|
146
|
+
return members.map((member) => ({
|
|
147
|
+
success: false,
|
|
148
|
+
output: `${member.prepared.task}: @convesoft/nx-rust could not ask cargo tree for the crates that the addon depends on, so it cannot tell which of them write type definitions. The task does not run, so that Nx stores no result for it.\n${tree}`,
|
|
149
|
+
}));
|
|
150
|
+
}
|
|
151
|
+
// Each task's closure and the crates of it that use napi-derive.
|
|
152
|
+
const closures = members.map((member) => {
|
|
153
|
+
const root = [...tree.roots].find((key) => { var _a; return ((_a = tree.nodes.get(key)) === null || _a === void 0 ? void 0 : _a.name) === member.prepared.crate; });
|
|
154
|
+
return root === undefined ? undefined : closure(tree.nodes, root);
|
|
155
|
+
});
|
|
156
|
+
// The hack crate of cargo-hakari can depend on napi-derive only to unify
|
|
157
|
+
// its features, and has no #[napi] item (`DES-NAPI`).
|
|
158
|
+
const napiCrates = closures.map((keys) => (keys !== null && keys !== void 0 ? keys : [])
|
|
159
|
+
.map((key) => tree.nodes.get(key))
|
|
160
|
+
.filter((node) => node.name !== first.prepared.hakariPackage &&
|
|
161
|
+
[...node.children].some((child) => { var _a; return ((_a = tree.nodes.get(child)) === null || _a === void 0 ? void 0 : _a.name) === "napi-derive"; })));
|
|
162
|
+
members.forEach((member, index) => {
|
|
163
|
+
var _a;
|
|
164
|
+
const keys = closures[index];
|
|
165
|
+
if (keys === undefined) {
|
|
166
|
+
results[index] = {
|
|
167
|
+
success: false,
|
|
168
|
+
output: `${member.prepared.task}: cargo tree does not list ${(_a = member.prepared.crate) !== null && _a !== void 0 ? _a : "the crate"} among the crates of this napi-build group, so @convesoft/nx-rust cannot tell which crates write its type definitions. The task does not run, so that Nx stores no result for it.`,
|
|
169
|
+
};
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
const other = napiCrates[index].flatMap((node) => [...node.children]
|
|
173
|
+
.map((child) => tree.nodes.get(child))
|
|
174
|
+
.filter((child) => child.name === "napi-derive" && !child.version.startsWith("v3."))
|
|
175
|
+
.map((child) => `${node.name} depends on napi-derive ${child.version.slice(1)}`));
|
|
176
|
+
if (other.length > 0) {
|
|
177
|
+
results[index] = {
|
|
178
|
+
success: false,
|
|
179
|
+
output: `${member.prepared.task}: ${(0, cargo_output_1.describeList)(other)}, but napi-build builds Node addons of napi-rs 3, whose crates use napi-derive 3. The task does not run, so that Nx stores no result for it. Upgrade the crates to napi-derive 3 and napi 3.`,
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
const running = members.flatMap((member, index) => results[index] === undefined ? [{ member, index }] : []);
|
|
184
|
+
if (running.length > 0) {
|
|
185
|
+
const configuration = (0, node_path_1.join)(directories.build, "nx-rust", "napi", (0, node_crypto_1.createHash)("sha256")
|
|
186
|
+
.update(JSON.stringify([cwd, compile]))
|
|
187
|
+
.digest("hex")
|
|
188
|
+
.slice(0, 16));
|
|
189
|
+
const types = (0, node_path_1.join)(configuration, "types");
|
|
190
|
+
(0, node_fs_1.rmSync)(types, { recursive: true, force: true });
|
|
191
|
+
(0, node_fs_1.mkdirSync)(types, { recursive: true });
|
|
192
|
+
const forced = new Set(running.flatMap(({ index }) => napiCrates[index].map((node) => node.name)));
|
|
193
|
+
const value = (0, node_crypto_1.randomUUID)();
|
|
194
|
+
const variables = { NAPI_TYPE_DEF_TMP_FOLDER: types };
|
|
195
|
+
for (const name of forced) {
|
|
196
|
+
variables[`NAPI_FORCE_BUILD_${name.toUpperCase().replace(/-/g, "_")}`] = value;
|
|
197
|
+
}
|
|
198
|
+
// The compile's output, whose JSON messages report the libraries.
|
|
199
|
+
let compileOutput = "";
|
|
200
|
+
const compiled = yield (0, group_run_1.runGroup)(running.map(({ member }) => (Object.assign(Object.assign({}, member), { invocation: Object.assign(Object.assign({}, member.invocation), { env: Object.assign(Object.assign({}, member.invocation.env), variables) }) }))), verbose, live, (_step, output) => {
|
|
201
|
+
compileOutput = output;
|
|
202
|
+
});
|
|
203
|
+
const libraries = reportedLibraries(compileOutput);
|
|
204
|
+
for (const [at, { member, index }] of running.entries()) {
|
|
205
|
+
const result = compiled[at];
|
|
206
|
+
if (!result.success) {
|
|
207
|
+
results[index] = result;
|
|
208
|
+
continue;
|
|
209
|
+
}
|
|
210
|
+
const missing = napiCrates[index]
|
|
211
|
+
.map((node) => node.name)
|
|
212
|
+
.filter((name) => !(0, node_fs_1.existsSync)((0, node_path_1.join)(types, name)));
|
|
213
|
+
if (missing.length > 0) {
|
|
214
|
+
results[index] = {
|
|
215
|
+
success: false,
|
|
216
|
+
output: [
|
|
217
|
+
...(result.output === "" ? [] : [result.output]),
|
|
218
|
+
missingTypesMessage(member.prepared.task, missing),
|
|
219
|
+
].join("\n"),
|
|
220
|
+
};
|
|
221
|
+
continue;
|
|
222
|
+
}
|
|
223
|
+
const written = yield postProcess(member, (_d = libraries.get((_c = (_b = member.invocation.package) === null || _b === void 0 ? void 0 : _b.id) !== null && _c !== void 0 ? _c : "")) !== null && _d !== void 0 ? _d : [], types, (0, node_path_1.join)(configuration, "tasks", (_e = member.prepared.crate) !== null && _e !== void 0 ? _e : ""), napiCrates[index].map((node) => node.name));
|
|
224
|
+
results[index] = {
|
|
225
|
+
success: written.success,
|
|
226
|
+
output: [...(result.output === "" ? [] : [result.output]), written.output].join("\n"),
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
return results;
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* The message with which a `napi-build` task fails where crates that the
|
|
235
|
+
* compile forced wrote no type information (`DES-NAPI`, "Every file
|
|
236
|
+
* written"; `DES-DIAGNOSTICS`).
|
|
237
|
+
*/
|
|
238
|
+
// @mara implements DES-DIAGNOSTICS
|
|
239
|
+
function missingTypesMessage(task, crates) {
|
|
240
|
+
const named = (0, cargo_output_1.describeList)(crates);
|
|
241
|
+
const one = crates.length === 1;
|
|
242
|
+
return `${task}: ${named}, which the addon is or depends on, ${one ? "uses" : "use"} napi-derive but wrote no type information while napi-build compiled ${one ? "it" : "them"}, so napi-build cannot tell which of ${one ? "its" : "their"} #[napi] items the addon has. Either the build script of ${named} does not run napi_build::setup(), which alone lets napi-build compile ${one ? "it" : "them"} again, or ${one ? "it has" : "they have"} no #[napi] item left and should drop ${one ? "its" : "their"} dependency on napi-derive. The task does not run, so that Nx stores no result for it.`;
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* The crates of the group's compile by `cargo tree`, with the compile's
|
|
246
|
+
* selection (`--workspace`, or `-p` for each crate under `hakari`, under
|
|
247
|
+
* `cargo` and for a group of one crate), feature flags, the `--config` and
|
|
248
|
+
* `-Z` flags of the `cargo` strategy and `--locked`, through normal
|
|
249
|
+
* dependencies on the host, so that the closure is the one that cargo builds
|
|
250
|
+
* (`DES-NAPI`, "Every napi crate forced"); or cargo's error.
|
|
251
|
+
*/
|
|
252
|
+
function cargoTree(compile, cwd, env) {
|
|
253
|
+
var _a, _b, _c, _d;
|
|
254
|
+
const args = ["tree", "-e", "normal", "--prefix", "depth", "-f", "{p}"];
|
|
255
|
+
for (let at = 0; at < compile.length; at++) {
|
|
256
|
+
const word = compile[at];
|
|
257
|
+
if (word === "-p" || word === "--features" || word === "--config") {
|
|
258
|
+
// `--config` carries the `cargo` strategy's feature unification.
|
|
259
|
+
args.push(word, compile[at + 1]);
|
|
260
|
+
at++;
|
|
261
|
+
}
|
|
262
|
+
else if (word.startsWith("-Z") ||
|
|
263
|
+
word === "--workspace" ||
|
|
264
|
+
word === "--all-features" ||
|
|
265
|
+
word === "--no-default-features" ||
|
|
266
|
+
word === "--locked") {
|
|
267
|
+
args.push(word);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
const run = (0, node_child_process_1.spawnSync)("cargo", args, {
|
|
271
|
+
cwd,
|
|
272
|
+
env,
|
|
273
|
+
encoding: "utf8",
|
|
274
|
+
maxBuffer: 256 * 1024 * 1024,
|
|
275
|
+
});
|
|
276
|
+
if (run.status !== 0) {
|
|
277
|
+
return `cargo ${args.join(" ")} failed: ${((_a = run.stderr) !== null && _a !== void 0 ? _a : "").trim() || ((_c = (_b = run.error) === null || _b === void 0 ? void 0 : _b.message) !== null && _c !== void 0 ? _c : `status ${run.status}`)}`;
|
|
278
|
+
}
|
|
279
|
+
const nodes = new Map();
|
|
280
|
+
const roots = new Set();
|
|
281
|
+
const stack = [];
|
|
282
|
+
for (const line of run.stdout.split("\n")) {
|
|
283
|
+
const match = /^(\d+)(\S+) (v\S+)(.*)$/.exec(line);
|
|
284
|
+
if (match === null) {
|
|
285
|
+
continue;
|
|
286
|
+
}
|
|
287
|
+
const depth = Number(match[1]);
|
|
288
|
+
const key = `${match[2]} ${match[3]}${match[4].replace(/ \(\*\)$/, "").replace(/ \(proc-macro\)/, "")}`;
|
|
289
|
+
if (!nodes.has(key)) {
|
|
290
|
+
nodes.set(key, { name: match[2], version: match[3], children: new Set() });
|
|
291
|
+
}
|
|
292
|
+
stack[depth] = key;
|
|
293
|
+
stack.length = depth + 1;
|
|
294
|
+
if (depth === 0) {
|
|
295
|
+
roots.add(key);
|
|
296
|
+
}
|
|
297
|
+
else {
|
|
298
|
+
(_d = nodes.get(stack[depth - 1])) === null || _d === void 0 ? void 0 : _d.children.add(key);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
return { nodes, roots };
|
|
302
|
+
}
|
|
303
|
+
// Every crate that `root` reaches, itself included, each once.
|
|
304
|
+
function closure(nodes, root) {
|
|
305
|
+
var _a, _b;
|
|
306
|
+
const seen = new Set([root]);
|
|
307
|
+
const queue = [root];
|
|
308
|
+
while (queue.length > 0) {
|
|
309
|
+
const key = queue.shift();
|
|
310
|
+
for (const child of (_b = (_a = nodes.get(key)) === null || _a === void 0 ? void 0 : _a.children) !== null && _b !== void 0 ? _b : []) {
|
|
311
|
+
if (!seen.has(child)) {
|
|
312
|
+
seen.add(child);
|
|
313
|
+
queue.push(child);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
return [...seen];
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* The dynamic libraries that cargo's JSON messages report for each package's
|
|
321
|
+
* `cdylib` target, by the package's ID ({@link reportedCdylibFiles}): the
|
|
322
|
+
* files with the extension of a dynamic library, `.so`, `.dylib` or `.dll`.
|
|
323
|
+
* Cargo reports the file where it puts it, in the folder of a triple where
|
|
324
|
+
* one is selected, also the host's (`DES-NAPI`).
|
|
325
|
+
*/
|
|
326
|
+
function reportedLibraries(output) {
|
|
327
|
+
return (0, cargo_output_1.reportedCdylibFiles)(output, /\.(so|dylib|dll)$/);
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Writes a task's outputs into the crate's folder, as `napi build
|
|
331
|
+
* --platform` writes them (`DES-NAPI`, "Post-processing"): removes the
|
|
332
|
+
* three outputs of an earlier run, copies the library that cargo reported
|
|
333
|
+
* for the crate's `cdylib` in this compile ({@link reportedLibraries}) to the
|
|
334
|
+
* addon's file, failing where it reported none or several, and writes `index.d.ts` and `index.js` with
|
|
335
|
+
* `generateTypeDef` and `writeJsBinding` of the installed `@napi-rs/cli`,
|
|
336
|
+
* with the crate's `napi` settings that `readNapiConfig` reads, from a
|
|
337
|
+
* folder of the task's own that holds only the type information of the
|
|
338
|
+
* crate and of the crates of its closure that use napi-derive.
|
|
339
|
+
*/
|
|
340
|
+
// @mara implements DES-NAPI
|
|
341
|
+
function postProcess(member, reported, types, folder, crates) {
|
|
342
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
343
|
+
var _a, _b, _c, _d, _e;
|
|
344
|
+
const { prepared, invocation } = member;
|
|
345
|
+
const napi = prepared.napi;
|
|
346
|
+
const task = prepared.task;
|
|
347
|
+
const fail = (message) => ({
|
|
348
|
+
success: false,
|
|
349
|
+
output: `${task}: ${message} The task does not run, so that Nx stores no result for it.`,
|
|
350
|
+
});
|
|
351
|
+
try {
|
|
352
|
+
const cli = (0, napi_cli_1.loadNapiCli)(napi.cli);
|
|
353
|
+
const config = yield cli.readNapiConfig((0, node_path_1.join)(napi.crateFolder, "package.json"));
|
|
354
|
+
const addon = `${config.binaryName}.${cli.parseTriple(napi.host).platformArchABI}.node`;
|
|
355
|
+
if (addon !== napi.addon) {
|
|
356
|
+
return fail(`@napi-rs/cli names the addon ${addon}, but napi-build expected ${napi.addon} from the crate's package.json.`);
|
|
357
|
+
}
|
|
358
|
+
for (const file of [napi.addon, napi_1.napiLoaderFile, napi_1.napiTypesFile]) {
|
|
359
|
+
(0, node_fs_1.rmSync)((0, node_path_1.join)(napi.crateFolder, file), { force: true });
|
|
360
|
+
}
|
|
361
|
+
(0, node_fs_1.rmSync)(folder, { recursive: true, force: true });
|
|
362
|
+
(0, node_fs_1.mkdirSync)(folder, { recursive: true });
|
|
363
|
+
for (const crate of crates) {
|
|
364
|
+
(0, node_fs_1.copyFileSync)((0, node_path_1.join)(types, crate), (0, node_path_1.join)(folder, crate));
|
|
365
|
+
}
|
|
366
|
+
// The file that cargo reports for the crate's cdylib in this compile,
|
|
367
|
+
// wherever the triple and profile put it.
|
|
368
|
+
if (reported.length !== 1) {
|
|
369
|
+
return fail(reported.length === 0
|
|
370
|
+
? `cargo reported no cdylib library of ${(_a = prepared.crate) !== null && _a !== void 0 ? _a : "the crate"} in this compile, so napi-build has no library to copy to the addon. Give the crate's [lib] table crate-type = ["cdylib"].`
|
|
371
|
+
: `cargo reported ${reported.length} cdylib libraries of ${(_b = prepared.crate) !== null && _b !== void 0 ? _b : "the crate"} in this compile, ${reported.map((file) => (0, node_path_1.relative)(invocation.cwd, file)).join(" and ")}, so napi-build cannot tell which one is the addon.`);
|
|
372
|
+
}
|
|
373
|
+
(0, node_fs_1.copyFileSync)(reported[0], (0, node_path_1.join)(napi.crateFolder, napi.addon));
|
|
374
|
+
const typeDef = ((_d = (_c = invocation.package) === null || _c === void 0 ? void 0 : _c.dependencies) !== null && _d !== void 0 ? _d : []).some((dependency) => {
|
|
375
|
+
var _a;
|
|
376
|
+
return dependency.name === "napi-derive" &&
|
|
377
|
+
(dependency.uses_default_features !== false ||
|
|
378
|
+
((_a = dependency.features) !== null && _a !== void 0 ? _a : []).includes("type-def"));
|
|
379
|
+
});
|
|
380
|
+
// As `napi build` orders the WASI flavours of the crate's targets:
|
|
381
|
+
// the threaded one first.
|
|
382
|
+
const wasi = config.targets.filter((target) => target.platform === "wasi");
|
|
383
|
+
const wasiFlavors = [
|
|
384
|
+
...new Set([
|
|
385
|
+
...wasi.filter((target) => target.triple === "wasm32-wasip1-threads"),
|
|
386
|
+
...wasi.filter((target) => target.triple !== "wasm32-wasip1-threads"),
|
|
387
|
+
].map((target) => target.platformArchABI)),
|
|
388
|
+
];
|
|
389
|
+
let exports = [];
|
|
390
|
+
if (typeDef) {
|
|
391
|
+
const generated = yield cli.generateTypeDef({
|
|
392
|
+
typeDefDir: folder,
|
|
393
|
+
configDtsHeader: config.dtsHeader,
|
|
394
|
+
configDtsHeaderFile: config.dtsHeaderFile,
|
|
395
|
+
constEnum: config.constEnum,
|
|
396
|
+
runtimeStringEnum: config.runtimeStringEnum,
|
|
397
|
+
cwd: napi.crateFolder,
|
|
398
|
+
declareBindingTarget: (names) => wasiFlavors.length > 0 || names.length > 0,
|
|
399
|
+
});
|
|
400
|
+
(0, node_fs_1.writeFileSync)((0, node_path_1.join)(napi.crateFolder, napi_1.napiTypesFile), generated.dts, "utf8");
|
|
401
|
+
exports = generated.exports;
|
|
402
|
+
}
|
|
403
|
+
yield cli.writeJsBinding({
|
|
404
|
+
platform: true,
|
|
405
|
+
idents: exports,
|
|
406
|
+
binaryName: config.binaryName,
|
|
407
|
+
packageName: config.packageName,
|
|
408
|
+
version: (_e = prepared.env.npm_new_version) !== null && _e !== void 0 ? _e : config.packageJson.version,
|
|
409
|
+
outputDir: napi.crateFolder,
|
|
410
|
+
wasiFlavors,
|
|
411
|
+
});
|
|
412
|
+
const written = [napi.addon, napi_1.napiLoaderFile, napi_1.napiTypesFile].filter((name) => (0, node_fs_1.existsSync)((0, node_path_1.join)(napi.crateFolder, name)));
|
|
413
|
+
return { success: true, output: `${task}: wrote ${(0, cargo_output_1.describeList)(written)}.` };
|
|
414
|
+
}
|
|
415
|
+
catch (error) {
|
|
416
|
+
return fail(`@napi-rs/cli ${napi.cli.version} could not write the addon's files: ${error instanceof Error ? error.message : String(error)}.`);
|
|
417
|
+
}
|
|
418
|
+
});
|
|
419
|
+
}
|
|
420
|
+
//# sourceMappingURL=napi-build.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"napi-build.js","sourceRoot":"","sources":["../../../../nx-rust/src/executors/napi-build.ts"],"names":[],"mappings":";;;AAiEA,0CA2EC;AAgCD,oCA0IC;AAoGD,8CAEC;;AA5ZD,2DAA+C;AAC/C,6CAAqD;AACrD,qCAAqF;AACrF,yCAAuD;AACvD,sDAAkD;AAClD,4DAAyE;AACzE,wCAA8F;AAE9F,gDAK2B;AAC3B,4DAA4E;AAC5E,yDAAsD;AACtD,iDAAmE;AACnE,2CAA6F;AAc7F,i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IAAI,CAAC,KAAK,EAAE,qBAAc,EAAE,oBAAa,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAC1E,IAAA,oBAAU,EAAC,IAAA,gBAAI,EAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC,CACzC,CAAC;YACF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,WAAW,IAAA,2BAAY,EAAC,OAAO,CAAC,GAAG,EAAE,CAAC;QAC/E,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,IAAI,CACT,gBAAgB,IAAI,CAAC,GAAG,CAAC,OAAO,uCAAuC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CACjI,CAAC;QACJ,CAAC;IACH,CAAC;CAAA"}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { type CrateOutcome, type OutputCrate, type OutputScope } from "./cargo-output";
|
|
2
|
+
/**
|
|
3
|
+
* How `cargo nextest run` ended, as the reading of its step trusts it
|
|
4
|
+
* (`DES-TEST-RUN`, step 4): with 0, which nextest gives only where every
|
|
5
|
+
* test that the run was to run finished and passed; with 100, which it
|
|
6
|
+
* gives where a test failed and where the run ended before every test had
|
|
7
|
+
* run, as on a global timeout, a signal or an interrupt; with 101, where
|
|
8
|
+
* the build of the test binaries failed; with 105, where a setup script
|
|
9
|
+
* failed; or otherwise, as by a signal, with another status or without
|
|
10
|
+
* starting at all (`EVD-NEXTEST-RUNNER-STEPS`).
|
|
11
|
+
*/
|
|
12
|
+
export type NextestEnd = {
|
|
13
|
+
kind: "succeeded";
|
|
14
|
+
} | {
|
|
15
|
+
kind: "tests-failed";
|
|
16
|
+
} | {
|
|
17
|
+
kind: "build-failed";
|
|
18
|
+
} | {
|
|
19
|
+
kind: "setup-failed";
|
|
20
|
+
} | {
|
|
21
|
+
kind: "unexplained";
|
|
22
|
+
reason: string;
|
|
23
|
+
};
|
|
24
|
+
/** The status with which nextest ends where a test failed or the run ended early. */
|
|
25
|
+
export declare const testRunFailedStatus = 100;
|
|
26
|
+
/** The status with which nextest ends where the build of the test binaries failed. */
|
|
27
|
+
export declare const buildFailedStatus = 101;
|
|
28
|
+
/** The status with which nextest ends where a setup script failed. */
|
|
29
|
+
export declare const setupScriptFailedStatus = 105;
|
|
30
|
+
/** How a nextest step ended ({@link NextestEnd}), from its exit status and signal, or why it did not start. */
|
|
31
|
+
export declare function nextestEnd(code: number | null, signal: string | null, failure?: string): NextestEnd;
|
|
32
|
+
/** The plugin's tool configuration for one nextest step, in a folder of its own. */
|
|
33
|
+
export interface NextestToolConfiguration {
|
|
34
|
+
/** The folder, which {@link removeToolConfiguration} removes after the step. */
|
|
35
|
+
folder: string;
|
|
36
|
+
/** The configuration file, which nextest takes as `--tool-config-file nx-rust:<file>`. */
|
|
37
|
+
file: string;
|
|
38
|
+
/** The JUnit report that the file asks nextest to write. */
|
|
39
|
+
report: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Writes the plugin's tool configuration for one nextest step into a new
|
|
43
|
+
* folder under the system's temporary folder (`DES-TEST-RUN`, "nextest's
|
|
44
|
+
* configuration"): it sets only `junit.path` of the `default` profile, to an
|
|
45
|
+
* absolute path in that folder, which every profile inherits unless it sets
|
|
46
|
+
* its own. nextest gives the repository's configuration precedence over a
|
|
47
|
+
* tool configuration, so that the file adds the report and changes no test
|
|
48
|
+
* that runs (`EVD-TEST-STREAM-AND-NEXTEST`). No other task's files are
|
|
49
|
+
* written: the folder is the step's own.
|
|
50
|
+
*/
|
|
51
|
+
export declare function writeToolConfiguration(): NextestToolConfiguration;
|
|
52
|
+
/** Removes the folder of a tool configuration and the report in it. */
|
|
53
|
+
export declare function removeToolConfiguration(configuration: NextestToolConfiguration): void;
|
|
54
|
+
/** One test of nextest's JUnit report. */
|
|
55
|
+
export interface JunitCase {
|
|
56
|
+
/** The test binary's ID, such as `a`, `a::it` or `a::bin/a`: the name of its suite. */
|
|
57
|
+
binary: string;
|
|
58
|
+
/** The test's name. */
|
|
59
|
+
name: string;
|
|
60
|
+
/** Whether the test failed: a `failure` or `error` element, not a flaky try that passed in the end. */
|
|
61
|
+
failed: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Whether the test did not run: a `skipped` element, which nextest writes
|
|
64
|
+
* for a test that a filter left out where the configuration's
|
|
65
|
+
* `junit.report-skipped` asks for it.
|
|
66
|
+
*/
|
|
67
|
+
skipped: boolean;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* What the plugin read of nextest's JUnit report: its tests, or that the
|
|
71
|
+
* file is missing, or why it cannot be read.
|
|
72
|
+
*/
|
|
73
|
+
export type JunitReport = {
|
|
74
|
+
cases: JunitCase[];
|
|
75
|
+
} | {
|
|
76
|
+
missing: string;
|
|
77
|
+
} | {
|
|
78
|
+
unreadable: string;
|
|
79
|
+
file: string;
|
|
80
|
+
};
|
|
81
|
+
/** Reads nextest's JUnit report at `file` ({@link JunitReport}). */
|
|
82
|
+
export declare function readJunitReport(file: string): JunitReport;
|
|
83
|
+
/**
|
|
84
|
+
* The tests of a JUnit report as nextest writes it: `testsuites`, one
|
|
85
|
+
* `testsuite` per test binary named by its binary ID, and in it one
|
|
86
|
+
* `testcase` per test that ran, which failed where it has a `failure` or
|
|
87
|
+
* `error` element; `flakyFailure` and `rerunFailure` record tries.
|
|
88
|
+
*
|
|
89
|
+
* The reading checks the nesting of every element and fails on anything it
|
|
90
|
+
* does not understand, so that a report cut short or of another shape is
|
|
91
|
+
* not read as one without failures. Text, where a test's output goes, holds
|
|
92
|
+
* no markup: XML escapes it.
|
|
93
|
+
*
|
|
94
|
+
* @returns The tests, or why the report cannot be read.
|
|
95
|
+
*/
|
|
96
|
+
export declare function parseJunit(text: string): JunitCase[] | string;
|
|
97
|
+
/**
|
|
98
|
+
* The package of a test binary: the part of its binary ID before the first
|
|
99
|
+
* `::`, which was the package name of every binary in nextest's reports
|
|
100
|
+
* (`EVD-CARGO-AFFECTED-REPORT`, "Tests to crates").
|
|
101
|
+
*/
|
|
102
|
+
export declare function binaryPackage(binary: string): string;
|
|
103
|
+
/**
|
|
104
|
+
* What a suite of nextest's JUnit report stands for, by its name
|
|
105
|
+
* (`EVD-NEXTEST-RUNNER-STEPS`): a test binary, named by its binary ID; a
|
|
106
|
+
* setup script, `@setup-script:<id>`; either with `@stress-<n>` after it in a
|
|
107
|
+
* stress run; or something else, which the plugin does not know.
|
|
108
|
+
*/
|
|
109
|
+
export type SuiteKind = {
|
|
110
|
+
kind: "binary";
|
|
111
|
+
binary: string;
|
|
112
|
+
package: string;
|
|
113
|
+
} | {
|
|
114
|
+
kind: "setup-script";
|
|
115
|
+
script: string;
|
|
116
|
+
} | {
|
|
117
|
+
kind: "unknown";
|
|
118
|
+
name: string;
|
|
119
|
+
};
|
|
120
|
+
/** The kind of the suite of nextest's JUnit report named `name` ({@link SuiteKind}). */
|
|
121
|
+
export declare function suiteKind(name: string): SuiteKind;
|
|
122
|
+
/** A test that nextest's list says a run with the same arguments is to run. */
|
|
123
|
+
export interface ListedTest {
|
|
124
|
+
/** The package of its binary, as the list names it. */
|
|
125
|
+
package: string;
|
|
126
|
+
/** The binary ID. */
|
|
127
|
+
binary: string;
|
|
128
|
+
/** The test's name. */
|
|
129
|
+
name: string;
|
|
130
|
+
}
|
|
131
|
+
/** The tests that a nextest run was to run, or why the plugin cannot tell. */
|
|
132
|
+
export type ListedTests = {
|
|
133
|
+
tests: ListedTest[];
|
|
134
|
+
} | {
|
|
135
|
+
unreadable: string;
|
|
136
|
+
};
|
|
137
|
+
/**
|
|
138
|
+
* The tests whose `filter-match` is `matches` in the output of `cargo
|
|
139
|
+
* nextest list --message-format json`, whose format nextest keeps stable:
|
|
140
|
+
* `rust-suites` by binary ID, each with its `package-name` and its
|
|
141
|
+
* `testcases`, each of which matches the run's filters or not, with the
|
|
142
|
+
* reason (`EVD-NEXTEST-RUNNER-STEPS`). An output of another shape cannot be
|
|
143
|
+
* read.
|
|
144
|
+
*/
|
|
145
|
+
export declare function parseNextestList(stdout: string): ListedTests;
|
|
146
|
+
/**
|
|
147
|
+
* Reads the step `cargo nextest run` of a group of several crates or of the
|
|
148
|
+
* whole workspace (`DES-TEST-RUN`, steps 3 and 4, "nextest's
|
|
149
|
+
* configuration"), from nextest's exit status, its JUnit report and, where
|
|
150
|
+
* it exits with 100, its list of the tests that the run was to run, never
|
|
151
|
+
* from a line that nextest or cargo writes for people:
|
|
152
|
+
*
|
|
153
|
+
* - with 0, which nextest gives only where every test that the run was to
|
|
154
|
+
* run finished and passed, every task passes; a report that holds a failed
|
|
155
|
+
* test then fails every task, since it contradicts the status;
|
|
156
|
+
* - with 100, which nextest gives where a test failed and where it ended the
|
|
157
|
+
* run early, as on a global timeout, a signal or an interrupt, a task
|
|
158
|
+
* passes only where the report holds no failed test of its package and
|
|
159
|
+
* every test of its package that the list names ran and passed; every task
|
|
160
|
+
* fails where the report is missing, as where the repository's profile
|
|
161
|
+
* sets its own `junit.path`, or cannot be read, and every task without a
|
|
162
|
+
* failed test of its own where the list cannot be read;
|
|
163
|
+
* - with 101, the build of the test binaries failed, which stops the step
|
|
164
|
+
* before any test runs, and every task fails with the crates that did not
|
|
165
|
+
* compile (`DES-BATCH`, "Test runs");
|
|
166
|
+
* - with 105, a setup script failed, and every task fails with the scripts
|
|
167
|
+
* that the report names;
|
|
168
|
+
* - with any other status, by a signal or without a start, every task fails.
|
|
169
|
+
*
|
|
170
|
+
* A report that holds a failed setup script, a suite that is neither a test
|
|
171
|
+
* binary nor a setup script ({@link suiteKind}) or a test of a package
|
|
172
|
+
* outside the group fails every task, whatever the status; a setup script
|
|
173
|
+
* that passed decides nothing.
|
|
174
|
+
*
|
|
175
|
+
* Each task's output holds the compiler's messages about its crate, the
|
|
176
|
+
* lines of nextest that name one of its test binaries with the output under
|
|
177
|
+
* them, and every line that names no crate of the group, such as nextest's
|
|
178
|
+
* `Starting` line, with the tests that the configuration skipped, and its
|
|
179
|
+
* summary; and the task's message gives the number of its crate's tests in
|
|
180
|
+
* the report, so that a crate whose tests the configuration skips shows 0.
|
|
181
|
+
*
|
|
182
|
+
* @param selection Whether the step runs a selection of affected tests
|
|
183
|
+
* (`DES-TEST-RUN`, step 3), which the count's wording then names.
|
|
184
|
+
*/
|
|
185
|
+
export declare function readNextestStep(output: string, end: NextestEnd, crates: readonly OutputCrate[], scope: OutputScope | undefined, report: JunitReport, listed?: ListedTests, selection?: boolean): CrateOutcome[];
|