@smoothbricks/nx-plugin 0.5.7 → 0.6.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/README.md +1097 -360
- package/dist/.build-inputs.json +141 -0
- package/dist/bin/smoo-nx-cargo-toolchain.d.ts +3 -0
- package/dist/bin/smoo-nx-cargo-toolchain.d.ts.map +1 -0
- package/dist/bin/smoo-nx-cargo-toolchain.js +8 -0
- package/dist/bin/smoo-nx-forbidden-spellings.d.ts +3 -0
- package/dist/bin/smoo-nx-forbidden-spellings.d.ts.map +1 -0
- package/dist/bin/smoo-nx-forbidden-spellings.js +32 -0
- package/dist/bin/smoo-nx-nextest-timings.d.ts +3 -0
- package/dist/bin/smoo-nx-nextest-timings.d.ts.map +1 -0
- package/dist/bin/smoo-nx-nextest-timings.js +28 -0
- package/dist/bounded-test-policy.d.ts +1 -1
- package/dist/bounded-test-policy.d.ts.map +1 -1
- package/dist/bounded-test-policy.js +14 -15
- package/dist/build-state-output-policy.d.ts +95 -1
- package/dist/build-state-output-policy.d.ts.map +1 -1
- package/dist/build-state-output-policy.js +368 -30
- package/dist/bun-lock-scope.d.ts +44 -0
- package/dist/bun-lock-scope.d.ts.map +1 -0
- package/dist/bun-lock-scope.js +97 -0
- package/dist/cargo-build-script-env.d.ts +49 -0
- package/dist/cargo-build-script-env.d.ts.map +1 -0
- package/dist/cargo-build-script-env.js +324 -0
- package/dist/cargo-closure-input.d.ts +31 -4
- package/dist/cargo-closure-input.d.ts.map +1 -1
- package/dist/cargo-closure-input.js +66 -6
- package/dist/cargo-retention-hook.d.ts +17 -0
- package/dist/cargo-retention-hook.d.ts.map +1 -0
- package/dist/cargo-retention-hook.js +85 -0
- package/dist/cargo-source-hash.d.ts +25 -7
- package/dist/cargo-source-hash.d.ts.map +1 -1
- package/dist/cargo-source-hash.js +108 -43
- package/dist/cargo-toolchain-paths.d.ts +40 -0
- package/dist/cargo-toolchain-paths.d.ts.map +1 -0
- package/dist/cargo-toolchain-paths.js +84 -0
- package/dist/cargo-toolchain-policy.d.ts +25 -8
- package/dist/cargo-toolchain-policy.d.ts.map +1 -1
- package/dist/cargo-toolchain-policy.js +39 -5
- package/dist/cargo-workspace.d.ts +10 -4
- package/dist/cargo-workspace.d.ts.map +1 -1
- package/dist/cargo-workspace.js +65 -95
- package/dist/cross-check-policy.d.ts +9 -9
- package/dist/cross-check-policy.d.ts.map +1 -1
- package/dist/cross-check-policy.js +11 -11
- package/dist/disk-command-policy.d.ts.map +1 -1
- package/dist/disk-command-policy.js +1 -0
- package/dist/ensure-built-receipt.d.ts +22 -5
- package/dist/ensure-built-receipt.d.ts.map +1 -1
- package/dist/ensure-built-receipt.js +168 -48
- package/dist/ensure-built-witness.d.ts +27 -8
- package/dist/ensure-built-witness.d.ts.map +1 -1
- package/dist/ensure-built-witness.js +45 -15
- package/dist/ensure-built.d.ts.map +1 -1
- package/dist/ensure-built.js +9 -1
- package/dist/eslint-config-closure.d.ts +7 -0
- package/dist/eslint-config-closure.d.ts.map +1 -0
- package/dist/eslint-config-closure.js +346 -0
- package/dist/executors/bounded-exec/bounds.d.ts +56 -0
- package/dist/executors/bounded-exec/bounds.d.ts.map +1 -0
- package/dist/executors/bounded-exec/bounds.js +43 -0
- package/dist/executors/bounded-exec/cpu-pool-thread.d.ts +28 -0
- package/dist/executors/bounded-exec/cpu-pool-thread.d.ts.map +1 -0
- package/dist/executors/bounded-exec/cpu-pool-thread.js +20 -0
- package/dist/executors/bounded-exec/cpu-pool.d.ts +35 -38
- package/dist/executors/bounded-exec/cpu-pool.d.ts.map +1 -1
- package/dist/executors/bounded-exec/cpu-pool.js +56 -120
- package/dist/executors/bounded-exec/executor.d.ts +19 -12
- package/dist/executors/bounded-exec/executor.d.ts.map +1 -1
- package/dist/executors/bounded-exec/executor.js +389 -239
- package/dist/executors/bounded-exec/gateway-lease.d.ts +23 -19
- package/dist/executors/bounded-exec/gateway-lease.d.ts.map +1 -1
- package/dist/executors/bounded-exec/gateway-lease.js +102 -29
- package/dist/executors/bounded-exec/hang-diagnostics.d.ts +18 -1
- package/dist/executors/bounded-exec/hang-diagnostics.d.ts.map +1 -1
- package/dist/executors/bounded-exec/hang-diagnostics.js +148 -30
- package/dist/executors/bounded-exec/lease-wait.d.ts +64 -0
- package/dist/executors/bounded-exec/lease-wait.d.ts.map +1 -0
- package/dist/executors/bounded-exec/lease-wait.js +72 -0
- package/dist/executors/bounded-exec/lock-wait.d.ts +51 -0
- package/dist/executors/bounded-exec/lock-wait.d.ts.map +1 -0
- package/dist/executors/bounded-exec/lock-wait.js +108 -0
- package/dist/executors/bounded-exec/mbx-pool.d.ts +31 -0
- package/dist/executors/bounded-exec/mbx-pool.d.ts.map +1 -0
- package/dist/executors/bounded-exec/mbx-pool.js +24 -0
- package/dist/executors/bounded-exec/owned-subtree.d.ts +84 -0
- package/dist/executors/bounded-exec/owned-subtree.d.ts.map +1 -0
- package/dist/executors/bounded-exec/owned-subtree.js +178 -0
- package/dist/executors/bounded-exec/progress.d.ts +4 -1
- package/dist/executors/bounded-exec/progress.d.ts.map +1 -1
- package/dist/executors/bounded-exec/progress.js +5 -2
- package/dist/executors/bounded-exec/ram-attach.d.ts +19 -0
- package/dist/executors/bounded-exec/ram-attach.d.ts.map +1 -0
- package/dist/executors/bounded-exec/ram-attach.js +207 -0
- package/dist/executors/bounded-exec/ram-detach.d.ts +25 -0
- package/dist/executors/bounded-exec/ram-detach.d.ts.map +1 -0
- package/dist/executors/bounded-exec/ram-detach.js +207 -0
- package/dist/executors/bounded-exec/ram-temp-fixtures.d.ts +76 -0
- package/dist/executors/bounded-exec/ram-temp-fixtures.d.ts.map +1 -1
- package/dist/executors/bounded-exec/ram-temp-fixtures.js +296 -0
- package/dist/executors/bounded-exec/ram-temp.d.ts +388 -88
- package/dist/executors/bounded-exec/ram-temp.d.ts.map +1 -1
- package/dist/executors/bounded-exec/ram-temp.js +1213 -399
- package/dist/executors/bounded-exec/run-cpu-pool.d.ts +10 -4
- package/dist/executors/bounded-exec/run-cpu-pool.d.ts.map +1 -1
- package/dist/executors/bounded-exec/run-cpu-pool.js +122 -35
- package/dist/executors/bounded-exec/runner-hook.js +14 -5
- package/dist/executors/bounded-exec/runner-lifecycle.d.ts +14 -1
- package/dist/executors/bounded-exec/runner-lifecycle.d.ts.map +1 -1
- package/dist/executors/bounded-exec/runner-lifecycle.js +27 -6
- package/dist/executors/bounded-exec/{cpu-tokens.d.ts → runner-sizing.d.ts} +14 -42
- package/dist/executors/bounded-exec/runner-sizing.d.ts.map +1 -0
- package/dist/executors/bounded-exec/{cpu-tokens.js → runner-sizing.js} +5 -35
- package/dist/executors/bounded-exec/runtime-pin.d.ts +73 -0
- package/dist/executors/bounded-exec/runtime-pin.d.ts.map +1 -0
- package/dist/executors/bounded-exec/runtime-pin.js +167 -0
- package/dist/executors/bounded-exec/schema.d.ts +18 -1
- package/dist/executors/bounded-exec/schema.d.ts.map +1 -1
- package/dist/executors/bounded-exec/verdict.d.ts +48 -11
- package/dist/executors/bounded-exec/verdict.d.ts.map +1 -1
- package/dist/executors/bounded-exec/verdict.js +89 -20
- package/dist/executors/cargo-zigbuild/executor.d.ts +21 -0
- package/dist/executors/cargo-zigbuild/executor.d.ts.map +1 -1
- package/dist/executors/cargo-zigbuild/executor.js +67 -12
- package/dist/executors/clean-outputs/executor.js +1 -0
- package/dist/executors/scriptc-native/executor.d.ts +79 -0
- package/dist/executors/scriptc-native/executor.d.ts.map +1 -0
- package/dist/executors/scriptc-native/executor.js +367 -0
- package/dist/executors/scriptc-native/ffi-paths.d.ts +9 -0
- package/dist/executors/scriptc-native/ffi-paths.d.ts.map +1 -0
- package/dist/executors/scriptc-native/ffi-paths.js +25 -0
- package/dist/executors/scriptc-native/schema.d.ts +34 -0
- package/dist/executors/scriptc-native/schema.d.ts.map +1 -0
- package/dist/executors/scriptc-native/schema.js +1 -0
- package/dist/executors/typescript-emit/emit-overrides.d.ts +14 -0
- package/dist/executors/typescript-emit/emit-overrides.d.ts.map +1 -0
- package/dist/executors/typescript-emit/emit-overrides.js +24 -0
- package/dist/executors/typescript-emit/executor.d.ts +3 -1
- package/dist/executors/typescript-emit/executor.d.ts.map +1 -1
- package/dist/executors/typescript-emit/executor.js +146 -33
- package/dist/forbidden-spelling-policy.d.ts +56 -0
- package/dist/forbidden-spelling-policy.d.ts.map +1 -0
- package/dist/forbidden-spelling-policy.js +176 -0
- package/dist/generators/create-package/generator.d.ts.map +1 -1
- package/dist/generators/create-package/generator.js +3 -4
- package/dist/graph-input-contract.d.ts +14 -0
- package/dist/graph-input-contract.d.ts.map +1 -1
- package/dist/graph-input-contract.js +67 -2
- package/dist/index.d.ts +23 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +672 -214
- package/dist/managed-assets.d.ts +2 -0
- package/dist/managed-assets.d.ts.map +1 -1
- package/dist/managed-files/files.d.ts +3 -3
- package/dist/managed-files/files.d.ts.map +1 -1
- package/dist/managed-files/files.js +28 -3
- package/dist/managed-files/managed-format.d.ts.map +1 -1
- package/dist/managed-files/managed-format.js +1 -0
- package/dist/managed-files/publish-workflow.js +14 -11
- package/dist/nextest-code-bound.js +1 -0
- package/dist/nextest-timings.d.ts +35 -0
- package/dist/nextest-timings.d.ts.map +1 -0
- package/dist/nextest-timings.js +168 -0
- package/dist/owned-installation.d.ts +6 -5
- package/dist/owned-installation.d.ts.map +1 -1
- package/dist/owned-installation.js +150 -26
- package/dist/package-target-policy.d.ts.map +1 -1
- package/dist/package-target-policy.js +2 -3
- package/dist/process-children.d.ts +7 -0
- package/dist/process-children.d.ts.map +1 -0
- package/dist/process-children.darwin.d.ts +7 -0
- package/dist/process-children.darwin.d.ts.map +1 -0
- package/dist/process-children.darwin.js +13 -0
- package/dist/process-children.js +14 -0
- package/dist/process-children.linux.d.ts +8 -0
- package/dist/process-children.linux.d.ts.map +1 -0
- package/dist/process-children.linux.js +25 -0
- package/dist/process-group.d.ts +108 -0
- package/dist/process-group.d.ts.map +1 -0
- package/dist/process-group.js +171 -0
- package/dist/process-listing.d.ts +7 -0
- package/dist/process-listing.d.ts.map +1 -0
- package/dist/process-listing.js +51 -0
- package/dist/producer-receipts.d.ts +8 -2
- package/dist/producer-receipts.d.ts.map +1 -1
- package/dist/producer-receipts.js +514 -47
- package/dist/task-graph-policy.d.ts +21 -0
- package/dist/task-graph-policy.d.ts.map +1 -0
- package/dist/task-graph-policy.js +91 -0
- package/dist/test-timings.js +4 -4
- package/dist/test-walk-policy.d.ts +14 -5
- package/dist/test-walk-policy.d.ts.map +1 -1
- package/dist/test-walk-policy.js +8 -2
- package/dist/testing.d.ts +73 -28
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +217 -223
- package/dist/tool-bins.d.ts +33 -0
- package/dist/tool-bins.d.ts.map +1 -0
- package/dist/tool-bins.js +72 -0
- package/dist/typecheck-test-policy.d.ts.map +1 -1
- package/dist/typecheck-test-policy.js +3 -4
- package/dist/wait-why-policy.d.ts +28 -0
- package/dist/wait-why-policy.d.ts.map +1 -0
- package/dist/wait-why-policy.js +223 -0
- package/dist/workspace-config-policy.d.ts +14 -8
- package/dist/workspace-config-policy.d.ts.map +1 -1
- package/dist/workspace-config-policy.js +60 -16
- package/dist/workspace-manifest.d.ts +41 -6
- package/dist/workspace-manifest.d.ts.map +1 -1
- package/dist/workspace-manifest.js +57 -0
- package/executors.json +16 -1
- package/loader.js +2 -0
- package/managed/raw/envrc +11 -0
- package/managed/raw/patches/nx@23.2.1.patch +2840 -199
- package/managed/raw/patches/ttsc@0.34.1.patch +119 -0
- package/managed/raw/tooling/direnv/cargo-fetch-bound.ts +245 -0
- package/managed/raw/tooling/direnv/cargo-fetch-run.ts +299 -0
- package/managed/raw/tooling/direnv/compiler-variables.sh +42 -0
- package/managed/raw/tooling/direnv/developer-links.ts +464 -25
- package/managed/raw/tooling/direnv/devenv.smoo.nix +78 -38
- package/managed/raw/tooling/direnv/github-actions-bootstrap.sh +14 -12
- package/managed/raw/tooling/direnv/installed-bun-links.ts +308 -0
- package/managed/raw/tooling/direnv/linked-snapshots.ts +62 -3
- package/managed/raw/tooling/direnv/nx-socket-dir.sh +56 -17
- package/managed/raw/tooling/direnv/repo-path +68 -6
- package/managed/raw/tooling/direnv/secret-references.ts +13 -4
- package/managed/raw/tooling/direnv/setup-environment.ts +128 -537
- package/managed/raw/tooling/direnv/toolchain-stamp.ts +4 -2
- package/managed/raw/tooling/direnv/ttsc-env.sh +9 -0
- package/managed/raw/tooling/direnv/uv-relocation.ts +227 -0
- package/managed/raw/tooling/git-hooks/commit-msg.sh +2 -1
- package/managed/raw/tooling/git-hooks/pre-commit.sh +2 -1
- package/managed/raw/tooling/git-hooks/pre-push.sh +2 -1
- package/managed/templates/github/actions/cache-ttsc-plugins/action.yml +85 -7
- package/managed/templates/github/actions/save-nix-devenv/action.yml +12 -2
- package/managed/templates/github/actions/setup-devenv/action.yml +2 -0
- package/package.json +95 -14
- package/src/bin/smoo-nx-cargo-toolchain.ts +11 -0
- package/src/bin/smoo-nx-forbidden-spellings.ts +33 -0
- package/src/bin/smoo-nx-nextest-timings.ts +31 -0
- package/src/bounded-test-policy.ts +12 -14
- package/src/build-state-output-policy.ts +458 -34
- package/src/bun-lock-scope.ts +108 -0
- package/src/cargo-build-script-env.ts +265 -0
- package/src/cargo-closure-input.ts +74 -7
- package/src/cargo-retention-hook.ts +94 -0
- package/src/cargo-source-hash.ts +138 -41
- package/src/cargo-toolchain-paths.ts +95 -0
- package/src/cargo-toolchain-policy.ts +49 -5
- package/src/cargo-workspace.ts +72 -123
- package/src/cross-check-policy.ts +12 -10
- package/src/disk-command-policy.ts +1 -0
- package/src/ensure-built-receipt.ts +173 -39
- package/src/ensure-built-witness.ts +62 -10
- package/src/ensure-built.ts +11 -1
- package/src/eslint-config-closure.ts +357 -0
- package/src/executors/bounded-exec/bounds.ts +76 -0
- package/src/executors/bounded-exec/cpu-pool-thread.ts +43 -0
- package/src/executors/bounded-exec/cpu-pool.ts +55 -120
- package/src/executors/bounded-exec/executor.ts +442 -260
- package/src/executors/bounded-exec/gateway-lease.ts +94 -35
- package/src/executors/bounded-exec/hang-diagnostics.ts +173 -31
- package/src/executors/bounded-exec/lease-wait.ts +116 -0
- package/src/executors/bounded-exec/lock-wait.ts +141 -0
- package/src/executors/bounded-exec/mbx-pool.ts +48 -0
- package/src/executors/bounded-exec/owned-subtree.ts +235 -0
- package/src/executors/bounded-exec/progress.ts +9 -3
- package/src/executors/bounded-exec/ram-attach.ts +238 -0
- package/src/executors/bounded-exec/ram-detach.ts +226 -0
- package/src/executors/bounded-exec/ram-temp-fixtures.ts +358 -0
- package/src/executors/bounded-exec/ram-temp-registry.txt +440 -0
- package/src/executors/bounded-exec/ram-temp.ts +1497 -460
- package/src/executors/bounded-exec/run-cpu-pool.ts +129 -35
- package/src/executors/bounded-exec/runner-hook.ts +14 -6
- package/src/executors/bounded-exec/runner-lifecycle.ts +31 -8
- package/src/executors/bounded-exec/{cpu-tokens.ts → runner-sizing.ts} +13 -59
- package/src/executors/bounded-exec/runtime-pin.ts +232 -0
- package/src/executors/bounded-exec/schema.json +11 -2
- package/src/executors/bounded-exec/schema.ts +19 -1
- package/src/executors/bounded-exec/verdict.ts +145 -35
- package/src/executors/cargo-zigbuild/executor.ts +82 -8
- package/src/executors/clean-outputs/executor.ts +1 -0
- package/src/executors/scriptc-native/executor.ts +394 -0
- package/src/executors/scriptc-native/ffi-paths.ts +29 -0
- package/src/executors/scriptc-native/schema.json +60 -0
- package/src/executors/scriptc-native/schema.ts +34 -0
- package/src/executors/typescript-emit/emit-overrides.ts +24 -0
- package/src/executors/typescript-emit/executor.ts +186 -38
- package/src/forbidden-spelling-policy.ts +226 -0
- package/src/generators/create-package/generator.ts +7 -7
- package/src/graph-input-contract.ts +61 -2
- package/src/index.ts +788 -224
- package/src/managed-assets.ts +3 -0
- package/src/managed-files/files.ts +28 -3
- package/src/managed-files/managed-format.ts +1 -0
- package/src/managed-files/publish-workflow.ts +20 -15
- package/src/nextest-code-bound.ts +1 -0
- package/src/nextest-timings.ts +106 -0
- package/src/owned-installation.ts +150 -23
- package/src/package-target-policy.ts +2 -3
- package/src/process-children.darwin.ts +14 -0
- package/src/process-children.linux.ts +33 -0
- package/src/process-children.ts +22 -0
- package/src/process-group.ts +209 -0
- package/src/process-listing.ts +54 -0
- package/src/producer-receipts.ts +92 -41
- package/src/task-graph-policy.ts +98 -0
- package/src/test-walk-policy.ts +23 -8
- package/src/testing.ts +240 -232
- package/src/tool-bins.ts +108 -0
- package/src/typecheck-test-policy.ts +2 -3
- package/src/wait-why-policy.ts +226 -0
- package/src/workspace-config-policy.ts +63 -15
- package/src/workspace-manifest.ts +89 -6
- package/test-timings.json +124 -99
- package/dist/bin/smoo-nx-failures.d.ts +0 -3
- package/dist/bin/smoo-nx-failures.d.ts.map +0 -1
- package/dist/bin/smoo-nx-failures.js +0 -3
- package/dist/bin/smoo-nx-nextest-extract.d.ts +0 -3
- package/dist/bin/smoo-nx-nextest-extract.d.ts.map +0 -1
- package/dist/bin/smoo-nx-nextest-extract.js +0 -42
- package/dist/executors/bounded-exec/cpu-tokens.d.ts.map +0 -1
- package/dist/failure-summary.d.ts +0 -5
- package/dist/failure-summary.d.ts.map +0 -1
- package/dist/failure-summary.js +0 -118
- package/dist/nextest-extraction.d.ts +0 -117
- package/dist/nextest-extraction.d.ts.map +0 -1
- package/dist/nextest-extraction.js +0 -303
- package/managed/raw/patches/ttsc@0.30.4.patch +0 -2255
- package/src/__tests__/cargo-closure-filesets.ts +0 -94
- package/src/__tests__/cargo-closure-fixture.ts +0 -113
- package/src/__tests__/counted-cargo-process.ts +0 -286
- package/src/__tests__/counted-cargo.ts +0 -713
- package/src/__tests__/directory-change.ts +0 -27
- package/src/__tests__/fixture-cargo-home.ts +0 -36
- package/src/__tests__/fixture-nx-env.ts +0 -193
- package/src/__tests__/owned-installation.ts +0 -13
- package/src/__tests__/past-tick.ts +0 -12
- package/src/__tests__/progress-clock.ts +0 -43
- package/src/__tests__/runtime-input.ts +0 -23
- package/src/bin/smoo-nx-bound-failures.test.ts +0 -127
- package/src/bin/smoo-nx-failures.ts +0 -4
- package/src/bin/smoo-nx-nextest-extract.ts +0 -44
- package/src/bounded-test-policy.test.ts +0 -1029
- package/src/build-state-output-policy.test.ts +0 -115
- package/src/bun-bootstrap.test.ts +0 -102
- package/src/bun-file-packages.test.ts +0 -47
- package/src/cargo-closure-filesets.test.ts +0 -63
- package/src/cargo-closure-input.property.test.ts +0 -50
- package/src/cargo-closure-input.test.ts +0 -506
- package/src/cargo-closure-key.test.ts +0 -240
- package/src/cargo-resolve-cache.test.ts +0 -1181
- package/src/cargo-source-hash.test.ts +0 -707
- package/src/cargo-workspace.test.ts +0 -615
- package/src/cross-check-policy.test.ts +0 -316
- package/src/disk-command-policy.test.ts +0 -61
- package/src/ensure-built-receipt.test.ts +0 -279
- package/src/ensure-built-witness.test.ts +0 -688
- package/src/ensure-built.test.ts +0 -1462
- package/src/executors/all-verdicts/executor.test.ts +0 -135
- package/src/executors/bounded-exec/cargo-progress-host.test.ts +0 -332
- package/src/executors/bounded-exec/cpu-pool.test.ts +0 -684
- package/src/executors/bounded-exec/cpu-tokens.test.ts +0 -519
- package/src/executors/bounded-exec/disk-lease.test.ts +0 -219
- package/src/executors/bounded-exec/executor-host.test.ts +0 -800
- package/src/executors/bounded-exec/executor.test.ts +0 -1819
- package/src/executors/bounded-exec/go-progress-host.test.ts +0 -171
- package/src/executors/bounded-exec/hang-diagnostics.test.ts +0 -291
- package/src/executors/bounded-exec/progress.test.ts +0 -139
- package/src/executors/bounded-exec/ram-temp-held.test.ts +0 -264
- package/src/executors/bounded-exec/ram-temp-host.test.ts +0 -635
- package/src/executors/bounded-exec/ram-temp.test.ts +0 -750
- package/src/executors/bounded-exec/run-cpu-pool.test.ts +0 -79
- package/src/executors/bounded-exec/runner-hook.test.ts +0 -193
- package/src/executors/bounded-exec/runner-lifecycle.test.ts +0 -82
- package/src/executors/bounded-exec/verdict.test.ts +0 -545
- package/src/executors/cargo-zigbuild/executor.test.ts +0 -129
- package/src/executors/clean-outputs/executor.test.ts +0 -20
- package/src/executors/typescript-emit/executor.test.ts +0 -83
- package/src/failure-summary.ts +0 -119
- package/src/generators/bounded-test-targets/generator.test.ts +0 -138
- package/src/generators/bun-test-tracing/generator.test.ts +0 -250
- package/src/generators/create-package/generator.test.ts +0 -190
- package/src/generators/make-public/generator.test.ts +0 -137
- package/src/graph-input-contract.test.ts +0 -379
- package/src/host-controller-wiring.test.ts +0 -31
- package/src/index.test.ts +0 -3321
- package/src/linked-snapshots.nx.test.ts +0 -254
- package/src/managed-files/forgejo-artifact.test.ts +0 -395
- package/src/managed-files/generator.test.ts +0 -243
- package/src/managed-files/github-host-cache-isolation.test.ts +0 -86
- package/src/managed-files/json-edit.test.ts +0 -216
- package/src/managed-files/managed-content.test.ts +0 -166
- package/src/managed-files/managed-format-json.test.ts +0 -308
- package/src/managed-files/repo-path.test.ts +0 -172
- package/src/managed-files/setup-devenv-free-disk.test.ts +0 -95
- package/src/managed-files/trace-db-artifact.test.ts +0 -7
- package/src/managed-files/tree-permissions.test.ts +0 -109
- package/src/managed-files/tree.test.ts +0 -123
- package/src/manifest-hash.test.ts +0 -219
- package/src/nextest-code-bound.test.ts +0 -161
- package/src/nextest-extraction.test.ts +0 -216
- package/src/nextest-extraction.ts +0 -371
- package/src/nextest-partitions.test.ts +0 -501
- package/src/nx-cache-bound.test.ts +0 -109
- package/src/nx-cache-restore-mtime.test.ts +0 -170
- package/src/nx-daemon-claim.test.ts +0 -279
- package/src/nx-daemon-idle-cpu.test.ts +0 -80
- package/src/nx-daemon-idle-policy.test.ts +0 -111
- package/src/nx-daemon-ignore-files.test.ts +0 -210
- package/src/nx-daemon-root-normalization.test.ts +0 -105
- package/src/nx-daemon-start-never.test.ts +0 -292
- package/src/nx-daemon-validity.test.ts +0 -1055
- package/src/nx-dot-input-policy.test.ts +0 -353
- package/src/nx-failure-life-cycles.test.ts +0 -207
- package/src/nx-files-archive-racy.test.ts +0 -97
- package/src/nx-foreign-workspace-env.test.ts +0 -329
- package/src/nx-incomplete-run-summary.test.ts +0 -70
- package/src/nx-plugin-load-errors.test.ts +0 -120
- package/src/nx-project-graph-errors.test.ts +0 -70
- package/src/nx-project-resolution-cache.test.ts +0 -176
- package/src/nx-raw-inputs.test.ts +0 -166
- package/src/nx-resident-graph-workers.test.ts +0 -112
- package/src/nx-run-information.test.ts +0 -118
- package/src/nx-skipped-task-exit.test.ts +0 -180
- package/src/nx-state-location.test.ts +0 -63
- package/src/nx-store-resolution.test.ts +0 -81
- package/src/nx-task-graph-cycles.test.ts +0 -148
- package/src/nx-task-output-lease.test.ts +0 -550
- package/src/nx-use-local.test.ts +0 -105
- package/src/owned-installation.test.ts +0 -105
- package/src/package-target-policy.test.ts +0 -1014
- package/src/producer-receipts.test.ts +0 -285
- package/src/release-config-policy.test.ts +0 -311
- package/src/runtime-input.test.ts +0 -393
- package/src/serial-group-wiring.test.ts +0 -326
- package/src/task-history-namespace.test.ts +0 -181
- package/src/task-results.test.ts +0 -228
- package/src/test-clock-policy.test.ts +0 -338
- package/src/test-program.test.ts +0 -303
- package/src/test-timings.test.ts +0 -240
- package/src/test-walk-policy.test.ts +0 -620
- package/src/testing.test.ts +0 -509
- package/src/typecheck-test-policy.test.ts +0 -1468
- package/src/typescript-resolution.test.ts +0 -76
- package/src/version-actions.test.ts +0 -80
- package/src/workspace-config-policy.test.ts +0 -737
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/** One resolved dependency of a package: the package it resolved to, and whether every declaration of it is a dev one. */
|
|
2
|
+
export interface CargoEdge {
|
|
3
|
+
readonly pkg: string;
|
|
4
|
+
/** Cargo builds this dependency for the dependent's tests, examples and benches only. */
|
|
5
|
+
readonly devOnly: boolean;
|
|
6
|
+
}
|
|
7
|
+
/** Every package Cargo builds for a selection, by package id, each with the dependencies Cargo builds for it. */
|
|
8
|
+
export type CargoClosure = ReadonlyMap<string, readonly string[]>;
|
|
1
9
|
/** A mutable (path) package in Cargo's locked resolve. Every path is canonical. */
|
|
2
10
|
export interface LocalCargoPackage {
|
|
3
11
|
readonly id: string;
|
|
@@ -16,8 +24,13 @@ export interface CargoResolve {
|
|
|
16
24
|
/** The workspace's own members: `root`'s manifest governs each of them. */
|
|
17
25
|
readonly members: ReadonlySet<string>;
|
|
18
26
|
readonly local: readonly LocalCargoPackage[];
|
|
27
|
+
/**
|
|
28
|
+
* Every package Cargo.lock pins (registry, git, alternate registry), by package id: its `source`, which for a git
|
|
29
|
+
* dependency names the locked commit that the id alone does not.
|
|
30
|
+
*/
|
|
31
|
+
readonly locked: ReadonlyMap<string, string>;
|
|
19
32
|
/** Every dependency edge by package id, or null when Cargo reported no resolution. */
|
|
20
|
-
readonly edges: ReadonlyMap<string, readonly
|
|
33
|
+
readonly edges: ReadonlyMap<string, readonly CargoEdge[]> | null;
|
|
21
34
|
}
|
|
22
35
|
export interface CargoPathInputsOptions {
|
|
23
36
|
/** Also hash packages inside both the Nx and Cargo workspaces, for custom targets without inferred Cargo inputs. */
|
|
@@ -30,8 +43,6 @@ export interface CargoPathInputsOptions {
|
|
|
30
43
|
}
|
|
31
44
|
/** Directories the hash never descends into: build output, VCS and volume metadata, installed packages. */
|
|
32
45
|
export declare const HASH_SKIPPED_DIRECTORIES: readonly ['target', '.git', 'node_modules', '.nx', '.cache', '.cowshed', '.fseventsd', '.TemporaryItems', '.Trashes', '.Spotlight-V100', '.DocumentRevisions-V100'];
|
|
33
|
-
/** Files in every ancestor of a package directory that Cargo reads while building it. */
|
|
34
|
-
export declare const CARGO_ANCESTOR_INPUTS: readonly ['Cargo.toml', '.cargo/config', '.cargo/config.toml'];
|
|
35
46
|
/** A Cargo resolution refusal: no stale closure or runtime whole-workspace substitute is safe. */
|
|
36
47
|
export declare class CargoMetadataError extends Error {
|
|
37
48
|
readonly manifestPath: string;
|
|
@@ -70,11 +81,18 @@ export declare function acquireCargoResolveLock(lockFile: string, boundMs: numbe
|
|
|
70
81
|
}>;
|
|
71
82
|
export declare function hashCargoPathInputs(manifestPath: string, workspaceRoot: string, options?: CargoPathInputsOptions): Promise<string>;
|
|
72
83
|
/**
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
|
|
84
|
+
* What Cargo builds for the local packages under `directory`, as {@link buildClosure} computes it with those packages
|
|
85
|
+
* selected.
|
|
86
|
+
*/
|
|
87
|
+
export declare function dependencyClosure(cargo: CargoResolve, directory: string): Promise<CargoClosure>;
|
|
88
|
+
/**
|
|
89
|
+
* The packages Cargo compiles to build, test or run the `selected` ones, each with the dependencies Cargo builds for
|
|
90
|
+
* it. A selected package's targets reach every dependency kind: its library and binaries the normal ones, its build
|
|
91
|
+
* script the build ones, its tests, examples and benches the dev ones. Below the selection Cargo builds a package for
|
|
92
|
+
* its library and build script alone, so a dependency's own dev-dependencies never compile into a selected package's
|
|
93
|
+
* binaries and are not part of what it builds.
|
|
76
94
|
*/
|
|
77
|
-
export declare function
|
|
95
|
+
export declare function buildClosure(cargo: CargoResolve, selected: readonly string[]): CargoClosure;
|
|
78
96
|
/** A compiled-in value, with the source spelling that identifies it across checkouts. */
|
|
79
97
|
export interface CompiledCargoInput {
|
|
80
98
|
readonly file: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cargo-source-hash.d.ts","sourceRoot":"","sources":["../src/cargo-source-hash.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cargo-source-hash.d.ts","sourceRoot":"","sources":["../src/cargo-source-hash.ts"],"names":[],"mappings":"AAgHA,0HAA0H;AAC1H,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,yFAAyF;IACzF,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B;AAED,iHAAiH;AACjH,MAAM,MAAM,YAAY,GAAG,WAAW,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC;AAElE,mFAAmF;AACnF,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,iHAAiH;IACjH,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;CACpC;AAED,kGAAkG;AAClG,MAAM,WAAW,YAAY;IAC3B,0CAA0C;IAC1C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,2EAA2E;IAC3E,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACtC,QAAQ,CAAC,KAAK,EAAE,SAAS,iBAAiB,EAAE,CAAC;IAC7C;;;OAGG;IACH,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7C,sFAAsF;IACtF,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,SAAS,EAAE,CAAC,GAAG,IAAI,CAAC;CAClE;AAED,MAAM,WAAW,sBAAsB;IACrC,oHAAoH;IACpH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAgLD,2GAA2G;AAC3G,eAAO,MAAM,wBAAwB,YACnC,QAAQ,EACR,MAAM,EACN,cAAc,EACd,KAAK,EACL,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,iBAAiB,EACjB,UAAU,EACV,iBAAiB,EACjB,yBAAyB,CACjB,CAAC;AA2CX,kGAAkG;AAClG,qBAAa,kBAAmB,SAAQ,KAAK;IAC3C,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAE9B,YAAY,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAU/C;CACF;AAeD;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,SAAU,CAAC;AAiJ9C;;;;;GAKG;AACH,wBAAsB,gBAAgB,CACpC,YAAY,EAAE,MAAM,EACpB,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,EAC7B,OAAO,GAAE,MAA+B,GACvC,OAAO,CAAC,YAAY,CAAC,CA0DvB;AA+FD,gFAAgF;AAChF,qBAAa,qBAAsB,SAAQ,KAAK;IAE5C,QAAQ,CAAC,QAAQ,EAAE,MAAM;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM;IACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM;IACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS;IAJxC,YACW,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,GAAG,SAAS,EAOvC;CACF;AAKD;;;;GAIG;AACH,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC;IAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAAC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;CAAE,CAAC,CAqF7D;AAoCD,wBAAsB,mBAAmB,CACvC,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,MAAM,EACrB,OAAO,CAAC,EAAE,sBAAsB,GAC/B,OAAO,CAAC,MAAM,CAAC,CAoLjB;AAED;;;GAGG;AACH,wBAAsB,iBAAiB,CAAC,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAOrG;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,SAAS,MAAM,EAAE,GAAG,YAAY,CAY3F;AAuGD,yFAAyF;AACzF,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAgDD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,kBAAkB,EAAE,CAAC,GAAG,kBAAkB,EAAE,CAU5G"}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { execFileSync, spawn, spawnSync } from 'node:child_process';
|
|
2
2
|
import { createHash, randomUUID } from 'node:crypto';
|
|
3
3
|
import { channel } from 'node:diagnostics_channel';
|
|
4
|
-
import { accessSync, constants, existsSync, readdirSync, readFileSync, realpathSync, statSync } from 'node:fs';
|
|
4
|
+
import { accessSync, constants, existsSync, readdirSync, readFileSync, realpathSync, statSync, writeSync, } from 'node:fs';
|
|
5
5
|
import { lstat, mkdir, readdir, readFile, readlink, realpath, rename, rm, stat, writeFile } from 'node:fs/promises';
|
|
6
6
|
import { createRequire } from 'node:module';
|
|
7
7
|
import { homedir } from 'node:os';
|
|
8
8
|
import { delimiter, dirname, isAbsolute, join, relative, resolve, sep } from 'node:path';
|
|
9
|
+
import { CARGO_ANCESTOR_INPUTS } from '@smoothbricks/cargo-retain/cargo-ancestor-inputs';
|
|
9
10
|
import native from 'nx/src/native/index.js';
|
|
10
11
|
import { workspaceDataDirectoryForWorkspace } from 'nx/src/utils/cache-directory.js';
|
|
11
12
|
import { CARGO_TOOLCHAIN_PIN_INPUTS } from './cargo-toolchain-policy.js';
|
|
13
|
+
import { describeTeardown, killProcessGroupNow, TEARDOWN_PATIENCE } from './process-group.js';
|
|
12
14
|
import { rustTokens } from './rust-tokens.js';
|
|
13
15
|
const { IS_WASM, WorkspaceContext } = native;
|
|
14
16
|
const cargoResolveEvents = channel('@smoothbricks/nx-plugin:cargo-resolve');
|
|
@@ -52,6 +54,7 @@ function parseCargoMetadata(json) {
|
|
|
52
54
|
id: text(member(node, 'id'), 'resolve node id'),
|
|
53
55
|
deps: list(member(node, 'deps'), 'resolve node deps').map((dependency) => ({
|
|
54
56
|
pkg: text(member(dependency, 'pkg'), 'resolve edge'),
|
|
57
|
+
dep_kinds: dependencyKinds(member(dependency, 'dep_kinds')),
|
|
55
58
|
})),
|
|
56
59
|
})),
|
|
57
60
|
},
|
|
@@ -59,6 +62,17 @@ function parseCargoMetadata(json) {
|
|
|
59
62
|
workspace_root: text(member(document, 'workspace_root'), 'workspace_root'),
|
|
60
63
|
};
|
|
61
64
|
}
|
|
65
|
+
/** A resolve edge's `dep_kinds`. An edge Cargo reports with no kind is refused: read as dev-only, it would drop a dependency. */
|
|
66
|
+
function dependencyKinds(value) {
|
|
67
|
+
if (!Array.isArray(value) || value.length === 0)
|
|
68
|
+
throw new Error('cargo metadata reported no valid resolve edge kinds');
|
|
69
|
+
return value.map((entry) => {
|
|
70
|
+
const kind = typeof entry === 'object' && entry !== null ? Reflect.get(entry, 'kind') : undefined;
|
|
71
|
+
if (kind !== null && kind !== 'dev' && kind !== 'build')
|
|
72
|
+
throw new Error('cargo metadata reported no valid resolve edge kind');
|
|
73
|
+
return { kind };
|
|
74
|
+
});
|
|
75
|
+
}
|
|
62
76
|
/**
|
|
63
77
|
* Nx workers handle termination by exiting, so their exit hook kills owned
|
|
64
78
|
* Cargo groups. Standalone callers need signal forwarding after detaching
|
|
@@ -68,24 +82,47 @@ function parseCargoMetadata(json) {
|
|
|
68
82
|
* soon as it is spawned, and a signal that reached this process before its
|
|
69
83
|
* hooks would end it on the default action with Cargo's group left running.
|
|
70
84
|
* Uncatchable SIGKILL cannot execute either hook.
|
|
85
|
+
* Each child is kept with what it is called when something is told of it.
|
|
86
|
+
*/
|
|
87
|
+
const cargoChildren = new Map();
|
|
88
|
+
/**
|
|
89
|
+
* Ends the child's process group, and keeps ending it while the kernel lists members: a member forked as the signal
|
|
90
|
+
* goes out survives it, and one that holds Cargo's output pipe keeps `close` from ever coming, so the call would never
|
|
91
|
+
* settle. Every caller is synchronous, so the child stays unreaped until this returns and the kernel lists it as a
|
|
92
|
+
* member of its own group however dead it is: a group left listed cannot be told from one with a survivor, and is said
|
|
93
|
+
* on stderr as listed, not as running (`describeTeardown`). A kill that fails is said too. Neither is thrown: the
|
|
94
|
+
* callers are ending this process or failing a call, and the failure they carry, the other children still to be ended
|
|
95
|
+
* and the signal still to be given back all come before a diagnostic.
|
|
71
96
|
*/
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
if (process.platform === 'win32' || child.pid === undefined)
|
|
97
|
+
function killCargoChild(child, command) {
|
|
98
|
+
if (process.platform === 'win32' || child.pid === undefined) {
|
|
75
99
|
child.kill('SIGKILL');
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
try {
|
|
103
|
+
if (killProcessGroupNow(child.pid, TEARDOWN_PATIENCE))
|
|
104
|
+
tell(describeTeardown({ command, group: child.pid }));
|
|
105
|
+
}
|
|
106
|
+
catch (error) {
|
|
107
|
+
tell(`${command} could not be ended: ${error instanceof Error ? error.message : String(error)}`);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Says `message` on stderr, now: the exit hook and the signal handler run where nothing is awaited. Where stderr is
|
|
112
|
+
* gone there is nobody to tell, and a diagnostic must neither replace the failure it accompanies nor stop the signal
|
|
113
|
+
* being given back.
|
|
114
|
+
*/
|
|
115
|
+
function tell(message) {
|
|
116
|
+
try {
|
|
117
|
+
writeSync(2, `${message}\n`);
|
|
118
|
+
}
|
|
119
|
+
catch {
|
|
120
|
+
// Nobody is left to tell.
|
|
84
121
|
}
|
|
85
122
|
}
|
|
86
123
|
function killCargoChildren() {
|
|
87
|
-
for (const child of cargoChildren)
|
|
88
|
-
killCargoChild(child);
|
|
124
|
+
for (const [child, command] of cargoChildren)
|
|
125
|
+
killCargoChild(child, command);
|
|
89
126
|
}
|
|
90
127
|
const forwardedSignals = new Set();
|
|
91
128
|
const cargoSignalHandlers = {
|
|
@@ -98,10 +135,15 @@ function removeCargoSignalHandlers() {
|
|
|
98
135
|
process.removeListener(signal, cargoSignalHandlers[signal]);
|
|
99
136
|
forwardedSignals.clear();
|
|
100
137
|
}
|
|
138
|
+
/** Ends the children, then gives the signal back so that this process still ends by it, whatever the kill did. */
|
|
101
139
|
function forwardCargoSignal(signal) {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
140
|
+
try {
|
|
141
|
+
killCargoChildren();
|
|
142
|
+
}
|
|
143
|
+
finally {
|
|
144
|
+
removeCargoSignalHandlers();
|
|
145
|
+
process.kill(process.pid, signal);
|
|
146
|
+
}
|
|
105
147
|
}
|
|
106
148
|
function ownCargoChildren() {
|
|
107
149
|
process.on('exit', killCargoChildren);
|
|
@@ -129,6 +171,7 @@ function disownCargoChildren() {
|
|
|
129
171
|
function runCargo(args, cwd, boundMs = CARGO_RESOLVE_BOUND_MS) {
|
|
130
172
|
// spawn forwards detached groups; execFile does not. The public ES2022
|
|
131
173
|
// library API requires the constructor form, not Promise.withResolvers.
|
|
174
|
+
// eslint-disable-next-line deadline/no-unbounded-wait -- WHY unbounded: settled by the CARGO_RESOLVE_BOUND_MS timer armed inside it, which ends a cargo held behind another's lock as CargoResolveLockError
|
|
132
175
|
return new Promise((settle, reject) => {
|
|
133
176
|
// Hooks first: a signal caught from here on runs its listener after this
|
|
134
177
|
// synchronous body, by which time the child is in `cargoChildren`.
|
|
@@ -147,7 +190,8 @@ function runCargo(args, cwd, boundMs = CARGO_RESOLVE_BOUND_MS) {
|
|
|
147
190
|
disownCargoChildren();
|
|
148
191
|
throw error;
|
|
149
192
|
}
|
|
150
|
-
|
|
193
|
+
const command = `cargo ${args.join(' ')}`;
|
|
194
|
+
cargoChildren.set(child, command);
|
|
151
195
|
let stdout = '';
|
|
152
196
|
let stderr = '';
|
|
153
197
|
let stdoutBytes = 0;
|
|
@@ -155,7 +199,7 @@ function runCargo(args, cwd, boundMs = CARGO_RESOLVE_BOUND_MS) {
|
|
|
155
199
|
let failure;
|
|
156
200
|
const fail = (error) => {
|
|
157
201
|
failure ??= error;
|
|
158
|
-
killCargoChild(child);
|
|
202
|
+
killCargoChild(child, command);
|
|
159
203
|
};
|
|
160
204
|
const timer = setTimeout(() => fail(new Error(`cargo ${args.join(' ')} in ${cwd} did not finish within ${boundMs}ms; killed it, ` +
|
|
161
205
|
'because an unbounded Cargo wait hangs every project-graph construction with no output')), boundMs);
|
|
@@ -215,8 +259,6 @@ export const HASH_SKIPPED_DIRECTORIES = [
|
|
|
215
259
|
'.Spotlight-V100',
|
|
216
260
|
'.DocumentRevisions-V100',
|
|
217
261
|
];
|
|
218
|
-
/** Files in every ancestor of a package directory that Cargo reads while building it. */
|
|
219
|
-
export const CARGO_ANCESTOR_INPUTS = ['Cargo.toml', '.cargo/config', '.cargo/config.toml'];
|
|
220
262
|
/**
|
|
221
263
|
* Cargo owns resolution, including workspace inheritance, target dependencies,
|
|
222
264
|
* patches, and transitive path dependencies. A locked offline query observes
|
|
@@ -270,8 +312,8 @@ export class CargoMetadataError extends Error {
|
|
|
270
312
|
}
|
|
271
313
|
}
|
|
272
314
|
const resolves = new Map();
|
|
273
|
-
//
|
|
274
|
-
const RESOLVE_CACHE_SCHEMA = 'cargo-resolve-
|
|
315
|
+
// v3 retains each resolve edge's dependency kinds, which decide what Cargo builds for a selected package.
|
|
316
|
+
const RESOLVE_CACHE_SCHEMA = 'cargo-resolve-v3';
|
|
275
317
|
/**
|
|
276
318
|
* The longest one Cargo child, or one wait for a foreign resolve flight's lock, may take.
|
|
277
319
|
* Both waits sit on every project-graph construction, so an unbounded one is a silent,
|
|
@@ -376,9 +418,13 @@ function cargoFromMetadata(metadata) {
|
|
|
376
418
|
governingManifest: pkg.governing_manifest_path,
|
|
377
419
|
};
|
|
378
420
|
}),
|
|
421
|
+
locked: new Map(metadata.packages.flatMap((pkg) => (pkg.source === null ? [] : [[pkg.id, pkg.source]]))),
|
|
379
422
|
edges: metadata.resolve === null
|
|
380
423
|
? null
|
|
381
|
-
: new Map(metadata.resolve.nodes.map((node) => [
|
|
424
|
+
: new Map(metadata.resolve.nodes.map((node) => [
|
|
425
|
+
node.id,
|
|
426
|
+
node.deps.map((dep) => ({ pkg: dep.pkg, devOnly: dep.dep_kinds.every(({ kind }) => kind === 'dev') })),
|
|
427
|
+
])),
|
|
382
428
|
};
|
|
383
429
|
}
|
|
384
430
|
async function loadResolveCache(file) {
|
|
@@ -583,6 +629,8 @@ export class CargoResolveLockError extends Error {
|
|
|
583
629
|
this.name = 'CargoResolveLockError';
|
|
584
630
|
}
|
|
585
631
|
}
|
|
632
|
+
/** What the child that waits for the Cargo resolve lock is called when something is told of it. */
|
|
633
|
+
const LOCK_WAITER = 'the Cargo resolve lock waiter';
|
|
586
634
|
/**
|
|
587
635
|
* The pinned Nx binding has only blocking acquisition. Isolate that syscall in
|
|
588
636
|
* one child per cold flight so the caller's deadline can kill and reap it.
|
|
@@ -599,6 +647,7 @@ export function acquireCargoResolveLock(lockFile, boundMs) {
|
|
|
599
647
|
"process.stdin.on('end', () => { lock.unlock(); process.exit(0); });",
|
|
600
648
|
].join('\n');
|
|
601
649
|
// The public ES2022 library API requires the constructor form, not Promise.withResolvers.
|
|
650
|
+
// eslint-disable-next-line deadline/no-unbounded-wait -- WHY unbounded: settled by the boundMs timer armed inside it, which ends the lock waiter as CargoResolveLockError
|
|
602
651
|
return new Promise((settle, reject) => {
|
|
603
652
|
const started = performance.now();
|
|
604
653
|
const child = spawn(process.execPath, ['--eval', program], {
|
|
@@ -612,9 +661,10 @@ export function acquireCargoResolveLock(lockFile, boundMs) {
|
|
|
612
661
|
let stderr = '';
|
|
613
662
|
const fail = (error) => {
|
|
614
663
|
failure ??= error;
|
|
615
|
-
killCargoChild(child);
|
|
664
|
+
killCargoChild(child, LOCK_WAITER);
|
|
616
665
|
};
|
|
617
666
|
const timer = setTimeout(() => fail(new CargoResolveLockError(lockFile, boundMs, Math.ceil(performance.now() - started), child.pid)), boundMs);
|
|
667
|
+
// eslint-disable-next-line deadline/no-unbounded-wait -- WHY unbounded: the waiter's close after the boundMs timer above settled or killed it; a killed child's close follows its SIGKILL
|
|
618
668
|
const closed = new Promise((finish) => {
|
|
619
669
|
child.on('close', (code, signal) => {
|
|
620
670
|
clearTimeout(timer);
|
|
@@ -668,7 +718,7 @@ export function acquireCargoResolveLock(lockFile, boundMs) {
|
|
|
668
718
|
child.stderr.on('error', fail);
|
|
669
719
|
if (cargoChildren.size === 0)
|
|
670
720
|
ownCargoChildren();
|
|
671
|
-
cargoChildren.
|
|
721
|
+
cargoChildren.set(child, LOCK_WAITER);
|
|
672
722
|
});
|
|
673
723
|
}
|
|
674
724
|
async function resolveCargoMetadata(manifestPath, cwd, boundMs = CARGO_RESOLVE_BOUND_MS) {
|
|
@@ -729,10 +779,10 @@ export async function hashCargoPathInputs(manifestPath, workspaceRoot, options)
|
|
|
729
779
|
const fromRoot = relative(root, directory);
|
|
730
780
|
const fromCargo = relative(cargo.root, directory);
|
|
731
781
|
if (fromRoot !== '..' &&
|
|
732
|
-
!fromRoot.startsWith(
|
|
782
|
+
!fromRoot.startsWith(`..${sep}`) &&
|
|
733
783
|
!isAbsolute(fromRoot) &&
|
|
734
784
|
fromCargo !== '..' &&
|
|
735
|
-
!fromCargo.startsWith(
|
|
785
|
+
!fromCargo.startsWith(`..${sep}`) &&
|
|
736
786
|
!isAbsolute(fromCargo) &&
|
|
737
787
|
!fromRoot.split(sep).includes('node_modules'))
|
|
738
788
|
continue;
|
|
@@ -747,7 +797,7 @@ export async function hashCargoPathInputs(manifestPath, workspaceRoot, options)
|
|
|
747
797
|
for (const name of CARGO_ANCESTOR_INPUTS) {
|
|
748
798
|
const file = join(ancestor, name);
|
|
749
799
|
if (statSync(file, { throwIfNoEntry: false })?.isFile()) {
|
|
750
|
-
includeFile(await realpath(file), inputKey(pkg, 'ancestor', depth
|
|
800
|
+
includeFile(await realpath(file), inputKey(pkg, 'ancestor', `${depth}/${name}`));
|
|
751
801
|
}
|
|
752
802
|
}
|
|
753
803
|
}
|
|
@@ -769,7 +819,7 @@ export async function hashCargoPathInputs(manifestPath, workspaceRoot, options)
|
|
|
769
819
|
const path = join(canonical, entry.name);
|
|
770
820
|
if (ignored(path))
|
|
771
821
|
continue;
|
|
772
|
-
const localPath = within === '' ? entry.name : within
|
|
822
|
+
const localPath = within === '' ? entry.name : `${within}/${entry.name}`;
|
|
773
823
|
if (entry.isSymbolicLink())
|
|
774
824
|
links.set(path, { key: inputKey(owner, 'link', localPath), target: await readlink(path) });
|
|
775
825
|
const info = entry.isSymbolicLink() ? await lstat(await realpath(path)) : entry;
|
|
@@ -794,7 +844,7 @@ export async function hashCargoPathInputs(manifestPath, workspaceRoot, options)
|
|
|
794
844
|
for (const source of scan.sources)
|
|
795
845
|
scans.set(source, scan);
|
|
796
846
|
// Equal package identities can interleave, so their discovery shares one boundary.
|
|
797
|
-
const prefix = JSON.stringify([owner.name, owner.version]).slice(0, -1)
|
|
847
|
+
const prefix = `${JSON.stringify([owner.name, owner.version]).slice(0, -1)},`;
|
|
798
848
|
const group = groups.get(prefix);
|
|
799
849
|
if (group === undefined)
|
|
800
850
|
groups.set(prefix, [scan]);
|
|
@@ -830,7 +880,7 @@ export async function hashCargoPathInputs(manifestPath, workspaceRoot, options)
|
|
|
830
880
|
// All ordinary sources have a file identity before this package's include identities.
|
|
831
881
|
// Earlier includes may already have consumed a later package's source; only its
|
|
832
882
|
// discovered references survive that boundary, never the source buffer.
|
|
833
|
-
const boundary = prefix
|
|
883
|
+
const boundary = `${prefix}"include",`;
|
|
834
884
|
while (next < scheduled.length && scheduled[next].key < boundary)
|
|
835
885
|
await consume(scheduled[next++]);
|
|
836
886
|
const included = [];
|
|
@@ -845,7 +895,7 @@ export async function hashCargoPathInputs(manifestPath, workspaceRoot, options)
|
|
|
845
895
|
for (const input of [...scan.found.values()].sort((left, right) => left.file < right.file ? -1 : left.file > right.file ? 1 : 0)) {
|
|
846
896
|
if (ignored(input.file))
|
|
847
897
|
continue;
|
|
848
|
-
const accepted = includeFile(await realpath(input.file), inputKey(scan.owner, 'include', relative(scan.directory, input.source)
|
|
898
|
+
const accepted = includeFile(await realpath(input.file), inputKey(scan.owner, 'include', `${relative(scan.directory, input.source)}\0${input.literal}`));
|
|
849
899
|
if (accepted !== undefined)
|
|
850
900
|
included.push(accepted);
|
|
851
901
|
}
|
|
@@ -861,26 +911,37 @@ export async function hashCargoPathInputs(manifestPath, workspaceRoot, options)
|
|
|
861
911
|
return hash.digest('hex');
|
|
862
912
|
}
|
|
863
913
|
/**
|
|
864
|
-
*
|
|
865
|
-
*
|
|
866
|
-
* build scripts, and any of those compiles the edge's source.
|
|
914
|
+
* What Cargo builds for the local packages under `directory`, as {@link buildClosure} computes it with those packages
|
|
915
|
+
* selected.
|
|
867
916
|
*/
|
|
868
917
|
export async function dependencyClosure(cargo, directory) {
|
|
869
918
|
const base = await realpath(directory);
|
|
870
|
-
const
|
|
919
|
+
const selected = cargo.local
|
|
871
920
|
.filter((pkg) => pkg.directory === base || pkg.directory.startsWith(`${base}${sep}`))
|
|
872
921
|
.map((pkg) => pkg.id);
|
|
873
|
-
if (
|
|
922
|
+
if (selected.length === 0)
|
|
874
923
|
throw new Error(`no local Cargo package lies under ${directory}`);
|
|
924
|
+
return buildClosure(cargo, selected);
|
|
925
|
+
}
|
|
926
|
+
/**
|
|
927
|
+
* The packages Cargo compiles to build, test or run the `selected` ones, each with the dependencies Cargo builds for
|
|
928
|
+
* it. A selected package's targets reach every dependency kind: its library and binaries the normal ones, its build
|
|
929
|
+
* script the build ones, its tests, examples and benches the dev ones. Below the selection Cargo builds a package for
|
|
930
|
+
* its library and build script alone, so a dependency's own dev-dependencies never compile into a selected package's
|
|
931
|
+
* binaries and are not part of what it builds.
|
|
932
|
+
*/
|
|
933
|
+
export function buildClosure(cargo, selected) {
|
|
875
934
|
if (cargo.edges === null)
|
|
876
935
|
throw new Error('cargo metadata reported no dependency resolution');
|
|
877
|
-
const
|
|
936
|
+
const roots = new Set(selected);
|
|
937
|
+
const reached = new Map();
|
|
938
|
+
const pending = [...selected];
|
|
878
939
|
for (let id = pending.pop(); id !== undefined; id = pending.pop()) {
|
|
879
940
|
if (reached.has(id))
|
|
880
941
|
continue;
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
942
|
+
const built = (cargo.edges.get(id) ?? []).filter((edge) => roots.has(id) || !edge.devOnly).map((edge) => edge.pkg);
|
|
943
|
+
reached.set(id, built);
|
|
944
|
+
pending.push(...built);
|
|
884
945
|
}
|
|
885
946
|
return reached;
|
|
886
947
|
}
|
|
@@ -911,6 +972,7 @@ function gitIgnoredBeneath(directories) {
|
|
|
911
972
|
if (sourceRoots.length === 0)
|
|
912
973
|
continue;
|
|
913
974
|
const installed = [...ignoredRoots].map((member) => join(repository, member));
|
|
975
|
+
// eslint-disable-next-line deadline/no-unbounded-wait -- WHY unbounded: a local git file listing whose length is its own read of this repository: it asks no remote, and a held index.lock fails it at once rather than waiting, so only the operator's interrupt ends a hung one
|
|
914
976
|
const listing = execFileSync('git', [
|
|
915
977
|
...ISOLATED_GIT_ARGS,
|
|
916
978
|
'--literal-pathspecs',
|
|
@@ -942,6 +1004,7 @@ function gitIgnoredBeneath(directories) {
|
|
|
942
1004
|
}
|
|
943
1005
|
/** The members of `paths` (relative to `repository`) that git ignores, own patterns or an ancestor's. */
|
|
944
1006
|
function gitCheckIgnore(repository, paths) {
|
|
1007
|
+
// eslint-disable-next-line deadline/no-unbounded-wait -- WHY unbounded: a local git ignore check of the paths on its stdin: it asks no remote, and a held index.lock fails it at once rather than waiting, so only the operator's interrupt ends a hung one
|
|
945
1008
|
const result = spawnSync('git', [...ISOLATED_GIT_ARGS, '-C', repository, 'check-ignore', '-z', '--stdin'], {
|
|
946
1009
|
input: `${paths.join('\0')}\0`,
|
|
947
1010
|
encoding: 'utf8',
|
|
@@ -960,7 +1023,9 @@ function gitCheckIgnore(repository, paths) {
|
|
|
960
1023
|
function gitRepository(directory) {
|
|
961
1024
|
try {
|
|
962
1025
|
// The walk compares realpaths, so git's answer is canonicalized the same way.
|
|
963
|
-
return realpathSync(
|
|
1026
|
+
return realpathSync(
|
|
1027
|
+
// eslint-disable-next-line deadline/no-unbounded-wait -- WHY unbounded: a local git work-tree lookup: it asks no remote, and a held index.lock fails it at once rather than waiting, so only the operator's interrupt ends a hung one
|
|
1028
|
+
execFileSync('git', [...ISOLATED_GIT_ARGS, '-C', directory, 'rev-parse', '--show-toplevel'], {
|
|
964
1029
|
encoding: 'utf8',
|
|
965
1030
|
stdio: CHILD_STDIO,
|
|
966
1031
|
env: isolatedGitEnv(),
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The programs the shell declares for Cargo to compile and link with, each named by the Nix store object it is: the
|
|
3
|
+
* half of a cargo task's toolchain identity that no file states.
|
|
4
|
+
*
|
|
5
|
+
* `devenv.lock` locks the inputs, not what the shell builds from them. A patch to the linker moves no byte of the lock
|
|
6
|
+
* and no line of `rustc -vV`, yet it changes what links every unit. Hashing the shell's Nix sources instead was
|
|
7
|
+
* measured to rekey every cargo verdict on every unrelated shell edit (the managed module alone changed 43 times in 30
|
|
8
|
+
* days). The store object is the fact itself: devenv evaluates a package to the path of a derivation whose hash covers
|
|
9
|
+
* everything it was built from, so the path moves when the toolchain moves, once, and not when anything else in the
|
|
10
|
+
* shell does.
|
|
11
|
+
*
|
|
12
|
+
* What counts is what Cargo keys on. The linker of each target is `CARGO_TARGET_<TRIPLE>_LINKER`, which Cargo hashes
|
|
13
|
+
* into every unit. The programs cc-rs runs for build scripts are `CC`, `CXX`, `AR` and `RANLIB` (generic, per target,
|
|
14
|
+
* and their `HOST_` and `TARGET_` forms), each of which cc-rs declares `rerun-if-env-changed`. Flag variables name no
|
|
15
|
+
* program. The wrapper devenv builds for a Linux linker names its clang and its lld, so a change to either moves that
|
|
16
|
+
* wrapper's object, and one entry covers all three.
|
|
17
|
+
*
|
|
18
|
+
* rustc and cargo are not here on purpose. Cargo keys units on the output of `rustc -vV`, never on rustc's path, and the
|
|
19
|
+
* version recipe beside this one hashes it. On a non-Linux host the default shell and its linux-cross profile carry
|
|
20
|
+
* different rust-std targets, so a rustc path would split the pre-push probe from the cached cross-check verdict.
|
|
21
|
+
*
|
|
22
|
+
* Only a path in the Nix store counts. A store object is named by the hash of everything it was built from, so one
|
|
23
|
+
* shell gives one object on every machine of a platform. A path elsewhere belongs to the machine and takes no part.
|
|
24
|
+
*/
|
|
25
|
+
export declare const NIX_STORE_ROOT = "/nix/store";
|
|
26
|
+
export interface CargoToolchainProbe {
|
|
27
|
+
readonly environment: Readonly<Record<string, string | undefined>>;
|
|
28
|
+
readonly storeRoot: string;
|
|
29
|
+
/** What `program` is once every link is followed, or undefined where it names no executable file. */
|
|
30
|
+
readonly resolve: (program: string) => string | undefined;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* One `NAME store-object` line, in name order, for each program variable whose program lives in the store; empty where
|
|
34
|
+
* the shell declares none. A variable holds a program name or path, then arguments (`ccache cc`): the first word is
|
|
35
|
+
* the program, a bare name is looked up on PATH.
|
|
36
|
+
*/
|
|
37
|
+
export declare function cargoToolchainPaths(probe: CargoToolchainProbe): string;
|
|
38
|
+
/** The real path of `program`: itself where it holds a path, else the first executable file `searchPath` names. */
|
|
39
|
+
export declare function resolveProgram(program: string, searchPath: string | undefined): string | undefined;
|
|
40
|
+
//# sourceMappingURL=cargo-toolchain-paths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cargo-toolchain-paths.d.ts","sourceRoot":"","sources":["../src/cargo-toolchain-paths.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,cAAc,eAAe,CAAC;AAM3C,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC;IACnE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,qGAAqG;IACrG,QAAQ,CAAC,OAAO,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;CAC3D;AAUD;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,mBAAmB,GAAG,MAAM,CAWtE;AAKD,mHAAmH;AACnH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAwBlG"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { accessSync, constants, realpathSync } from 'node:fs';
|
|
2
|
+
import { delimiter, join } from 'node:path';
|
|
3
|
+
/**
|
|
4
|
+
* The programs the shell declares for Cargo to compile and link with, each named by the Nix store object it is: the
|
|
5
|
+
* half of a cargo task's toolchain identity that no file states.
|
|
6
|
+
*
|
|
7
|
+
* `devenv.lock` locks the inputs, not what the shell builds from them. A patch to the linker moves no byte of the lock
|
|
8
|
+
* and no line of `rustc -vV`, yet it changes what links every unit. Hashing the shell's Nix sources instead was
|
|
9
|
+
* measured to rekey every cargo verdict on every unrelated shell edit (the managed module alone changed 43 times in 30
|
|
10
|
+
* days). The store object is the fact itself: devenv evaluates a package to the path of a derivation whose hash covers
|
|
11
|
+
* everything it was built from, so the path moves when the toolchain moves, once, and not when anything else in the
|
|
12
|
+
* shell does.
|
|
13
|
+
*
|
|
14
|
+
* What counts is what Cargo keys on. The linker of each target is `CARGO_TARGET_<TRIPLE>_LINKER`, which Cargo hashes
|
|
15
|
+
* into every unit. The programs cc-rs runs for build scripts are `CC`, `CXX`, `AR` and `RANLIB` (generic, per target,
|
|
16
|
+
* and their `HOST_` and `TARGET_` forms), each of which cc-rs declares `rerun-if-env-changed`. Flag variables name no
|
|
17
|
+
* program. The wrapper devenv builds for a Linux linker names its clang and its lld, so a change to either moves that
|
|
18
|
+
* wrapper's object, and one entry covers all three.
|
|
19
|
+
*
|
|
20
|
+
* rustc and cargo are not here on purpose. Cargo keys units on the output of `rustc -vV`, never on rustc's path, and the
|
|
21
|
+
* version recipe beside this one hashes it. On a non-Linux host the default shell and its linux-cross profile carry
|
|
22
|
+
* different rust-std targets, so a rustc path would split the pre-push probe from the cached cross-check verdict.
|
|
23
|
+
*
|
|
24
|
+
* Only a path in the Nix store counts. A store object is named by the hash of everything it was built from, so one
|
|
25
|
+
* shell gives one object on every machine of a platform. A path elsewhere belongs to the machine and takes no part.
|
|
26
|
+
*/
|
|
27
|
+
export const NIX_STORE_ROOT = '/nix/store';
|
|
28
|
+
/** The variables naming a program Cargo or one of its build scripts runs. */
|
|
29
|
+
const PROGRAM_VARIABLE = /^(?:CARGO_TARGET_[A-Z0-9_]+_LINKER|(?:CC|CXX|AR|RANLIB)(?:_[a-z].*)?|(?:HOST_|TARGET_)(?:CC|CXX|AR|RANLIB))$/;
|
|
30
|
+
/** The store object holding `path`, whichever of its files the path names, or undefined outside the store. */
|
|
31
|
+
function storeObject(path, storeRoot) {
|
|
32
|
+
const prefix = `${storeRoot}/`;
|
|
33
|
+
if (!path.startsWith(prefix))
|
|
34
|
+
return undefined;
|
|
35
|
+
const [object] = path.slice(prefix.length).split('/', 1);
|
|
36
|
+
return object === undefined || object === '' ? undefined : `${prefix}${object}`;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* One `NAME store-object` line, in name order, for each program variable whose program lives in the store; empty where
|
|
40
|
+
* the shell declares none. A variable holds a program name or path, then arguments (`ccache cc`): the first word is
|
|
41
|
+
* the program, a bare name is looked up on PATH.
|
|
42
|
+
*/
|
|
43
|
+
export function cargoToolchainPaths(probe) {
|
|
44
|
+
const lines = [];
|
|
45
|
+
for (const name of Object.keys(probe.environment).sort()) {
|
|
46
|
+
if (!PROGRAM_VARIABLE.test(name))
|
|
47
|
+
continue;
|
|
48
|
+
const program = probe.environment[name]?.trim().split(/\s+/, 1)[0];
|
|
49
|
+
if (program === undefined || program === '')
|
|
50
|
+
continue;
|
|
51
|
+
const resolved = probe.resolve(program);
|
|
52
|
+
const object = resolved === undefined ? undefined : storeObject(resolved, probe.storeRoot);
|
|
53
|
+
if (object !== undefined)
|
|
54
|
+
lines.push(`${name} ${object}\n`);
|
|
55
|
+
}
|
|
56
|
+
return lines.join('');
|
|
57
|
+
}
|
|
58
|
+
/** Errors that say a candidate is not a program, as opposed to a machine that cannot be read. */
|
|
59
|
+
const NOT_A_PROGRAM = new Set(['ENOENT', 'ENOTDIR', 'EACCES', 'ELOOP', 'ENAMETOOLONG']);
|
|
60
|
+
/** The real path of `program`: itself where it holds a path, else the first executable file `searchPath` names. */
|
|
61
|
+
export function resolveProgram(program, searchPath) {
|
|
62
|
+
const candidates = program.includes('/')
|
|
63
|
+
? [program]
|
|
64
|
+
: (searchPath ?? '')
|
|
65
|
+
.split(delimiter)
|
|
66
|
+
.filter((directory) => directory !== '')
|
|
67
|
+
.map((directory) => join(directory, program));
|
|
68
|
+
for (const candidate of candidates) {
|
|
69
|
+
try {
|
|
70
|
+
accessSync(candidate, constants.X_OK);
|
|
71
|
+
return realpathSync(candidate);
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
if (error instanceof Error &&
|
|
75
|
+
'code' in error &&
|
|
76
|
+
typeof error.code === 'string' &&
|
|
77
|
+
NOT_A_PROGRAM.has(error.code)) {
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
throw error;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return undefined;
|
|
84
|
+
}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* The DECLARED pin, hashed as an ordinary file. devenv resolves this lock into
|
|
8
8
|
* the rustc, cargo, linker, C toolchain and SDK that every cargo command
|
|
9
9
|
* inherits, so a bump here is exactly the event that must invalidate a cached
|
|
10
|
-
* artifact — and it is the
|
|
10
|
+
* artifact — and it is the half of the identity that a file can state portably.
|
|
11
11
|
*
|
|
12
12
|
* This replaces a runtime input that dumped the ambient cargo environment
|
|
13
13
|
* (every `CARGO_`, `RUST`, `CC`, `CXX`, `AR`, `SDKROOT`, `LIBCLANG_PATH`,
|
|
@@ -39,15 +39,30 @@
|
|
|
39
39
|
* `rust-toolchain*` entries already rely on.
|
|
40
40
|
*/
|
|
41
41
|
export declare const CARGO_TOOLCHAIN_PIN_INPUTS: readonly string[];
|
|
42
|
+
/** The runtime input of the programs the shell declares, a fresh value for each caller. */
|
|
43
|
+
export declare function cargoToolchainPathsInput(): {
|
|
44
|
+
runtime: string;
|
|
45
|
+
};
|
|
46
|
+
/** An input of a resolved list that can carry the identity: a fileset, or a runtime command. */
|
|
47
|
+
export type ReachedInput = string | {
|
|
48
|
+
readonly runtime: string;
|
|
49
|
+
};
|
|
50
|
+
/** Every input a cargo task's key names of its toolchain: the pin files, then the programs the shell declares. */
|
|
51
|
+
export declare function cargoToolchainInputs(): (string | {
|
|
52
|
+
runtime: string;
|
|
53
|
+
})[];
|
|
42
54
|
/**
|
|
43
|
-
* The name a repository's own `inputs` declaration uses to reach the
|
|
44
|
-
* without restating
|
|
55
|
+
* The name a repository's own `inputs` declaration uses to reach the whole
|
|
56
|
+
* toolchain identity without restating it.
|
|
45
57
|
*
|
|
46
58
|
* A declared target REPLACES the inferred input list, pin included, so a
|
|
47
59
|
* hand-written `inputs` array silently drops the toolchain identity and the
|
|
48
60
|
* target stops seeing a toolchain bump at all. Inference defines this named
|
|
49
61
|
* input on every project that has cargo targets so a declaration can name one
|
|
50
62
|
* token that cannot drift from what the plugin attaches.
|
|
63
|
+
*
|
|
64
|
+
* The identity holds an input no fileset can state, so a declaration names this
|
|
65
|
+
* rather than restating the lock.
|
|
51
66
|
*/
|
|
52
67
|
export declare const CARGO_TOOLCHAIN_NAMED_INPUT = "cargoToolchain";
|
|
53
68
|
/** The toolchain versions `command` prints, from the directory whose rust-toolchain selects them. */
|
|
@@ -55,11 +70,13 @@ export declare function cargoRuntimeInput(projectRoot: string, command: string):
|
|
|
55
70
|
runtime: string;
|
|
56
71
|
};
|
|
57
72
|
/**
|
|
58
|
-
* Does
|
|
73
|
+
* Does a resolved input list carry the toolchain identity?
|
|
59
74
|
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
75
|
+
* `reached` is what a declaration's inputs hold once their named inputs are resolved. The inference-owned
|
|
76
|
+
* `cargoToolchain`, left unresolved, stands for the whole identity. Otherwise the list must hold both halves itself: a
|
|
77
|
+
* devenv lock that nothing in the list excludes, and the programs runtime input exactly as inference spells it. A lock
|
|
78
|
+
* restated without the programs is refused, however it is reached: no fileset can state the programs the shell
|
|
79
|
+
* declares, so a list that stops at the lock misses a change to the linker.
|
|
63
80
|
*/
|
|
64
|
-
export declare function
|
|
81
|
+
export declare function carriesCargoToolchain(reached: readonly ReachedInput[]): boolean;
|
|
65
82
|
//# sourceMappingURL=cargo-toolchain-policy.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cargo-toolchain-policy.d.ts","sourceRoot":"","sources":["../src/cargo-toolchain-policy.ts"],"names":[],"mappings":"AACA;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,eAAO,MAAM,0BAA0B,EAAE,SAAS,MAAM,EAGvD,CAAC;
|
|
1
|
+
{"version":3,"file":"cargo-toolchain-policy.d.ts","sourceRoot":"","sources":["../src/cargo-toolchain-policy.ts"],"names":[],"mappings":"AACA;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,eAAO,MAAM,0BAA0B,EAAE,SAAS,MAAM,EAGvD,CAAC;AASF,2FAA2F;AAC3F,wBAAgB,wBAAwB,IAAI;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAE9D;AAED,gGAAgG;AAChG,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAEjE,kHAAkH;AAClH,wBAAgB,oBAAoB,IAAI,CAAC,MAAM,GAAG;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,EAAE,CAEvE;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,2BAA2B,mBAAmB,CAAC;AAE5D,qGAAqG;AACrG,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAE3F;AAaD;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,SAAS,YAAY,EAAE,GAAG,OAAO,CAU/E"}
|