@smoothbricks/nx-plugin 0.4.26 → 0.4.27
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 +994 -117
- package/dist/bin/smoo-nx-bound-failures.d.ts +3 -0
- package/dist/bin/smoo-nx-bound-failures.d.ts.map +1 -0
- package/dist/bin/smoo-nx-bound-failures.js +31 -0
- package/dist/bin/smoo-nx-cargo-hash.js +28 -3
- package/dist/bin/smoo-nx-exec.js +15 -73
- package/dist/bin/smoo-nx-failures.d.ts +3 -0
- package/dist/bin/smoo-nx-failures.d.ts.map +1 -0
- package/dist/bin/smoo-nx-failures.js +3 -0
- package/dist/bin/smoo-nx-nextest-extract.js +3 -2
- package/dist/bin/smoo-nx-test-walks.d.ts +3 -0
- package/dist/bin/smoo-nx-test-walks.d.ts.map +1 -0
- package/dist/bin/smoo-nx-test-walks.js +34 -0
- package/dist/bounded-test-policy.d.ts +7 -1
- package/dist/bounded-test-policy.d.ts.map +1 -1
- package/dist/bounded-test-policy.js +101 -40
- package/dist/build-state-output-policy.d.ts +25 -0
- package/dist/build-state-output-policy.d.ts.map +1 -0
- package/dist/build-state-output-policy.js +64 -0
- package/dist/cargo-closure-input.d.ts +3 -2
- package/dist/cargo-closure-input.d.ts.map +1 -1
- package/dist/cargo-closure-input.js +16 -15
- package/dist/cargo-dev-profile.d.ts +37 -0
- package/dist/cargo-dev-profile.d.ts.map +1 -0
- package/dist/cargo-dev-profile.js +108 -0
- package/dist/cargo-source-hash.d.ts +43 -6
- package/dist/cargo-source-hash.d.ts.map +1 -1
- package/dist/cargo-source-hash.js +309 -73
- package/dist/cargo-toolchain-policy.d.ts +4 -0
- package/dist/cargo-toolchain-policy.d.ts.map +1 -1
- package/dist/cargo-toolchain-policy.js +5 -0
- package/dist/cargo-workspace.d.ts +101 -5
- package/dist/cargo-workspace.d.ts.map +1 -1
- package/dist/cargo-workspace.js +291 -10
- package/dist/cross-check-policy.d.ts +21 -3
- package/dist/cross-check-policy.d.ts.map +1 -1
- package/dist/cross-check-policy.js +24 -6
- package/dist/disk-command-policy.d.ts +7 -0
- package/dist/disk-command-policy.d.ts.map +1 -0
- package/dist/disk-command-policy.js +98 -0
- package/dist/ensure-built-receipt.d.ts +25 -0
- package/dist/ensure-built-receipt.d.ts.map +1 -0
- package/dist/ensure-built-receipt.js +261 -0
- package/dist/ensure-built-witness.d.ts +57 -0
- package/dist/ensure-built-witness.d.ts.map +1 -0
- package/dist/ensure-built-witness.js +412 -0
- package/dist/ensure-built.d.ts +207 -12
- package/dist/ensure-built.d.ts.map +1 -1
- package/dist/ensure-built.js +576 -202
- package/dist/eslint-file-set.d.ts +7 -0
- package/dist/eslint-file-set.d.ts.map +1 -0
- package/dist/eslint-file-set.js +12 -0
- package/dist/executors/bounded-exec/cpu-pool.d.ts +63 -0
- package/dist/executors/bounded-exec/cpu-pool.d.ts.map +1 -0
- package/dist/executors/bounded-exec/cpu-pool.js +379 -0
- package/dist/executors/bounded-exec/cpu-tokens.d.ts +82 -0
- package/dist/executors/bounded-exec/cpu-tokens.d.ts.map +1 -0
- package/dist/executors/bounded-exec/cpu-tokens.js +114 -0
- package/dist/executors/bounded-exec/disk-lease.d.ts +61 -0
- package/dist/executors/bounded-exec/disk-lease.d.ts.map +1 -0
- package/dist/executors/bounded-exec/disk-lease.js +91 -0
- package/dist/executors/bounded-exec/executor.d.ts +45 -2
- package/dist/executors/bounded-exec/executor.d.ts.map +1 -1
- package/dist/executors/bounded-exec/executor.js +447 -52
- package/dist/executors/bounded-exec/gateway-lease.d.ts +52 -0
- package/dist/executors/bounded-exec/gateway-lease.d.ts.map +1 -0
- package/dist/executors/bounded-exec/gateway-lease.js +143 -0
- package/dist/executors/bounded-exec/hang-diagnostics.d.ts +35 -0
- package/dist/executors/bounded-exec/hang-diagnostics.d.ts.map +1 -0
- package/dist/executors/bounded-exec/hang-diagnostics.js +231 -0
- package/dist/executors/bounded-exec/progress.d.ts +35 -0
- package/dist/executors/bounded-exec/progress.d.ts.map +1 -0
- package/dist/executors/bounded-exec/progress.js +79 -0
- package/dist/executors/bounded-exec/ram-temp-fixtures.d.ts +3 -0
- package/dist/executors/bounded-exec/ram-temp-fixtures.d.ts.map +1 -0
- package/dist/executors/bounded-exec/ram-temp-fixtures.js +12 -0
- package/dist/executors/bounded-exec/ram-temp-held.d.ts +91 -0
- package/dist/executors/bounded-exec/ram-temp-held.d.ts.map +1 -0
- package/dist/executors/bounded-exec/ram-temp-held.js +152 -0
- package/dist/executors/bounded-exec/ram-temp.d.ts +223 -0
- package/dist/executors/bounded-exec/ram-temp.d.ts.map +1 -0
- package/dist/executors/bounded-exec/ram-temp.js +1528 -0
- package/dist/executors/bounded-exec/schema.d.ts +29 -11
- package/dist/executors/bounded-exec/schema.d.ts.map +1 -1
- package/dist/executors/bounded-exec/verdict.d.ts +162 -0
- package/dist/executors/bounded-exec/verdict.d.ts.map +1 -0
- package/dist/executors/bounded-exec/verdict.js +318 -0
- package/dist/executors/shard-timings/executor.d.ts +14 -0
- package/dist/executors/shard-timings/executor.d.ts.map +1 -0
- package/dist/executors/shard-timings/executor.js +25 -0
- package/dist/executors/shard-timings/schema.d.ts +4 -0
- package/dist/executors/shard-timings/schema.d.ts.map +1 -0
- package/dist/executors/shard-timings/schema.js +1 -0
- package/dist/failure-summary.d.ts +5 -0
- package/dist/failure-summary.d.ts.map +1 -0
- package/dist/failure-summary.js +118 -0
- package/dist/generators/create-package/generator.d.ts.map +1 -1
- package/dist/generators/create-package/generator.js +6 -2
- package/dist/index.d.ts +14 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +370 -138
- package/dist/managed-files/ci-workflow.d.ts +13 -0
- package/dist/managed-files/ci-workflow.d.ts.map +1 -1
- package/dist/managed-files/ci-workflow.js +44 -13
- package/dist/managed-files/files.d.ts +7 -1
- package/dist/managed-files/files.d.ts.map +1 -1
- package/dist/managed-files/files.js +62 -8
- package/dist/managed-files/json-edit.d.ts +21 -0
- package/dist/managed-files/json-edit.d.ts.map +1 -0
- package/dist/managed-files/json-edit.js +295 -0
- package/dist/managed-files/managed-format.d.ts +33 -1
- package/dist/managed-files/managed-format.d.ts.map +1 -1
- package/dist/managed-files/managed-format.js +82 -2
- package/dist/managed-files/pr-preview-cleanup-workflow.d.ts +7 -0
- package/dist/managed-files/pr-preview-cleanup-workflow.d.ts.map +1 -1
- package/dist/managed-files/pr-preview-cleanup-workflow.js +68 -4
- package/dist/managed-files/publish-workflow.d.ts.map +1 -1
- package/dist/managed-files/publish-workflow.js +231 -48
- package/dist/managed-files/tree.d.ts +5 -0
- package/dist/managed-files/tree.d.ts.map +1 -1
- package/dist/managed-files/tree.js +5 -3
- package/dist/manifest-hash.d.ts.map +1 -1
- package/dist/manifest-hash.js +2 -5
- package/dist/nextest-code-bound.d.ts +62 -0
- package/dist/nextest-code-bound.d.ts.map +1 -0
- package/dist/nextest-code-bound.js +154 -0
- package/dist/nextest-extraction.d.ts +24 -8
- package/dist/nextest-extraction.d.ts.map +1 -1
- package/dist/nextest-extraction.js +42 -7
- package/dist/package-target-policy.d.ts.map +1 -1
- package/dist/package-target-policy.js +3 -5
- package/dist/release-config-policy.d.ts.map +1 -1
- package/dist/release-config-policy.js +3 -5
- package/dist/runtime-input.d.ts +14 -0
- package/dist/runtime-input.d.ts.map +1 -0
- package/dist/runtime-input.js +15 -0
- package/dist/rust-tokens.d.ts +11 -0
- package/dist/rust-tokens.d.ts.map +1 -0
- package/dist/rust-tokens.js +81 -0
- package/dist/task-results.d.ts +6 -0
- package/dist/task-results.d.ts.map +1 -0
- package/dist/task-results.js +61 -0
- package/dist/test-program.d.ts +54 -0
- package/dist/test-program.d.ts.map +1 -0
- package/dist/test-program.js +292 -0
- package/dist/test-timings.d.ts +71 -0
- package/dist/test-timings.d.ts.map +1 -0
- package/dist/test-timings.js +393 -0
- package/dist/test-walk-policy.d.ts +103 -0
- package/dist/test-walk-policy.d.ts.map +1 -0
- package/dist/test-walk-policy.js +657 -0
- package/dist/testing.d.ts +177 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +824 -0
- package/dist/type-guards.d.ts +3 -0
- package/dist/type-guards.d.ts.map +1 -0
- package/dist/type-guards.js +4 -0
- package/dist/typecheck-test-policy.d.ts +8 -5
- package/dist/typecheck-test-policy.d.ts.map +1 -1
- package/dist/typecheck-test-policy.js +113 -100
- package/dist/workspace-config-policy.d.ts +8 -0
- package/dist/workspace-config-policy.d.ts.map +1 -1
- package/dist/workspace-config-policy.js +175 -63
- package/dist/workspace-index.d.ts +12 -0
- package/dist/workspace-index.d.ts.map +1 -0
- package/dist/workspace-index.js +17 -0
- package/dist/workspace-manifest.d.ts +37 -0
- package/dist/workspace-manifest.d.ts.map +1 -1
- package/executors.json +5 -0
- package/loader.js +13 -11
- package/managed/raw/envrc +33 -67
- package/managed/raw/git-format-staged.yml +30 -35
- package/managed/raw/patches/nx@23.2.1.patch +3484 -0
- package/managed/raw/tooling/direnv/apple-developer.sh +83 -0
- package/managed/raw/tooling/direnv/developer-links.ts +569 -11
- package/managed/raw/tooling/direnv/devenv.smoo.nix +314 -93
- package/managed/raw/tooling/direnv/github-actions-bootstrap.sh +20 -11
- package/managed/raw/tooling/direnv/linked-snapshots.ts +845 -0
- package/managed/raw/tooling/direnv/nx-socket-dir.sh +82 -0
- package/managed/raw/tooling/direnv/repo-path +14 -2
- package/managed/raw/tooling/direnv/setup-environment.ts +962 -148
- package/managed/raw/tooling/direnv/toolchain-stamp.ts +45 -3
- package/managed/raw/tooling/direnv/ttsc-env.sh +39 -0
- package/managed/raw/tooling/git-hooks/commit-msg.sh +5 -6
- package/managed/raw/tooling/git-hooks/pre-commit.sh +7 -6
- package/managed/raw/tooling/git-hooks/pre-push.sh +20 -15
- package/managed/templates/github/actions/cache-nix-devenv/action.yml +6 -6
- package/managed/templates/github/actions/cache-node-modules/action.yml +6 -4
- package/managed/templates/github/actions/cache-nx/action.yml +1 -1
- package/managed/templates/github/actions/cache-ttsc-plugins/action.yml +1 -1
- package/managed/templates/github/actions/forgejo-artifact.cjs +99 -0
- package/managed/templates/github/actions/forgejo-download-artifact/action.yml +49 -0
- package/managed/templates/github/actions/forgejo-download-artifact/index.cjs +7 -0
- package/managed/templates/github/actions/forgejo-upload-artifact/action.yml +65 -0
- package/managed/templates/github/actions/forgejo-upload-artifact/index.cjs +7 -0
- package/managed/templates/github/actions/setup-devenv/action.yml +21 -3
- package/managed/templates/github/workflows/managed-files.yml +1 -2
- package/nextest.toml +8 -41
- package/package.json +74 -12
- package/runtime-input.sh +81 -0
- package/src/__tests__/counted-cargo.ts +33 -14
- package/src/__tests__/fixture-nx-env.ts +111 -46
- package/src/__tests__/progress-clock.ts +43 -0
- package/src/__tests__/runtime-input.ts +23 -0
- package/src/bin/smoo-nx-bound-failures.test.ts +127 -0
- package/src/bin/smoo-nx-bound-failures.ts +33 -0
- package/src/bin/smoo-nx-cargo-hash.ts +28 -3
- package/src/bin/smoo-nx-exec.ts +16 -74
- package/src/bin/smoo-nx-failures.ts +4 -0
- package/src/bin/smoo-nx-nextest-extract.ts +3 -2
- package/src/bin/smoo-nx-test-walks.ts +42 -0
- package/src/bounded-test-policy.test.ts +268 -21
- package/src/bounded-test-policy.ts +114 -42
- package/src/build-state-output-policy.test.ts +115 -0
- package/src/build-state-output-policy.ts +90 -0
- package/src/bun-bootstrap.test.ts +57 -3
- package/src/bun-file-packages.test.ts +47 -0
- package/src/cargo-closure-input.test.ts +138 -66
- package/src/cargo-closure-input.ts +17 -15
- package/src/cargo-dev-profile.ts +137 -0
- package/src/cargo-resolve-cache.test.ts +70 -1
- package/src/cargo-source-hash.test.ts +193 -97
- package/src/cargo-source-hash.ts +345 -68
- package/src/cargo-toolchain-policy.ts +6 -0
- package/src/cargo-workspace.test.ts +320 -0
- package/src/cargo-workspace.ts +336 -10
- package/src/cross-check-policy.test.ts +59 -1
- package/src/cross-check-policy.ts +25 -6
- package/src/disk-command-policy.test.ts +61 -0
- package/src/disk-command-policy.ts +107 -0
- package/src/ensure-built-receipt.test.ts +184 -0
- package/src/ensure-built-receipt.ts +263 -0
- package/src/ensure-built-witness.test.ts +344 -0
- package/src/ensure-built-witness.ts +252 -0
- package/src/ensure-built.test.ts +1036 -578
- package/src/ensure-built.ts +820 -224
- package/src/eslint-file-set.ts +9 -0
- package/src/executors/bounded-exec/cpu-pool.test.ts +454 -0
- package/src/executors/bounded-exec/cpu-pool.ts +417 -0
- package/src/executors/bounded-exec/cpu-tokens.test.ts +269 -0
- package/src/executors/bounded-exec/cpu-tokens.ts +177 -0
- package/src/executors/bounded-exec/disk-lease.test.ts +185 -0
- package/src/executors/bounded-exec/disk-lease.ts +139 -0
- package/src/executors/bounded-exec/executor-host.test.ts +778 -0
- package/src/executors/bounded-exec/executor.test.ts +1116 -63
- package/src/executors/bounded-exec/executor.ts +565 -67
- package/src/executors/bounded-exec/gateway-lease.ts +176 -0
- package/src/executors/bounded-exec/hang-diagnostics.test.ts +285 -0
- package/src/executors/bounded-exec/hang-diagnostics.ts +283 -0
- package/src/executors/bounded-exec/progress.test.ts +79 -0
- package/src/executors/bounded-exec/progress.ts +118 -0
- package/src/executors/bounded-exec/ram-temp-fixtures.ts +12 -0
- package/src/executors/bounded-exec/ram-temp-held.test.ts +264 -0
- package/src/executors/bounded-exec/ram-temp-held.ts +242 -0
- package/src/executors/bounded-exec/ram-temp-host.test.ts +605 -0
- package/src/executors/bounded-exec/ram-temp.test.ts +674 -0
- package/src/executors/bounded-exec/ram-temp.ts +1918 -0
- package/src/executors/bounded-exec/schema.json +11 -5
- package/src/executors/bounded-exec/schema.ts +27 -11
- package/src/executors/bounded-exec/verdict.test.ts +440 -0
- package/src/executors/bounded-exec/verdict.ts +433 -0
- package/src/executors/shard-timings/executor.ts +36 -0
- package/src/executors/shard-timings/schema.json +21 -0
- package/src/executors/shard-timings/schema.ts +4 -0
- package/src/failure-summary.ts +119 -0
- package/src/generators/bounded-test-targets/generator.test.ts +4 -4
- package/src/generators/bun-test-tracing/generator.test.ts +2 -2
- package/src/generators/create-package/generator.test.ts +6 -0
- package/src/generators/create-package/generator.ts +6 -2
- package/src/host-controller-wiring.test.ts +31 -0
- package/src/index.test.ts +909 -295
- package/src/index.ts +441 -143
- package/src/linked-snapshots.nx.test.ts +172 -0
- package/src/managed-files/ci-workflow.ts +54 -13
- package/src/managed-files/files.ts +65 -9
- package/src/managed-files/forgejo-artifact.test.ts +395 -0
- package/src/managed-files/generator.test.ts +60 -1
- package/src/managed-files/json-edit.test.ts +216 -0
- package/src/managed-files/json-edit.ts +290 -0
- package/src/managed-files/managed-format-json.test.ts +308 -0
- package/src/managed-files/managed-format.ts +90 -2
- package/src/managed-files/pr-preview-cleanup-workflow.ts +69 -3
- package/src/managed-files/publish-workflow.ts +285 -67
- package/src/managed-files/repo-path.test.ts +129 -0
- package/src/managed-files/trace-db-artifact.test.ts +7 -0
- package/src/managed-files/tree.ts +11 -3
- package/src/manifest-hash.ts +2 -6
- package/src/nextest-code-bound.test.ts +155 -0
- package/src/nextest-code-bound.ts +195 -0
- package/src/nextest-extraction.test.ts +37 -5
- package/src/nextest-extraction.ts +51 -9
- package/src/nextest-partitions.test.ts +427 -82
- package/src/nx-cache-bound.test.ts +5 -10
- package/src/nx-cache-restore-mtime.test.ts +170 -0
- package/src/nx-daemon-claim.test.ts +277 -0
- package/src/nx-daemon-idle-cpu.test.ts +81 -0
- package/src/nx-daemon-idle-policy.test.ts +51 -0
- package/src/nx-daemon-ignore-files.test.ts +210 -0
- package/src/nx-daemon-root-normalization.test.ts +105 -0
- package/src/nx-daemon-validity.test.ts +925 -0
- package/src/nx-dot-input-policy.test.ts +353 -0
- package/src/nx-failure-life-cycles.test.ts +207 -0
- package/src/nx-files-archive-racy.test.ts +97 -0
- package/src/nx-foreign-workspace-env.test.ts +329 -0
- package/src/nx-incomplete-run-summary.test.ts +70 -0
- package/src/nx-plugin-load-errors.test.ts +120 -0
- package/src/nx-project-resolution-cache.test.ts +176 -0
- package/src/nx-raw-inputs.test.ts +166 -0
- package/src/nx-resident-graph-workers.test.ts +7 -16
- package/src/nx-run-information.test.ts +118 -0
- package/src/nx-skipped-task-exit.test.ts +180 -0
- package/src/nx-state-location.test.ts +63 -0
- package/src/nx-store-resolution.test.ts +26 -25
- package/src/nx-task-graph-cycles.test.ts +148 -0
- package/src/nx-task-output-lease.test.ts +414 -0
- package/src/nx-use-local.test.ts +103 -0
- package/src/package-target-policy.ts +3 -6
- package/src/release-config-policy.ts +3 -6
- package/src/runtime-input.test.ts +215 -0
- package/src/runtime-input.ts +17 -0
- package/src/rust-tokens.ts +78 -0
- package/src/serial-group-wiring.test.ts +326 -0
- package/src/task-history-namespace.test.ts +87 -89
- package/src/task-results.test.ts +226 -0
- package/src/task-results.ts +75 -0
- package/src/test-program.test.ts +303 -0
- package/src/test-program.ts +341 -0
- package/src/test-timings.test.ts +240 -0
- package/src/test-timings.ts +311 -0
- package/src/test-walk-policy.test.ts +585 -0
- package/src/test-walk-policy.ts +731 -0
- package/src/testing.test.ts +509 -0
- package/src/testing.ts +922 -0
- package/src/type-guards.ts +4 -0
- package/src/typecheck-test-policy.test.ts +496 -11
- package/src/typecheck-test-policy.ts +137 -103
- package/src/workspace-config-policy.test.ts +212 -13
- package/src/workspace-config-policy.ts +101 -73
- package/src/workspace-index.ts +18 -0
- package/src/workspace-manifest.ts +41 -0
- package/test-timings.json +85 -30
- package/managed/raw/tooling/direnv/inherited-devenv.ts +0 -665
- package/managed/raw/tooling/direnv/shared-caches.sh +0 -53
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type TomlTable } from 'smol-toml';
|
|
2
|
+
import { type CompiledCargoInput } from './cargo-source-hash.js';
|
|
2
3
|
export interface CargoWorkspacePackage {
|
|
3
4
|
name: string;
|
|
4
5
|
dir: string;
|
|
@@ -52,6 +53,7 @@ export interface CargoPackageTestInputsOptions {
|
|
|
52
53
|
export interface CargoInputsCache {
|
|
53
54
|
readonly manifests: Map<string, Promise<TomlTable>>;
|
|
54
55
|
readonly nestedCrateDirs: Map<string, string[]>;
|
|
56
|
+
readonly compiledInFiles: Map<string, CompiledCargoInput[]>;
|
|
55
57
|
readonly results: Map<string, Promise<string[]>>;
|
|
56
58
|
}
|
|
57
59
|
export declare function createCargoInputsCache(): CargoInputsCache;
|
|
@@ -77,8 +79,10 @@ export declare const CARGO_TEST_ARCHIVE_TARGET = "cargo-test-archive";
|
|
|
77
79
|
* does NOT create this parent directory and fails the whole build when it is
|
|
78
80
|
* missing ("error writing to archive ... No such file or directory"), so the
|
|
79
81
|
* target mkdir's it first.
|
|
82
|
+
* The archive is an Nx-restored output, so it lives on the source volume, never
|
|
83
|
+
* beneath Cargo's symlinked target directory (16_build_volumes.md).
|
|
80
84
|
*/
|
|
81
|
-
export declare const CARGO_TEST_ARCHIVE_FILE = "
|
|
85
|
+
export declare const CARGO_TEST_ARCHIVE_FILE = ".cache/nextest/archive.tar.zst";
|
|
82
86
|
/**
|
|
83
87
|
* One foreign target triple this cargo workspace also archives its tests for.
|
|
84
88
|
*/
|
|
@@ -120,19 +124,27 @@ export declare function listCargoCrossTestTargets(absoluteProjectRoot: string):
|
|
|
120
124
|
* shards, so it never sits in one run that outgrows the target's bound.
|
|
121
125
|
*/
|
|
122
126
|
export declare const CARGO_TEST_EXCEPTIONS_SUFFIX = "exceptions";
|
|
127
|
+
/** Name prefix of the runner a serial test group gets; see `serialTestGroups`. */
|
|
128
|
+
export declare const CARGO_TEST_GROUP_PREFIX = "cargo-test-group-";
|
|
123
129
|
/**
|
|
124
130
|
* A crate on one target keeps the bare name; a split crate suffixes the piece,
|
|
125
131
|
* so `cargo-test-example-core-shard2` still reads as "example-core's tests".
|
|
126
132
|
*/
|
|
127
133
|
export declare function cargoTestPackageTargetName(packageName: string, piece?: string): string;
|
|
134
|
+
/**
|
|
135
|
+
* A serial group's runner. It selects by filter across the whole workspace, so
|
|
136
|
+
* it is no crate: `packageNameFromCargoTestTarget` reads it as none.
|
|
137
|
+
*/
|
|
138
|
+
export declare function cargoTestGroupTargetName(group: string): string;
|
|
128
139
|
/**
|
|
129
140
|
* Inverse of `cargoTestPackageTargetName`, used by the reachability policy to
|
|
130
141
|
* check that the per-crate targets cover every workspace member. Pieces of one
|
|
131
142
|
* crate collapse back to that crate, so a split crate counts as covered once.
|
|
132
143
|
*
|
|
133
|
-
* The
|
|
134
|
-
*
|
|
135
|
-
*
|
|
144
|
+
* The workspace-wide `cargo-test-*` targets are not crates: reading them as one
|
|
145
|
+
* would invent members named "compile" and "archive", and a serial group's runner
|
|
146
|
+
* would invent one named after its group. Each reports every crate's coverage
|
|
147
|
+
* against a set that can never match.
|
|
136
148
|
*/
|
|
137
149
|
export declare function packageNameFromCargoTestTarget(targetName: string): string | null;
|
|
138
150
|
/**
|
|
@@ -150,6 +162,80 @@ export declare function packageNameFromCargoTestTarget(targetName: string): stri
|
|
|
150
162
|
* Returns null when nothing is singled out, the "nothing to pin" case.
|
|
151
163
|
*/
|
|
152
164
|
export declare function exceptionalTestFilter(nextestConfigPath: string): string | null;
|
|
165
|
+
/**
|
|
166
|
+
* The only `platform` a serial group's overrides may declare: nextest's cfg for macOS. The group
|
|
167
|
+
* runs on macOS hosts only, a host decision made by the planner, never a cfg parse here.
|
|
168
|
+
*/
|
|
169
|
+
export declare const SERIAL_TEST_GROUP_PLATFORM = "cfg(target_os=\"macos\")";
|
|
170
|
+
/**
|
|
171
|
+
* Which workspace members a serial group's filter can select tests from: exactly the named
|
|
172
|
+
* packages when every clause of the filter is scoped to one, otherwise every member.
|
|
173
|
+
*/
|
|
174
|
+
export type SerialTestGroupScope = {
|
|
175
|
+
readonly kind: 'packages';
|
|
176
|
+
readonly packages: readonly string[];
|
|
177
|
+
} | {
|
|
178
|
+
readonly kind: 'workspace';
|
|
179
|
+
};
|
|
180
|
+
/**
|
|
181
|
+
* One nextest test group capped at a single thread, and the tests its overrides
|
|
182
|
+
* assign it.
|
|
183
|
+
*/
|
|
184
|
+
export interface SerialTestGroup {
|
|
185
|
+
/** The group's name, as `[test-groups]` declares it. */
|
|
186
|
+
group: string;
|
|
187
|
+
/** Every default-profile override filter that names the group, as one filterset. */
|
|
188
|
+
filter: string;
|
|
189
|
+
/** The members the filter can select from, which are the members whose sources its runner hashes. */
|
|
190
|
+
scope: SerialTestGroupScope;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* The repository's test groups capped at one thread (`max-threads = 1`), each
|
|
194
|
+
* with the tests its default-profile overrides assign it.
|
|
195
|
+
*
|
|
196
|
+
* A serial group is declared exactly once, in `.config/nextest.toml`: the name
|
|
197
|
+
* under `[test-groups]` plus the overrides that name it. Its runner's filter is
|
|
198
|
+
* derived from those overrides rather than restated, so the runner and the
|
|
199
|
+
* per-crate exclusions cannot drift from what nextest actually serializes.
|
|
200
|
+
*
|
|
201
|
+
* Each group also carries the `scope` of its filter (`filterScope`): the members its runner hashes.
|
|
202
|
+
* A group whose every clause is scoped to a `package(<name>)` reruns only when those crates or their
|
|
203
|
+
* local dependencies change; any other group is scoped to the whole workspace. Nothing here orders one
|
|
204
|
+
* group against another: they are separate runners, and a repository that needs two never concurrent
|
|
205
|
+
* declares the edge between their targets itself.
|
|
206
|
+
*
|
|
207
|
+
* Every override naming a serial group must declare `SERIAL_TEST_GROUP_PLATFORM`.
|
|
208
|
+
* This plugin has no cfg evaluator, so it honours exactly that platform and
|
|
209
|
+
* refuses any other rather than guessing where the group applies.
|
|
210
|
+
*
|
|
211
|
+
* Returns [] when the file is absent or declares no serial group, so a workspace
|
|
212
|
+
* without one keeps exactly its existing targets.
|
|
213
|
+
*/
|
|
214
|
+
export declare function serialTestGroups(nextestConfigPath: string): SerialTestGroup[];
|
|
215
|
+
/**
|
|
216
|
+
* The packages `filter` can select tests from, read off its `package(<name>)` predicates. The scope is
|
|
217
|
+
* never narrower than the selection: whatever this does not read with certainty is the whole workspace.
|
|
218
|
+
*
|
|
219
|
+
* The filter is read as nextest reads it, with nextest's precedence — parentheses, then `not` and `!`,
|
|
220
|
+
* then `and`, `&` and `-`, then `or`, `|` and `+`, each level left to right — and with nextest's blanks,
|
|
221
|
+
* which are spaces and line endings. Each expression is bounded by the packages it can select from:
|
|
222
|
+
*
|
|
223
|
+
* - `package(<name>)` and `package(=<name>)`, for a plain Cargo name, bound it to that package. A glob,
|
|
224
|
+
* `~contains`, `/regex/` or `#glob` name can match any package, so it bounds nothing.
|
|
225
|
+
* - Every other predicate bounds nothing, and nor does `not`: `not package(a)` selects from every other
|
|
226
|
+
* package, and `deps` and `rdeps` reach beyond the package they name.
|
|
227
|
+
* - `a and b` selects only what both select, so it is bounded by the narrower of the two bounds, and
|
|
228
|
+
* `a - b`, which is `a and not b`, by `a`. `a or b` is bounded by both together, so one unbounded
|
|
229
|
+
* clause leaves the union unbounded however the union is spelled.
|
|
230
|
+
*
|
|
231
|
+
* A predicate's argument ends where nextest ends it: a regex at its closing `/`, any other matcher at its
|
|
232
|
+
* first `)`. Only arguments that need none of nextest's escape sequences are read: a backslash, or a comma
|
|
233
|
+
* outside a regex, makes where the predicate ends depend on escapes this does not implement. Those, a
|
|
234
|
+
* filter that does not parse, and one whose packages exclude each other have no bound.
|
|
235
|
+
*/
|
|
236
|
+
export declare function filterScope(filter: string): SerialTestGroupScope;
|
|
237
|
+
/** The plugin's nextest.toml as the workspace root's `node_modules` links it. */
|
|
238
|
+
export declare const PLUGIN_NEXTEST_CONFIG_PATH = "node_modules/@smoothbricks/nx-plugin/nextest.toml";
|
|
153
239
|
/**
|
|
154
240
|
* The plugin's own nextest settings, as a config layer BENEATH the repository's.
|
|
155
241
|
*
|
|
@@ -168,8 +254,18 @@ export declare function exceptionalTestFilter(nextestConfigPath: string): string
|
|
|
168
254
|
* (`bounded-exec`, which spawns with `shell: true`) go through a shell — so the
|
|
169
255
|
* command text stays identical everywhere. Quoted, because a workspace path may
|
|
170
256
|
* contain spaces.
|
|
257
|
+
*
|
|
258
|
+
* The file is named through the workspace root's `node_modules` link, as
|
|
259
|
+
* `NEXTEST_EXTRACT_BIN` is, never through where the plugin really lives: a
|
|
260
|
+
* plugin linked from a checkout outside the workspace sits a different number
|
|
261
|
+
* of `../` away from each workspace depending on how deep that workspace is,
|
|
262
|
+
* and that count re-keyed every target of every Cargo project — and every
|
|
263
|
+
* dependent task — in each workspace that sat at a new depth.
|
|
264
|
+
*
|
|
265
|
+
* `projectRoot` is the Cargo workspace's root relative to the Nx workspace
|
|
266
|
+
* root, which is the directory these commands run in.
|
|
171
267
|
*/
|
|
172
|
-
export declare function nextestToolConfigArg(
|
|
268
|
+
export declare function nextestToolConfigArg(projectRoot: string): string;
|
|
173
269
|
/** The repository's own nextest config, which now layers over the plugin's. */
|
|
174
270
|
export declare const NEXTEST_REPO_CONFIG_PATH = ".config/nextest.toml";
|
|
175
271
|
//# sourceMappingURL=cargo-workspace.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cargo-workspace.d.ts","sourceRoot":"","sources":["../src/cargo-workspace.ts"],"names":[],"mappings":"AAIA,OAAO,EAAsB,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AAE/D,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,+BAAgC,SAAQ,qBAAqB;IAC5E,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,0BAA0B,CAAC,mBAAmB,EAAE,MAAM,GAAG,qBAAqB,EAAE,CAkF/F;AA0ED;;;;GAIG;AACH,wBAAgB,+BAA+B,CAC7C,QAAQ,EAAE,SAAS,qBAAqB,EAAE,EAC1C,QAAQ,EAAE,SAAS,qBAAqB,EAAE,GACzC,+BAA+B,EAAE,CAgBnC;AAED;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B,uB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BG;AACH,wBAAgB,gBAAgB,CAAC,iBAAiB,EAAE,MAAM,GAAG,eAAe,EAAE,CAuC7E;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,oBAAoB,CAMhE;AAmKD,iFAAiF;AACjF,eAAO,MAAM,0BAA0B,sDAAsD,CAAC;AAE9F;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAGhE;AAED,+EAA+E;AAC/E,eAAO,MAAM,wBAAwB,yBAAyB,CAAC"}
|
package/dist/cargo-workspace.js
CHANGED
|
@@ -3,6 +3,7 @@ import { readFile } from 'node:fs/promises';
|
|
|
3
3
|
import { dirname, isAbsolute, join, normalize, posix, relative, resolve, sep } from 'node:path';
|
|
4
4
|
import { readNxJson } from 'nx/src/config/nx-json.js';
|
|
5
5
|
import { parse as parseToml } from 'smol-toml';
|
|
6
|
+
import { compiledInFiles } from './cargo-source-hash.js';
|
|
6
7
|
export function listCargoWorkspacePackages(absoluteProjectRoot) {
|
|
7
8
|
const workspaceTomlPath = join(absoluteProjectRoot, 'Cargo.toml');
|
|
8
9
|
if (!existsSync(workspaceTomlPath)) {
|
|
@@ -170,7 +171,7 @@ export function attributeCargoWorkspacePackages(packages, projects) {
|
|
|
170
171
|
*/
|
|
171
172
|
export const EXTERNAL_RUST_CRATES_INPUT = 'externalRustCrates';
|
|
172
173
|
export function createCargoInputsCache() {
|
|
173
|
-
return { manifests: new Map(), nestedCrateDirs: new Map(), results: new Map() };
|
|
174
|
+
return { manifests: new Map(), nestedCrateDirs: new Map(), compiledInFiles: new Map(), results: new Map() };
|
|
174
175
|
}
|
|
175
176
|
export function cargoPackageTestInputs(options) {
|
|
176
177
|
const cache = options.cache ?? createCargoInputsCache();
|
|
@@ -294,6 +295,13 @@ async function deriveCargoPackageTestInputs({ workspaceRoot, absoluteProjectRoot
|
|
|
294
295
|
if (!dirs.has(childDir))
|
|
295
296
|
exclusions.add(`!${inputPath(child)}/**`);
|
|
296
297
|
}
|
|
298
|
+
// `include_str!("../../../skills/SKILL.md")` compiles a file the package's own
|
|
299
|
+
// fileset does not reach; a target that does not hash it serves a binary
|
|
300
|
+
// built from the file's old bytes.
|
|
301
|
+
for (const { file } of compiledInFiles(absoluteDir, cache.compiledInFiles)) {
|
|
302
|
+
if (isOutsideRoot(relative(absoluteDir, file)))
|
|
303
|
+
declaredSources.add(file);
|
|
304
|
+
}
|
|
297
305
|
}
|
|
298
306
|
for (const source of [...declaredSources].sort()) {
|
|
299
307
|
const sourceRelative = relative(workspaceRoot, source);
|
|
@@ -505,8 +513,10 @@ export const CARGO_TEST_ARCHIVE_TARGET = 'cargo-test-archive';
|
|
|
505
513
|
* does NOT create this parent directory and fails the whole build when it is
|
|
506
514
|
* missing ("error writing to archive ... No such file or directory"), so the
|
|
507
515
|
* target mkdir's it first.
|
|
516
|
+
* The archive is an Nx-restored output, so it lives on the source volume, never
|
|
517
|
+
* beneath Cargo's symlinked target directory (16_build_volumes.md).
|
|
508
518
|
*/
|
|
509
|
-
export const CARGO_TEST_ARCHIVE_FILE = '
|
|
519
|
+
export const CARGO_TEST_ARCHIVE_FILE = '.cache/nextest/archive.tar.zst';
|
|
510
520
|
/**
|
|
511
521
|
* Foreign target triples this cargo workspace archives tests for, from
|
|
512
522
|
* `[workspace.metadata.smoothbricks.test] cross-targets`. An entry is either
|
|
@@ -572,27 +582,43 @@ export function listCargoCrossTestTargets(absoluteProjectRoot) {
|
|
|
572
582
|
* shards, so it never sits in one run that outgrows the target's bound.
|
|
573
583
|
*/
|
|
574
584
|
export const CARGO_TEST_EXCEPTIONS_SUFFIX = 'exceptions';
|
|
585
|
+
/** Name prefix of the runner a serial test group gets; see `serialTestGroups`. */
|
|
586
|
+
export const CARGO_TEST_GROUP_PREFIX = 'cargo-test-group-';
|
|
575
587
|
/**
|
|
576
588
|
* A crate on one target keeps the bare name; a split crate suffixes the piece,
|
|
577
589
|
* so `cargo-test-example-core-shard2` still reads as "example-core's tests".
|
|
578
590
|
*/
|
|
579
591
|
export function cargoTestPackageTargetName(packageName, piece) {
|
|
580
592
|
const base = `cargo-test-${packageName}`;
|
|
581
|
-
|
|
593
|
+
const name = piece === undefined ? base : `${base}-${piece}`;
|
|
594
|
+
// A crate named `group-*` would take the name of a serial group's runner.
|
|
595
|
+
if (name.startsWith(CARGO_TEST_GROUP_PREFIX)) {
|
|
596
|
+
throw new Error(`cargo crate ${packageName} would be named ${name}, reserved for a nextest test group runner`);
|
|
597
|
+
}
|
|
598
|
+
return name;
|
|
599
|
+
}
|
|
600
|
+
/**
|
|
601
|
+
* A serial group's runner. It selects by filter across the whole workspace, so
|
|
602
|
+
* it is no crate: `packageNameFromCargoTestTarget` reads it as none.
|
|
603
|
+
*/
|
|
604
|
+
export function cargoTestGroupTargetName(group) {
|
|
605
|
+
return `${CARGO_TEST_GROUP_PREFIX}${group}`;
|
|
582
606
|
}
|
|
583
607
|
/**
|
|
584
608
|
* Inverse of `cargoTestPackageTargetName`, used by the reachability policy to
|
|
585
609
|
* check that the per-crate targets cover every workspace member. Pieces of one
|
|
586
610
|
* crate collapse back to that crate, so a split crate counts as covered once.
|
|
587
611
|
*
|
|
588
|
-
* The
|
|
589
|
-
*
|
|
590
|
-
*
|
|
612
|
+
* The workspace-wide `cargo-test-*` targets are not crates: reading them as one
|
|
613
|
+
* would invent members named "compile" and "archive", and a serial group's runner
|
|
614
|
+
* would invent one named after its group. Each reports every crate's coverage
|
|
615
|
+
* against a set that can never match.
|
|
591
616
|
*/
|
|
592
617
|
export function packageNameFromCargoTestTarget(targetName) {
|
|
593
618
|
if (!targetName.startsWith('cargo-test-') ||
|
|
594
619
|
targetName === CARGO_TEST_COMPILE_TARGET ||
|
|
595
|
-
targetName === CARGO_TEST_ARCHIVE_TARGET
|
|
620
|
+
targetName === CARGO_TEST_ARCHIVE_TARGET ||
|
|
621
|
+
targetName.startsWith(CARGO_TEST_GROUP_PREFIX)) {
|
|
596
622
|
return null;
|
|
597
623
|
}
|
|
598
624
|
const name = targetName
|
|
@@ -632,9 +658,255 @@ export function exceptionalTestFilter(nextestConfigPath) {
|
|
|
632
658
|
}
|
|
633
659
|
}
|
|
634
660
|
}
|
|
661
|
+
return filterUnion(filters);
|
|
662
|
+
}
|
|
663
|
+
/** The filters as one filterset that any of them matches, or null for none. */
|
|
664
|
+
function filterUnion(filters) {
|
|
635
665
|
const unique = [...new Set(filters)];
|
|
636
666
|
return unique.length === 0 ? null : unique.map((filter) => `(${filter})`).join(' or ');
|
|
637
667
|
}
|
|
668
|
+
/**
|
|
669
|
+
* The only `platform` a serial group's overrides may declare: nextest's cfg for macOS. The group
|
|
670
|
+
* runs on macOS hosts only, a host decision made by the planner, never a cfg parse here.
|
|
671
|
+
*/
|
|
672
|
+
export const SERIAL_TEST_GROUP_PLATFORM = 'cfg(target_os="macos")';
|
|
673
|
+
/**
|
|
674
|
+
* The repository's test groups capped at one thread (`max-threads = 1`), each
|
|
675
|
+
* with the tests its default-profile overrides assign it.
|
|
676
|
+
*
|
|
677
|
+
* A serial group is declared exactly once, in `.config/nextest.toml`: the name
|
|
678
|
+
* under `[test-groups]` plus the overrides that name it. Its runner's filter is
|
|
679
|
+
* derived from those overrides rather than restated, so the runner and the
|
|
680
|
+
* per-crate exclusions cannot drift from what nextest actually serializes.
|
|
681
|
+
*
|
|
682
|
+
* Each group also carries the `scope` of its filter (`filterScope`): the members its runner hashes.
|
|
683
|
+
* A group whose every clause is scoped to a `package(<name>)` reruns only when those crates or their
|
|
684
|
+
* local dependencies change; any other group is scoped to the whole workspace. Nothing here orders one
|
|
685
|
+
* group against another: they are separate runners, and a repository that needs two never concurrent
|
|
686
|
+
* declares the edge between their targets itself.
|
|
687
|
+
*
|
|
688
|
+
* Every override naming a serial group must declare `SERIAL_TEST_GROUP_PLATFORM`.
|
|
689
|
+
* This plugin has no cfg evaluator, so it honours exactly that platform and
|
|
690
|
+
* refuses any other rather than guessing where the group applies.
|
|
691
|
+
*
|
|
692
|
+
* Returns [] when the file is absent or declares no serial group, so a workspace
|
|
693
|
+
* without one keeps exactly its existing targets.
|
|
694
|
+
*/
|
|
695
|
+
export function serialTestGroups(nextestConfigPath) {
|
|
696
|
+
if (!existsSync(nextestConfigPath)) {
|
|
697
|
+
return [];
|
|
698
|
+
}
|
|
699
|
+
const parsed = parseToml(readFileSync(nextestConfigPath, 'utf-8'));
|
|
700
|
+
if (!isRecord(parsed)) {
|
|
701
|
+
return [];
|
|
702
|
+
}
|
|
703
|
+
const declaredValue = parsed['test-groups'];
|
|
704
|
+
const declaredGroups = isRecord(declaredValue) ? declaredValue : {};
|
|
705
|
+
const serial = Object.keys(declaredGroups)
|
|
706
|
+
.filter((name) => {
|
|
707
|
+
const declared = declaredGroups[name];
|
|
708
|
+
return isRecord(declared) && declared['max-threads'] === 1;
|
|
709
|
+
})
|
|
710
|
+
.sort((left, right) => left.localeCompare(right));
|
|
711
|
+
const profiles = isRecord(parsed.profile) ? parsed.profile : {};
|
|
712
|
+
const defaults = isRecord(profiles.default) ? profiles.default : {};
|
|
713
|
+
const overridesValue = defaults.overrides;
|
|
714
|
+
const overrides = Array.isArray(overridesValue) ? overridesValue : [];
|
|
715
|
+
return serial.flatMap((group) => {
|
|
716
|
+
const filters = [];
|
|
717
|
+
for (const override of overrides) {
|
|
718
|
+
if (!isRecord(override) || override['test-group'] !== group) {
|
|
719
|
+
continue;
|
|
720
|
+
}
|
|
721
|
+
if (override.platform !== SERIAL_TEST_GROUP_PLATFORM) {
|
|
722
|
+
throw new Error(`${nextestConfigPath}: test-group "${group}" overrides must declare platform = '${SERIAL_TEST_GROUP_PLATFORM}' ` +
|
|
723
|
+
`(the only platform a serial group runs on here), got ${JSON.stringify(override.platform ?? null)}`);
|
|
724
|
+
}
|
|
725
|
+
if (typeof override.filter === 'string' && override.filter.length > 0) {
|
|
726
|
+
filters.push(override.filter);
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
const filter = filterUnion(filters);
|
|
730
|
+
return filter === null ? [] : [{ group, filter, scope: filterScope(filter) }];
|
|
731
|
+
});
|
|
732
|
+
}
|
|
733
|
+
/**
|
|
734
|
+
* The packages `filter` can select tests from, read off its `package(<name>)` predicates. The scope is
|
|
735
|
+
* never narrower than the selection: whatever this does not read with certainty is the whole workspace.
|
|
736
|
+
*
|
|
737
|
+
* The filter is read as nextest reads it, with nextest's precedence — parentheses, then `not` and `!`,
|
|
738
|
+
* then `and`, `&` and `-`, then `or`, `|` and `+`, each level left to right — and with nextest's blanks,
|
|
739
|
+
* which are spaces and line endings. Each expression is bounded by the packages it can select from:
|
|
740
|
+
*
|
|
741
|
+
* - `package(<name>)` and `package(=<name>)`, for a plain Cargo name, bound it to that package. A glob,
|
|
742
|
+
* `~contains`, `/regex/` or `#glob` name can match any package, so it bounds nothing.
|
|
743
|
+
* - Every other predicate bounds nothing, and nor does `not`: `not package(a)` selects from every other
|
|
744
|
+
* package, and `deps` and `rdeps` reach beyond the package they name.
|
|
745
|
+
* - `a and b` selects only what both select, so it is bounded by the narrower of the two bounds, and
|
|
746
|
+
* `a - b`, which is `a and not b`, by `a`. `a or b` is bounded by both together, so one unbounded
|
|
747
|
+
* clause leaves the union unbounded however the union is spelled.
|
|
748
|
+
*
|
|
749
|
+
* A predicate's argument ends where nextest ends it: a regex at its closing `/`, any other matcher at its
|
|
750
|
+
* first `)`. Only arguments that need none of nextest's escape sequences are read: a backslash, or a comma
|
|
751
|
+
* outside a regex, makes where the predicate ends depend on escapes this does not implement. Those, a
|
|
752
|
+
* filter that does not parse, and one whose packages exclude each other have no bound.
|
|
753
|
+
*/
|
|
754
|
+
export function filterScope(filter) {
|
|
755
|
+
const read = readUnion(filter, 0);
|
|
756
|
+
if (read === null || skipBlank(filter, read.end) !== filter.length || read.bound === 'any' || read.bound.size === 0) {
|
|
757
|
+
return { kind: 'workspace' };
|
|
758
|
+
}
|
|
759
|
+
return { kind: 'packages', packages: [...read.bound].sort((left, right) => left.localeCompare(right)) };
|
|
760
|
+
}
|
|
761
|
+
/** nextest's loosest-binding level: `or`, `|` and `+` between chains of `and`. */
|
|
762
|
+
function readUnion(text, from) {
|
|
763
|
+
let left = readIntersection(text, from);
|
|
764
|
+
while (left !== null) {
|
|
765
|
+
const operatorEnd = skipUnionOperator(text, left.end);
|
|
766
|
+
if (operatorEnd === null)
|
|
767
|
+
return left;
|
|
768
|
+
const right = readIntersection(text, operatorEnd);
|
|
769
|
+
if (right === null)
|
|
770
|
+
return null;
|
|
771
|
+
const bound = left.bound === 'any' || right.bound === 'any' ? 'any' : new Set([...left.bound, ...right.bound]);
|
|
772
|
+
left = { bound, end: right.end };
|
|
773
|
+
}
|
|
774
|
+
return null;
|
|
775
|
+
}
|
|
776
|
+
/** A chain of `and`, `&` and `-`, which bind tighter than a union, left to right. */
|
|
777
|
+
function readIntersection(text, from) {
|
|
778
|
+
let left = readOperand(text, from);
|
|
779
|
+
while (left !== null) {
|
|
780
|
+
const operator = readIntersectionOperator(text, left.end);
|
|
781
|
+
if (operator === null)
|
|
782
|
+
return left;
|
|
783
|
+
const right = readOperand(text, operator.end);
|
|
784
|
+
left =
|
|
785
|
+
right === null
|
|
786
|
+
? null
|
|
787
|
+
: { bound: operator.difference ? left.bound : boundIntersection(left.bound, right.bound), end: right.end };
|
|
788
|
+
}
|
|
789
|
+
return null;
|
|
790
|
+
}
|
|
791
|
+
/** A negation, a parenthesised filterset, or one predicate. */
|
|
792
|
+
function readOperand(text, from) {
|
|
793
|
+
const at = skipBlank(text, from);
|
|
794
|
+
const word = readWord(text, at, 'not');
|
|
795
|
+
const negated = word ?? (text.charAt(at) === '!' ? at + 1 : null);
|
|
796
|
+
if (negated !== null) {
|
|
797
|
+
const operand = readOperand(text, negated);
|
|
798
|
+
return operand === null ? null : { bound: 'any', end: operand.end };
|
|
799
|
+
}
|
|
800
|
+
if (text.charAt(at) !== '(')
|
|
801
|
+
return readPredicate(text, at);
|
|
802
|
+
const inner = readUnion(text, at + 1);
|
|
803
|
+
if (inner === null)
|
|
804
|
+
return null;
|
|
805
|
+
const close = skipBlank(text, inner.end);
|
|
806
|
+
return text.charAt(close) === ')' ? { bound: inner.bound, end: close + 1 } : null;
|
|
807
|
+
}
|
|
808
|
+
/** What follows a predicate's `(`: nothing, or a name matcher. */
|
|
809
|
+
const PREDICATE_ARGUMENTS = {
|
|
810
|
+
all: 'none',
|
|
811
|
+
none: 'none',
|
|
812
|
+
default: 'none',
|
|
813
|
+
test: 'matcher',
|
|
814
|
+
group: 'matcher',
|
|
815
|
+
package: 'matcher',
|
|
816
|
+
deps: 'matcher',
|
|
817
|
+
rdeps: 'matcher',
|
|
818
|
+
binary_id: 'matcher',
|
|
819
|
+
kind: 'matcher',
|
|
820
|
+
binary: 'matcher',
|
|
821
|
+
platform: 'matcher',
|
|
822
|
+
};
|
|
823
|
+
/** One predicate: `all()` and its kin, or a name followed by its parenthesised matcher. */
|
|
824
|
+
function readPredicate(text, at) {
|
|
825
|
+
const identifier = /[a-z_]+/y;
|
|
826
|
+
identifier.lastIndex = at;
|
|
827
|
+
const predicate = identifier.exec(text)?.[0];
|
|
828
|
+
if (predicate === undefined)
|
|
829
|
+
return null;
|
|
830
|
+
const open = skipBlank(text, at + predicate.length);
|
|
831
|
+
if (text.charAt(open) !== '(')
|
|
832
|
+
return null;
|
|
833
|
+
const argument = Object.hasOwn(PREDICATE_ARGUMENTS, predicate) ? PREDICATE_ARGUMENTS[predicate] : undefined;
|
|
834
|
+
if (argument === undefined)
|
|
835
|
+
return null;
|
|
836
|
+
if (argument === 'none') {
|
|
837
|
+
const close = skipBlank(text, open + 1);
|
|
838
|
+
return text.charAt(close) === ')' ? { bound: 'any', end: close + 1 } : null;
|
|
839
|
+
}
|
|
840
|
+
const matcher = readMatcher(text, open + 1);
|
|
841
|
+
return matcher === null
|
|
842
|
+
? null
|
|
843
|
+
: { bound: predicate === 'package' ? packageBound(matcher.text) : 'any', end: matcher.end };
|
|
844
|
+
}
|
|
845
|
+
/**
|
|
846
|
+
* The argument of a predicate whose `(` ends just before `from`, as written between its parentheses, and
|
|
847
|
+
* the offset past its `)`; null when it cannot be delimited exactly as nextest delimits it.
|
|
848
|
+
*/
|
|
849
|
+
function readMatcher(text, from) {
|
|
850
|
+
const start = skipBlank(text, from);
|
|
851
|
+
const close = text.charAt(start) === '/' ? regexMatcherClose(text, start) : plainMatcherClose(text, start);
|
|
852
|
+
return close === null ? null : { text: text.slice(from, close), end: close + 1 };
|
|
853
|
+
}
|
|
854
|
+
/** The `)` that follows the `/regex/` starting at `start`, when the regex holds no backslash. */
|
|
855
|
+
function regexMatcherClose(text, start) {
|
|
856
|
+
const slash = text.indexOf('/', start + 1);
|
|
857
|
+
if (slash < 0 || text.slice(start, slash).includes('\\'))
|
|
858
|
+
return null;
|
|
859
|
+
const close = skipBlank(text, slash + 1);
|
|
860
|
+
return text.charAt(close) === ')' ? close : null;
|
|
861
|
+
}
|
|
862
|
+
/** The first `)` at or after `start`, when nothing before it is a backslash or a comma. */
|
|
863
|
+
function plainMatcherClose(text, start) {
|
|
864
|
+
const close = text.indexOf(')', start);
|
|
865
|
+
return close < 0 || /[,\\]/.test(text.slice(start, close)) ? null : close;
|
|
866
|
+
}
|
|
867
|
+
/** A plain Cargo package name, with or without nextest's `=` prefix: nothing a glob can widen. */
|
|
868
|
+
const PLAIN_PACKAGE_NAME = /^=?([A-Za-z0-9_-]+)$/;
|
|
869
|
+
function packageBound(matcher) {
|
|
870
|
+
const name = PLAIN_PACKAGE_NAME.exec(matcher)?.[1];
|
|
871
|
+
return name === undefined ? 'any' : new Set([name]);
|
|
872
|
+
}
|
|
873
|
+
function boundIntersection(left, right) {
|
|
874
|
+
if (left === 'any')
|
|
875
|
+
return right;
|
|
876
|
+
if (right === 'any')
|
|
877
|
+
return left;
|
|
878
|
+
return new Set([...left].filter((name) => right.has(name)));
|
|
879
|
+
}
|
|
880
|
+
/** The offset of the first character at or after `from` that nextest does not read as blank. */
|
|
881
|
+
function skipBlank(text, from) {
|
|
882
|
+
const blank = /(?: |\r?\n)*/y;
|
|
883
|
+
blank.lastIndex = from;
|
|
884
|
+
return from + (blank.exec(text)?.[0].length ?? 0);
|
|
885
|
+
}
|
|
886
|
+
/** `word` at `at`, read as nextest reads an operator word: not the start of a longer identifier. */
|
|
887
|
+
function readWord(text, at, word) {
|
|
888
|
+
const end = at + word.length;
|
|
889
|
+
return text.startsWith(word, at) && !/[A-Za-z0-9_]/.test(text.charAt(end)) ? end : null;
|
|
890
|
+
}
|
|
891
|
+
/** The offset past the `or`, `|` or `+` that follows `from` after any blanks, or null. */
|
|
892
|
+
function skipUnionOperator(text, from) {
|
|
893
|
+
const at = skipBlank(text, from);
|
|
894
|
+
const character = text.charAt(at);
|
|
895
|
+
return readWord(text, at, 'or') ?? (character === '|' || character === '+' ? at + 1 : null);
|
|
896
|
+
}
|
|
897
|
+
/** The `and`, `&` or `-` that follows `from` after any blanks: where it ends, and whether it subtracts. */
|
|
898
|
+
function readIntersectionOperator(text, from) {
|
|
899
|
+
const at = skipBlank(text, from);
|
|
900
|
+
const word = readWord(text, at, 'and');
|
|
901
|
+
if (word !== null)
|
|
902
|
+
return { end: word, difference: false };
|
|
903
|
+
const character = text.charAt(at);
|
|
904
|
+
if (character === '&')
|
|
905
|
+
return { end: at + 1, difference: false };
|
|
906
|
+
return character === '-' ? { end: at + 1, difference: true } : null;
|
|
907
|
+
}
|
|
908
|
+
/** The plugin's nextest.toml as the workspace root's `node_modules` links it. */
|
|
909
|
+
export const PLUGIN_NEXTEST_CONFIG_PATH = 'node_modules/@smoothbricks/nx-plugin/nextest.toml';
|
|
638
910
|
/**
|
|
639
911
|
* The plugin's own nextest settings, as a config layer BENEATH the repository's.
|
|
640
912
|
*
|
|
@@ -653,10 +925,19 @@ export function exceptionalTestFilter(nextestConfigPath) {
|
|
|
653
925
|
* (`bounded-exec`, which spawns with `shell: true`) go through a shell — so the
|
|
654
926
|
* command text stays identical everywhere. Quoted, because a workspace path may
|
|
655
927
|
* contain spaces.
|
|
928
|
+
*
|
|
929
|
+
* The file is named through the workspace root's `node_modules` link, as
|
|
930
|
+
* `NEXTEST_EXTRACT_BIN` is, never through where the plugin really lives: a
|
|
931
|
+
* plugin linked from a checkout outside the workspace sits a different number
|
|
932
|
+
* of `../` away from each workspace depending on how deep that workspace is,
|
|
933
|
+
* and that count re-keyed every target of every Cargo project — and every
|
|
934
|
+
* dependent task — in each workspace that sat at a new depth.
|
|
935
|
+
*
|
|
936
|
+
* `projectRoot` is the Cargo workspace's root relative to the Nx workspace
|
|
937
|
+
* root, which is the directory these commands run in.
|
|
656
938
|
*/
|
|
657
|
-
export function nextestToolConfigArg(
|
|
658
|
-
const
|
|
659
|
-
const path = rel.length === 0 ? configAbs : rel.split(sep).join('/');
|
|
939
|
+
export function nextestToolConfigArg(projectRoot) {
|
|
940
|
+
const path = posix.join(posix.relative(projectRoot, '.'), PLUGIN_NEXTEST_CONFIG_PATH);
|
|
660
941
|
return `--tool-config-file "smoo:$PWD/${path}"`;
|
|
661
942
|
}
|
|
662
943
|
/** The repository's own nextest config, which now layers over the plugin's. */
|
|
@@ -82,8 +82,24 @@ export declare const CARGO_FETCH_TARGET = "cargo-fetch";
|
|
|
82
82
|
*/
|
|
83
83
|
export declare const CARGO_FETCH_COMMAND = "cargo fetch --locked";
|
|
84
84
|
/**
|
|
85
|
-
*
|
|
86
|
-
*
|
|
85
|
+
* Deny warnings through Cargo's `build.warnings`, never `-- -D warnings`.
|
|
86
|
+
*
|
|
87
|
+
* Arguments after `--` reach clippy-driver through `CLIPPY_ARGS`, which Cargo
|
|
88
|
+
* hashes into every member unit's fingerprint. A gate that passes
|
|
89
|
+
* `-D warnings` therefore owns a unit set of its own: it and a plain
|
|
90
|
+
* `cargo clippy` invalidate each other, re-checking every member each time.
|
|
91
|
+
* `build.warnings` is Cargo's own verdict over the diagnostics it collected,
|
|
92
|
+
* including those it replays from Fresh units, and it reaches no compiler
|
|
93
|
+
* invocation, so every caller shares one unit set while the gate still fails.
|
|
94
|
+
*
|
|
95
|
+
* On the command line rather than in a config file: the gate's verdict is not
|
|
96
|
+
* a repository's local choice, and `--config` outranks every config file.
|
|
97
|
+
*/
|
|
98
|
+
export declare const CARGO_DENY_WARNINGS = "--config 'build.warnings=\"deny\"'";
|
|
99
|
+
/**
|
|
100
|
+
* Clippy rather than `cargo check`, and warnings denied, because that is
|
|
101
|
+
* exactly what CI's `lint` runs; a weaker local command would pass where CI
|
|
102
|
+
* fails.
|
|
87
103
|
*
|
|
88
104
|
* `--all-targets` is what answers "what does test mean when cross-compiling": it
|
|
89
105
|
* type-checks bins, tests, benches and examples for the target, so test CODE is
|
|
@@ -101,7 +117,8 @@ export declare const CARGO_FETCH_COMMAND = "cargo fetch --locked";
|
|
|
101
117
|
*
|
|
102
118
|
* Keep the caller's CARGO_HOME: it owns registry sources, credentials and global
|
|
103
119
|
* Cargo configuration, including paths relative to that configuration. Relocating
|
|
104
|
-
* or replaying it through --config changes path resolution or precedence
|
|
120
|
+
* or replaying it through --config changes path resolution or precedence; the
|
|
121
|
+
* one `--config` here sets `build.warnings` alone.
|
|
105
122
|
* Cargo may serialize registry access on its package-cache lock; these checks
|
|
106
123
|
* are unbounded, and correctness takes priority over overlapping that access.
|
|
107
124
|
*
|
|
@@ -119,6 +136,7 @@ export declare const CARGO_CROSS_LINT_COMMAND: string;
|
|
|
119
136
|
* a proc-macro and ordinary code use stays a distinct unit: a dev build
|
|
120
137
|
* compiles it once at the target profile, while a check build needs a separate
|
|
121
138
|
* host copy. Distinct hashes coexist, so neither command dirties the other.
|
|
139
|
+
* A plain `cargo clippy --workspace --all-targets` checks exactly these units.
|
|
122
140
|
*/
|
|
123
141
|
export declare const CARGO_LINT_CLIPPY_COMMAND: string;
|
|
124
142
|
/** Root `package.json` script name, in the repo's `verb:qualifier` style. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cross-check-policy.d.ts","sourceRoot":"","sources":["../src/cross-check-policy.ts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AACH,eAAO,MAAM,yBAAyB,QAAyE,CAAC;AAEhH,6EAA6E;AAC7E,eAAO,MAAM,uBAAuB,gBAAgB,CAAC;AAErD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,0BAA0B,2EAAiG,CAAC;AAEzI;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,+BAA+B,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEtE;AAED,6DAA6D;AAC7D,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAE/D;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEhE;AAID,iFAAiF;AACjF,wBAAgB,qCAAqC,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAKvF"}
|
|
@@ -85,8 +85,24 @@ export const CARGO_FETCH_TARGET = 'cargo-fetch';
|
|
|
85
85
|
*/
|
|
86
86
|
export const CARGO_FETCH_COMMAND = 'cargo fetch --locked';
|
|
87
87
|
/**
|
|
88
|
-
*
|
|
89
|
-
*
|
|
88
|
+
* Deny warnings through Cargo's `build.warnings`, never `-- -D warnings`.
|
|
89
|
+
*
|
|
90
|
+
* Arguments after `--` reach clippy-driver through `CLIPPY_ARGS`, which Cargo
|
|
91
|
+
* hashes into every member unit's fingerprint. A gate that passes
|
|
92
|
+
* `-D warnings` therefore owns a unit set of its own: it and a plain
|
|
93
|
+
* `cargo clippy` invalidate each other, re-checking every member each time.
|
|
94
|
+
* `build.warnings` is Cargo's own verdict over the diagnostics it collected,
|
|
95
|
+
* including those it replays from Fresh units, and it reaches no compiler
|
|
96
|
+
* invocation, so every caller shares one unit set while the gate still fails.
|
|
97
|
+
*
|
|
98
|
+
* On the command line rather than in a config file: the gate's verdict is not
|
|
99
|
+
* a repository's local choice, and `--config` outranks every config file.
|
|
100
|
+
*/
|
|
101
|
+
export const CARGO_DENY_WARNINGS = `--config 'build.warnings="deny"'`;
|
|
102
|
+
/**
|
|
103
|
+
* Clippy rather than `cargo check`, and warnings denied, because that is
|
|
104
|
+
* exactly what CI's `lint` runs; a weaker local command would pass where CI
|
|
105
|
+
* fails.
|
|
90
106
|
*
|
|
91
107
|
* `--all-targets` is what answers "what does test mean when cross-compiling": it
|
|
92
108
|
* type-checks bins, tests, benches and examples for the target, so test CODE is
|
|
@@ -104,7 +120,8 @@ export const CARGO_FETCH_COMMAND = 'cargo fetch --locked';
|
|
|
104
120
|
*
|
|
105
121
|
* Keep the caller's CARGO_HOME: it owns registry sources, credentials and global
|
|
106
122
|
* Cargo configuration, including paths relative to that configuration. Relocating
|
|
107
|
-
* or replaying it through --config changes path resolution or precedence
|
|
123
|
+
* or replaying it through --config changes path resolution or precedence; the
|
|
124
|
+
* one `--config` here sets `build.warnings` alone.
|
|
108
125
|
* Cargo may serialize registry access on its package-cache lock; these checks
|
|
109
126
|
* are unbounded, and correctness takes priority over overlapping that access.
|
|
110
127
|
*
|
|
@@ -112,7 +129,7 @@ export const CARGO_FETCH_COMMAND = 'cargo fetch --locked';
|
|
|
112
129
|
* are distinct anyway, and its own lock keeps the cross check from queueing
|
|
113
130
|
* behind host builds.
|
|
114
131
|
*/
|
|
115
|
-
export const CARGO_CROSS_LINT_COMMAND = `${CARGO_CROSS_LINT_GUARD}; ${cargoFrozen(`clippy --workspace --all-targets --target ${CARGO_LINUX_TRIPLE} --target-dir target/cargo-lint-cross
|
|
132
|
+
export const CARGO_CROSS_LINT_COMMAND = `${CARGO_CROSS_LINT_GUARD}; ${cargoFrozen(`clippy --workspace --all-targets --target ${CARGO_LINUX_TRIPLE} --target-dir target/cargo-lint-cross ${CARGO_DENY_WARNINGS}`)}`;
|
|
116
133
|
/**
|
|
117
134
|
* No `--target-dir`: clippy writes the workspace's own `target/`, beside every
|
|
118
135
|
* dev build. Check units carry their mode in the unit hash, so they never
|
|
@@ -122,8 +139,9 @@ export const CARGO_CROSS_LINT_COMMAND = `${CARGO_CROSS_LINT_GUARD}; ${cargoFroze
|
|
|
122
139
|
* a proc-macro and ordinary code use stays a distinct unit: a dev build
|
|
123
140
|
* compiles it once at the target profile, while a check build needs a separate
|
|
124
141
|
* host copy. Distinct hashes coexist, so neither command dirties the other.
|
|
142
|
+
* A plain `cargo clippy --workspace --all-targets` checks exactly these units.
|
|
125
143
|
*/
|
|
126
|
-
export const CARGO_LINT_CLIPPY_COMMAND = cargoFrozen(
|
|
144
|
+
export const CARGO_LINT_CLIPPY_COMMAND = cargoFrozen(`clippy --workspace --all-targets ${CARGO_DENY_WARNINGS}`);
|
|
127
145
|
/** Root `package.json` script name, in the repo's `verb:qualifier` style. */
|
|
128
146
|
export const CROSS_CHECK_SCRIPT_NAME = 'check:linux';
|
|
129
147
|
/**
|
|
@@ -181,7 +199,7 @@ export function cargoCrossTestTargetName(triple) {
|
|
|
181
199
|
* the other's name.
|
|
182
200
|
*/
|
|
183
201
|
export function cargoCrossTestArchiveFile(triple) {
|
|
184
|
-
return
|
|
202
|
+
return `.cache/nextest/archive-${triple}.tar.zst`;
|
|
185
203
|
}
|
|
186
204
|
const CARGO_CROSS_TEST_ARCHIVE_PREFIX = cargoCrossTestArchiveTargetName('');
|
|
187
205
|
/** Inverse of `cargoCrossTestArchiveTargetName`; null for every other target. */
|