@smoothbricks/nx-plugin 0.7.18 → 0.7.19
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 +160 -99
- package/dist/.build-inputs.json +35 -29
- package/dist/built-output-packages.js +1 -1
- package/dist/cargo-closure-input.js +1 -1
- package/dist/cargo-source-hash.d.ts +3 -21
- package/dist/cargo-source-hash.d.ts.map +1 -1
- package/dist/cargo-source-hash.js +4 -91
- package/dist/cargo-toolchain-paths.d.ts +2 -2
- package/dist/cargo-toolchain-paths.js +2 -2
- package/dist/cargo-workspace.d.ts.map +1 -1
- package/dist/cargo-workspace.js +2 -1
- package/dist/executors/bounded-exec/admission-queue.d.ts +3 -1
- package/dist/executors/bounded-exec/admission-queue.d.ts.map +1 -1
- package/dist/executors/bounded-exec/admission-queue.js +9 -10
- package/dist/executors/bounded-exec/awake-clock.d.ts +5 -0
- package/dist/executors/bounded-exec/awake-clock.d.ts.map +1 -0
- package/dist/executors/bounded-exec/awake-clock.js +22 -0
- package/dist/executors/bounded-exec/bounds.d.ts +7 -5
- package/dist/executors/bounded-exec/bounds.d.ts.map +1 -1
- package/dist/executors/bounded-exec/bounds.js +14 -11
- package/dist/executors/bounded-exec/case-gate.d.ts +114 -0
- package/dist/executors/bounded-exec/case-gate.d.ts.map +1 -0
- package/dist/executors/bounded-exec/case-gate.js +342 -0
- package/dist/executors/bounded-exec/cpu-pool-thread.d.ts +1 -0
- package/dist/executors/bounded-exec/cpu-pool-thread.d.ts.map +1 -1
- package/dist/executors/bounded-exec/cpu-pool-thread.js +2 -2
- package/dist/executors/bounded-exec/cpu-pool.d.ts +28 -1
- package/dist/executors/bounded-exec/cpu-pool.d.ts.map +1 -1
- package/dist/executors/bounded-exec/cpu-pool.js +102 -16
- package/dist/executors/bounded-exec/endpoint-life.d.ts +146 -0
- package/dist/executors/bounded-exec/endpoint-life.d.ts.map +1 -0
- package/dist/executors/bounded-exec/endpoint-life.js +228 -0
- package/dist/executors/bounded-exec/executor.d.ts.map +1 -1
- package/dist/executors/bounded-exec/executor.js +207 -69
- package/dist/executors/bounded-exec/gateway-lease.d.ts +1 -1
- package/dist/executors/bounded-exec/gateway-lease.d.ts.map +1 -1
- package/dist/executors/bounded-exec/gateway-lease.js +8 -1
- package/dist/executors/bounded-exec/go-run-summary.d.ts +51 -0
- package/dist/executors/bounded-exec/go-run-summary.d.ts.map +1 -0
- package/dist/executors/bounded-exec/go-run-summary.js +98 -0
- package/dist/executors/bounded-exec/hang-diagnostics.d.ts +3 -3
- package/dist/executors/bounded-exec/hang-diagnostics.d.ts.map +1 -1
- package/dist/executors/bounded-exec/hang-diagnostics.js +66 -48
- package/dist/executors/bounded-exec/lease-wait.d.ts +1 -0
- package/dist/executors/bounded-exec/lease-wait.d.ts.map +1 -1
- package/dist/executors/bounded-exec/lease-wait.js +1 -0
- package/dist/executors/bounded-exec/mbx-pool.d.ts +28 -7
- package/dist/executors/bounded-exec/mbx-pool.d.ts.map +1 -1
- package/dist/executors/bounded-exec/mbx-pool.js +30 -9
- package/dist/executors/bounded-exec/mbx-reservations.d.ts +8 -5
- package/dist/executors/bounded-exec/mbx-reservations.d.ts.map +1 -1
- package/dist/executors/bounded-exec/mbx-reservations.js +187 -283
- package/dist/executors/bounded-exec/parent-grant.d.ts +2 -0
- package/dist/executors/bounded-exec/parent-grant.d.ts.map +1 -1
- package/dist/executors/bounded-exec/parent-grant.js +1 -0
- package/dist/executors/bounded-exec/pool-admission.d.ts +29 -3
- package/dist/executors/bounded-exec/pool-admission.d.ts.map +1 -1
- package/dist/executors/bounded-exec/pool-admission.js +47 -1
- package/dist/executors/bounded-exec/progress.d.ts +3 -0
- package/dist/executors/bounded-exec/progress.d.ts.map +1 -1
- package/dist/executors/bounded-exec/progress.js +31 -1
- package/dist/executors/bounded-exec/reservation-connection.d.ts +90 -0
- package/dist/executors/bounded-exec/reservation-connection.d.ts.map +1 -0
- package/dist/executors/bounded-exec/reservation-connection.js +248 -0
- package/dist/executors/bounded-exec/run-cpu-pool.d.ts.map +1 -1
- package/dist/executors/bounded-exec/run-cpu-pool.js +3 -0
- package/dist/executors/bounded-exec/runner-sizing.d.ts +9 -5
- package/dist/executors/bounded-exec/runner-sizing.d.ts.map +1 -1
- package/dist/executors/bounded-exec/runner-sizing.js +13 -9
- package/dist/executors/bounded-exec/schema.d.ts +2 -2
- package/dist/executors/bounded-exec/suite-minimum.d.ts +21 -0
- package/dist/executors/bounded-exec/suite-minimum.d.ts.map +1 -0
- package/dist/executors/bounded-exec/suite-minimum.js +85 -0
- package/dist/executors/bounded-exec/test-result-writer.d.ts +2 -0
- package/dist/executors/bounded-exec/test-result-writer.d.ts.map +1 -1
- package/dist/executors/bounded-exec/test-result-writer.js +1 -0
- package/dist/executors/bounded-exec/test-results.d.ts +5 -0
- package/dist/executors/bounded-exec/test-results.d.ts.map +1 -1
- package/dist/executors/bounded-exec/test-results.js +2 -2
- package/dist/executors/bounded-exec/verdict.d.ts +26 -4
- package/dist/executors/bounded-exec/verdict.d.ts.map +1 -1
- package/dist/executors/bounded-exec/verdict.js +26 -5
- package/dist/executors/cargo-zigbuild/executor.d.ts +10 -8
- package/dist/executors/cargo-zigbuild/executor.d.ts.map +1 -1
- package/dist/executors/cargo-zigbuild/executor.js +32 -19
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +105 -73
- package/dist/managed-files/ci-workflow.d.ts +4 -1
- package/dist/managed-files/ci-workflow.d.ts.map +1 -1
- package/dist/managed-files/ci-workflow.js +9 -14
- package/dist/managed-files/files.d.ts +3 -3
- package/dist/managed-files/files.js +3 -3
- package/dist/task-results.js +2 -1
- package/dist/workspace-config-policy.d.ts.map +1 -1
- package/dist/workspace-config-policy.js +135 -42
- package/executors.json +2 -0
- package/managed/raw/envrc +24 -0
- package/managed/raw/patches/nx@24.0.3.patch +1179 -133
- package/managed/raw/patches/ttsc@0.37.1.patch +1055 -0
- package/managed/raw/tooling/direnv/developer-links.ts +105 -11
- package/managed/raw/tooling/direnv/devenv.smoo.nix +20 -19
- package/package.json +67 -11
- package/runtime/nx-publish/.build-inputs.json +2 -2
- package/runtime/nx-publish/cache_adapter.js +293 -3
- package/runtime/nx-publish/nx_publish.js +36 -14
- package/src/built-output-packages.ts +1 -1
- package/src/cargo-closure-input.ts +1 -1
- package/src/cargo-source-hash.ts +16 -132
- package/src/cargo-toolchain-paths.ts +2 -2
- package/src/cargo-workspace.ts +1 -2
- package/src/executors/bounded-exec/admission-queue.ts +11 -10
- package/src/executors/bounded-exec/awake-clock.ts +20 -0
- package/src/executors/bounded-exec/bounds.ts +28 -15
- package/src/executors/bounded-exec/case-gate.ts +365 -0
- package/src/executors/bounded-exec/cpu-pool-thread.ts +3 -3
- package/src/executors/bounded-exec/cpu-pool.ts +139 -12
- package/src/executors/bounded-exec/endpoint-life.ts +279 -0
- package/src/executors/bounded-exec/executor.ts +280 -106
- package/src/executors/bounded-exec/gateway-lease.ts +6 -0
- package/src/executors/bounded-exec/go-run-summary.ts +137 -0
- package/src/executors/bounded-exec/hang-diagnostics.ts +70 -52
- package/src/executors/bounded-exec/lease-wait.ts +1 -0
- package/src/executors/bounded-exec/mbx-pool.ts +36 -9
- package/src/executors/bounded-exec/mbx-reservations.ts +213 -182
- package/src/executors/bounded-exec/parent-grant.ts +3 -0
- package/src/executors/bounded-exec/pool-admission.ts +59 -2
- package/src/executors/bounded-exec/progress.ts +37 -2
- package/src/executors/bounded-exec/reservation-connection.ts +221 -0
- package/src/executors/bounded-exec/run-cpu-pool.ts +2 -0
- package/src/executors/bounded-exec/runner-sizing.ts +13 -8
- package/src/executors/bounded-exec/schema.json +1 -1
- package/src/executors/bounded-exec/schema.ts +2 -2
- package/src/executors/bounded-exec/suite-minimum.ts +81 -0
- package/src/executors/bounded-exec/test-result-writer.ts +3 -0
- package/src/executors/bounded-exec/test-results.ts +5 -0
- package/src/executors/bounded-exec/verdict.ts +39 -6
- package/src/executors/cargo-zigbuild/executor.ts +30 -19
- package/src/index.ts +112 -78
- package/src/managed-files/ci-workflow.ts +13 -17
- package/src/managed-files/files.ts +3 -3
- package/src/workspace-config-policy.ts +161 -43
- package/test-timings.json +157 -147
- package/managed/raw/patches/ttsc@0.36.3.patch +0 -1660
|
@@ -11,9 +11,11 @@ import {
|
|
|
11
11
|
gitWorkspaceRoot,
|
|
12
12
|
writeBuildInputs,
|
|
13
13
|
} from '@smoothbricks/build-inputs';
|
|
14
|
-
import {
|
|
14
|
+
import type { CargoLockResolve } from '@smoothbricks/build-inputs/cargo-closure';
|
|
15
|
+
import type { Result } from '@smoothbricks/cargo-retain';
|
|
15
16
|
import typia from 'typia';
|
|
16
17
|
|
|
18
|
+
import { CargoMetadataError, readCargoResolve } from '../../cargo-source-hash.js';
|
|
17
19
|
import type { CargoZigbuildOptions } from './schema.js';
|
|
18
20
|
|
|
19
21
|
interface CargoZigbuildContext {
|
|
@@ -75,22 +77,21 @@ export function cargoTriple(target: string): string {
|
|
|
75
77
|
}
|
|
76
78
|
|
|
77
79
|
/**
|
|
78
|
-
* The remedy for a failed build of `target
|
|
79
|
-
*
|
|
80
|
-
*
|
|
80
|
+
* The remedy for a failed build of `target`, when rustc has no standard library for its triple: every managed shell
|
|
81
|
+
* carries the whole Linux rust-std set, so that rustc is not the one the checkout's shell provides. A build outside it
|
|
82
|
+
* fails in rustc, which names the missing target but not the shell. `libdir` is what
|
|
81
83
|
* `rustc --print target-libdir --target <triple>` printed, or null when rustc could not answer.
|
|
82
84
|
*/
|
|
83
85
|
export function missingRustStdRemedy(
|
|
84
86
|
command: string,
|
|
85
87
|
target: string,
|
|
86
|
-
platform: NodeJS.Platform,
|
|
87
88
|
libdir: { readonly path: string; readonly exists: boolean } | null,
|
|
88
89
|
): string | null {
|
|
89
|
-
if (
|
|
90
|
+
if (libdir === null || libdir.exists) return null;
|
|
90
91
|
return (
|
|
91
|
-
`${command}: rustc has no standard library for ${cargoTriple(target)} (${libdir.path} is absent).
|
|
92
|
-
"Linux rust-std set
|
|
93
|
-
'
|
|
92
|
+
`${command}: rustc has no standard library for ${cargoTriple(target)} (${libdir.path} is absent). Every managed ` +
|
|
93
|
+
"shell carries the Linux rust-std set, so this rustc is not the checkout's shell's: enter it (direnv reload) and " +
|
|
94
|
+
'run nx run <project>:<target> again'
|
|
94
95
|
);
|
|
95
96
|
}
|
|
96
97
|
|
|
@@ -173,13 +174,14 @@ export function depInfoPath(built: string): string {
|
|
|
173
174
|
/**
|
|
174
175
|
* The input record (build-inputs.ts) of the build that wrote `built`, or why none can be made: the record
|
|
175
176
|
* `smoo-nx-build-inputs` writes after a macOS build, from the dep-info beside the artifact, so one link check judges
|
|
176
|
-
* both. `
|
|
177
|
-
* Nx task running the build, which the executor reads from its
|
|
177
|
+
* both. `cargo` is the resolve Cargo reports for the build's manifest, which names the workspace manifest and the
|
|
178
|
+
* lockfile closure the record states. `producer` is the Nx task running the build, which the executor reads from its
|
|
179
|
+
* environment.
|
|
178
180
|
*/
|
|
179
181
|
export function buildInputsOf(
|
|
180
182
|
built: string,
|
|
181
183
|
manifestPath: string,
|
|
182
|
-
|
|
184
|
+
cargo: CargoLockResolve,
|
|
183
185
|
producer?: BuildInputProducer,
|
|
184
186
|
): Result<BuildInputRecord, string> {
|
|
185
187
|
const directory = path.dirname(manifestPath);
|
|
@@ -191,7 +193,12 @@ export function buildInputsOf(
|
|
|
191
193
|
if (!existsSync(depInfo)) {
|
|
192
194
|
return { ok: false, error: `${depInfo} does not exist: cargo wrote no dep-info beside ${built}` };
|
|
193
195
|
}
|
|
194
|
-
|
|
196
|
+
let record: BuildInputRecord | null;
|
|
197
|
+
try {
|
|
198
|
+
record = cargoBuildInputs(workspaceRoot, readFileSync(depInfo, 'utf8'), cargo, producer);
|
|
199
|
+
} catch (error) {
|
|
200
|
+
return { ok: false, error: `${depInfo}: ${error instanceof Error ? error.message : String(error)}` };
|
|
201
|
+
}
|
|
195
202
|
if (record === null) return { ok: false, error: `${depInfo} names no file of ${workspaceRoot}` };
|
|
196
203
|
return { ok: true, value: record };
|
|
197
204
|
}
|
|
@@ -262,7 +269,7 @@ export default async function cargoZigbuildExecutor(
|
|
|
262
269
|
}
|
|
263
270
|
if (status.code !== 0) {
|
|
264
271
|
console.error(`${command}: exited with ${status.signal ?? `status ${status.code}`}`);
|
|
265
|
-
const remedy = missingRustStdRemedy(command, options.target,
|
|
272
|
+
const remedy = missingRustStdRemedy(command, options.target, await rustLibdir(options.target));
|
|
266
273
|
if (remedy !== null) console.error(remedy);
|
|
267
274
|
return { success: false };
|
|
268
275
|
}
|
|
@@ -273,13 +280,17 @@ export default async function cargoZigbuildExecutor(
|
|
|
273
280
|
}
|
|
274
281
|
|
|
275
282
|
// From the dep-info cargo just wrote, before the artifact is copied: a build whose inputs cannot be named leaves the
|
|
276
|
-
// output as it was, and a source edited while the artifact is copied is not recorded with its new bytes.
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
283
|
+
// output as it was, and a source edited while the artifact is copied is not recorded with its new bytes. The resolve
|
|
284
|
+
// is the one the task's key was computed from (readCargoResolve), so the record states the key's lockfile closure.
|
|
285
|
+
let cargo: CargoLockResolve;
|
|
286
|
+
try {
|
|
287
|
+
cargo = await readCargoResolve(manifestPath, context.root);
|
|
288
|
+
} catch (error) {
|
|
289
|
+
if (!(error instanceof CargoMetadataError)) throw error;
|
|
290
|
+
console.error(`${command}: ${error.message}`);
|
|
280
291
|
return { success: false };
|
|
281
292
|
}
|
|
282
|
-
const inputs = buildInputsOf(built, manifestPath, cargo
|
|
293
|
+
const inputs = buildInputsOf(built, manifestPath, cargo, producer);
|
|
283
294
|
if (!inputs.ok) {
|
|
284
295
|
console.error(`${command}: ${inputs.error}`);
|
|
285
296
|
return { success: false };
|
package/src/index.ts
CHANGED
|
@@ -169,6 +169,13 @@ const WORKSPACE_TSCONFIG_BASE_INPUT = '{workspaceRoot}/tsconfig.base.json';
|
|
|
169
169
|
*/
|
|
170
170
|
const TYPECHECK_COMPILER_ENV = 'SMOO_TYPECHECK_TSC';
|
|
171
171
|
const TYPECHECK_COMPILER_INPUT = { env: TYPECHECK_COMPILER_ENV };
|
|
172
|
+
/**
|
|
173
|
+
* The named input a project defines as the compiler identity of its inferred `typecheck`: {@link TYPECHECK_COMPILER_INPUT}
|
|
174
|
+
* where that target runs the native compiler, undefined where it runs ttsc, whose compiler the workspace keys, or where
|
|
175
|
+
* a declared `typecheck` replaces the inferred command. A workspace `typecheck` default that replaces the inferred
|
|
176
|
+
* inputs names it to key exactly the compiler its command runs, and defines it empty in `nx.json` for the rest.
|
|
177
|
+
*/
|
|
178
|
+
const TYPECHECK_COMPILER_NAMED_INPUT = 'typecheckCompiler';
|
|
172
179
|
function typecheckCommand(args: string): string {
|
|
173
180
|
return `"\${${TYPECHECK_COMPILER_ENV}:?is unset, enter the devenv shell (devenv.smoo.nix builds the typecheck compiler)}" ${args}`;
|
|
174
181
|
}
|
|
@@ -980,6 +987,18 @@ function nextestHelperInputs(
|
|
|
980
987
|
: [];
|
|
981
988
|
}
|
|
982
989
|
|
|
990
|
+
/**
|
|
991
|
+
* The record writer's bytes, for a target that runs it after its build, where this workspace builds it: the writer
|
|
992
|
+
* decides the `.build-inputs.json` the target's outputs hold, so a change to what a record states re-keys the target
|
|
993
|
+
* and no cache hit restores a record in the old form. An installed writer is its package's, keyed as the package.
|
|
994
|
+
*/
|
|
995
|
+
function buildInputsToolInputs(
|
|
996
|
+
nativeTools: NativeTools | null,
|
|
997
|
+
): { dependentTasksOutputFiles: string; transitive: false }[] {
|
|
998
|
+
return nativeTools !== null && nativeToolDependsOn(nativeTools, 'build-inputs').length > 0
|
|
999
|
+
? [{ dependentTasksOutputFiles: `**/dist/bin/${nativeTools.platform}/smoo-nx-build-inputs`, transitive: false }]
|
|
1000
|
+
: [];
|
|
1001
|
+
}
|
|
983
1002
|
/**
|
|
984
1003
|
* One foreign triple's test archive, and the target that EXECUTES it.
|
|
985
1004
|
*
|
|
@@ -2551,29 +2570,29 @@ async function createProjectTargets(
|
|
|
2551
2570
|
}
|
|
2552
2571
|
}
|
|
2553
2572
|
|
|
2554
|
-
//
|
|
2555
|
-
//
|
|
2556
|
-
//
|
|
2557
|
-
//
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
// The canonical release-check instead judges prebuilt shipping artifacts and must remain dependency-free.
|
|
2561
|
-
const observerProducers = [...nativeToolDependsOn(nativeTools, 'cowshed'), ...lineageProducer];
|
|
2562
|
-
if (observerProducers.length > 0) {
|
|
2573
|
+
// The Darwin Node idle clock and the Cargo admission observer both load the local cowshed addon. They can fail
|
|
2574
|
+
// a run but do not change a passing command, so none keys its bytes (README, "Bounded exec key"). Declarations
|
|
2575
|
+
// retain these prerequisites with Nx's ordinary "..." merge token. The wall-only release-check judges already
|
|
2576
|
+
// built shipping artifacts and remains dependency-free.
|
|
2577
|
+
const addonProducers = [...nativeToolDependsOn(nativeTools, 'cowshed'), ...lineageProducer];
|
|
2578
|
+
if (addonProducers.length > 0) {
|
|
2563
2579
|
for (const name of new Set([...Object.keys(targets), ...Object.keys(declaredTargets)])) {
|
|
2564
2580
|
const declared = declaredTargets[name];
|
|
2565
2581
|
const executor =
|
|
2566
2582
|
isRecord(declared) && declared.executor !== undefined ? declared.executor : targets[name]?.executor;
|
|
2567
2583
|
if (executor !== '@smoothbricks/nx-plugin:bounded-exec' || name === 'release-check') continue;
|
|
2568
|
-
// Nx discards an incompatible executor's inferred configuration; only the observer prerequisites belong below it.
|
|
2569
|
-
if (targets[name]?.executor !== undefined && targets[name]?.executor !== executor) {
|
|
2570
|
-
targets[name] = {};
|
|
2571
|
-
}
|
|
2572
2584
|
const runs = [...targetOptionSets(declared), ...targetOptionSets(targets[name])];
|
|
2573
|
-
|
|
2585
|
+
const needsAddon = runs.some(
|
|
2586
|
+
(options) =>
|
|
2587
|
+
runsAsCargoLeaf(boundedCommandLine(options) ?? '') ||
|
|
2588
|
+
(hostPlatform?.targetFamily === 'macos' && typeof options.idleTimeoutMs === 'number'),
|
|
2589
|
+
);
|
|
2590
|
+
if (!needsAddon) continue;
|
|
2591
|
+
// Nx discards an incompatible executor's inferred configuration; only the runtime prerequisites belong below it.
|
|
2592
|
+
if (targets[name]?.executor !== undefined && targets[name]?.executor !== executor) targets[name] = {};
|
|
2574
2593
|
targets[name] ??= {};
|
|
2575
2594
|
const target = targets[name];
|
|
2576
|
-
target.dependsOn = [...(target.dependsOn ?? []), ...
|
|
2595
|
+
target.dependsOn = [...(target.dependsOn ?? []), ...addonProducers];
|
|
2577
2596
|
}
|
|
2578
2597
|
}
|
|
2579
2598
|
|
|
@@ -2643,6 +2662,21 @@ async function createProjectTargets(
|
|
|
2643
2662
|
}
|
|
2644
2663
|
}
|
|
2645
2664
|
|
|
2665
|
+
// The inferred typecheck's compiler, named only where its command is the one inferred here: a declared typecheck
|
|
2666
|
+
// that runs another command runs something this inference does not know. Nx keeps the inferred command under a
|
|
2667
|
+
// declaration that names the same executor and no command, and replaces it under any other executor, under a
|
|
2668
|
+
// top-level `command` (its run-commands shorthand) or under `options.command`/`options.commands`.
|
|
2669
|
+
const declaredTypecheck = declaredTargets.typecheck;
|
|
2670
|
+
const declaredTypecheckOptions = isRecord(declaredTypecheck) ? declaredTypecheck.options : undefined;
|
|
2671
|
+
const typecheckCompilerInputs =
|
|
2672
|
+
targets.typecheck === undefined ||
|
|
2673
|
+
(isRecord(declaredTypecheck) &&
|
|
2674
|
+
((declaredTypecheck.executor !== undefined && declaredTypecheck.executor !== targets.typecheck.executor) ||
|
|
2675
|
+
declaredTypecheck.command !== undefined)) ||
|
|
2676
|
+
(isRecord(declaredTypecheckOptions) &&
|
|
2677
|
+
(declaredTypecheckOptions.command !== undefined || declaredTypecheckOptions.commands !== undefined))
|
|
2678
|
+
? []
|
|
2679
|
+
: typecheck.inputs;
|
|
2646
2680
|
// A declared target REPLACES the inferred input list, pin included, so a
|
|
2647
2681
|
// repository that hand-writes `inputs` for a cargo target silently loses its
|
|
2648
2682
|
// toolchain identity. Name the identity once here so such a declaration can
|
|
@@ -2654,6 +2688,7 @@ async function createProjectTargets(
|
|
|
2654
2688
|
// task in the repository to serve projects that can never reference it.
|
|
2655
2689
|
const namedInputs: Record<string, NonNullable<TargetConfiguration['inputs']>> = {
|
|
2656
2690
|
[BUN_LOCK_SCOPE_NAMED_INPUT]: [bunLockInput(projectRoot)],
|
|
2691
|
+
...(typecheckCompilerInputs.length === 0 ? {} : { [TYPECHECK_COMPILER_NAMED_INPUT]: [...typecheckCompilerInputs] }),
|
|
2657
2692
|
...(versionless === null
|
|
2658
2693
|
? {}
|
|
2659
2694
|
: {
|
|
@@ -2997,62 +3032,9 @@ function createNapiTargets(
|
|
|
2997
3032
|
};
|
|
2998
3033
|
// The task that builds the executable recordInputs runs, when this workspace builds it.
|
|
2999
3034
|
const buildInputsTool = nativeToolDependsOn(nativeTools, 'build-inputs');
|
|
3000
|
-
const
|
|
3001
|
-
const convention = NAPI_TARGET_CONVENTIONS[triple];
|
|
3002
|
-
return convention !== undefined && sameNapiPlatform(convention, hostPlatform);
|
|
3003
|
-
});
|
|
3035
|
+
const recordedInputs = [...(cargoInputs ?? []), ...buildInputsToolInputs(nativeTools)];
|
|
3004
3036
|
const targets: Record<string, TargetConfiguration> = {};
|
|
3005
|
-
|
|
3006
|
-
// The addon the test suite loads. A plain dev build shares target/debug with
|
|
3007
|
-
// cargo-test's dependency graph, so after the tests compile this is nearly
|
|
3008
|
-
// free, where a `--target <triple>` platform build compiles the graph again
|
|
3009
|
-
// under target/<triple>/. The output lives OUTSIDE dist/ because packages
|
|
3010
|
-
// publish `files: ["dist"]` wholesale: an addon the test run wrote under
|
|
3011
|
-
// dist/ would ship in place of the release build. native.ts resolves this
|
|
3012
|
-
// directory only when the napi-test target sets NAPI_DEBUG_ADDON=1, so
|
|
3013
|
-
// production loads never see it.
|
|
3014
|
-
targets['napi-debug'] = {
|
|
3015
|
-
executor: 'nx:run-commands',
|
|
3016
|
-
metadata: CARGO_PRODUCER_METADATA,
|
|
3017
|
-
cache: true,
|
|
3018
|
-
dependsOn: ['^build'],
|
|
3019
|
-
inputs: cargoInputs,
|
|
3020
|
-
outputs: ['{projectRoot}/.cache/native-debug/'],
|
|
3021
|
-
options: {
|
|
3022
|
-
cwd: cargoCwd,
|
|
3023
|
-
command: `${napiCommand} build --platform --no-js --dts ${config.binaryName}.napi.d.ts ${commonCommand} --output-dir ${outputDir('.cache/native-debug')}`,
|
|
3024
|
-
},
|
|
3025
|
-
};
|
|
3026
|
-
|
|
3027
|
-
if (!hasHostPlatformTarget) {
|
|
3028
|
-
// The platform target for this host triple is the same compilation, so a
|
|
3029
|
-
// second cargo-napi invocation only buys a duplicate dependency graph
|
|
3030
|
-
// (a plain build and a `--target` build write different target/
|
|
3031
|
-
// subdirectories); native.ts already resolves the identical
|
|
3032
|
-
// platform-suffixed filename from <tree>/<platform-dir> after <tree>/host,
|
|
3033
|
-
// in the one tree its package's source authority selects (.cache/native-dev
|
|
3034
|
-
// in a checkout, dist/native installed).
|
|
3035
|
-
const hostBuild = (profile: CargoProfile): string =>
|
|
3036
|
-
`${napiCommand} build${CARGO_PROFILE_FLAG[profile]} --platform --no-js --dts ${config.binaryName}.napi.d.ts ${commonCommand} --output-dir ${runOutputDirectory}${recordInputs(null, profile, runOutputDirectory)}`;
|
|
3037
|
-
const hostOutputs = nativeOutputPaths('host');
|
|
3038
|
-
targets['cargo-napi'] = {
|
|
3039
|
-
executor: 'nx:run-commands',
|
|
3040
|
-
metadata: CARGO_PRODUCER_METADATA,
|
|
3041
|
-
cache: true,
|
|
3042
|
-
dependsOn: ['^build', ...buildInputsTool],
|
|
3043
|
-
inputs: cargoInputs,
|
|
3044
|
-
outputs: [`{projectRoot}/${OUTPUT_DIR_OPTION}/`],
|
|
3045
|
-
options: {
|
|
3046
|
-
cwd: cargoCwd,
|
|
3047
|
-
command: hostBuild('dev'),
|
|
3048
|
-
outputDir: hostOutputs.dev,
|
|
3049
|
-
},
|
|
3050
|
-
configurations: {
|
|
3051
|
-
[RELEASE_CONFIGURATION]: { command: hostBuild('release'), outputDir: hostOutputs.release },
|
|
3052
|
-
},
|
|
3053
|
-
};
|
|
3054
|
-
}
|
|
3055
|
-
|
|
3037
|
+
const debugDirectory = '.cache/native-debug';
|
|
3056
3038
|
for (const triple of config.targets) {
|
|
3057
3039
|
const convention = NAPI_TARGET_CONVENTIONS[triple];
|
|
3058
3040
|
if (!convention) {
|
|
@@ -3060,13 +3042,33 @@ function createNapiTargets(
|
|
|
3060
3042
|
}
|
|
3061
3043
|
const targetName = `napi-${convention.architecture}-${convention.targetFamily}`;
|
|
3062
3044
|
const outputs = nativeOutputPaths(convention.outputName);
|
|
3045
|
+
const fileName = `${config.binaryName}.${convention.outputName}.node`;
|
|
3046
|
+
if (sameNapiPlatform(convention, hostPlatform)) {
|
|
3047
|
+
const source = `${outputs.dev}/${fileName}`;
|
|
3048
|
+
const destination = `${debugDirectory}/${fileName}`;
|
|
3049
|
+
const staging = `${destination}.partial`;
|
|
3050
|
+
targets['napi-debug'] = {
|
|
3051
|
+
executor: 'nx:run-commands',
|
|
3052
|
+
cache: true,
|
|
3053
|
+
// An empty configuration selects the producer's default instead of inheriting `production` from the run.
|
|
3054
|
+
dependsOn: [{ target: targetName, configuration: '' }],
|
|
3055
|
+
inputs: [
|
|
3056
|
+
{ externalDependencies: [] },
|
|
3057
|
+
{ dependentTasksOutputFiles: posix.join(projectRoot, source), transitive: false },
|
|
3058
|
+
],
|
|
3059
|
+
outputs: [`{projectRoot}/${destination}`],
|
|
3060
|
+
options: {
|
|
3061
|
+
cwd: projectRoot,
|
|
3062
|
+
command: `mkdir -p ${debugDirectory} && cp ${source} ${staging} && mv -f ${staging} ${destination}`,
|
|
3063
|
+
},
|
|
3064
|
+
};
|
|
3065
|
+
}
|
|
3063
3066
|
if (convention.targetFamily === 'linux') {
|
|
3064
3067
|
// Every host builds a Linux addon the same way: devenv's zig through
|
|
3065
3068
|
// cargo-zigbuild, glibc pinned by the triple suffix. The napi CLI cannot
|
|
3066
3069
|
// carry that suffix (it looks for the artifact under
|
|
3067
3070
|
// target/<triple>.2.17/), so the executor names the `.node` itself.
|
|
3068
|
-
const nodeFile = (directory: string): string =>
|
|
3069
|
-
`{projectRoot}/${directory}/${config.binaryName}.${convention.outputName}.node`;
|
|
3071
|
+
const nodeFile = (directory: string): string => `{projectRoot}/${directory}/${fileName}`;
|
|
3070
3072
|
targets[targetName] = {
|
|
3071
3073
|
executor: '@smoothbricks/nx-plugin:cargo-zigbuild',
|
|
3072
3074
|
metadata: CARGO_PRODUCER_METADATA,
|
|
@@ -3095,7 +3097,7 @@ function createNapiTargets(
|
|
|
3095
3097
|
metadata: CARGO_PRODUCER_METADATA,
|
|
3096
3098
|
cache: true,
|
|
3097
3099
|
...(buildInputsTool.length > 0 ? { dependsOn: buildInputsTool } : {}),
|
|
3098
|
-
inputs:
|
|
3100
|
+
inputs: recordedInputs,
|
|
3099
3101
|
outputs: [`{projectRoot}/${OUTPUT_DIR_OPTION}/`],
|
|
3100
3102
|
options: {
|
|
3101
3103
|
cwd: cargoCwd,
|
|
@@ -3107,6 +3109,41 @@ function createNapiTargets(
|
|
|
3107
3109
|
},
|
|
3108
3110
|
};
|
|
3109
3111
|
}
|
|
3112
|
+
|
|
3113
|
+
if (!targets['napi-debug']) {
|
|
3114
|
+
// No declared platform target serves this host: retain the direct builds for both checkout consumers.
|
|
3115
|
+
targets['napi-debug'] = {
|
|
3116
|
+
executor: 'nx:run-commands',
|
|
3117
|
+
metadata: CARGO_PRODUCER_METADATA,
|
|
3118
|
+
cache: true,
|
|
3119
|
+
dependsOn: ['^build'],
|
|
3120
|
+
inputs: cargoInputs,
|
|
3121
|
+
outputs: [`{projectRoot}/${debugDirectory}/`],
|
|
3122
|
+
options: {
|
|
3123
|
+
cwd: cargoCwd,
|
|
3124
|
+
command: `${napiCommand} build --platform --no-js --dts ${config.binaryName}.napi.d.ts ${commonCommand} --output-dir ${outputDir(debugDirectory)}`,
|
|
3125
|
+
},
|
|
3126
|
+
};
|
|
3127
|
+
const hostBuild = (profile: CargoProfile): string =>
|
|
3128
|
+
`${napiCommand} build${CARGO_PROFILE_FLAG[profile]} --platform --no-js --dts ${config.binaryName}.napi.d.ts ${commonCommand} --output-dir ${runOutputDirectory}${recordInputs(null, profile, runOutputDirectory)}`;
|
|
3129
|
+
const hostOutputs = nativeOutputPaths('host');
|
|
3130
|
+
targets['cargo-napi'] = {
|
|
3131
|
+
executor: 'nx:run-commands',
|
|
3132
|
+
metadata: CARGO_PRODUCER_METADATA,
|
|
3133
|
+
cache: true,
|
|
3134
|
+
dependsOn: ['^build', ...buildInputsTool],
|
|
3135
|
+
inputs: recordedInputs,
|
|
3136
|
+
outputs: [`{projectRoot}/${OUTPUT_DIR_OPTION}/`],
|
|
3137
|
+
options: {
|
|
3138
|
+
cwd: cargoCwd,
|
|
3139
|
+
command: hostBuild('dev'),
|
|
3140
|
+
outputDir: hostOutputs.dev,
|
|
3141
|
+
},
|
|
3142
|
+
configurations: {
|
|
3143
|
+
[RELEASE_CONFIGURATION]: { command: hostBuild('release'), outputDir: hostOutputs.release },
|
|
3144
|
+
},
|
|
3145
|
+
};
|
|
3146
|
+
}
|
|
3110
3147
|
return targets;
|
|
3111
3148
|
}
|
|
3112
3149
|
|
|
@@ -3137,11 +3174,8 @@ function createNapiTestTarget(projectRoot: string, hasDedicatedBunfig: boolean):
|
|
|
3137
3174
|
return {
|
|
3138
3175
|
executor: '@smoothbricks/nx-plugin:bounded-exec',
|
|
3139
3176
|
cache: true,
|
|
3140
|
-
//
|
|
3141
|
-
//
|
|
3142
|
-
// compiles the whole graph again. tsc-js supplies dist/ts for the suite's
|
|
3143
|
-
// own imports; napi-debug supplies the addon from the graph cargo-test
|
|
3144
|
-
// already built.
|
|
3177
|
+
// Name only what the suite reads, not `build` with its unrelated host binaries.
|
|
3178
|
+
// tsc-js supplies dist/ts; napi-debug supplies the development addon.
|
|
3145
3179
|
dependsOn: ['cargo-test', 'napi-debug', 'tsc-js', '^build'],
|
|
3146
3180
|
options: {
|
|
3147
3181
|
// cwd is src/, not the package root: `bun test <arg>` treats the arg as a
|
|
@@ -119,7 +119,10 @@ export interface CiWorkflowDefinitionOptions extends DeployStepSecretConfig {
|
|
|
119
119
|
deploy: boolean;
|
|
120
120
|
browserTests: boolean;
|
|
121
121
|
e2eDeployment: boolean;
|
|
122
|
-
/**
|
|
122
|
+
/**
|
|
123
|
+
* The first entry is the branch whose pushes queue behind a running CI run instead of canceling it, and, with
|
|
124
|
+
* deploy, deploy the staging stage.
|
|
125
|
+
*/
|
|
123
126
|
pushBranches: NonEmptyArray<string>;
|
|
124
127
|
/** Default ubuntu-latest when omitted. */
|
|
125
128
|
runsOn?: string | string[];
|
|
@@ -297,22 +300,12 @@ permissions:
|
|
|
297
300
|
${options.deploy ? ' deployments: write\n' : ''} statuses: write
|
|
298
301
|
|
|
299
302
|
concurrency:
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
#
|
|
304
|
-
# so a newer push never cancels the deploy job mid-flight. Pull requests and
|
|
305
|
-
# other branches keep canceling superseded runs.
|
|
306
|
-
group: ${CI_CONCURRENCY_GROUP}
|
|
307
|
-
cancel-in-progress: \${{ github.ref != ${stagingRefLiteral(options)} }}`
|
|
308
|
-
: ` # This workflow validates and never deploys, so there is no in-flight
|
|
309
|
-
# deployment for a newer push to protect: every pull request, and every ref
|
|
310
|
-
# for pushes, cancels its superseded runs. Queuing them instead serializes
|
|
311
|
-
# the staging branch, and a burst of pushes then reports the newest commit
|
|
312
|
-
# one full run per queued push late.
|
|
303
|
+
# One in-flight run per pull request, and per ref for pushes. Pushes to the first
|
|
304
|
+
# push branch queue behind a running workflow instead of canceling it, so every
|
|
305
|
+
# push there ends in a finished run and a newer push never cancels a deploy job
|
|
306
|
+
# mid-flight. Pull requests and other branches keep canceling superseded runs.
|
|
313
307
|
group: ${CI_CONCURRENCY_GROUP}
|
|
314
|
-
cancel-in-progress:
|
|
315
|
-
}
|
|
308
|
+
cancel-in-progress: \${{ github.ref != ${stagingRefLiteral(options)} }}
|
|
316
309
|
|
|
317
310
|
defaults:
|
|
318
311
|
run:
|
|
@@ -1194,7 +1187,10 @@ export const SAME_REPO_GATE_FOLDED = [
|
|
|
1194
1187
|
' }}',
|
|
1195
1188
|
];
|
|
1196
1189
|
|
|
1197
|
-
/**
|
|
1190
|
+
/**
|
|
1191
|
+
* The first push branch is the one whose pushes queue behind a running CI run, and, with deploy, deploy the staging
|
|
1192
|
+
* stage.
|
|
1193
|
+
*/
|
|
1198
1194
|
function stagingPushBranch(options: CiWorkflowDefinitionOptions): string {
|
|
1199
1195
|
return options.pushBranches[0];
|
|
1200
1196
|
}
|
|
@@ -72,9 +72,9 @@ export interface ManagedFileContext {
|
|
|
72
72
|
|
|
73
73
|
/** Temporary upstream compiler repairs distributed to smoo-managed Bun workspaces. */
|
|
74
74
|
export const managedTtscPatch = {
|
|
75
|
-
version: '0.
|
|
76
|
-
key: 'ttsc@0.
|
|
77
|
-
path: 'patches/ttsc@0.
|
|
75
|
+
version: '0.37.1',
|
|
76
|
+
key: 'ttsc@0.37.1',
|
|
77
|
+
path: 'patches/ttsc@0.37.1.patch',
|
|
78
78
|
} as const;
|
|
79
79
|
|
|
80
80
|
/** Maintained Nx 24.0.3 repairs, applied as an ordinary Bun patchedDependency over the registry release. */
|