@smoothbricks/nx-plugin 0.3.12 → 0.3.13
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/dist/index.d.ts +8 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +112 -39
- package/nextest.toml +37 -0
- package/package.json +1 -1
- package/src/executors/bounded-exec/executor.test.ts +2 -2
- package/src/index.test.ts +158 -74
- package/src/index.ts +142 -44
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { type CreateNodesV2 } from 'nx/src/devkit-exports.js';
|
|
2
2
|
import { CARGO_TEST_COMPILE_TARGET } from './cargo-workspace.js';
|
|
3
3
|
export { CARGO_TEST_COMPILE_TARGET };
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
type NapiArchitecture = 'arm64' | 'x64';
|
|
5
|
+
type NapiTargetFamily = 'linux' | 'macos';
|
|
6
|
+
interface NapiPlatform {
|
|
7
|
+
architecture: NapiArchitecture;
|
|
8
|
+
targetFamily: NapiTargetFamily;
|
|
9
|
+
}
|
|
10
|
+
interface NapiTargetConvention extends NapiPlatform {
|
|
7
11
|
outputName: string;
|
|
8
|
-
targetFamily: 'linux' | 'macos';
|
|
9
|
-
useNapiCross: boolean;
|
|
10
12
|
}
|
|
11
13
|
/**
|
|
12
14
|
* Prerequisite target that extracts the cross toolchain one triple needs. The
|
|
@@ -14,6 +16,7 @@ interface NapiTargetConvention {
|
|
|
14
16
|
* dependency of `napi-<arch>-linux` and package-local `cli-<arch>-linux`.
|
|
15
17
|
*/
|
|
16
18
|
export declare function napiToolchainTargetName(convention: NapiTargetConvention): string;
|
|
19
|
+
export declare function createNodesV2ForPlatform(platform: NodeJS.Platform, architecture: string): CreateNodesV2;
|
|
17
20
|
export declare const createNodesV2: CreateNodesV2;
|
|
18
21
|
declare const _default: {
|
|
19
22
|
createNodesV2: CreateNodesV2;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAEL,KAAK,aAAa,EAGnB,MAAM,0BAA0B,CAAC;AAKlC,OAAO,EACL,yBAAyB,EAQ1B,MAAM,sBAAsB,CAAC;AAY9B,OAAO,EAAE,yBAAyB,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAEL,KAAK,aAAa,EAGnB,MAAM,0BAA0B,CAAC;AAKlC,OAAO,EACL,yBAAyB,EAQ1B,MAAM,sBAAsB,CAAC;AAY9B,OAAO,EAAE,yBAAyB,EAAE,CAAC;AAUrC,KAAK,gBAAgB,GAAG,OAAO,GAAG,KAAK,CAAC;AACxC,KAAK,gBAAgB,GAAG,OAAO,GAAG,OAAO,CAAC;AAE1C,UAAU,YAAY;IACpB,YAAY,EAAE,gBAAgB,CAAC;IAC/B,YAAY,EAAE,gBAAgB,CAAC;CAChC;AAmED,UAAU,oBAAqB,SAAQ,YAAY;IACjD,UAAU,EAAE,MAAM,CAAC;CACpB;AA0CD;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,oBAAoB,GAAG,MAAM,CAEhF;AAoMD,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,YAAY,EAAE,MAAM,GAAG,aAAa,CAEvG;AAED,eAAO,MAAM,aAAa,EAAE,aAG3B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import { parse as parseToml } from 'smol-toml';
|
|
|
8
8
|
import { BOUNDED_TEST_KILL_AFTER_MS, BOUNDED_TEST_TIMEOUT_MS } from './bounded-test-policy.js';
|
|
9
9
|
import { CARGO_TEST_COMPILE_TARGET, CARGO_TEST_EXCEPTIONS_SUFFIX, CARGO_TEST_TARGET, cargoPackageTestInputs, cargoTestPackageTargetName, exceptionalTestFilter, listCargoWorkspacePackages, nextestConfigRelPath, } from './cargo-workspace.js';
|
|
10
10
|
import { CARGO_CROSS_LINT_COMMAND, CARGO_CROSS_LINT_TARGET, CARGO_FETCH_COMMAND, CARGO_FETCH_TARGET, CARGO_FROZEN_PREFIX, CARGO_LINT_CLIPPY_COMMAND, cargoFrozen, } from './cross-check-policy.js';
|
|
11
|
-
import {
|
|
11
|
+
import { PLATFORM_TARGET_GLOBS } from './workspace-config-policy.js';
|
|
12
12
|
export { CARGO_TEST_COMPILE_TARGET };
|
|
13
13
|
const BUILD_OUTPUT_TARGET_PATTERN = /-(?:js|web|html|css|android|native|napi|bun|wasm)$/;
|
|
14
14
|
const TYPESCRIPT_TOOLCHAIN_INPUTS = [
|
|
@@ -17,26 +17,42 @@ const TYPESCRIPT_TOOLCHAIN_INPUTS = [
|
|
|
17
17
|
'{workspaceRoot}/patches/**/*',
|
|
18
18
|
'{workspaceRoot}/tsconfig.base.json',
|
|
19
19
|
];
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
if (HOST_PLATFORM_SUFFIX === null)
|
|
20
|
+
function napiPlatform(platform, architecture) {
|
|
21
|
+
const targetFamily = platform === 'darwin' ? 'macos' : platform === 'linux' ? 'linux' : null;
|
|
22
|
+
const targetArchitecture = architecture === 'arm64' ? 'arm64' : architecture === 'x64' ? 'x64' : null;
|
|
23
|
+
return targetFamily !== null && targetArchitecture !== null
|
|
24
|
+
? { architecture: targetArchitecture, targetFamily }
|
|
25
|
+
: null;
|
|
26
|
+
}
|
|
27
|
+
function sameNapiPlatform(left, right) {
|
|
28
|
+
return left.architecture === right?.architecture && left.targetFamily === right.targetFamily;
|
|
29
|
+
}
|
|
30
|
+
function hostPlatformTargetNames(targetNames, hostPlatform) {
|
|
31
|
+
if (hostPlatform === null)
|
|
33
32
|
return [];
|
|
33
|
+
const suffix = `-${hostPlatform.architecture}-${hostPlatform.targetFamily}`;
|
|
34
34
|
return [...new Set(targetNames)]
|
|
35
35
|
.filter(
|
|
36
36
|
// Binary targets only. A toolchain prerequisite carries the same platform
|
|
37
37
|
// suffix but produces no artifact: the cross builds that need it depend
|
|
38
38
|
// on it directly, so the aggregate stays a list of outputs.
|
|
39
|
-
(name) => name.endsWith(
|
|
39
|
+
(name) => name.endsWith(suffix) && !name.startsWith(NAPI_TOOLCHAIN_TARGET_PREFIX))
|
|
40
|
+
.sort();
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* The reserved suffixes name targets that EMIT an artifact, and the `build`
|
|
44
|
+
* aggregate is a list of those. Handing Nx the raw `*-<family>` globs let it
|
|
45
|
+
* match on suffix alone, and one namespace collides by construction: a
|
|
46
|
+
* per-crate cargo test runner is named `cargo-test-<crate>`, so any crate whose
|
|
47
|
+
* name ends in an output family — `*-napi`, `*-wasm`, `*-native`, `*-js` — put
|
|
48
|
+
* its RUNNER in the aggregate. The runners are one serialized chain, so a
|
|
49
|
+
* single such crate made `build` pull an entire cargo test suite. Expanding the
|
|
50
|
+
* families here instead of delegating to Nx's matcher keeps the plugin's own
|
|
51
|
+
* `cargo-test-` namespace out of the aggregate however a crate is named.
|
|
52
|
+
*/
|
|
53
|
+
function buildOutputTargetNames(targetNames) {
|
|
54
|
+
return [...new Set(targetNames)]
|
|
55
|
+
.filter((name) => BUILD_OUTPUT_TARGET_PATTERN.test(name) && !name.startsWith(`${CARGO_TEST_TARGET}-`))
|
|
40
56
|
.sort();
|
|
41
57
|
}
|
|
42
58
|
//#region smoo!n/rust-output-target-inference
|
|
@@ -66,27 +82,33 @@ const NAPI_TARGET_CONVENTIONS = {
|
|
|
66
82
|
architecture: 'arm64',
|
|
67
83
|
outputName: 'darwin-arm64',
|
|
68
84
|
targetFamily: 'macos',
|
|
69
|
-
useNapiCross: false,
|
|
70
85
|
},
|
|
71
86
|
'x86_64-apple-darwin': {
|
|
72
87
|
architecture: 'x64',
|
|
73
88
|
outputName: 'darwin-x64',
|
|
74
89
|
targetFamily: 'macos',
|
|
75
|
-
useNapiCross: false,
|
|
76
90
|
},
|
|
77
91
|
'aarch64-unknown-linux-gnu': {
|
|
78
92
|
architecture: 'arm64',
|
|
79
93
|
outputName: 'linux-arm64-gnu',
|
|
80
94
|
targetFamily: 'linux',
|
|
81
|
-
useNapiCross: true,
|
|
82
95
|
},
|
|
83
96
|
'x86_64-unknown-linux-gnu': {
|
|
84
97
|
architecture: 'x64',
|
|
85
98
|
outputName: 'linux-x64-gnu',
|
|
86
99
|
targetFamily: 'linux',
|
|
87
|
-
useNapiCross: true,
|
|
88
100
|
},
|
|
89
101
|
};
|
|
102
|
+
const NATIVE_LINUX_COMPILER_ENV = Object.freeze({ CC: 'cc', CXX: 'c++' });
|
|
103
|
+
const CROSS_LINUX_COMPILER_ENV = Object.freeze({ TARGET_CC: 'clang', TARGET_CXX: 'clang++' });
|
|
104
|
+
function usesNapiCross(target, hostPlatform) {
|
|
105
|
+
return target.targetFamily === 'linux' && !sameNapiPlatform(target, hostPlatform);
|
|
106
|
+
}
|
|
107
|
+
function napiCompilerEnv(target, hostPlatform) {
|
|
108
|
+
if (target?.targetFamily !== 'linux')
|
|
109
|
+
return undefined;
|
|
110
|
+
return sameNapiPlatform(target, hostPlatform) ? NATIVE_LINUX_COMPILER_ENV : CROSS_LINUX_COMPILER_ENV;
|
|
111
|
+
}
|
|
90
112
|
const NAPI_TOOLCHAIN_TARGET_PREFIX = 'napi-toolchain-';
|
|
91
113
|
/**
|
|
92
114
|
* Prerequisite target that extracts the cross toolchain one triple needs. The
|
|
@@ -235,9 +257,8 @@ async function addPerPackageCargoTestTargets(targets, projectRoot, workspaceRoot
|
|
|
235
257
|
}
|
|
236
258
|
return packageTargetNames;
|
|
237
259
|
}
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
async (projectConfigurationFiles, _options, context) => {
|
|
260
|
+
function createNodesHandler(hostPlatform) {
|
|
261
|
+
return async (projectConfigurationFiles, _options, context) => {
|
|
241
262
|
const results = [];
|
|
242
263
|
const errors = [];
|
|
243
264
|
await Promise.all(projectConfigurationFiles.map(async (packageJsonPath) => {
|
|
@@ -248,7 +269,10 @@ export const createNodesV2 = [
|
|
|
248
269
|
results.push([packageJsonPath, {}]);
|
|
249
270
|
return;
|
|
250
271
|
}
|
|
251
|
-
results.push([
|
|
272
|
+
results.push([
|
|
273
|
+
packageJsonPath,
|
|
274
|
+
await createProjectTargets(packageJsonPath, context.workspaceRoot, hostPlatform),
|
|
275
|
+
]);
|
|
252
276
|
}
|
|
253
277
|
catch (error) {
|
|
254
278
|
errors.push([packageJsonPath, error instanceof Error ? error : new Error(String(error))]);
|
|
@@ -258,14 +282,21 @@ export const createNodesV2 = [
|
|
|
258
282
|
throw new AggregateCreateNodesError(errors, results);
|
|
259
283
|
}
|
|
260
284
|
return results;
|
|
261
|
-
}
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
export function createNodesV2ForPlatform(platform, architecture) {
|
|
288
|
+
return ['**/package.json', createNodesHandler(napiPlatform(platform, architecture))];
|
|
289
|
+
}
|
|
290
|
+
export const createNodesV2 = [
|
|
291
|
+
'**/package.json',
|
|
292
|
+
(...args) => createNodesHandler(napiPlatform(process.platform, process.arch))(...args),
|
|
262
293
|
];
|
|
263
294
|
function isManagedPackageJsonSource(packageJsonPath) {
|
|
264
295
|
const normalized = packageJsonPath.replaceAll('\\', '/');
|
|
265
296
|
return normalized.includes('/managed/raw/') || normalized.includes('/managed/templates/');
|
|
266
297
|
}
|
|
267
298
|
export default { createNodesV2 };
|
|
268
|
-
async function createProjectTargets(packageJsonPath, workspaceRoot) {
|
|
299
|
+
async function createProjectTargets(packageJsonPath, workspaceRoot, hostPlatform) {
|
|
269
300
|
const projectRoot = dirname(packageJsonPath);
|
|
270
301
|
const absoluteProjectRoot = join(workspaceRoot, projectRoot);
|
|
271
302
|
const packageJson = await readPackageJson(join(workspaceRoot, packageJsonPath));
|
|
@@ -355,7 +386,7 @@ async function createProjectTargets(packageJsonPath, workspaceRoot) {
|
|
|
355
386
|
targets['cargo-wasm'] = createCargoWasmTarget(projectRoot, cargoWasmConfig);
|
|
356
387
|
}
|
|
357
388
|
if (napiConfig) {
|
|
358
|
-
Object.assign(targets, createNapiTargets(projectRoot, napiConfig));
|
|
389
|
+
Object.assign(targets, createNapiTargets(projectRoot, napiConfig, hostPlatform));
|
|
359
390
|
if (!('napi-test' in (packageJson.nx?.targets ?? {})) &&
|
|
360
391
|
existsSync(join(absoluteProjectRoot, 'src/native.test.ts'))) {
|
|
361
392
|
targets['napi-test'] = createNapiTestTarget(projectRoot, existsSync(join(absoluteProjectRoot, 'bunfig.napi-test.toml')));
|
|
@@ -584,6 +615,33 @@ async function createProjectTargets(packageJsonPath, workspaceRoot) {
|
|
|
584
615
|
}
|
|
585
616
|
}
|
|
586
617
|
}
|
|
618
|
+
// `build` lists cargo-test-compile beside the host's platform binaries, and
|
|
619
|
+
// every one of those is a `napi build` — another cargo writer on the package's
|
|
620
|
+
// default `target/`, which cargo flocks.
|
|
621
|
+
//
|
|
622
|
+
// Only `cargo-napi` gets the ordering edge. A platform-suffixed target may NOT
|
|
623
|
+
// have one: `validatePlatformTargetDependencies` (package-target-policy.ts:674)
|
|
624
|
+
// walks each platform target's dependency closure and refuses any member of a
|
|
625
|
+
// different family, because the publish flow builds and collects one platform
|
|
626
|
+
// at a time — a `*-macos` collect that reached a familyless sibling would drag
|
|
627
|
+
// in work the macOS runner has no business doing. `cargo-napi` carries no
|
|
628
|
+
// platform suffix, so it is not scanned and the edge is legal there.
|
|
629
|
+
//
|
|
630
|
+
// The platform binaries therefore stay Nx siblings of cargo-test-compile and
|
|
631
|
+
// serialize on cargo's flock instead of on a graph edge. That is the same
|
|
632
|
+
// arrangement `cli-<arch>-<os>` and `napi-<arch>-<os>` already have with each
|
|
633
|
+
// other — both `napi build --release` on one target dir — so this adds a third
|
|
634
|
+
// participant to an existing wait, not a new hazard. The flock makes them wait;
|
|
635
|
+
// it does not corrupt anything, and these are unbounded `nx:run-commands`
|
|
636
|
+
// targets, so the wait is not charged against a test budget.
|
|
637
|
+
const cargoWriterNames = hostPlatformTargetNames([...Object.keys(declaredTargets), ...Object.keys(targets)], hostPlatform);
|
|
638
|
+
const cargoNapi = targets['cargo-napi'];
|
|
639
|
+
if (cargoNapi && targets[CARGO_TEST_COMPILE_TARGET]) {
|
|
640
|
+
const dependsOn = cargoNapi.dependsOn ?? [];
|
|
641
|
+
if (!dependsOn.includes(CARGO_TEST_COMPILE_TARGET)) {
|
|
642
|
+
cargoNapi.dependsOn = [...dependsOn, CARGO_TEST_COMPILE_TARGET];
|
|
643
|
+
}
|
|
644
|
+
}
|
|
587
645
|
// No `outputs`, deliberately: this aggregate runs no command, so every file
|
|
588
646
|
// under dist belongs to the concrete target that emitted it. Claiming
|
|
589
647
|
// `{projectRoot}/dist` here would cache the children's bytes a second time
|
|
@@ -598,10 +656,20 @@ async function createProjectTargets(packageJsonPath, workspaceRoot) {
|
|
|
598
656
|
targets.build = {
|
|
599
657
|
executor: 'nx:noop',
|
|
600
658
|
cache: true,
|
|
659
|
+
// `cargo-napi` is both an output family and a serialized cargo writer, so
|
|
660
|
+
// the two sources overlap; the Set keeps one edge per target while holding
|
|
661
|
+
// the order the families are listed in.
|
|
601
662
|
dependsOn: [
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
663
|
+
...new Set([
|
|
664
|
+
'^build',
|
|
665
|
+
// Compiling the test executables is build work: it is unbounded and
|
|
666
|
+
// cacheable, while every RUNNER is a bounded-exec target reached only
|
|
667
|
+
// through the `test` aggregate. That split is what keeps a cold cargo
|
|
668
|
+
// workspace's compile time out of the bounded test window.
|
|
669
|
+
...(targets[CARGO_TEST_COMPILE_TARGET] ? [CARGO_TEST_COMPILE_TARGET] : []),
|
|
670
|
+
...buildOutputTargetNames([...Object.keys(declaredTargets), ...Object.keys(targets)]),
|
|
671
|
+
...cargoWriterNames,
|
|
672
|
+
]),
|
|
605
673
|
],
|
|
606
674
|
};
|
|
607
675
|
}
|
|
@@ -762,21 +830,22 @@ function resolveNapiConfig(packageJson, packageJsonPath, absoluteProjectRoot, is
|
|
|
762
830
|
}
|
|
763
831
|
return { binaryName, cargoPackage, manifestPath, targets };
|
|
764
832
|
}
|
|
765
|
-
function createNapiTargets(projectRoot, config) {
|
|
833
|
+
function createNapiTargets(projectRoot, config, hostPlatform) {
|
|
766
834
|
const commonCommand = `--manifest-path ${config.manifestPath} --package ${config.cargoPackage}`;
|
|
767
|
-
const hostPlatformTargetName =
|
|
835
|
+
const hostPlatformTargetName = hostPlatform === null ? null : `napi-${hostPlatform.architecture}-${hostPlatform.targetFamily}`;
|
|
768
836
|
let nativeHostTargetName = null;
|
|
769
837
|
if (hostPlatformTargetName !== null) {
|
|
770
838
|
for (const triple of config.targets) {
|
|
771
839
|
const convention = NAPI_TARGET_CONVENTIONS[triple];
|
|
772
840
|
const targetName = convention ? `napi-${convention.architecture}-${convention.targetFamily}` : null;
|
|
773
|
-
if (targetName === hostPlatformTargetName && !convention
|
|
841
|
+
if (targetName === hostPlatformTargetName && convention && !usesNapiCross(convention, hostPlatform)) {
|
|
774
842
|
nativeHostTargetName = targetName;
|
|
775
843
|
break;
|
|
776
844
|
}
|
|
777
845
|
}
|
|
778
846
|
}
|
|
779
847
|
const targets = {};
|
|
848
|
+
const hostCompilerEnv = napiCompilerEnv(hostPlatform, hostPlatform);
|
|
780
849
|
// The addon the test suite loads. A dev-profile build shares target/debug
|
|
781
850
|
// with cargo-test's dependency graph, so after the tests compile this is
|
|
782
851
|
// nearly free — where the release platform build it replaces cost minutes
|
|
@@ -793,6 +862,7 @@ function createNapiTargets(projectRoot, config) {
|
|
|
793
862
|
options: {
|
|
794
863
|
cwd: projectRoot,
|
|
795
864
|
command: `napi build --platform --no-js --dts ${config.binaryName}.napi.d.ts ${commonCommand} --output-dir .cache/native-debug`,
|
|
865
|
+
...(hostCompilerEnv ? { env: hostCompilerEnv } : {}),
|
|
796
866
|
},
|
|
797
867
|
};
|
|
798
868
|
if (nativeHostTargetName === null) {
|
|
@@ -809,12 +879,13 @@ function createNapiTargets(projectRoot, config) {
|
|
|
809
879
|
options: {
|
|
810
880
|
cwd: projectRoot,
|
|
811
881
|
command: `napi build --release --platform --no-js --dts ${config.binaryName}.napi.d.ts ${commonCommand} --output-dir dist/native/host`,
|
|
882
|
+
...(hostCompilerEnv ? { env: hostCompilerEnv } : {}),
|
|
812
883
|
},
|
|
813
884
|
};
|
|
814
885
|
}
|
|
815
886
|
for (const triple of config.targets) {
|
|
816
887
|
const convention = NAPI_TARGET_CONVENTIONS[triple];
|
|
817
|
-
if (!convention
|
|
888
|
+
if (!convention || !usesNapiCross(convention, hostPlatform)) {
|
|
818
889
|
continue;
|
|
819
890
|
}
|
|
820
891
|
// One toolchain target per triple, shared by every cross build that needs
|
|
@@ -838,20 +909,22 @@ function createNapiTargets(projectRoot, config) {
|
|
|
838
909
|
}
|
|
839
910
|
const targetName = `napi-${convention.architecture}-${convention.targetFamily}`;
|
|
840
911
|
const outputDirectory = `dist/native/${convention.outputName}`;
|
|
841
|
-
const
|
|
912
|
+
const useNapiCross = usesNapiCross(convention, hostPlatform);
|
|
913
|
+
const crossFlag = useNapiCross ? ' --use-napi-cross' : '';
|
|
914
|
+
const compilerEnv = napiCompilerEnv(convention, hostPlatform);
|
|
842
915
|
targets[targetName] = {
|
|
843
916
|
executor: 'nx:run-commands',
|
|
844
917
|
cache: true,
|
|
845
|
-
...(
|
|
918
|
+
...(useNapiCross ? { dependsOn: [napiToolchainTargetName(convention)] } : {}),
|
|
846
919
|
inputs: NAPI_INPUTS,
|
|
847
920
|
outputs: [`{projectRoot}/${outputDirectory}`],
|
|
848
921
|
options: {
|
|
849
922
|
cwd: projectRoot,
|
|
850
923
|
command: `napi build --release --platform --no-js --dts ${config.binaryName}.${convention.outputName}.d.ts --target ${triple}${crossFlag} ${commonCommand} --output-dir ${outputDirectory}`,
|
|
851
|
-
//
|
|
852
|
-
//
|
|
853
|
-
//
|
|
854
|
-
...(
|
|
924
|
+
// Genuine Linux cross-compiles use Clang plus napi-rs's downloaded
|
|
925
|
+
// GNU sysroot. A native Linux target uses Nix's cc wrapper so C build
|
|
926
|
+
// scripts resolve the host libc headers instead.
|
|
927
|
+
...(compilerEnv ? { env: compilerEnv } : {}),
|
|
855
928
|
},
|
|
856
929
|
};
|
|
857
930
|
}
|
package/nextest.toml
CHANGED
|
@@ -37,6 +37,43 @@ slow-timeout = { period = "180s", terminate-after = 1 }
|
|
|
37
37
|
[test-groups]
|
|
38
38
|
real-apfs = { max-threads = 1 }
|
|
39
39
|
|
|
40
|
+
# The full-lifecycle real-APFS tests cannot meet the default deadline, and
|
|
41
|
+
# `specs/cowshed/08_testing.md` already contains the arithmetic that proves it.
|
|
42
|
+
#
|
|
43
|
+
# That spec sets the house rule for real-substrate timing: "CI asserts with a 3×
|
|
44
|
+
# multiplier to absorb runner noise". `apfs_integration.rs` measured its lifecycle
|
|
45
|
+
# at 14.8s (Sparse) and 10.6s (Asif) on an IDLE host, so under the repo's own noise
|
|
46
|
+
# model CI needs 44.4s and 31.8s. A 30s deadline was therefore unreachable by
|
|
47
|
+
# construction: the test was not slow, the bound contradicted the spec.
|
|
48
|
+
#
|
|
49
|
+
# Nor is the cost reducible. The same spec's "Attach floor verdict: not
|
|
50
|
+
# flag-reducible" records that `-noverify` saves ~15ms (noise), `-noautofsck`
|
|
51
|
+
# nothing, and `diskutil image attach` exposes no equivalent knobs — the ~235-400ms
|
|
52
|
+
# per attach is inherent to DiskImages + APFS mount + DiskArbitration, and halving
|
|
53
|
+
# it would need DiskImages2 or the diskarbitrationd private API, which the spec
|
|
54
|
+
# explicitly forbids budgets from assuming. The lifecycle attaches once per phase
|
|
55
|
+
# across adopt, mount, clone-under-churn, checkpoint, restore, retire, reclaim, GC
|
|
56
|
+
# and detach, so its floor is a multiple of an irreducible constant.
|
|
57
|
+
#
|
|
58
|
+
# The alternative was splitting the lifecycle into phase-scoped tests so each fits
|
|
59
|
+
# 30s. It loses: every split pays that attach constant again, so the suite's total
|
|
60
|
+
# wall time rises to buy a smaller per-test bound. Splitting Sparse from Asif was
|
|
61
|
+
# worth it because it bought failure ATTRIBUTION; splitting phases buys only a
|
|
62
|
+
# number.
|
|
63
|
+
#
|
|
64
|
+
# 60s is 3× the worst idle measurement (44.4s) rounded up, not a guess. It stays
|
|
65
|
+
# bounded because an unbounded run phase is how a hung test becomes a hung lane.
|
|
66
|
+
# Re-derive it if the idle measurements in `apfs_integration.rs` change.
|
|
67
|
+
#
|
|
68
|
+
# Membership is by name and narrower than the group: the fast `real_apfs_*` unit
|
|
69
|
+
# tests in the lib keep the 30s default — they passed at 4.4s and 7.3s and have no
|
|
70
|
+
# claim on more. This override precedes the group-only one so it wins the
|
|
71
|
+
# first-match for both keys it sets.
|
|
72
|
+
[[profile.default.overrides]]
|
|
73
|
+
filter = 'test(/real_apfs_.*_substrate_lifecycle/)'
|
|
74
|
+
slow-timeout = { period = "60s", terminate-after = 1 }
|
|
75
|
+
test-group = 'real-apfs'
|
|
76
|
+
|
|
40
77
|
[[profile.default.overrides]]
|
|
41
78
|
filter = 'test(/real_apfs_/)'
|
|
42
79
|
test-group = 'real-apfs'
|
package/package.json
CHANGED
|
@@ -117,7 +117,7 @@ describe('@smoothbricks/nx-plugin:bounded-exec', () => {
|
|
|
117
117
|
[
|
|
118
118
|
'let ticks = 0;',
|
|
119
119
|
'const timer = setInterval(() => {',
|
|
120
|
-
' console.log(
|
|
120
|
+
' console.log("tick " + ++ticks);',
|
|
121
121
|
' if (ticks === 6) {',
|
|
122
122
|
' clearInterval(timer);',
|
|
123
123
|
' }',
|
|
@@ -144,7 +144,7 @@ describe('@smoothbricks/nx-plugin:bounded-exec', () => {
|
|
|
144
144
|
[
|
|
145
145
|
'let ticks = 0;',
|
|
146
146
|
'const timer = setInterval(() => {',
|
|
147
|
-
' console.error(
|
|
147
|
+
' console.error("tick " + ++ticks);',
|
|
148
148
|
' if (ticks === 5) {',
|
|
149
149
|
' clearInterval(timer);',
|
|
150
150
|
' }',
|
package/src/index.test.ts
CHANGED
|
@@ -4,17 +4,15 @@ import { tmpdir } from 'node:os';
|
|
|
4
4
|
import { dirname, join } from 'node:path';
|
|
5
5
|
import { fileURLToPath } from 'node:url';
|
|
6
6
|
|
|
7
|
-
import type { CreateNodesContextV2, TargetConfiguration } from 'nx/src/devkit-exports.js';
|
|
7
|
+
import type { CreateNodesContextV2, CreateNodesV2, TargetConfiguration } from 'nx/src/devkit-exports.js';
|
|
8
8
|
import { AggregateCreateNodesError } from 'nx/src/project-graph/error-types.js';
|
|
9
9
|
import { mergeTargetConfigurations } from 'nx/src/project-graph/utils/project-configuration-utils.js';
|
|
10
10
|
import { BOUNDED_TEST_TIMEOUT_MS } from './bounded-test-policy.js';
|
|
11
11
|
import { exceptionalTestFilter } from './cargo-workspace.js';
|
|
12
12
|
import { CARGO_CROSS_LINT_COMMAND, CARGO_CROSS_LINT_TARGET, CARGO_LINT_CLIPPY_COMMAND } from './cross-check-policy.js';
|
|
13
|
-
import { createNodesV2 } from './index.js';
|
|
14
|
-
import { BUILD_OUTPUT_DEPENDENCIES } from './workspace-config-policy.js';
|
|
13
|
+
import { createNodesV2, createNodesV2ForPlatform } from './index.js';
|
|
15
14
|
|
|
16
15
|
const [, inferTargets] = createNodesV2;
|
|
17
|
-
const buildOutputDependencies = ['^build', ...BUILD_OUTPUT_DEPENDENCIES];
|
|
18
16
|
|
|
19
17
|
describe('@smoothbricks/nx-plugin inferred targets', () => {
|
|
20
18
|
it('names standalone package projects from package metadata', async () => {
|
|
@@ -109,7 +107,7 @@ describe('@smoothbricks/nx-plugin inferred targets', () => {
|
|
|
109
107
|
]);
|
|
110
108
|
expect(targets.build?.executor).toBe('nx:noop');
|
|
111
109
|
expect(targets.build?.cache).toBe(true);
|
|
112
|
-
expect(targets.build?.dependsOn).toEqual(
|
|
110
|
+
expect(targets.build?.dependsOn).toEqual(['^build', 'tsc-js']);
|
|
113
111
|
// An `nx:noop` aggregate writes no file, so it must claim none: a
|
|
114
112
|
// `{projectRoot}/dist` claim here would double-cache its children's bytes
|
|
115
113
|
// and make `github-ci nx-run-many --collect-outputs` attribute every file
|
|
@@ -206,7 +204,7 @@ describe('@smoothbricks/nx-plugin inferred targets', () => {
|
|
|
206
204
|
expect(targets['tsc-js']).toBeUndefined();
|
|
207
205
|
expect(targets['tsdown-js']).toBeUndefined();
|
|
208
206
|
expect(targets.build?.executor).toBe('nx:noop');
|
|
209
|
-
expect(targets.build?.dependsOn).toEqual(
|
|
207
|
+
expect(targets.build?.dependsOn).toEqual(['^build', 'tsdown-js']);
|
|
210
208
|
expect(targets.clean?.executor).toBe('@smoothbricks/nx-plugin:clean-outputs');
|
|
211
209
|
} finally {
|
|
212
210
|
await workspace.cleanup();
|
|
@@ -234,9 +232,10 @@ describe('@smoothbricks/nx-plugin inferred targets', () => {
|
|
|
234
232
|
|
|
235
233
|
expect(targets.build).toBeUndefined();
|
|
236
234
|
expect(targets.clean?.executor).toBe('@smoothbricks/nx-plugin:clean-outputs');
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
235
|
+
// No ordinary aggregate above is the whole assertion: a platform suffix
|
|
236
|
+
// is not an output family, so `bundle-ios`/`-macos`/`-linux` give this
|
|
237
|
+
// project nothing for `build` to aggregate — only a `clean` to own their
|
|
238
|
+
// outputs.
|
|
240
239
|
} finally {
|
|
241
240
|
await workspace.cleanup();
|
|
242
241
|
}
|
|
@@ -431,7 +430,7 @@ describe('@smoothbricks/nx-plugin inferred targets', () => {
|
|
|
431
430
|
});
|
|
432
431
|
expect(targets['tsc-js']?.dependsOn).toEqual(['^*-js', 'cargo-wasm']);
|
|
433
432
|
expect(targets.typecheck?.dependsOn).toEqual(['^*-js', 'cargo-wasm']);
|
|
434
|
-
expect(targets.build?.dependsOn).toEqual(
|
|
433
|
+
expect(targets.build?.dependsOn).toEqual(['^build', 'cargo-wasm', 'tsc-js']);
|
|
435
434
|
expect(targets.clean?.executor).toBe('@smoothbricks/nx-plugin:clean-outputs');
|
|
436
435
|
// A nested crate manifest is enough for output inference, but not for
|
|
437
436
|
// workspace-wide cargo-test/lint policy.
|
|
@@ -482,83 +481,161 @@ describe('@smoothbricks/nx-plugin inferred targets', () => {
|
|
|
482
481
|
|
|
483
482
|
expect(targets['cargo-wasm']).toBeUndefined();
|
|
484
483
|
expect(targets['tsc-js']?.outputs).toEqual(['{projectRoot}/dist/ts']);
|
|
485
|
-
//
|
|
486
|
-
//
|
|
484
|
+
// This fixture declares all four supported triples, so on EVERY supported
|
|
485
|
+
// runner the host's own triple is present and native: the host provider is
|
|
486
|
+
// that platform target and `cargo-napi` is never inferred. Tying the native
|
|
487
|
+
// regime to `-macos` asserted a macOS-only model and failed on Linux with
|
|
488
|
+
// zero host providers found. The dedicated `cargo-napi` regime is covered
|
|
489
|
+
// below against a platform no declared triple can serve, which reaches it
|
|
490
|
+
// on every runner instead of only on Linux.
|
|
487
491
|
const hostOs = process.platform === 'darwin' ? 'macos' : process.platform === 'linux' ? 'linux' : null;
|
|
488
492
|
const hostArch = process.arch === 'arm64' ? 'arm64' : process.arch === 'x64' ? 'x64' : null;
|
|
489
493
|
const hostSuffix = hostOs !== null && hostArch !== null ? `-${hostArch}-${hostOs}` : null;
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
494
|
+
expect(hostSuffix).not.toBeNull();
|
|
495
|
+
expect(targets[`napi${hostSuffix}`]).toBeDefined();
|
|
496
|
+
expect(targets['cargo-napi']).toBeUndefined();
|
|
497
|
+
|
|
498
|
+
// A platform outside NAPI_TARGET_CONVENTIONS leaves no native host target,
|
|
499
|
+
// which is precisely the condition that infers the dedicated host build.
|
|
500
|
+
const unservedHostTargets = await inferProjectTargets(
|
|
501
|
+
workspace,
|
|
502
|
+
'packages/cowshed/package.json',
|
|
503
|
+
createNodesV2ForPlatform('win32', 'x64'),
|
|
504
|
+
);
|
|
505
|
+
expect(unservedHostTargets['cargo-napi']).toMatchObject({
|
|
506
|
+
executor: 'nx:run-commands',
|
|
507
|
+
cache: true,
|
|
508
|
+
// The dedicated host build is another cargo writer on the default
|
|
509
|
+
// `target/`, and `build` lists it beside cargo-test-compile.
|
|
510
|
+
dependsOn: ['^build', 'cargo-test-compile'],
|
|
511
|
+
outputs: ['{projectRoot}/dist/native/host'],
|
|
512
|
+
options: {
|
|
513
|
+
cwd: 'packages/cowshed',
|
|
514
|
+
command:
|
|
515
|
+
'napi build --release --platform --no-js --dts cowshed.napi.d.ts --manifest-path crates/cowshed-napi/Cargo.toml --package cowshed-napi --output-dir dist/native/host',
|
|
516
|
+
},
|
|
517
|
+
});
|
|
518
|
+
expect(unservedHostTargets.build?.dependsOn).toEqual(['^build', 'cargo-test-compile', 'cargo-napi', 'tsc-js']);
|
|
513
519
|
expect(targets['napi-arm64-macos']?.outputs).toEqual(['{projectRoot}/dist/native/darwin-arm64']);
|
|
514
520
|
expect(targets['napi-arm64-macos']?.options).toMatchObject({
|
|
515
521
|
command:
|
|
516
522
|
'napi build --release --platform --no-js --dts cowshed.darwin-arm64.d.ts --target aarch64-apple-darwin --manifest-path crates/cowshed-napi/Cargo.toml --package cowshed-napi --output-dir dist/native/darwin-arm64',
|
|
517
523
|
});
|
|
518
524
|
expect(targets['napi-arm64-macos']?.options?.env).toBeUndefined();
|
|
525
|
+
// No cargo-test-compile edge here, on ANY host: a platform target's
|
|
526
|
+
// dependency closure may only reach its own family
|
|
527
|
+
// (`validatePlatformTargetDependencies`), so this pair serializes on
|
|
528
|
+
// cargo's flock rather than on a graph edge.
|
|
519
529
|
expect(targets['napi-arm64-macos']?.dependsOn).toBeUndefined();
|
|
520
|
-
|
|
530
|
+
// A macOS triple never gets a cross toolchain: `usesNapiCross` is
|
|
531
|
+
// `family === 'linux' && target !== host`, so the family decides this one
|
|
532
|
+
// and no host can change it.
|
|
533
|
+
expect(targets['napi-toolchain-x64-macos']).toBeUndefined();
|
|
534
|
+
// Everything else about the cross regime depends on WHICH host is
|
|
535
|
+
// inferring — on an x64 Linux runner `napi-x64-linux` is the native build,
|
|
536
|
+
// with no `--use-napi-cross` and no toolchain prerequisite at all. Those
|
|
537
|
+
// facts are asserted against forced platforms below instead of against
|
|
538
|
+
// whichever machine happens to run the suite.
|
|
539
|
+
|
|
540
|
+
// Exercise both host branches explicitly: this suite usually runs on
|
|
541
|
+
// Darwin, but Linux's native compiler selection is the contract at risk.
|
|
542
|
+
const linuxX64Targets = await inferProjectTargets(
|
|
543
|
+
workspace,
|
|
544
|
+
'packages/cowshed/package.json',
|
|
545
|
+
createNodesV2ForPlatform('linux', 'x64'),
|
|
546
|
+
);
|
|
547
|
+
expect(linuxX64Targets['napi-x64-linux']?.options?.command).not.toContain('--use-napi-cross');
|
|
548
|
+
expect(linuxX64Targets['napi-x64-linux']?.options?.env).toEqual({ CC: 'cc', CXX: 'c++' });
|
|
549
|
+
expect(linuxX64Targets['napi-x64-linux']?.dependsOn).toBeUndefined();
|
|
550
|
+
expect(linuxX64Targets['napi-toolchain-x64-linux']).toBeUndefined();
|
|
551
|
+
expect(linuxX64Targets['napi-arm64-linux']?.options?.command).toContain('--use-napi-cross');
|
|
552
|
+
expect(linuxX64Targets['napi-arm64-linux']?.options?.env).toEqual({
|
|
553
|
+
TARGET_CC: 'clang',
|
|
554
|
+
TARGET_CXX: 'clang++',
|
|
555
|
+
});
|
|
556
|
+
expect(linuxX64Targets['napi-debug']?.options?.env).toEqual({ CC: 'cc', CXX: 'c++' });
|
|
557
|
+
|
|
558
|
+
const darwinArm64Targets = await inferProjectTargets(
|
|
559
|
+
workspace,
|
|
560
|
+
'packages/cowshed/package.json',
|
|
561
|
+
createNodesV2ForPlatform('darwin', 'arm64'),
|
|
562
|
+
);
|
|
563
|
+
expect(darwinArm64Targets['napi-x64-linux']?.options?.command).toContain('--use-napi-cross');
|
|
564
|
+
expect(darwinArm64Targets['napi-x64-linux']?.options?.env).toEqual({
|
|
565
|
+
TARGET_CC: 'clang',
|
|
566
|
+
TARGET_CXX: 'clang++',
|
|
567
|
+
});
|
|
568
|
+
expect(darwinArm64Targets['napi-x64-linux']?.dependsOn).toEqual(['napi-toolchain-x64-linux']);
|
|
569
|
+
expect(darwinArm64Targets['napi-debug']?.options?.env).toBeUndefined();
|
|
570
|
+
expect(darwinArm64Targets['napi-toolchain-arm64-linux']).toEqual({
|
|
521
571
|
executor: '@smoothbricks/nx-plugin:napi-cross-toolchain',
|
|
522
572
|
cache: false,
|
|
523
573
|
options: { triple: 'aarch64-unknown-linux-gnu' },
|
|
524
574
|
});
|
|
525
|
-
expect(
|
|
575
|
+
expect(darwinArm64Targets['napi-toolchain-x64-linux']).toEqual({
|
|
526
576
|
executor: '@smoothbricks/nx-plugin:napi-cross-toolchain',
|
|
527
577
|
cache: false,
|
|
528
578
|
options: { triple: 'x86_64-unknown-linux-gnu' },
|
|
529
579
|
});
|
|
530
|
-
expect(
|
|
531
|
-
expect(
|
|
532
|
-
expect(
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
//
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
'
|
|
543
|
-
|
|
544
|
-
'
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
580
|
+
expect(darwinArm64Targets['napi-arm64-linux']?.dependsOn).toEqual(['napi-toolchain-arm64-linux']);
|
|
581
|
+
expect(darwinArm64Targets['napi-x64-linux']?.outputs).toEqual(['{projectRoot}/dist/native/linux-x64-gnu']);
|
|
582
|
+
expect(darwinArm64Targets['napi-x64-linux']?.options?.command).toBe(
|
|
583
|
+
'napi build --release --platform --no-js --dts cowshed.linux-x64-gnu.d.ts --target x86_64-unknown-linux-gnu --use-napi-cross --manifest-path crates/cowshed-napi/Cargo.toml --package cowshed-napi --output-dir dist/native/linux-x64-gnu',
|
|
584
|
+
);
|
|
585
|
+
|
|
586
|
+
// The whole rule, stated once per forced host: a triple gets a cross
|
|
587
|
+
// toolchain exactly when it is a linux triple that is not this host's own.
|
|
588
|
+
// Asserting the pair by name is what broke on Linux, where
|
|
589
|
+
// napi-toolchain-x64-linux legitimately does not exist.
|
|
590
|
+
for (const [inferred, hostTriple] of [
|
|
591
|
+
[linuxX64Targets, 'x64-linux'],
|
|
592
|
+
[darwinArm64Targets, 'arm64-macos'],
|
|
593
|
+
] as const) {
|
|
594
|
+
for (const suffix of ['arm64-linux', 'x64-linux', 'arm64-macos', 'x64-macos']) {
|
|
595
|
+
const expectsToolchain = suffix.endsWith('-linux') && suffix !== hostTriple;
|
|
596
|
+
expect(inferred[`napi-toolchain-${suffix}`] === undefined).toBe(!expectsToolchain);
|
|
597
|
+
expect(inferred[`napi-${suffix}`]?.options?.command).toContain(
|
|
598
|
+
expectsToolchain ? '--use-napi-cross' : '--target',
|
|
599
|
+
);
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
// The aggregate build pulls in exactly the inferring host's
|
|
603
|
+
// platform-suffixed targets (publish still owns foreign platforms), and
|
|
604
|
+
// the only cargo-test work it owns is compiling the executables — every
|
|
605
|
+
// RUNNER is reached through `test`. Both hosts are asserted here so the
|
|
606
|
+
// expectation does not depend on which machine runs the suite: the
|
|
607
|
+
// previous form read `process.platform`, and the macOS answer was the only
|
|
608
|
+
// one anyone checked.
|
|
609
|
+
for (const [inferred, hostSuffix] of [
|
|
610
|
+
[linuxX64Targets, '-x64-linux'],
|
|
611
|
+
[darwinArm64Targets, '-arm64-macos'],
|
|
612
|
+
] as const) {
|
|
613
|
+
const hostNapiTargets = [
|
|
614
|
+
'cli-arm64-macos',
|
|
615
|
+
'cli-x64-linux',
|
|
616
|
+
'napi-arm64-macos',
|
|
617
|
+
'napi-x64-macos',
|
|
618
|
+
'napi-arm64-linux',
|
|
619
|
+
'napi-x64-linux',
|
|
620
|
+
]
|
|
621
|
+
.filter((name) => name.endsWith(hostSuffix))
|
|
622
|
+
.sort();
|
|
623
|
+
expect(hostNapiTargets.length).toBeGreaterThan(0);
|
|
624
|
+
expect(inferred.build?.dependsOn).toEqual(['^build', 'cargo-test-compile', 'tsc-js', ...hostNapiTargets]);
|
|
625
|
+
// Crate `cowshed-napi` names its bounded runner
|
|
626
|
+
// `cargo-test-cowshed-napi`, which the retired `*-napi` output-family
|
|
627
|
+
// glob matched on suffix alone. The runners are one serialized chain, so
|
|
628
|
+
// that single edge put the whole cargo test suite inside
|
|
629
|
+
// `nx run-many -t build`.
|
|
630
|
+
expect(inferred['cargo-test-cowshed-napi']).toBeDefined();
|
|
631
|
+
for (const dependency of inferred.build?.dependsOn ?? []) {
|
|
632
|
+
expect(String(dependency).startsWith('cargo-test-')).toBe(dependency === 'cargo-test-compile');
|
|
633
|
+
}
|
|
634
|
+
for (const dependency of inferred.build?.dependsOn ?? []) {
|
|
635
|
+
if (typeof dependency === 'string' && /-(?:arm64|x64)-(?:macos|linux)$/.test(dependency)) {
|
|
636
|
+
expect(dependency.endsWith(hostSuffix)).toBe(true);
|
|
637
|
+
}
|
|
559
638
|
}
|
|
560
|
-
} else {
|
|
561
|
-
expect(platformBuildDependencies).toEqual([]);
|
|
562
639
|
}
|
|
563
640
|
expect(targets.clean?.executor).toBe('@smoothbricks/nx-plugin:clean-outputs');
|
|
564
641
|
// The test suite runs against the dev-profile addon, never a release
|
|
@@ -634,10 +711,11 @@ describe('@smoothbricks/nx-plugin inferred targets', () => {
|
|
|
634
711
|
// The declared target stays the only cargo-wasm: inference never emits a
|
|
635
712
|
// duplicate for Nx to merge, even with a cdylib *-wasm member crate present.
|
|
636
713
|
expect(targets['cargo-wasm']).toBeUndefined();
|
|
637
|
-
// Its *-wasm output-family name feeds the aggregate build and
|
|
638
|
-
|
|
714
|
+
// Its declared *-wasm output-family name feeds the aggregate build and
|
|
715
|
+
// clean by concrete name, and the cargo workspace's test-executable
|
|
716
|
+
// compilation comes with it.
|
|
639
717
|
expect(targets.build?.executor).toBe('nx:noop');
|
|
640
|
-
expect(targets.build?.dependsOn).toEqual(
|
|
718
|
+
expect(targets.build?.dependsOn).toEqual(['^build', 'cargo-test-compile', 'cargo-wasm']);
|
|
641
719
|
expect(targets.clean?.executor).toBe('@smoothbricks/nx-plugin:clean-outputs');
|
|
642
720
|
} finally {
|
|
643
721
|
await workspace.cleanup();
|
|
@@ -891,16 +969,22 @@ interface WorkspaceFixture {
|
|
|
891
969
|
cleanup(): Promise<void>;
|
|
892
970
|
}
|
|
893
971
|
|
|
894
|
-
async function inferProject(
|
|
895
|
-
|
|
972
|
+
async function inferProject(
|
|
973
|
+
workspace: WorkspaceFixture,
|
|
974
|
+
packageJsonPath: string,
|
|
975
|
+
createNodes: CreateNodesV2 = createNodesV2,
|
|
976
|
+
) {
|
|
977
|
+
const [, infer] = createNodes;
|
|
978
|
+
const result = await infer([packageJsonPath], undefined, workspace.context);
|
|
896
979
|
return result[0]?.[1].projects?.[dirname(packageJsonPath)];
|
|
897
980
|
}
|
|
898
981
|
|
|
899
982
|
async function inferProjectTargets(
|
|
900
983
|
workspace: WorkspaceFixture,
|
|
901
984
|
packageJsonPath: string,
|
|
985
|
+
createNodes?: CreateNodesV2,
|
|
902
986
|
): Promise<Record<string, TargetConfiguration>> {
|
|
903
|
-
return (await inferProject(workspace, packageJsonPath))?.targets ?? {};
|
|
987
|
+
return (await inferProject(workspace, packageJsonPath, createNodes))?.targets ?? {};
|
|
904
988
|
}
|
|
905
989
|
|
|
906
990
|
/**
|
package/src/index.ts
CHANGED
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
CARGO_LINT_CLIPPY_COMMAND,
|
|
33
33
|
cargoFrozen,
|
|
34
34
|
} from './cross-check-policy.js';
|
|
35
|
-
import {
|
|
35
|
+
import { PLATFORM_TARGET_GLOBS } from './workspace-config-policy.js';
|
|
36
36
|
|
|
37
37
|
export { CARGO_TEST_COMPILE_TARGET };
|
|
38
38
|
|
|
@@ -44,30 +44,56 @@ const TYPESCRIPT_TOOLCHAIN_INPUTS = [
|
|
|
44
44
|
'{workspaceRoot}/tsconfig.base.json',
|
|
45
45
|
];
|
|
46
46
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
47
|
+
type NapiArchitecture = 'arm64' | 'x64';
|
|
48
|
+
type NapiTargetFamily = 'linux' | 'macos';
|
|
49
|
+
|
|
50
|
+
interface NapiPlatform {
|
|
51
|
+
architecture: NapiArchitecture;
|
|
52
|
+
targetFamily: NapiTargetFamily;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function napiPlatform(platform: NodeJS.Platform, architecture: string): NapiPlatform | null {
|
|
56
|
+
const targetFamily = platform === 'darwin' ? 'macos' : platform === 'linux' ? 'linux' : null;
|
|
57
|
+
const targetArchitecture = architecture === 'arm64' ? 'arm64' : architecture === 'x64' ? 'x64' : null;
|
|
58
|
+
return targetFamily !== null && targetArchitecture !== null
|
|
59
|
+
? { architecture: targetArchitecture, targetFamily }
|
|
60
|
+
: null;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function sameNapiPlatform(left: NapiPlatform, right: NapiPlatform | null): boolean {
|
|
64
|
+
return left.architecture === right?.architecture && left.targetFamily === right.targetFamily;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function hostPlatformTargetNames(targetNames: Iterable<string>, hostPlatform: NapiPlatform | null): string[] {
|
|
68
|
+
if (hostPlatform === null) return [];
|
|
69
|
+
const suffix = `-${hostPlatform.architecture}-${hostPlatform.targetFamily}`;
|
|
61
70
|
return [...new Set(targetNames)]
|
|
62
71
|
.filter(
|
|
63
72
|
// Binary targets only. A toolchain prerequisite carries the same platform
|
|
64
73
|
// suffix but produces no artifact: the cross builds that need it depend
|
|
65
74
|
// on it directly, so the aggregate stays a list of outputs.
|
|
66
|
-
(name) => name.endsWith(
|
|
75
|
+
(name) => name.endsWith(suffix) && !name.startsWith(NAPI_TOOLCHAIN_TARGET_PREFIX),
|
|
67
76
|
)
|
|
68
77
|
.sort();
|
|
69
78
|
}
|
|
70
79
|
|
|
80
|
+
/**
|
|
81
|
+
* The reserved suffixes name targets that EMIT an artifact, and the `build`
|
|
82
|
+
* aggregate is a list of those. Handing Nx the raw `*-<family>` globs let it
|
|
83
|
+
* match on suffix alone, and one namespace collides by construction: a
|
|
84
|
+
* per-crate cargo test runner is named `cargo-test-<crate>`, so any crate whose
|
|
85
|
+
* name ends in an output family — `*-napi`, `*-wasm`, `*-native`, `*-js` — put
|
|
86
|
+
* its RUNNER in the aggregate. The runners are one serialized chain, so a
|
|
87
|
+
* single such crate made `build` pull an entire cargo test suite. Expanding the
|
|
88
|
+
* families here instead of delegating to Nx's matcher keeps the plugin's own
|
|
89
|
+
* `cargo-test-` namespace out of the aggregate however a crate is named.
|
|
90
|
+
*/
|
|
91
|
+
function buildOutputTargetNames(targetNames: Iterable<string>): string[] {
|
|
92
|
+
return [...new Set(targetNames)]
|
|
93
|
+
.filter((name) => BUILD_OUTPUT_TARGET_PATTERN.test(name) && !name.startsWith(`${CARGO_TEST_TARGET}-`))
|
|
94
|
+
.sort();
|
|
95
|
+
}
|
|
96
|
+
|
|
71
97
|
//#region smoo!n/rust-output-target-inference
|
|
72
98
|
// Cargo workspace inference: a package.json sitting next to a Cargo.toml that
|
|
73
99
|
// declares [workspace] gets direct cargo-test/test targets, cargo-lint feeding
|
|
@@ -91,11 +117,8 @@ const CARGO_INPUTS = [
|
|
|
91
117
|
const CARGO_OUTPUT_INPUTS = [...CARGO_INPUTS, '{projectRoot}/package.json', '{workspaceRoot}/bun.lock'];
|
|
92
118
|
const NAPI_INPUTS = CARGO_OUTPUT_INPUTS;
|
|
93
119
|
|
|
94
|
-
interface NapiTargetConvention {
|
|
95
|
-
architecture: string;
|
|
120
|
+
interface NapiTargetConvention extends NapiPlatform {
|
|
96
121
|
outputName: string;
|
|
97
|
-
targetFamily: 'linux' | 'macos';
|
|
98
|
-
useNapiCross: boolean;
|
|
99
122
|
}
|
|
100
123
|
|
|
101
124
|
const NAPI_TARGET_CONVENTIONS: Readonly<Record<string, NapiTargetConvention>> = {
|
|
@@ -103,28 +126,39 @@ const NAPI_TARGET_CONVENTIONS: Readonly<Record<string, NapiTargetConvention>> =
|
|
|
103
126
|
architecture: 'arm64',
|
|
104
127
|
outputName: 'darwin-arm64',
|
|
105
128
|
targetFamily: 'macos',
|
|
106
|
-
useNapiCross: false,
|
|
107
129
|
},
|
|
108
130
|
'x86_64-apple-darwin': {
|
|
109
131
|
architecture: 'x64',
|
|
110
132
|
outputName: 'darwin-x64',
|
|
111
133
|
targetFamily: 'macos',
|
|
112
|
-
useNapiCross: false,
|
|
113
134
|
},
|
|
114
135
|
'aarch64-unknown-linux-gnu': {
|
|
115
136
|
architecture: 'arm64',
|
|
116
137
|
outputName: 'linux-arm64-gnu',
|
|
117
138
|
targetFamily: 'linux',
|
|
118
|
-
useNapiCross: true,
|
|
119
139
|
},
|
|
120
140
|
'x86_64-unknown-linux-gnu': {
|
|
121
141
|
architecture: 'x64',
|
|
122
142
|
outputName: 'linux-x64-gnu',
|
|
123
143
|
targetFamily: 'linux',
|
|
124
|
-
useNapiCross: true,
|
|
125
144
|
},
|
|
126
145
|
};
|
|
127
146
|
|
|
147
|
+
const NATIVE_LINUX_COMPILER_ENV = Object.freeze({ CC: 'cc', CXX: 'c++' });
|
|
148
|
+
const CROSS_LINUX_COMPILER_ENV = Object.freeze({ TARGET_CC: 'clang', TARGET_CXX: 'clang++' });
|
|
149
|
+
|
|
150
|
+
function usesNapiCross(target: NapiTargetConvention, hostPlatform: NapiPlatform | null): boolean {
|
|
151
|
+
return target.targetFamily === 'linux' && !sameNapiPlatform(target, hostPlatform);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function napiCompilerEnv(
|
|
155
|
+
target: NapiPlatform | null,
|
|
156
|
+
hostPlatform: NapiPlatform | null,
|
|
157
|
+
): Readonly<Record<string, string>> | undefined {
|
|
158
|
+
if (target?.targetFamily !== 'linux') return undefined;
|
|
159
|
+
return sameNapiPlatform(target, hostPlatform) ? NATIVE_LINUX_COMPILER_ENV : CROSS_LINUX_COMPILER_ENV;
|
|
160
|
+
}
|
|
161
|
+
|
|
128
162
|
const NAPI_TOOLCHAIN_TARGET_PREFIX = 'napi-toolchain-';
|
|
129
163
|
|
|
130
164
|
/**
|
|
@@ -296,9 +330,10 @@ async function addPerPackageCargoTestTargets(
|
|
|
296
330
|
return packageTargetNames;
|
|
297
331
|
}
|
|
298
332
|
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
333
|
+
type CreateNodesHandler = CreateNodesV2[1];
|
|
334
|
+
|
|
335
|
+
function createNodesHandler(hostPlatform: NapiPlatform | null): CreateNodesHandler {
|
|
336
|
+
return async (projectConfigurationFiles, _options, context) => {
|
|
302
337
|
const results: CreateNodesResultV2 = [];
|
|
303
338
|
const errors: Array<[file: string | null, error: Error]> = [];
|
|
304
339
|
|
|
@@ -311,7 +346,10 @@ export const createNodesV2: CreateNodesV2 = [
|
|
|
311
346
|
results.push([packageJsonPath, {}]);
|
|
312
347
|
return;
|
|
313
348
|
}
|
|
314
|
-
results.push([
|
|
349
|
+
results.push([
|
|
350
|
+
packageJsonPath,
|
|
351
|
+
await createProjectTargets(packageJsonPath, context.workspaceRoot, hostPlatform),
|
|
352
|
+
]);
|
|
315
353
|
} catch (error) {
|
|
316
354
|
errors.push([packageJsonPath, error instanceof Error ? error : new Error(String(error))]);
|
|
317
355
|
}
|
|
@@ -323,7 +361,16 @@ export const createNodesV2: CreateNodesV2 = [
|
|
|
323
361
|
}
|
|
324
362
|
|
|
325
363
|
return results;
|
|
326
|
-
}
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
export function createNodesV2ForPlatform(platform: NodeJS.Platform, architecture: string): CreateNodesV2 {
|
|
368
|
+
return ['**/package.json', createNodesHandler(napiPlatform(platform, architecture))];
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
export const createNodesV2: CreateNodesV2 = [
|
|
372
|
+
'**/package.json',
|
|
373
|
+
(...args) => createNodesHandler(napiPlatform(process.platform, process.arch))(...args),
|
|
327
374
|
];
|
|
328
375
|
|
|
329
376
|
function isManagedPackageJsonSource(packageJsonPath: string): boolean {
|
|
@@ -343,7 +390,7 @@ interface PackageJson {
|
|
|
343
390
|
};
|
|
344
391
|
}
|
|
345
392
|
|
|
346
|
-
async function createProjectTargets(packageJsonPath: string, workspaceRoot: string) {
|
|
393
|
+
async function createProjectTargets(packageJsonPath: string, workspaceRoot: string, hostPlatform: NapiPlatform | null) {
|
|
347
394
|
const projectRoot = dirname(packageJsonPath);
|
|
348
395
|
const absoluteProjectRoot = join(workspaceRoot, projectRoot);
|
|
349
396
|
const packageJson = await readPackageJson(join(workspaceRoot, packageJsonPath));
|
|
@@ -438,7 +485,7 @@ async function createProjectTargets(packageJsonPath: string, workspaceRoot: stri
|
|
|
438
485
|
}
|
|
439
486
|
|
|
440
487
|
if (napiConfig) {
|
|
441
|
-
Object.assign(targets, createNapiTargets(projectRoot, napiConfig));
|
|
488
|
+
Object.assign(targets, createNapiTargets(projectRoot, napiConfig, hostPlatform));
|
|
442
489
|
if (
|
|
443
490
|
!('napi-test' in (packageJson.nx?.targets ?? {})) &&
|
|
444
491
|
existsSync(join(absoluteProjectRoot, 'src/native.test.ts'))
|
|
@@ -685,6 +732,37 @@ async function createProjectTargets(packageJsonPath: string, workspaceRoot: stri
|
|
|
685
732
|
}
|
|
686
733
|
}
|
|
687
734
|
|
|
735
|
+
// `build` lists cargo-test-compile beside the host's platform binaries, and
|
|
736
|
+
// every one of those is a `napi build` — another cargo writer on the package's
|
|
737
|
+
// default `target/`, which cargo flocks.
|
|
738
|
+
//
|
|
739
|
+
// Only `cargo-napi` gets the ordering edge. A platform-suffixed target may NOT
|
|
740
|
+
// have one: `validatePlatformTargetDependencies` (package-target-policy.ts:674)
|
|
741
|
+
// walks each platform target's dependency closure and refuses any member of a
|
|
742
|
+
// different family, because the publish flow builds and collects one platform
|
|
743
|
+
// at a time — a `*-macos` collect that reached a familyless sibling would drag
|
|
744
|
+
// in work the macOS runner has no business doing. `cargo-napi` carries no
|
|
745
|
+
// platform suffix, so it is not scanned and the edge is legal there.
|
|
746
|
+
//
|
|
747
|
+
// The platform binaries therefore stay Nx siblings of cargo-test-compile and
|
|
748
|
+
// serialize on cargo's flock instead of on a graph edge. That is the same
|
|
749
|
+
// arrangement `cli-<arch>-<os>` and `napi-<arch>-<os>` already have with each
|
|
750
|
+
// other — both `napi build --release` on one target dir — so this adds a third
|
|
751
|
+
// participant to an existing wait, not a new hazard. The flock makes them wait;
|
|
752
|
+
// it does not corrupt anything, and these are unbounded `nx:run-commands`
|
|
753
|
+
// targets, so the wait is not charged against a test budget.
|
|
754
|
+
const cargoWriterNames = hostPlatformTargetNames(
|
|
755
|
+
[...Object.keys(declaredTargets), ...Object.keys(targets)],
|
|
756
|
+
hostPlatform,
|
|
757
|
+
);
|
|
758
|
+
const cargoNapi = targets['cargo-napi'];
|
|
759
|
+
if (cargoNapi && targets[CARGO_TEST_COMPILE_TARGET]) {
|
|
760
|
+
const dependsOn = cargoNapi.dependsOn ?? [];
|
|
761
|
+
if (!dependsOn.includes(CARGO_TEST_COMPILE_TARGET)) {
|
|
762
|
+
cargoNapi.dependsOn = [...dependsOn, CARGO_TEST_COMPILE_TARGET];
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
|
|
688
766
|
// No `outputs`, deliberately: this aggregate runs no command, so every file
|
|
689
767
|
// under dist belongs to the concrete target that emitted it. Claiming
|
|
690
768
|
// `{projectRoot}/dist` here would cache the children's bytes a second time
|
|
@@ -699,10 +777,20 @@ async function createProjectTargets(packageJsonPath: string, workspaceRoot: stri
|
|
|
699
777
|
targets.build = {
|
|
700
778
|
executor: 'nx:noop',
|
|
701
779
|
cache: true,
|
|
780
|
+
// `cargo-napi` is both an output family and a serialized cargo writer, so
|
|
781
|
+
// the two sources overlap; the Set keeps one edge per target while holding
|
|
782
|
+
// the order the families are listed in.
|
|
702
783
|
dependsOn: [
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
784
|
+
...new Set([
|
|
785
|
+
'^build',
|
|
786
|
+
// Compiling the test executables is build work: it is unbounded and
|
|
787
|
+
// cacheable, while every RUNNER is a bounded-exec target reached only
|
|
788
|
+
// through the `test` aggregate. That split is what keeps a cold cargo
|
|
789
|
+
// workspace's compile time out of the bounded test window.
|
|
790
|
+
...(targets[CARGO_TEST_COMPILE_TARGET] ? [CARGO_TEST_COMPILE_TARGET] : []),
|
|
791
|
+
...buildOutputTargetNames([...Object.keys(declaredTargets), ...Object.keys(targets)]),
|
|
792
|
+
...cargoWriterNames,
|
|
793
|
+
]),
|
|
706
794
|
],
|
|
707
795
|
};
|
|
708
796
|
}
|
|
@@ -914,21 +1002,27 @@ function resolveNapiConfig(
|
|
|
914
1002
|
return { binaryName, cargoPackage, manifestPath, targets };
|
|
915
1003
|
}
|
|
916
1004
|
|
|
917
|
-
function createNapiTargets(
|
|
1005
|
+
function createNapiTargets(
|
|
1006
|
+
projectRoot: string,
|
|
1007
|
+
config: ResolvedNapiConfig,
|
|
1008
|
+
hostPlatform: NapiPlatform | null,
|
|
1009
|
+
): Record<string, TargetConfiguration> {
|
|
918
1010
|
const commonCommand = `--manifest-path ${config.manifestPath} --package ${config.cargoPackage}`;
|
|
919
|
-
const hostPlatformTargetName =
|
|
1011
|
+
const hostPlatformTargetName =
|
|
1012
|
+
hostPlatform === null ? null : `napi-${hostPlatform.architecture}-${hostPlatform.targetFamily}`;
|
|
920
1013
|
let nativeHostTargetName: string | null = null;
|
|
921
1014
|
if (hostPlatformTargetName !== null) {
|
|
922
1015
|
for (const triple of config.targets) {
|
|
923
1016
|
const convention = NAPI_TARGET_CONVENTIONS[triple];
|
|
924
1017
|
const targetName = convention ? `napi-${convention.architecture}-${convention.targetFamily}` : null;
|
|
925
|
-
if (targetName === hostPlatformTargetName && !convention
|
|
1018
|
+
if (targetName === hostPlatformTargetName && convention && !usesNapiCross(convention, hostPlatform)) {
|
|
926
1019
|
nativeHostTargetName = targetName;
|
|
927
1020
|
break;
|
|
928
1021
|
}
|
|
929
1022
|
}
|
|
930
1023
|
}
|
|
931
1024
|
const targets: Record<string, TargetConfiguration> = {};
|
|
1025
|
+
const hostCompilerEnv = napiCompilerEnv(hostPlatform, hostPlatform);
|
|
932
1026
|
|
|
933
1027
|
// The addon the test suite loads. A dev-profile build shares target/debug
|
|
934
1028
|
// with cargo-test's dependency graph, so after the tests compile this is
|
|
@@ -946,6 +1040,7 @@ function createNapiTargets(projectRoot: string, config: ResolvedNapiConfig): Rec
|
|
|
946
1040
|
options: {
|
|
947
1041
|
cwd: projectRoot,
|
|
948
1042
|
command: `napi build --platform --no-js --dts ${config.binaryName}.napi.d.ts ${commonCommand} --output-dir .cache/native-debug`,
|
|
1043
|
+
...(hostCompilerEnv ? { env: hostCompilerEnv } : {}),
|
|
949
1044
|
},
|
|
950
1045
|
};
|
|
951
1046
|
|
|
@@ -963,13 +1058,14 @@ function createNapiTargets(projectRoot: string, config: ResolvedNapiConfig): Rec
|
|
|
963
1058
|
options: {
|
|
964
1059
|
cwd: projectRoot,
|
|
965
1060
|
command: `napi build --release --platform --no-js --dts ${config.binaryName}.napi.d.ts ${commonCommand} --output-dir dist/native/host`,
|
|
1061
|
+
...(hostCompilerEnv ? { env: hostCompilerEnv } : {}),
|
|
966
1062
|
},
|
|
967
1063
|
};
|
|
968
1064
|
}
|
|
969
1065
|
|
|
970
1066
|
for (const triple of config.targets) {
|
|
971
1067
|
const convention = NAPI_TARGET_CONVENTIONS[triple];
|
|
972
|
-
if (!convention
|
|
1068
|
+
if (!convention || !usesNapiCross(convention, hostPlatform)) {
|
|
973
1069
|
continue;
|
|
974
1070
|
}
|
|
975
1071
|
// One toolchain target per triple, shared by every cross build that needs
|
|
@@ -994,20 +1090,22 @@ function createNapiTargets(projectRoot: string, config: ResolvedNapiConfig): Rec
|
|
|
994
1090
|
}
|
|
995
1091
|
const targetName = `napi-${convention.architecture}-${convention.targetFamily}`;
|
|
996
1092
|
const outputDirectory = `dist/native/${convention.outputName}`;
|
|
997
|
-
const
|
|
1093
|
+
const useNapiCross = usesNapiCross(convention, hostPlatform);
|
|
1094
|
+
const crossFlag = useNapiCross ? ' --use-napi-cross' : '';
|
|
1095
|
+
const compilerEnv = napiCompilerEnv(convention, hostPlatform);
|
|
998
1096
|
targets[targetName] = {
|
|
999
1097
|
executor: 'nx:run-commands',
|
|
1000
1098
|
cache: true,
|
|
1001
|
-
...(
|
|
1099
|
+
...(useNapiCross ? { dependsOn: [napiToolchainTargetName(convention)] } : {}),
|
|
1002
1100
|
inputs: NAPI_INPUTS,
|
|
1003
1101
|
outputs: [`{projectRoot}/${outputDirectory}`],
|
|
1004
1102
|
options: {
|
|
1005
1103
|
cwd: projectRoot,
|
|
1006
1104
|
command: `napi build --release --platform --no-js --dts ${config.binaryName}.${convention.outputName}.d.ts --target ${triple}${crossFlag} ${commonCommand} --output-dir ${outputDirectory}`,
|
|
1007
|
-
//
|
|
1008
|
-
//
|
|
1009
|
-
//
|
|
1010
|
-
...(
|
|
1105
|
+
// Genuine Linux cross-compiles use Clang plus napi-rs's downloaded
|
|
1106
|
+
// GNU sysroot. A native Linux target uses Nix's cc wrapper so C build
|
|
1107
|
+
// scripts resolve the host libc headers instead.
|
|
1108
|
+
...(compilerEnv ? { env: compilerEnv } : {}),
|
|
1011
1109
|
},
|
|
1012
1110
|
};
|
|
1013
1111
|
}
|