@smoothbricks/nx-plugin 0.6.3-0 → 0.7.0
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 +159 -121
- package/dist/.build-inputs.json +25 -20
- package/dist/bin/smoo-nx-go-test-build.d.ts +3 -0
- package/dist/bin/smoo-nx-go-test-build.d.ts.map +1 -0
- package/dist/bin/smoo-nx-go-test-build.js +79 -0
- package/dist/bin/smoo-nx-go-test-run.d.ts +3 -0
- package/dist/bin/smoo-nx-go-test-run.d.ts.map +1 -0
- package/dist/bin/smoo-nx-go-test-run.js +129 -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 +9 -8
- package/dist/cargo-workspace.d.ts +10 -20
- package/dist/cargo-workspace.d.ts.map +1 -1
- package/dist/cargo-workspace.js +12 -22
- package/dist/cross-check-policy.d.ts +2 -2
- package/dist/cross-check-policy.js +2 -2
- package/dist/deploy-policy.d.ts +6 -0
- package/dist/deploy-policy.d.ts.map +1 -1
- package/dist/deploy-policy.js +11 -0
- package/dist/executors/bounded-exec/executor.d.ts.map +1 -1
- package/dist/executors/bounded-exec/executor.js +49 -37
- package/dist/executors/bounded-exec/mbx-pool.d.ts +39 -10
- package/dist/executors/bounded-exec/mbx-pool.d.ts.map +1 -1
- package/dist/executors/bounded-exec/mbx-pool.js +78 -24
- package/dist/executors/bounded-exec/progress.js +5 -5
- package/dist/executors/bounded-exec/runner-sizing.d.ts +40 -2
- package/dist/executors/bounded-exec/runner-sizing.d.ts.map +1 -1
- package/dist/executors/bounded-exec/runner-sizing.js +55 -4
- package/dist/executors/bounded-exec/runtime-pin.js +1 -1
- package/dist/executors/bounded-exec/verdict.d.ts +6 -0
- package/dist/executors/bounded-exec/verdict.d.ts.map +1 -1
- package/dist/executors/bounded-exec/verdict.js +6 -0
- package/dist/executors/wrangler-deploy/deploy-hash.d.ts +10 -0
- package/dist/executors/wrangler-deploy/deploy-hash.d.ts.map +1 -0
- package/dist/executors/wrangler-deploy/deploy-hash.js +14 -0
- package/dist/executors/wrangler-deploy/executor.d.ts +24 -0
- package/dist/executors/wrangler-deploy/executor.d.ts.map +1 -0
- package/dist/executors/wrangler-deploy/executor.js +43 -0
- package/dist/executors/wrangler-deploy/hasher.d.ts +27 -0
- package/dist/executors/wrangler-deploy/hasher.d.ts.map +1 -0
- package/dist/executors/wrangler-deploy/hasher.js +90 -0
- package/dist/executors/wrangler-deploy/schema.d.ts +5 -0
- package/dist/executors/wrangler-deploy/schema.d.ts.map +1 -0
- package/dist/go-tests.d.ts +30 -0
- package/dist/go-tests.d.ts.map +1 -0
- package/dist/go-tests.js +43 -0
- package/dist/index.d.ts +9 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +271 -230
- package/dist/managed-files/files.d.ts.map +1 -1
- package/dist/managed-files/files.js +5 -0
- package/dist/process-group.js +2 -2
- package/dist/runtime-input-policy.d.ts +3 -3
- package/dist/runtime-input-policy.js +3 -3
- package/dist/test-timings.d.ts +23 -4
- package/dist/test-timings.d.ts.map +1 -1
- package/dist/test-timings.js +72 -12
- package/dist/version-actions.cjs +10 -11
- package/dist/version-actions.d.cts.map +1 -1
- package/dist/workspace-config-policy.d.ts.map +1 -1
- package/dist/workspace-config-policy.js +17 -22
- package/dist/workspace-manifest.js +3 -3
- package/executors.json +6 -5
- package/managed/raw/patches/nx@23.2.1.patch +118 -24
- package/managed/raw/patches/ttsc@0.34.1.patch +64 -0
- package/managed/raw/tooling/direnv/developer-links.ts +121 -51
- package/managed/raw/tooling/direnv/installed-bun-links.ts +7 -6
- package/managed/raw/tooling/direnv/setup-environment.ts +14 -4
- package/managed/raw/tooling/git-hooks/pinned-revisions-served.ts +252 -0
- package/managed/raw/tooling/git-hooks/pre-push.sh +34 -32
- package/package.json +57 -7
- package/runtime/nx-publish/.build-inputs.json +11 -0
- package/runtime-input.sh +50 -23
- package/src/bin/smoo-nx-go-test-build.ts +83 -0
- package/src/bin/smoo-nx-go-test-run.ts +140 -0
- package/src/bounded-test-policy.ts +9 -8
- package/src/cargo-workspace.ts +12 -24
- package/src/cross-check-policy.ts +2 -2
- package/src/deploy-policy.ts +11 -0
- package/src/executors/bounded-exec/executor.ts +61 -42
- package/src/executors/bounded-exec/mbx-pool.ts +97 -33
- package/src/executors/bounded-exec/progress.ts +5 -5
- package/src/executors/bounded-exec/runner-sizing.ts +73 -7
- package/src/executors/bounded-exec/runtime-pin.ts +1 -1
- package/src/executors/bounded-exec/verdict.ts +7 -0
- package/src/executors/wrangler-deploy/deploy-hash.ts +15 -0
- package/src/executors/wrangler-deploy/executor.ts +63 -0
- package/src/executors/wrangler-deploy/hasher.ts +111 -0
- package/src/executors/wrangler-deploy/schema.json +16 -0
- package/src/executors/wrangler-deploy/schema.ts +4 -0
- package/src/go-tests.ts +67 -0
- package/src/index.ts +294 -253
- package/src/managed-files/files.ts +5 -0
- package/src/process-group.ts +2 -2
- package/src/runtime-input-policy.ts +3 -3
- package/src/test-timings.ts +72 -14
- package/src/version-actions.cts +10 -11
- package/src/workspace-config-policy.ts +20 -29
- package/src/workspace-manifest.ts +3 -3
- package/test-timings.json +131 -130
- package/dist/executors/clean-outputs/executor.d.ts +0 -26
- package/dist/executors/clean-outputs/executor.d.ts.map +0 -1
- package/dist/executors/clean-outputs/executor.js +0 -83
- package/dist/executors/clean-outputs/schema.d.ts +0 -4
- package/dist/executors/clean-outputs/schema.d.ts.map +0 -1
- package/src/executors/clean-outputs/executor.ts +0 -131
- package/src/executors/clean-outputs/schema.json +0 -15
- package/src/executors/clean-outputs/schema.ts +0 -3
- /package/dist/executors/{clean-outputs → wrangler-deploy}/schema.js +0 -0
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { readdir, readFile } from 'node:fs/promises';
|
|
|
3
3
|
import { createRequire } from 'node:module';
|
|
4
4
|
import { dirname, isAbsolute, join, posix, relative, resolve, sep } from 'node:path';
|
|
5
5
|
import { fileURLToPath } from 'node:url';
|
|
6
|
-
import {
|
|
6
|
+
import { NEXTEST_BINARIES_BUILD_ARGS, NEXTEST_BINARIES_METADATA, NEXTEST_BUILD_KEY, NEXTEST_CARGO_METADATA, } from '@smoothbricks/nextest-extract';
|
|
7
7
|
import { readJsonFile, } from 'nx/src/devkit-exports.js';
|
|
8
8
|
import { AggregateCreateNodesError } from 'nx/src/project-graph/error-types.js';
|
|
9
9
|
import { parse as parseToml } from 'smol-toml';
|
|
@@ -13,7 +13,7 @@ import { bunLockDependencies, bunLockInput, bunLockNode } from './bun-lock-scope
|
|
|
13
13
|
import { CARGO_CLOSURE_INPUT, CARGO_LOCK_NODE_PREFIX, cargoClosureInputs, cargoLockNode, cargoLockNodeName, indexedCargoManifests, isCargoLockInput, resolveCargoClosureSource, } from './cargo-closure-input.js';
|
|
14
14
|
import { CARGO_PRODUCER_METADATA, postTasksExecution as postCargoRetention } from './cargo-retention-hook.js';
|
|
15
15
|
import { CARGO_TOOLCHAIN_NAMED_INPUT, cargoRuntimeInput, cargoToolchainInputs } from './cargo-toolchain-policy.js';
|
|
16
|
-
import { attributeCargoWorkspacePackages,
|
|
16
|
+
import { attributeCargoWorkspacePackages, CARGO_TEST_BUILD_TARGET, CARGO_TEST_EXCEPTIONS_SUFFIX, CARGO_TEST_TARGET, cargoPackageTestInputs, cargoTestGroupTargetName, cargoTestPackageTargetName, createCargoInputsCache, EXTERNAL_RUST_CRATES_INPUT, exceptionalTestFilter, listCargoCrossTestTargets, listCargoWorkspacePackages, NEXTEST_REPO_CONFIG_PATH, nextestToolConfigArg, PLUGIN_NEXTEST_CONFIG_PATH, requireExternalRustCratesInput, serialTestGroups, } from './cargo-workspace.js';
|
|
17
17
|
import { CARGO_CROSS_LINT_COMMAND, CARGO_CROSS_LINT_TARGET, CARGO_FETCH_COMMAND, CARGO_FETCH_TARGET, CARGO_LINT_CLIPPY_COMMAND, cargoCrossTestArchiveFile, cargoCrossTestArchiveTargetName, cargoCrossTestTargetName, cargoFrozen, runsFrozenCargo, } from './cross-check-policy.js';
|
|
18
18
|
import { eslintConfigClosure } from './eslint-config-closure.js';
|
|
19
19
|
import { ESLINT_SOURCES_GLOB, eslintSources } from './eslint-sources.js';
|
|
@@ -26,10 +26,10 @@ import { postTasksExecution as postProducerReceipts, preTasksExecution as prePro
|
|
|
26
26
|
import { runtimeInput, shellWord } from './runtime-input.js';
|
|
27
27
|
import { inferredTaskKind, refuseBuildTestDependencies } from './task-graph-policy.js';
|
|
28
28
|
import { postTasksExecution as postTaskResults, preTasksExecution as preTaskResults } from './task-results.js';
|
|
29
|
-
import { SHARD_TIMINGS_EXECUTOR, SHARD_TIMINGS_TARGET, timingsShardedSuite } from './test-timings.js';
|
|
29
|
+
import { SHARD_TIMINGS_EXECUTOR, SHARD_TIMINGS_TARGET, timingsShardedSuite, timingsSuiteInputs, } from './test-timings.js';
|
|
30
30
|
import { assertUpstreamBasePrecondition } from './test-walk-policy.js';
|
|
31
31
|
import { nativeToolCommand, nativeToolDependsOn, resolveNativeTools } from './tool-bins.js';
|
|
32
|
-
import { isBuildOutputTargetName, isTestNamespaceTargetName, isTestRunnerTargetName,
|
|
32
|
+
import { isBuildOutputTargetName, isTestNamespaceTargetName, isTestRunnerTargetName, RELEASE_CONFIGURATION, } from './workspace-config-policy.js';
|
|
33
33
|
import { globIndexedFiles } from './workspace-index.js';
|
|
34
34
|
/** Makes a version live and proves it answers; never cached. */
|
|
35
35
|
export const DEPLOY_TARGET = 'deploy';
|
|
@@ -387,15 +387,30 @@ const CARGO_OUTPUT_INPUTS = CARGO_INPUTS;
|
|
|
387
387
|
/** The lockfiles of crates no resolved Cargo workspace claims, which have no lock-scope node. */
|
|
388
388
|
const UNRESOLVED_CARGO_LOCK_INPUT = '{projectRoot}/**/Cargo.lock';
|
|
389
389
|
/**
|
|
390
|
-
*
|
|
391
|
-
*
|
|
392
|
-
*
|
|
393
|
-
*
|
|
390
|
+
* The files `cargo-fetch` reads: the manifests and the lock that name the crates, and the Cargo configuration that says
|
|
391
|
+
* where they come from. With the registry's state (cargoFetchedInput) they are its key. Unnamed, Nx plans every file of
|
|
392
|
+
* the project, which for a repository-root project includes its symlinked managed files, and a receipt binds no
|
|
393
|
+
* symlink. That workspace's members belong to other projects, so its globs start at the repository root.
|
|
394
394
|
*/
|
|
395
395
|
function cargoFetchInputs(projectRoot) {
|
|
396
396
|
const base = projectRoot === '.' ? '{workspaceRoot}' : '{projectRoot}';
|
|
397
397
|
return [`${base}/**/Cargo.toml`, `${base}/**/Cargo.lock`, `${base}/**/.cargo/config.toml`, `!${base}/**/target/**`];
|
|
398
398
|
}
|
|
399
|
+
/** The locked fetch of one manifest, relative to the project it runs in. */
|
|
400
|
+
function cargoFetchCommand(manifestPath) {
|
|
401
|
+
return manifestPath === 'Cargo.toml' ? CARGO_FETCH_COMMAND : `${CARGO_FETCH_COMMAND} --manifest-path ${manifestPath}`;
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* Whether the registry holds every manifest's locked graph, as the runtime input that brings CARGO_HOME into
|
|
405
|
+
* `cargo-fetch`'s key: the download lands outside the workspace, so no output can stand for it. `fetched` when an
|
|
406
|
+
* offline fetch of each manifest succeeds, which asks no network and fails on any crate the registry lacks. A registry
|
|
407
|
+
* that lacks one gives a value of its own run (the shell's pid and the time), which no cached run matches, so the fetch
|
|
408
|
+
* runs; a registry that holds them all keys an unchanged lock to its cached run.
|
|
409
|
+
*/
|
|
410
|
+
function cargoFetchedInput(projectRoot, manifests) {
|
|
411
|
+
const offline = manifests.map((manifest) => `${cargoFetchCommand(manifest)} --offline --quiet`).join(' && ');
|
|
412
|
+
return cargoRuntimeInput(projectRoot, `if { ${offline}; } >/dev/null 2>&1; then echo fetched; else echo "unfetched $$ $(date +%s)"; fi`);
|
|
413
|
+
}
|
|
399
414
|
/** A full cargo-mutants sweep's wall-clock backstop: a sweep takes hours, and a hung one must still end. */
|
|
400
415
|
const MUTATION_TIMEOUT_MS = 6 * 60 * 60 * 1000;
|
|
401
416
|
// The toolchain half of a cargo task's identity lives in its own module
|
|
@@ -406,11 +421,21 @@ const MUTATION_TIMEOUT_MS = 6 * 60 * 60 * 1000;
|
|
|
406
421
|
function fileHashInput(path) {
|
|
407
422
|
return runtimeInput(`bun -e 'console.log(new Bun.CryptoHasher("sha256").update(require("node:fs").readFileSync(process.argv[1])).digest("hex"))' ${shellWord(path)}`);
|
|
408
423
|
}
|
|
424
|
+
/**
|
|
425
|
+
* The bytes of a file that arrives from elsewhere, as a runtime input: their SHA-256, streamed, or `absent`. A task
|
|
426
|
+
* that needs the file fails without it, and Nx caches no failure, so no cached run is keyed on `absent`.
|
|
427
|
+
*/
|
|
428
|
+
export function arrivedFileHashInput(path) {
|
|
429
|
+
const hash = 'const file = Bun.file(process.argv[1]); const hash = new Bun.CryptoHasher("sha256"); ' +
|
|
430
|
+
'if (!(await file.exists())) console.log("absent"); ' +
|
|
431
|
+
'else { for await (const chunk of file.stream()) hash.update(chunk); console.log(hash.digest("hex")); }';
|
|
432
|
+
return runtimeInput(`bun -e ${shellWord(hash)} ${shellWord(path)}`);
|
|
433
|
+
}
|
|
409
434
|
/**
|
|
410
435
|
* One shell command that runs `steps` in order and stops at the first failure.
|
|
411
436
|
*
|
|
412
|
-
* For a step that CONSUMES what an earlier step produces — the
|
|
413
|
-
* its directory, `wasm-bindgen` reads the `.wasm` that `cargo build` writes.
|
|
437
|
+
* For a step that CONSUMES what an earlier step produces — the test build's
|
|
438
|
+
* metadata needs its directory, `wasm-bindgen` reads the `.wasm` that `cargo build` writes.
|
|
414
439
|
* The order lives in the command because that is the only place a
|
|
415
440
|
* producer-consumer pair inside one task can state it: `nx:run-commands`'
|
|
416
441
|
* `commands` array is a set of independent commands that Nx runs side by side.
|
|
@@ -554,69 +579,98 @@ function createCargoWasmTarget(projectRoot, config, repoRooted, cargoTargetDirec
|
|
|
554
579
|
};
|
|
555
580
|
}
|
|
556
581
|
/**
|
|
557
|
-
* The workspace's test binaries, compiled once and
|
|
558
|
-
* per-crate runners execute from.
|
|
582
|
+
* The workspace's test binaries, compiled once and run where they were built.
|
|
559
583
|
*
|
|
560
584
|
* This is the only cargo BUILD in the test graph. Before it, every per-crate
|
|
561
585
|
* target ran `nextest run --workspace -E 'package(X)'`, which is a workspace
|
|
562
586
|
* build with a filter: 32 such tasks on one repository each re-entered cargo,
|
|
563
587
|
* re-resolved features and chained behind one another so the flocked `target/`
|
|
564
|
-
* had a single writer.
|
|
565
|
-
* entirely — the runners execute
|
|
566
|
-
*
|
|
588
|
+
* had a single writer. Running from a reused build removes the build from the
|
|
589
|
+
* run entirely — the runners execute the binaries this build left in Cargo's
|
|
590
|
+
* target directory and never write its build tree — which is what lets the
|
|
591
|
+
* runners fan out.
|
|
567
592
|
*
|
|
568
593
|
* It is also the step that keeps compilation out of the bounded test window: a
|
|
569
594
|
* cold workspace can take many minutes to compile while still making progress,
|
|
570
595
|
* which is not a property of the tests, and the runners start after it. It is
|
|
571
596
|
* test work, so no `build` depends on it (a build never consumes test binaries)
|
|
572
|
-
* and each target that executes them names the edge itself.
|
|
573
|
-
* uncached `cargo test --no-run` warm-up: it compiled the same dev units a
|
|
574
|
-
* second time, queued on the same `target/` lock.
|
|
597
|
+
* and each target that executes them names the edge itself.
|
|
575
598
|
*
|
|
576
|
-
* Cached because it produces
|
|
577
|
-
*
|
|
578
|
-
*
|
|
599
|
+
* Cached because it produces VALUES: nextest's reuse-build metadata, the
|
|
600
|
+
* binaries `cargo nextest list --list-type binaries-only` built (an mbx-cached
|
|
601
|
+
* build) and the `cargo metadata` of the workspace they belong to, which is
|
|
602
|
+
* what `nextest run --binaries-metadata … --cargo-metadata …` reads. The
|
|
603
|
+
* binaries themselves stay in Cargo's target directory, where every build of
|
|
604
|
+
* the workspace keeps its warmth: never in an Nx output, which would restore a
|
|
605
|
+
* multi-GB tree per hit, and never in an archive, which a same-platform run
|
|
606
|
+
* would only unpack again (measured: 290 binaries, 678 MB, 4.6s quiet and 21s
|
|
607
|
+
* in a gate, per archive). A binary's path is cargo's `-C metadata` hash, which
|
|
608
|
+
* ignores source content, so the metadata says which binaries, never which
|
|
609
|
+
* bytes: the build's task hash is its third output, the key, and its last step
|
|
610
|
+
* records that key in the target directory it built. A checkout whose build was
|
|
611
|
+
* a cache hit holds another key, or none, and possibly binaries of an older
|
|
612
|
+
* tree at the very paths the metadata names; each runner's fixture rebuilds
|
|
613
|
+
* there first ({@link nextestRunnerFixture}). The key is also what makes a
|
|
614
|
+
* dependent that hashes this target's outputs see a source change the metadata
|
|
615
|
+
* alone would hide. Only a cross lane, whose binaries are built on one platform
|
|
616
|
+
* and run on another, moves them as an archive
|
|
617
|
+
* ({@link createCargoCrossTestTargets}). `--workspace` matches the clippy
|
|
618
|
+
* selection exactly, so both gates unify features the same way.
|
|
579
619
|
*
|
|
580
620
|
* Tests compile the dev profile only, so no test target carries a
|
|
581
621
|
* RELEASE_CONFIGURATION: Nx forwards a run's configuration down every
|
|
582
622
|
* `dependsOn` edge to each target that has it, and a release configuration
|
|
583
623
|
* must never turn the test binaries into release ones nobody runs.
|
|
584
624
|
*
|
|
585
|
-
* The directory and the
|
|
586
|
-
*
|
|
587
|
-
*
|
|
588
|
-
*
|
|
589
|
-
* an output, so a cache hit restores the key with the archive it names.
|
|
625
|
+
* The directory and the metadata are ONE command: a shell redirect does not
|
|
626
|
+
* create its parent, so the build consumes what the `mkdir` produced. Outside
|
|
627
|
+
* Nx there is no task hash, and a build no task names is refused here rather
|
|
628
|
+
* than by every runner.
|
|
590
629
|
*/
|
|
591
|
-
|
|
592
|
-
|
|
630
|
+
function createCargoTestBuildTarget(projectRoot, toolConfig, nativeTools) {
|
|
631
|
+
const helper = nativeToolCommand(nativeTools, projectRoot, 'nextest-extract', 'smoo-nx-nextest-binaries');
|
|
593
632
|
return {
|
|
594
633
|
executor: 'nx:run-commands',
|
|
595
634
|
metadata: CARGO_PRODUCER_METADATA,
|
|
596
635
|
cache: true,
|
|
597
636
|
inputs: CARGO_INPUTS,
|
|
598
|
-
outputs: [
|
|
637
|
+
outputs: [
|
|
638
|
+
`{projectRoot}/${NEXTEST_BINARIES_METADATA}`,
|
|
639
|
+
`{projectRoot}/${NEXTEST_CARGO_METADATA}`,
|
|
640
|
+
`{projectRoot}/${NEXTEST_BUILD_KEY}`,
|
|
641
|
+
],
|
|
642
|
+
dependsOn: nativeToolDependsOn(nativeTools, 'nextest-extract'),
|
|
599
643
|
options: {
|
|
600
644
|
command: sequence([
|
|
601
|
-
`mkdir -p ${posix.dirname(
|
|
602
|
-
|
|
603
|
-
|
|
645
|
+
`mkdir -p ${posix.dirname(NEXTEST_BINARIES_METADATA)}`,
|
|
646
|
+
`${nextestBinariesBuild(toolConfig)} > ${NEXTEST_BINARIES_METADATA}`,
|
|
647
|
+
`${cargoFrozen('metadata --format-version 1 --all-features')} > ${NEXTEST_CARGO_METADATA}`,
|
|
604
648
|
'test -n "$NX_TASK_HASH"',
|
|
605
|
-
`printf '%s\\n' "$NX_TASK_HASH" > ${
|
|
649
|
+
`printf '%s\\n' "$NX_TASK_HASH" > ${NEXTEST_BUILD_KEY}`,
|
|
650
|
+
`${helper} record ${NEXTEST_BUILD_KEY}`,
|
|
606
651
|
]),
|
|
607
652
|
cwd: projectRoot,
|
|
608
653
|
},
|
|
609
654
|
};
|
|
610
655
|
}
|
|
656
|
+
/**
|
|
657
|
+
* The build of the workspace's test binaries, printing nextest's binaries metadata: the command of
|
|
658
|
+
* `cargo-test-build` and of every runner's fixture, so the binaries a fixture materializes are the
|
|
659
|
+
* ones the metadata names.
|
|
660
|
+
*/
|
|
661
|
+
function nextestBinariesBuild(toolConfig) {
|
|
662
|
+
return cargoFrozen(`${NEXTEST_BINARIES_BUILD_ARGS.join(' ')} ${toolConfig}`);
|
|
663
|
+
}
|
|
611
664
|
/**
|
|
612
665
|
* One foreign triple's test archive, and the target that EXECUTES it.
|
|
613
666
|
*
|
|
614
|
-
*
|
|
615
|
-
*
|
|
616
|
-
*
|
|
617
|
-
*
|
|
618
|
-
*
|
|
619
|
-
*
|
|
667
|
+
* The one place a test archive exists: binaries built on one platform and run
|
|
668
|
+
* on another travel as a file, while a same-platform run executes
|
|
669
|
+
* `cargo-test-build`'s binaries where they were built. Same tool config
|
|
670
|
+
* layering and `--workspace-remap .` on the run as the in-place runners;
|
|
671
|
+
* `--target <triple>` and an archive file per triple, because those archives
|
|
672
|
+
* coexist as declared Nx outputs and one path for two triples would let a
|
|
673
|
+
* restored cache serve the wrong machine's binaries.
|
|
620
674
|
*
|
|
621
675
|
* `cargo-nextest` where every other cargo target spells `cargo --frozen`, and
|
|
622
676
|
* that is measured, not stylistic: cargo overwrites `CARGO` with its own path
|
|
@@ -630,13 +684,14 @@ function createCargoTestArchiveTarget(projectRoot, toolConfig) {
|
|
|
630
684
|
* inputs itself: both are otherwise attached by matching the
|
|
631
685
|
* `cargo --frozen` prefix in a command, and this command does not carry it.
|
|
632
686
|
*
|
|
633
|
-
* The RUNNER declares no dependency on the archive
|
|
634
|
-
*
|
|
635
|
-
*
|
|
636
|
-
*
|
|
637
|
-
*
|
|
638
|
-
*
|
|
639
|
-
*
|
|
687
|
+
* The RUNNER declares no dependency on the archive. That is the whole point of
|
|
688
|
+
* splitting the pair: it runs on a machine where the triple is native and the
|
|
689
|
+
* archive arrived as a file, so a dependency edge would ask that machine to
|
|
690
|
+
* cross-build what it was sent. It is cached on the archive's own bytes, the
|
|
691
|
+
* binaries it runs, never on the sources: a key of sources would vouch for
|
|
692
|
+
* binaries this machine did not build. It is also the one cargo target that
|
|
693
|
+
* needs no cargo: `nextest run --archive-file` extracts prebuilt binaries and
|
|
694
|
+
* never invokes cargo (measured, zero invocations).
|
|
640
695
|
*/
|
|
641
696
|
function createCargoCrossTestTargets(projectRoot, toolConfig, crossTarget, archiveInputs, pluginInstalled) {
|
|
642
697
|
const { target: triple, cargo } = crossTarget;
|
|
@@ -647,6 +702,9 @@ function createCargoCrossTestTargets(projectRoot, toolConfig, crossTarget, archi
|
|
|
647
702
|
`--archive-file ${archiveFile} --user-config-file none ${toolConfig}`,
|
|
648
703
|
]);
|
|
649
704
|
const archiveExecutor = 'nx:run-commands';
|
|
705
|
+
const runExecutor = '@smoothbricks/nx-plugin:bounded-exec';
|
|
706
|
+
const runCommand = `cargo-nextest nextest run --archive-file ${archiveFile} --workspace-remap . ` +
|
|
707
|
+
`--no-tests=pass --user-config-file none ${toolConfig}`;
|
|
650
708
|
return {
|
|
651
709
|
[cargoCrossTestArchiveTargetName(triple)]: {
|
|
652
710
|
executor: archiveExecutor,
|
|
@@ -689,14 +747,22 @@ function createCargoCrossTestTargets(projectRoot, toolConfig, crossTarget, archi
|
|
|
689
747
|
},
|
|
690
748
|
},
|
|
691
749
|
[cargoCrossTestTargetName(triple)]: {
|
|
692
|
-
executor:
|
|
693
|
-
cache:
|
|
694
|
-
|
|
750
|
+
executor: runExecutor,
|
|
751
|
+
cache: true,
|
|
752
|
+
// The archive's toolchain, npm and lock keys, as `cargo-test-build`'s: they decided the bytes it runs.
|
|
753
|
+
inputs: [
|
|
754
|
+
arrivedFileHashInput(posix.join(projectRoot, archiveFile)),
|
|
755
|
+
`{projectRoot}/${NEXTEST_REPO_CONFIG_PATH}`,
|
|
756
|
+
fileHashInput(PLUGIN_NEXTEST_CONFIG_PATH),
|
|
757
|
+
...cargoToolchainInputs(),
|
|
758
|
+
cargoRuntimeInput(projectRoot, 'cargo-nextest nextest --version'),
|
|
759
|
+
{ externalDependencies: cargoCommandNpmPackages({ executor: runExecutor }, runCommand, pluginInstalled) },
|
|
760
|
+
{ externalDependencies: [cargoLockNodeName(projectRoot)] },
|
|
761
|
+
],
|
|
695
762
|
outputs: [],
|
|
696
763
|
dependsOn: [],
|
|
697
764
|
options: {
|
|
698
|
-
command:
|
|
699
|
-
`--no-tests=pass --user-config-file none ${toolConfig}`,
|
|
765
|
+
command: runCommand,
|
|
700
766
|
cwd: projectRoot,
|
|
701
767
|
idleTimeoutMs: BOUNDED_TEST_IDLE_TIMEOUT_MS,
|
|
702
768
|
killAfterMs: BOUNDED_TEST_KILL_AFTER_MS,
|
|
@@ -710,7 +776,7 @@ function createCargoTestTarget(projectRoot) {
|
|
|
710
776
|
metadata: CARGO_PRODUCER_METADATA,
|
|
711
777
|
cache: true,
|
|
712
778
|
inputs: CARGO_INPUTS,
|
|
713
|
-
dependsOn: [
|
|
779
|
+
dependsOn: [CARGO_TEST_BUILD_TARGET],
|
|
714
780
|
options: {
|
|
715
781
|
command: cargoFrozen('test --workspace'),
|
|
716
782
|
cwd: projectRoot,
|
|
@@ -770,8 +836,8 @@ export function pluginInstalledIn(workspaceRoot, loadedFromNodeModules = PLUGIN_
|
|
|
770
836
|
/**
|
|
771
837
|
* The npm packages a cached cargo target runs, for its `externalDependencies`.
|
|
772
838
|
* Cargo runs none. A target this plugin's executor runs, or whose command reads
|
|
773
|
-
* the installed plugin's files (the nextest tool config, the
|
|
774
|
-
*
|
|
839
|
+
* the installed plugin's files (the nextest tool config, the test-binaries
|
|
840
|
+
* helper), runs the plugin. Without the input Nx keys every task whose
|
|
775
841
|
* executor is not an `@nx/` one on every package in the lockfile, so a
|
|
776
842
|
* lockfile-only commit re-ran every cargo verdict.
|
|
777
843
|
*/
|
|
@@ -1140,7 +1206,7 @@ function scriptcPlatformTargets(packageJson, packageJsonPath, projectRoot, libTs
|
|
|
1140
1206
|
*/
|
|
1141
1207
|
const WRANGLER_CONFIG_FILES = ['wrangler.jsonc', 'wrangler.json', 'wrangler.toml'];
|
|
1142
1208
|
/**
|
|
1143
|
-
* ONE target that deploys whichever stage it is handed, never a configuration
|
|
1209
|
+
* ONE target that deploys whichever stage it is handed (`--stage`), never a configuration
|
|
1144
1210
|
* per stage. Pull-request stages are `prN` for unbounded N, so an enumerated
|
|
1145
1211
|
* `configurations` map cannot describe the surface that actually exists, and a
|
|
1146
1212
|
* project carrying both spellings would have two ways to say one thing.
|
|
@@ -1149,15 +1215,17 @@ const WRANGLER_CONFIG_FILES = ['wrangler.jsonc', 'wrangler.json', 'wrangler.toml
|
|
|
1149
1215
|
* statement that CI deploys this project on every stage, and only the repository
|
|
1150
1216
|
* can make it. A plugin that tagged what it inferred would enrol every private
|
|
1151
1217
|
* wrangler project in CI deploys by writing the policy it is supposed to read.
|
|
1152
|
-
*
|
|
1153
|
-
* `{args.stage}` rather than `forwardAllArgs`: run-commands'
|
|
1154
|
-
* `interpolateArgsIntoCommand` returns as soon as it sees `{args.` and never
|
|
1155
|
-
* appends forwarded arguments, so `nx run web:deploy --stage=pr42` yields
|
|
1156
|
-
* exactly one `--stage`, for an arbitrary preview stage no map could enumerate.
|
|
1157
|
-
* An omitted stage interpolates to empty and `deploy-stage`'s required
|
|
1158
|
-
* `--stage` refuses it, which is the failure we want at the boundary.
|
|
1159
1218
|
*/
|
|
1160
|
-
const
|
|
1219
|
+
const WRANGLER_DEPLOY_EXECUTOR = '@smoothbricks/nx-plugin:wrangler-deploy';
|
|
1220
|
+
/**
|
|
1221
|
+
* What a deploy uploads: the project's files and its build half's output. Nx keys the
|
|
1222
|
+
* `--stage` override with them, so the hash is the artifact and the stage.
|
|
1223
|
+
*/
|
|
1224
|
+
const WRANGLER_DEPLOY_INPUTS = [
|
|
1225
|
+
'default',
|
|
1226
|
+
'^default',
|
|
1227
|
+
{ dependentTasksOutputFiles: '**/*', transitive: false },
|
|
1228
|
+
];
|
|
1161
1229
|
async function createProjectTargets(packageJsonPath, workspaceRoot, hostPlatform, nativeTools, cargoWorkspaces, eslint, versionless) {
|
|
1162
1230
|
const projectRoot = dirname(packageJsonPath);
|
|
1163
1231
|
const absoluteProjectRoot = join(workspaceRoot, projectRoot);
|
|
@@ -1218,9 +1286,7 @@ async function createProjectTargets(packageJsonPath, workspaceRoot, hostPlatform
|
|
|
1218
1286
|
const declaredTargets = packageJson.nx?.targets ?? {};
|
|
1219
1287
|
const cargoWasmConfig = await resolveCargoWasmConfig(absoluteProjectRoot, packageJsonPath, workspaceRoot, repoRootPackages);
|
|
1220
1288
|
const inferCargoWasm = cargoWasmConfig !== null && !('cargo-wasm' in declaredTargets);
|
|
1221
|
-
const
|
|
1222
|
-
const hasOrdinaryBuildOutputTarget = hasLibTsconfig || napiConfig !== null || cargoWasmConfig !== null || packageLocalBuildOutputs.ordinary;
|
|
1223
|
-
const hasAnyBuildOutputTarget = hasOrdinaryBuildOutputTarget || packageLocalBuildOutputs.platform;
|
|
1289
|
+
const hasOrdinaryBuildOutputTarget = hasLibTsconfig || napiConfig !== null || cargoWasmConfig !== null || declaresPackageLocalBuildOutput(packageJson);
|
|
1224
1290
|
const isDeployableWranglerProject = packageJson.private === true && WRANGLER_CONFIG_FILES.some((file) => existsSync(join(absoluteProjectRoot, file)));
|
|
1225
1291
|
if (hasLibTsconfig) {
|
|
1226
1292
|
const executableOutputs = packageBinOutputs(packageJson, packageJsonPath);
|
|
@@ -1345,9 +1411,9 @@ async function createProjectTargets(packageJsonPath, workspaceRoot, hostPlatform
|
|
|
1345
1411
|
// result — duplicating the very edges the spread exists to add.
|
|
1346
1412
|
//
|
|
1347
1413
|
// `dependsOn` REPLACES rather than unions. These lists state what each target
|
|
1348
|
-
// consumes — the fetched registry, the
|
|
1414
|
+
// consumes — the fetched registry, the test build, the debug addon — and a
|
|
1349
1415
|
// package that must re-route one (build its artifact ahead of the test run,
|
|
1350
|
-
// or drop `cargo-test-
|
|
1416
|
+
// or drop `cargo-test-build` because it compiles differently) can only say
|
|
1351
1417
|
// so by replacing the list; a union would make every inferred edge
|
|
1352
1418
|
// unremovable and a corrected order unrepresentable.
|
|
1353
1419
|
// Additive intent already has a spelling (`"..."` above), so a plugin-local
|
|
@@ -1376,29 +1442,30 @@ async function createProjectTargets(packageJsonPath, workspaceRoot, hostPlatform
|
|
|
1376
1442
|
// as the outputs of the targets a repository adds to `dependsOn`. Hashing
|
|
1377
1443
|
// those outputs here means a repository never has to restate `inputs` to
|
|
1378
1444
|
// add them - and a restated `inputs` REPLACES this union with the root
|
|
1379
|
-
// project's `default`, which owns no crate file, so the
|
|
1445
|
+
// project's `default`, which owns no crate file, so the test build then
|
|
1380
1446
|
// cache-hits against edited crates while every per-crate test reruns on
|
|
1381
1447
|
// the stale binary. That verdict is wrong, not merely slow.
|
|
1382
1448
|
const workspaceCargoInputs = [
|
|
1383
1449
|
...(workspaceInputs.length > 0 ? workspaceInputs : CARGO_INPUTS),
|
|
1384
1450
|
{ dependentTasksOutputFiles: '**/*', transitive: false },
|
|
1385
1451
|
];
|
|
1386
|
-
targets[
|
|
1387
|
-
// `
|
|
1388
|
-
//
|
|
1389
|
-
targets[
|
|
1452
|
+
targets[CARGO_TEST_BUILD_TARGET] = createCargoTestBuildTarget(cargoWorkspaceRoot, nextestToolConfigArg(cargoWorkspaceRoot), nativeTools);
|
|
1453
|
+
// The build's `cargo nextest list` loads the repository's nextest config and
|
|
1454
|
+
// refuses an invalid one, so that file keys the build as well as every run.
|
|
1455
|
+
targets[CARGO_TEST_BUILD_TARGET].inputs = [...workspaceCargoInputs, `{projectRoot}/${NEXTEST_REPO_CONFIG_PATH}`];
|
|
1390
1456
|
// One archive per declared foreign triple, from the same inputs and the
|
|
1391
|
-
// same repository nextest config
|
|
1392
|
-
//
|
|
1393
|
-
// the host
|
|
1457
|
+
// same repository nextest config, whose `archive.include` decides what an
|
|
1458
|
+
// archive CONTAINS: it is the workspace's test binaries for another
|
|
1459
|
+
// machine, so a change that invalidates the host build must invalidate
|
|
1460
|
+
// every cross archive.
|
|
1394
1461
|
for (const crossTarget of listCargoCrossTestTargets(join(workspaceRoot, cargoWorkspaceRoot))) {
|
|
1395
1462
|
Object.assign(targets, createCargoCrossTestTargets(cargoWorkspaceRoot, nextestToolConfigArg(cargoWorkspaceRoot), crossTarget, [...workspaceCargoInputs, `{projectRoot}/${NEXTEST_REPO_CONFIG_PATH}`], pluginInstalledIn(workspaceRoot)));
|
|
1396
1463
|
}
|
|
1397
1464
|
// A serial group's filter can span members, so no single crate owns it. The root
|
|
1398
|
-
// owns each group's runner beside the
|
|
1465
|
+
// owns each group's runner beside the test build it executes, and gives it the inputs
|
|
1399
1466
|
// of exactly the members its filter can select from (`filterScope`): a group scoped
|
|
1400
1467
|
// to its packages reruns only when their sources or local dependencies change,
|
|
1401
|
-
// and an unscoped one hashes every member, as the
|
|
1468
|
+
// and an unscoped one hashes every member, as the test build itself does.
|
|
1402
1469
|
for (const group of cargoWorkspace.serialGroups) {
|
|
1403
1470
|
targets[cargoTestGroupTargetName(group.group)] = cargoTestGroupTarget(cargoWorkspace, nativeTools, await cargoTestRunnerInputs(workspaceRoot, cargoWorkspace, serialGroupMemberDirs(cargoWorkspace, group)), group);
|
|
1404
1471
|
}
|
|
@@ -1416,11 +1483,11 @@ async function createProjectTargets(packageJsonPath, workspaceRoot, hostPlatform
|
|
|
1416
1483
|
// of its closure; a target dir per crate compiled every shared dependency
|
|
1417
1484
|
// once per crate (49 closures, 11 GiB on one repository) and no per-crate
|
|
1418
1485
|
// cache hit ever repaid that. The workspace inputs are exactly the union of
|
|
1419
|
-
// every crate's, so the verdict caches on the same key set the
|
|
1486
|
+
// every crate's, so the verdict caches on the same key set the test build
|
|
1420
1487
|
// does. Non-root packages depend on this target. Its target dir is its own
|
|
1421
1488
|
// (CARGO_LINT_CLIPPY_COMMAND, ./cross-check-policy.ts): Cargo flocks one
|
|
1422
1489
|
// directory per invocation, and a workspace clippy holding the dev build's
|
|
1423
|
-
// `target/` queued the
|
|
1490
|
+
// `target/` queued the test build and every dev build behind it.
|
|
1424
1491
|
targets['cargo-lint'] = {
|
|
1425
1492
|
executor: 'nx:run-commands',
|
|
1426
1493
|
metadata: CARGO_PRODUCER_METADATA,
|
|
@@ -1471,7 +1538,8 @@ async function createProjectTargets(packageJsonPath, workspaceRoot, hostPlatform
|
|
|
1471
1538
|
cwd: cargoWorkspaceRoot,
|
|
1472
1539
|
},
|
|
1473
1540
|
};
|
|
1474
|
-
// Mutation runs are minutes-to-hours
|
|
1541
|
+
// Mutation runs are minutes-to-hours and never part of build/lint. Cached on the code and toolchain they mutate
|
|
1542
|
+
// and on cargo-mutants' configuration, with the report as the output: an unchanged tree mutates nothing new.
|
|
1475
1543
|
// CI runs these per-PR via `cargo mutants --in-diff` (see mutants.toml docs).
|
|
1476
1544
|
// bounded-exec sizes cargo-mutants' own jobserver to its CPU grant (its `cargo-mutants` runner kind), which
|
|
1477
1545
|
// otherwise starts one task per core whatever else runs on the host. It reports no test bounded-exec can read as
|
|
@@ -1479,29 +1547,19 @@ async function createProjectTargets(packageJsonPath, workspaceRoot, hostPlatform
|
|
|
1479
1547
|
targets.mutation = {
|
|
1480
1548
|
executor: '@smoothbricks/nx-plugin:bounded-exec',
|
|
1481
1549
|
metadata: CARGO_PRODUCER_METADATA,
|
|
1482
|
-
cache:
|
|
1550
|
+
cache: true,
|
|
1551
|
+
inputs: [...workspaceCargoInputs, '{projectRoot}/**/.cargo/mutants.toml'],
|
|
1552
|
+
outputs: [`{workspaceRoot}/${posix.join(cargoWorkspaceRoot, 'mutants.out')}`],
|
|
1483
1553
|
options: { command: cargoFrozen('mutants --workspace'), cwd: cargoWorkspaceRoot, timeoutMs: MUTATION_TIMEOUT_MS },
|
|
1484
1554
|
};
|
|
1555
|
+
// Cached on the code and toolchain it measures: a rerun with unchanged inputs measures nothing new.
|
|
1485
1556
|
targets.bench = {
|
|
1486
1557
|
executor: 'nx:run-commands',
|
|
1487
1558
|
metadata: CARGO_PRODUCER_METADATA,
|
|
1488
|
-
cache:
|
|
1559
|
+
cache: true,
|
|
1560
|
+
inputs: workspaceCargoInputs,
|
|
1489
1561
|
options: { command: cargoFrozen('bench --workspace'), cwd: cargoWorkspaceRoot },
|
|
1490
1562
|
};
|
|
1491
|
-
// A read-only preview of the retention pass the plugin's postTasksExecution
|
|
1492
|
-
// schedules after runs that built (@smoothbricks/cargo-retain): the superseded unit
|
|
1493
|
-
// generations it would reclaim and why everything else stays. Never cached:
|
|
1494
|
-
// the verdict is about this machine's disk, not the commit.
|
|
1495
|
-
const retainTool = nativeToolDependsOn(nativeTools, 'cargo-retain');
|
|
1496
|
-
targets['cargo-retention'] = {
|
|
1497
|
-
executor: 'nx:run-commands',
|
|
1498
|
-
cache: false,
|
|
1499
|
-
...(retainTool.length > 0 ? { dependsOn: retainTool } : {}),
|
|
1500
|
-
options: {
|
|
1501
|
-
command: nativeToolCommand(nativeTools, cargoWorkspaceRoot, 'cargo-retain', 'smoo-nx-cargo-retain'),
|
|
1502
|
-
cwd: cargoWorkspaceRoot,
|
|
1503
|
-
},
|
|
1504
|
-
};
|
|
1505
1563
|
}
|
|
1506
1564
|
if (cargoWorkspace) {
|
|
1507
1565
|
const packageTargetNames = await addCargoTestTargets(targets, projectName, projectRoot, workspaceRoot, cargoWorkspace, nativeTools);
|
|
@@ -1586,19 +1644,16 @@ async function createProjectTargets(packageJsonPath, workspaceRoot, hostPlatform
|
|
|
1586
1644
|
if (frozenCargoManifests.size > 0) {
|
|
1587
1645
|
targets[CARGO_FETCH_TARGET] = {
|
|
1588
1646
|
executor: 'nx:run-commands',
|
|
1589
|
-
// The download lands in CARGO_HOME, outside the workspace
|
|
1590
|
-
//
|
|
1591
|
-
//
|
|
1592
|
-
cache:
|
|
1593
|
-
inputs: cargoFetchInputs(projectRoot),
|
|
1647
|
+
// The download lands in CARGO_HOME, outside the workspace, so nothing is
|
|
1648
|
+
// a workspace output; the registry's state reaches the key instead
|
|
1649
|
+
// (cargoFetchedInput), and a hit never stands for a crate it lacks.
|
|
1650
|
+
cache: true,
|
|
1651
|
+
inputs: [...cargoFetchInputs(projectRoot), cargoFetchedInput(projectRoot, [...frozenCargoManifests].sort())],
|
|
1652
|
+
outputs: [],
|
|
1594
1653
|
options: {
|
|
1595
1654
|
// One fetch per manifest, independent of the others: Cargo's own
|
|
1596
1655
|
// package-cache lock arbitrates the CARGO_HOME they share.
|
|
1597
|
-
commands: [...frozenCargoManifests]
|
|
1598
|
-
.sort()
|
|
1599
|
-
.map((manifestPath) => manifestPath === 'Cargo.toml'
|
|
1600
|
-
? CARGO_FETCH_COMMAND
|
|
1601
|
-
: `${CARGO_FETCH_COMMAND} --manifest-path ${manifestPath}`),
|
|
1656
|
+
commands: [...frozenCargoManifests].sort().map(cargoFetchCommand),
|
|
1602
1657
|
cwd: projectRoot,
|
|
1603
1658
|
},
|
|
1604
1659
|
};
|
|
@@ -1631,7 +1686,8 @@ async function createProjectTargets(packageJsonPath, workspaceRoot, hostPlatform
|
|
|
1631
1686
|
// lock-scope node of the directory it runs in) unless its inputs already do.
|
|
1632
1687
|
for (const [name, target] of Object.entries(targets)) {
|
|
1633
1688
|
const text = targetCommandText(target);
|
|
1634
|
-
|
|
1689
|
+
// `cargo-fetch` runs cargo unfrozen, as the one task that may reach the network, and is keyed like the rest.
|
|
1690
|
+
if (!runsFrozenCargo(text) && name !== CARGO_FETCH_TARGET)
|
|
1635
1691
|
continue;
|
|
1636
1692
|
target.outputs ??= [];
|
|
1637
1693
|
if (!target.cache)
|
|
@@ -1641,7 +1697,9 @@ async function createProjectTargets(packageJsonPath, workspaceRoot, hostPlatform
|
|
|
1641
1697
|
? ` && cargo clippy -V${name === CARGO_CROSS_LINT_TARGET ? '' : ' && cargo fmt --version'}`
|
|
1642
1698
|
: text.includes('nextest ')
|
|
1643
1699
|
? ' && cargo nextest --version'
|
|
1644
|
-
: ''
|
|
1700
|
+
: text.includes('mutants ')
|
|
1701
|
+
? ' && cargo mutants --version'
|
|
1702
|
+
: '';
|
|
1645
1703
|
const inputs = target.inputs ?? CARGO_INPUTS;
|
|
1646
1704
|
const namesPackages = inputs.some((input) => typeof input === 'object' && 'externalDependencies' in input && !isCargoLockInput(input));
|
|
1647
1705
|
const namesLock = inputs.some((input) => input === CARGO_CLOSURE_INPUT || isCargoLockInput(input));
|
|
@@ -1665,7 +1723,7 @@ async function createProjectTargets(packageJsonPath, workspaceRoot, hostPlatform
|
|
|
1665
1723
|
if (napiDebug && cargoWorkspace) {
|
|
1666
1724
|
// A crate whose project also builds the debug cdylib runs its tests after
|
|
1667
1725
|
// that build: the tests dlopen what `napi-debug` writes into `target/debug`,
|
|
1668
|
-
// and
|
|
1726
|
+
// and a test binary run in place loads it from this tree.
|
|
1669
1727
|
const runners = [
|
|
1670
1728
|
...cargoPackagePlans.flatMap((plan) => plan.pieces.map((piece) => piece.targetName)),
|
|
1671
1729
|
// The root owns the serial groups' runners, so they take its build as its pieces do.
|
|
@@ -1719,37 +1777,39 @@ async function createProjectTargets(packageJsonPath, workspaceRoot, hostPlatform
|
|
|
1719
1777
|
};
|
|
1720
1778
|
}
|
|
1721
1779
|
}
|
|
1722
|
-
// A deploy is
|
|
1780
|
+
// A deploy is cached only while its stage serves what it would deploy; the build half beside it
|
|
1781
|
+
// always is.
|
|
1723
1782
|
//
|
|
1724
1783
|
// Nx's cache answers "did this exact input set already produce an output". A deploy's real
|
|
1725
|
-
// question is "is this exact version live", and the two agree only until someone rolls back
|
|
1726
|
-
//
|
|
1727
|
-
//
|
|
1728
|
-
// `
|
|
1729
|
-
//
|
|
1730
|
-
//
|
|
1731
|
-
//
|
|
1732
|
-
//
|
|
1733
|
-
//
|
|
1784
|
+
// question is "is this exact version live", and the two agree only until someone rolls back:
|
|
1785
|
+
// the workspace is then unchanged, so the hash is unchanged. No input repairs that. A `runtime`
|
|
1786
|
+
// input cannot even learn WHICH STAGE is being deployed (Nx hashes runtime inputs with the env
|
|
1787
|
+
// from `getTaskSpecificEnv`, which excludes the task coordinates, and input strings never
|
|
1788
|
+
// interpolate `{args.*}`), and hashing the live tag in would never converge, because the
|
|
1789
|
+
// deployed version is tagged with the hash. An executor's custom hasher is the one Nx API that
|
|
1790
|
+
// sees `task.overrides`, so `wrangler-deploy`'s asks the question: it hashes the artifact and the
|
|
1791
|
+
// stage, answers that hash only while the stage serves the version tagged with it, and otherwise
|
|
1792
|
+
// adds a nonce, so the run misses and deploys (executors/wrangler-deploy/hasher.ts). The run
|
|
1793
|
+
// still tags the artifact's version, so the next hash, with that version live, is the artifact's
|
|
1794
|
+
// own: `deploy-stage` finds it live and changes nothing, and Nx caches that answer.
|
|
1734
1795
|
//
|
|
1735
|
-
// So the target is split along the line the question
|
|
1736
|
-
// file-derived — build the artifact and whatever the build registers
|
|
1737
|
-
//
|
|
1738
|
-
//
|
|
1739
|
-
//
|
|
1740
|
-
//
|
|
1741
|
-
// dependent has to re-check liveness, not inherit someone else's cache hit.
|
|
1796
|
+
// So the target is split along the line the question falls on. `deploy-build` is purely
|
|
1797
|
+
// file-derived — build the artifact and whatever the build registers. `deploy` checks live state
|
|
1798
|
+
// on every run, in its hasher, and a cache hit replays only a deploy that would change nothing.
|
|
1799
|
+
// That is what lets ordering be an ordinary `dependsOn: ["<other>:deploy"]` edge at any depth,
|
|
1800
|
+
// and it is why such an edge must point at `deploy` and not at `deploy-build`: a dependent has
|
|
1801
|
+
// to re-check liveness, not inherit someone else's build.
|
|
1742
1802
|
//
|
|
1743
1803
|
// Both are bases for a package-local declaration to land on, per the merge rules above: a
|
|
1744
1804
|
// declaration naming `cache`, `inputs` or `dependsOn` REPLACES what is set here and inherits
|
|
1745
1805
|
// everything it does not name, while Nx's `"..."` token expands to the inferred list at its
|
|
1746
1806
|
// position. So a project adding a cross-project edge writes
|
|
1747
|
-
// `"dependsOn": ["...", "backend:deploy"]` and keeps both the edge below and this
|
|
1807
|
+
// `"dependsOn": ["...", "backend:deploy"]` and keeps both the edge below and this executor —
|
|
1748
1808
|
// measured, not assumed, against an inferred base.
|
|
1749
1809
|
//
|
|
1750
1810
|
// `deploy` is INFERRED for a private wrangler project rather than patched onto a hand-written
|
|
1751
|
-
// one. The
|
|
1752
|
-
// the same `nx:run-commands` wrapper around
|
|
1811
|
+
// one. The executor is a constant of the convention, not of the project: every consumer wrote
|
|
1812
|
+
// the same `nx:run-commands` wrapper around `smoo wrangler deploy-stage`. `private: true` is the second half of the
|
|
1753
1813
|
// detection: a PUBLISHED package's wrangler manifest documents a binding for its consumers,
|
|
1754
1814
|
// so inferring a deploy from it would put a live `wrangler deploy` of someone's documentation
|
|
1755
1815
|
// one `nx run-many -t deploy` away. A published package that really is deployed declares
|
|
@@ -1770,11 +1830,12 @@ async function createProjectTargets(packageJsonPath, workspaceRoot, hostPlatform
|
|
|
1770
1830
|
? 'build'
|
|
1771
1831
|
: null;
|
|
1772
1832
|
targets[DEPLOY_TARGET] = {
|
|
1773
|
-
executor:
|
|
1774
|
-
cache:
|
|
1833
|
+
executor: WRANGLER_DEPLOY_EXECUTOR,
|
|
1834
|
+
cache: true,
|
|
1835
|
+
inputs: WRANGLER_DEPLOY_INPUTS,
|
|
1775
1836
|
outputs: [],
|
|
1776
1837
|
...(fileDerivedHalf === null ? {} : { dependsOn: [fileDerivedHalf] }),
|
|
1777
|
-
options: {
|
|
1838
|
+
options: {},
|
|
1778
1839
|
};
|
|
1779
1840
|
}
|
|
1780
1841
|
// Empty `outputs`, deliberately and explicitly: this aggregate runs no
|
|
@@ -1807,43 +1868,10 @@ async function createProjectTargets(packageJsonPath, workspaceRoot, hostPlatform
|
|
|
1807
1868
|
],
|
|
1808
1869
|
};
|
|
1809
1870
|
}
|
|
1810
|
-
// Every cargo build directory this project's own commands write. `clean`
|
|
1811
|
-
// cannot learn them from `outputs`: a clippy or nextest target dir is a
|
|
1812
|
-
// multi-GB build tree that must never enter the Nx cache, so the targets
|
|
1813
|
-
// deliberately declare `outputs: []`. Reading `--target-dir` back off the
|
|
1814
|
-
// commands means the list cannot drift from what actually gets written, and a
|
|
1815
|
-
// directory is named relative to the command's own cwd, not the project root.
|
|
1816
|
-
// The workspace's default `target/` is not listed: every dev build shares it.
|
|
1817
|
-
const cargoBuildDirs = [
|
|
1818
|
-
...new Set(Object.entries(targets).flatMap(([name, target]) => {
|
|
1819
|
-
const cwd = target.options?.cwd;
|
|
1820
|
-
const base = typeof cwd === 'string' ? cwd : projectRoot;
|
|
1821
|
-
const dirs = [...targetCommandText(target).matchAll(/--target-dir\s+(\S+)/g)].flatMap((match) => match[1] === undefined ? [] : [match[1]]);
|
|
1822
|
-
if (name === CARGO_TEST_ARCHIVE_TARGET) {
|
|
1823
|
-
dirs.push(posix.dirname(CARGO_TEST_ARCHIVE_FILE));
|
|
1824
|
-
}
|
|
1825
|
-
return dirs.map((dir) => `{workspaceRoot}/${posix.normalize(posix.join(base, dir))}`);
|
|
1826
|
-
})),
|
|
1827
|
-
].sort();
|
|
1828
|
-
if (hasAnyBuildOutputTarget || cargoBuildDirs.length > 0) {
|
|
1829
|
-
const declaredBuild = declaredTargets.build;
|
|
1830
|
-
const declaredBuildOutputs = isRecord(declaredBuild) && Array.isArray(declaredBuild.outputs)
|
|
1831
|
-
? declaredBuild.outputs.filter((output) => typeof output === 'string')
|
|
1832
|
-
: null;
|
|
1833
|
-
targets.clean = {
|
|
1834
|
-
executor: '@smoothbricks/nx-plugin:clean-outputs',
|
|
1835
|
-
cache: false,
|
|
1836
|
-
// Naming any output REPLACES the executor's default, so the build outputs
|
|
1837
|
-
// it would have used are restated here rather than lost.
|
|
1838
|
-
...(cargoBuildDirs.length > 0
|
|
1839
|
-
? { options: { outputs: [...(declaredBuildOutputs ?? ['{projectRoot}/dist']), ...cargoBuildDirs] } }
|
|
1840
|
-
: {}),
|
|
1841
|
-
};
|
|
1842
|
-
}
|
|
1843
1871
|
if (targets['typecheck-tests']) {
|
|
1844
1872
|
if (hasLibTsconfig) {
|
|
1845
|
-
// Test configs may resolve the package's own `./index.js` through dist
|
|
1846
|
-
//
|
|
1873
|
+
// Test configs may resolve the package's own `./index.js` through dist, so the
|
|
1874
|
+
// current-project declaration output is rebuilt first, not only the
|
|
1847
1875
|
// dependency-project outputs reached through typecheck.
|
|
1848
1876
|
targets['typecheck-tests'].dependsOn = ['tsc-js', 'typecheck'];
|
|
1849
1877
|
}
|
|
@@ -1854,8 +1882,8 @@ async function createProjectTargets(packageJsonPath, workspaceRoot, hostPlatform
|
|
|
1854
1882
|
// A Bun suite that `--shard` splits and a `--timings` manifest balances gets a
|
|
1855
1883
|
// check, which `lint` depends on, that the manifest names every file the
|
|
1856
1884
|
// shards run: Bun charges an unnamed file the median, and unnamed files
|
|
1857
|
-
// cluster into one shard.
|
|
1858
|
-
//
|
|
1885
|
+
// cluster into one shard. Cached on the manifests, the bunfig and the names
|
|
1886
|
+
// Bun's discovery would find, which include gitignored files no file input keys.
|
|
1859
1887
|
const sharded = timingsShardedSuite(projectRoot, declaredTargets);
|
|
1860
1888
|
if (!sharded.ok) {
|
|
1861
1889
|
throw new Error(`${packageJsonPath}: ${sharded.error}`);
|
|
@@ -1863,7 +1891,11 @@ async function createProjectTargets(packageJsonPath, workspaceRoot, hostPlatform
|
|
|
1863
1891
|
if (sharded.suite !== null) {
|
|
1864
1892
|
targets[SHARD_TIMINGS_TARGET] = {
|
|
1865
1893
|
executor: SHARD_TIMINGS_EXECUTOR,
|
|
1866
|
-
cache:
|
|
1894
|
+
cache: true,
|
|
1895
|
+
inputs: [
|
|
1896
|
+
...timingsSuiteInputs(sharded.suite),
|
|
1897
|
+
{ externalDependencies: pluginInstalledIn(workspaceRoot) ? [PLUGIN_PACKAGE] : [] },
|
|
1898
|
+
],
|
|
1867
1899
|
outputs: [],
|
|
1868
1900
|
options: { cwd: sharded.suite.cwd, args: sharded.suite.args },
|
|
1869
1901
|
};
|
|
@@ -2411,13 +2443,9 @@ function parseEnvPrefixedCommand(command) {
|
|
|
2411
2443
|
function isRecord(value) {
|
|
2412
2444
|
return value !== null && typeof value === 'object';
|
|
2413
2445
|
}
|
|
2414
|
-
function
|
|
2446
|
+
function declaresPackageLocalBuildOutput(packageJson) {
|
|
2415
2447
|
const targets = packageJson.nx?.targets;
|
|
2416
|
-
|
|
2417
|
-
return {
|
|
2418
|
-
ordinary: targetNames.some(isBuildOutputTargetName),
|
|
2419
|
-
platform: targetNames.some((targetName) => PLATFORM_TARGET_GLOBS.some((glob) => targetName.endsWith(glob.slice(1)))),
|
|
2420
|
-
};
|
|
2448
|
+
return isRecord(targets) && Object.keys(targets).some(isBuildOutputTargetName);
|
|
2421
2449
|
}
|
|
2422
2450
|
function cargoTargetDependency(currentProjectName, target) {
|
|
2423
2451
|
return target.projectName === currentProjectName
|
|
@@ -2538,7 +2566,7 @@ async function resolveCargoWorkspaces(packageJsonPaths, workspaceRoot, hostPlatf
|
|
|
2538
2566
|
* own time bound never delays an ordinary shard.
|
|
2539
2567
|
*
|
|
2540
2568
|
* Every piece EXECUTES, it never builds: it runs the binaries
|
|
2541
|
-
* `cargo-test-
|
|
2569
|
+
* `cargo-test-build` compiled once for the whole workspace. That is what
|
|
2542
2570
|
* removed the two costs the old shape could not avoid. `nextest run --workspace
|
|
2543
2571
|
* -E 'package(X)'` re-entered cargo once per crate, and the `-p X` form
|
|
2544
2572
|
* re-resolved that crate's features so cargo rebuilt the divergent half inside
|
|
@@ -2548,37 +2576,32 @@ async function resolveCargoWorkspaces(packageJsonPaths, workspaceRoot, hostPlatf
|
|
|
2548
2576
|
* it, so the filterset is the only selector left, and it selects the same tests
|
|
2549
2577
|
* it always did.
|
|
2550
2578
|
*
|
|
2551
|
-
* The
|
|
2552
|
-
*
|
|
2553
|
-
*
|
|
2554
|
-
*
|
|
2555
|
-
*
|
|
2556
|
-
*
|
|
2557
|
-
*
|
|
2558
|
-
*
|
|
2559
|
-
*
|
|
2560
|
-
*
|
|
2561
|
-
*
|
|
2562
|
-
*
|
|
2563
|
-
*
|
|
2564
|
-
*
|
|
2565
|
-
* than the archived copy of it — the same toolchain, because the archive's hash
|
|
2566
|
-
* covers the toolchain pin. The extraction lives in Cargo's own target
|
|
2567
|
-
* directory (`<target_directory>/nextest-extracted`), never in an Nx output: it
|
|
2568
|
-
* is a multi-GB tree for a cached verdict that has no outputs, rebuilt from the
|
|
2569
|
-
* archive like the rest of the build tree, and a checkout that keeps its build
|
|
2570
|
-
* state off its source tree keeps the extraction there with it.
|
|
2579
|
+
* The binaries run where the build left them, never copied. An archive makes
|
|
2580
|
+
* a same-platform run pay for a copy of every binary in the workspace before
|
|
2581
|
+
* its first test (measured: 290 binaries, 678 MB, 4.6s on a quiet host and 21s
|
|
2582
|
+
* in a gate, per archive), which only a cross lane needs
|
|
2583
|
+
* (createCargoCrossTestTargets). A run reads the build's reuse-build metadata,
|
|
2584
|
+
* the build's declared Nx outputs, and remaps the build's target directory onto
|
|
2585
|
+
* this checkout's, which `smoo-nx-nextest-binaries target-dir` reads from
|
|
2586
|
+
* Cargo, so a `build.target-dir` is honoured as every build honours it. The
|
|
2587
|
+
* binaries are not Nx outputs, so a checkout whose build was a cache hit can
|
|
2588
|
+
* hold the metadata without them, or with binaries of an older tree at the very
|
|
2589
|
+
* paths it names: the runner's fixture (nextestRunnerFixture) compares the key
|
|
2590
|
+
* the target directory records with the build's and stats each binary, and
|
|
2591
|
+
* otherwise rebuilds with the build's own command through mbx, in the runner's
|
|
2592
|
+
* build interval and never in its progress-bounded test window.
|
|
2571
2593
|
*
|
|
2572
|
-
* `--workspace-remap .` is not cosmetic.
|
|
2573
|
-
* of the tree that produced it; without the remap,
|
|
2574
|
-
* every test the producing tree's
|
|
2575
|
-
*
|
|
2576
|
-
* exists. With it, the runner's
|
|
2577
|
-
*
|
|
2578
|
-
* nextest also re-points
|
|
2579
|
-
*
|
|
2580
|
-
* time: a test that spawns
|
|
2581
|
-
* path and must read the
|
|
2594
|
+
* `--workspace-remap .` is not cosmetic. Reuse-build metadata records the
|
|
2595
|
+
* ABSOLUTE paths of the tree that produced it; without the remap, metadata
|
|
2596
|
+
* restored from another checkout hands every test the producing tree's
|
|
2597
|
+
* `CARGO_MANIFEST_DIR` — measured on a moved tree, tests then read another
|
|
2598
|
+
* checkout's fixtures, or a path that no longer exists. With it, the runner's
|
|
2599
|
+
* own cargo workspace root wins, so the metadata is relocatable and one cache
|
|
2600
|
+
* entry serves every checkout of the same commit. nextest also re-points
|
|
2601
|
+
* `CARGO_BIN_EXE_<name>`/`NEXTEST_BIN_EXE_<name>` at the remapped binaries at
|
|
2602
|
+
* RUNTIME (measured), but `env!` reads them at COMPILE time: a test that spawns
|
|
2603
|
+
* `env!("CARGO_BIN_EXE_x")` holds the producing tree's path and must read the
|
|
2604
|
+
* runtime variable instead to survive relocation.
|
|
2582
2605
|
*
|
|
2583
2606
|
* nextest.toml singles some tests out with an override: a raised `slow-timeout`
|
|
2584
2607
|
* marks a test whose cost is not the suite's. Those are lifted OUT of the hash
|
|
@@ -2599,8 +2622,8 @@ async function resolveCargoWorkspaces(packageJsonPaths, workspaceRoot, hostPlatf
|
|
|
2599
2622
|
* making valid empty crates and shards fail execution.
|
|
2600
2623
|
*
|
|
2601
2624
|
* Pieces fan out rather than chain: a reused-build run writes nothing to cargo's
|
|
2602
|
-
* `target/`, so no piece waits on another.
|
|
2603
|
-
*
|
|
2625
|
+
* `target/`, so no piece waits on another. Only a fixture that finds another
|
|
2626
|
+
* build in place builds, once for the checkout's runners, under a lock of its own.
|
|
2604
2627
|
*/
|
|
2605
2628
|
async function addCargoTestTargets(targets, currentProjectName, projectRoot, workspaceRoot, workspace, nativeTools) {
|
|
2606
2629
|
const targetNames = [];
|
|
@@ -2609,13 +2632,13 @@ async function addCargoTestTargets(targets, currentProjectName, projectRoot, wor
|
|
|
2609
2632
|
continue;
|
|
2610
2633
|
}
|
|
2611
2634
|
const inputs = await cargoTestRunnerInputs(workspaceRoot, workspace, [plan.package.dir]);
|
|
2612
|
-
const
|
|
2635
|
+
const build = cargoTargetDependency(currentProjectName, {
|
|
2613
2636
|
projectName: workspace.rootProjectName,
|
|
2614
|
-
targetName:
|
|
2637
|
+
targetName: CARGO_TEST_BUILD_TARGET,
|
|
2615
2638
|
});
|
|
2616
2639
|
for (const piece of plan.pieces) {
|
|
2617
2640
|
targetNames.push(piece.targetName);
|
|
2618
|
-
targets[piece.targetName] = cargoTestRunnerTarget(workspace, nativeTools,
|
|
2641
|
+
targets[piece.targetName] = cargoTestRunnerTarget(workspace, nativeTools, build, inputs, piece);
|
|
2619
2642
|
}
|
|
2620
2643
|
}
|
|
2621
2644
|
return targetNames;
|
|
@@ -2652,7 +2675,7 @@ function serialGroupMemberDirs(workspace, group) {
|
|
|
2652
2675
|
* manifests, not unrelated sibling sources.
|
|
2653
2676
|
*
|
|
2654
2677
|
* The repository's own nextest config layers OVER the plugin's tool config, so it
|
|
2655
|
-
* decides timeouts, groups and
|
|
2678
|
+
* decides timeouts, groups and setup scripts: a cached verdict that ignored it
|
|
2656
2679
|
* would survive the change that invalidates it.
|
|
2657
2680
|
*/
|
|
2658
2681
|
async function cargoTestRunnerInputs(workspaceRoot, workspace, memberDirs) {
|
|
@@ -2664,8 +2687,8 @@ async function cargoTestRunnerInputs(workspaceRoot, workspace, memberDirs) {
|
|
|
2664
2687
|
cache: workspace.inputsCache,
|
|
2665
2688
|
cargo: workspace.closureSource.cargo,
|
|
2666
2689
|
})));
|
|
2667
|
-
// The
|
|
2668
|
-
//
|
|
2690
|
+
// The test build unifies every built package's manifest into every test binary, and a runner's key does not follow
|
|
2691
|
+
// the build's outputs, so each runner names them all: the ones Nx holds as files, the rest through the repository's
|
|
2669
2692
|
// runtime hash of external sources.
|
|
2670
2693
|
const manifests = [];
|
|
2671
2694
|
const external = new Map();
|
|
@@ -2698,30 +2721,46 @@ async function cargoTestRunnerInputs(workspaceRoot, workspace, memberDirs) {
|
|
|
2698
2721
|
];
|
|
2699
2722
|
}
|
|
2700
2723
|
/**
|
|
2701
|
-
*
|
|
2702
|
-
*
|
|
2703
|
-
*
|
|
2724
|
+
* A runner's fixture budget: the build interval in which it rebuilds what the target directory lacks. It is a build's
|
|
2725
|
+
* budget, not a test's: on a host whose mbx store lacks the units, the fixture compiles the whole workspace's
|
|
2726
|
+
* tests, which a cold hosted runner takes tens of minutes to do while still making progress.
|
|
2727
|
+
*/
|
|
2728
|
+
const NEXTEST_BINARIES_FIXTURE_TIMEOUT_MS = 3_600_000;
|
|
2729
|
+
/**
|
|
2730
|
+
* The fixture every runner of the workspace runs before its tests: the binaries live outside Nx outputs, so it checks
|
|
2731
|
+
* that the target directory holds the build whose key the metadata came with, and every binary the metadata names,
|
|
2732
|
+
* and otherwise rebuilds with the build's own command. It reports its own duration and mbx's hits and misses apart
|
|
2733
|
+
* from the run's, and names the crates loudly when mbx had to compile (smoo-nx-nextest-binaries).
|
|
2734
|
+
*/
|
|
2735
|
+
function nextestRunnerFixture(workspace, nativeTools) {
|
|
2736
|
+
const helper = nativeToolCommand(nativeTools, workspace.projectRoot, 'nextest-extract', 'smoo-nx-nextest-binaries');
|
|
2737
|
+
return `${helper} ensure ${NEXTEST_BINARIES_METADATA} ${NEXTEST_BUILD_KEY} -- ${nextestBinariesBuild(nextestToolConfigArg(workspace.projectRoot))}`;
|
|
2738
|
+
}
|
|
2739
|
+
/**
|
|
2740
|
+
* One `nextest run` over a filterset against the workspace's test build. Every runner of the
|
|
2741
|
+
* workspace builds its command here, so the reuse-build, the remap, the tool config and the cwd
|
|
2742
|
+
* cannot drift between the per-crate pieces and the serial groups.
|
|
2704
2743
|
*/
|
|
2705
2744
|
function nextestRunnerCommand(workspace, nativeTools, selector, flags) {
|
|
2706
2745
|
const toolConfig = nextestToolConfigArg(workspace.projectRoot);
|
|
2707
2746
|
// Relative to the runner's cwd, so the hashed command is the same in every checkout.
|
|
2708
|
-
const
|
|
2709
|
-
const
|
|
2710
|
-
`--
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
/** One per-crate piece: a bounded run of its partition of the archive's tests. */
|
|
2716
|
-
function cargoTestRunnerTarget(workspace, nativeTools, archive, inputs, piece) {
|
|
2747
|
+
const helper = nativeToolCommand(nativeTools, workspace.projectRoot, 'nextest-extract', 'smoo-nx-nextest-binaries');
|
|
2748
|
+
const reuseBuild = `--binaries-metadata ${NEXTEST_BINARIES_METADATA} --cargo-metadata ${NEXTEST_CARGO_METADATA} ` +
|
|
2749
|
+
`--target-dir-remap "$(${helper} target-dir)"`;
|
|
2750
|
+
return cargoFrozen(`nextest run ${reuseBuild} --workspace-remap . -E ${shellWord(selector)}${flags} --user-config-file none ${toolConfig}`);
|
|
2751
|
+
}
|
|
2752
|
+
/** One per-crate piece: a bounded run of its partition of the test build's tests. */
|
|
2753
|
+
function cargoTestRunnerTarget(workspace, nativeTools, build, inputs, piece) {
|
|
2717
2754
|
return {
|
|
2718
2755
|
executor: '@smoothbricks/nx-plugin:bounded-exec',
|
|
2719
2756
|
cache: true,
|
|
2720
2757
|
inputs,
|
|
2721
|
-
dependsOn: [
|
|
2758
|
+
dependsOn: [build, ...nativeToolDependsOn(nativeTools, 'nextest-extract')],
|
|
2722
2759
|
options: {
|
|
2723
2760
|
command: nextestRunnerCommand(workspace, nativeTools, piece.selector, `${piece.extra} --no-fail-fast --no-tests=pass`),
|
|
2724
2761
|
cwd: workspace.projectRoot,
|
|
2762
|
+
fixtureCommand: nextestRunnerFixture(workspace, nativeTools),
|
|
2763
|
+
fixtureTimeoutMs: NEXTEST_BINARIES_FIXTURE_TIMEOUT_MS,
|
|
2725
2764
|
idleTimeoutMs: BOUNDED_TEST_IDLE_TIMEOUT_MS,
|
|
2726
2765
|
killAfterMs: BOUNDED_TEST_KILL_AFTER_MS,
|
|
2727
2766
|
},
|
|
@@ -2740,10 +2779,12 @@ function cargoTestGroupTarget(workspace, nativeTools, inputs, group) {
|
|
|
2740
2779
|
executor: '@smoothbricks/nx-plugin:bounded-exec',
|
|
2741
2780
|
cache: true,
|
|
2742
2781
|
inputs: [...inputs, fileHashInput(PLUGIN_NEXTEST_CODE_BOUND)],
|
|
2743
|
-
dependsOn: [
|
|
2782
|
+
dependsOn: [CARGO_TEST_BUILD_TARGET, ...nativeToolDependsOn(nativeTools, 'nextest-extract')],
|
|
2744
2783
|
options: {
|
|
2745
2784
|
command: nextestRunnerCommand(workspace, nativeTools, group.filter, ' --no-fail-fast --no-tests=fail'),
|
|
2746
2785
|
cwd: workspace.projectRoot,
|
|
2786
|
+
fixtureCommand: nextestRunnerFixture(workspace, nativeTools),
|
|
2787
|
+
fixtureTimeoutMs: NEXTEST_BINARIES_FIXTURE_TIMEOUT_MS,
|
|
2747
2788
|
idleTimeoutMs: BOUNDED_TEST_IDLE_TIMEOUT_MS,
|
|
2748
2789
|
killAfterMs: BOUNDED_TEST_KILL_AFTER_MS,
|
|
2749
2790
|
parallelism: 1,
|