@smoothbricks/nx-plugin 0.4.22 → 0.4.24
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 +93 -33
- package/dist/bin/smoo-nx-exec.js +35 -11
- package/dist/bin/smoo-nx-nextest-extract.d.ts +3 -0
- package/dist/bin/smoo-nx-nextest-extract.d.ts.map +1 -0
- package/dist/bin/smoo-nx-nextest-extract.js +41 -0
- package/dist/cargo-closure-input.d.ts +63 -0
- package/dist/cargo-closure-input.d.ts.map +1 -0
- package/dist/cargo-closure-input.js +197 -0
- package/dist/cargo-source-hash.d.ts +37 -0
- package/dist/cargo-source-hash.d.ts.map +1 -1
- package/dist/cargo-source-hash.js +108 -190
- package/dist/cross-check-policy.d.ts +14 -0
- package/dist/cross-check-policy.d.ts.map +1 -1
- package/dist/cross-check-policy.js +15 -1
- package/dist/ensure-built.d.ts +3 -2
- package/dist/ensure-built.d.ts.map +1 -1
- package/dist/ensure-built.js +33 -56
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +152 -91
- package/dist/managed-files/ci-workflow.d.ts.map +1 -1
- package/dist/managed-files/ci-workflow.js +12 -15
- package/dist/managed-files/files.d.ts.map +1 -1
- package/dist/managed-files/files.js +10 -0
- package/dist/managed-files/publish-workflow.d.ts.map +1 -1
- package/dist/managed-files/publish-workflow.js +12 -6
- package/dist/manifest-hash.d.ts.map +1 -1
- package/dist/manifest-hash.js +24 -30
- package/dist/nextest-extraction.d.ts +101 -0
- package/dist/nextest-extraction.d.ts.map +1 -0
- package/dist/nextest-extraction.js +268 -0
- package/dist/package-target-policy.js +1 -1
- package/dist/platform-targets.d.ts +7 -0
- package/dist/platform-targets.d.ts.map +1 -1
- package/dist/platform-targets.js +7 -0
- package/dist/workspace-config-policy.d.ts +1 -1
- package/dist/workspace-config-policy.d.ts.map +1 -1
- package/dist/workspace-config-policy.js +1 -1
- package/managed/raw/envrc +38 -1
- package/managed/raw/tooling/direnv/developer-links.ts +201 -0
- package/managed/raw/tooling/direnv/devenv.smoo.nix +75 -51
- package/managed/raw/tooling/direnv/secret-references.ts +3 -1
- package/managed/raw/tooling/direnv/setup-environment.ts +562 -78
- package/managed/raw/tooling/direnv/shared-caches.sh +53 -0
- package/managed/raw/tooling/git-hooks/pre-push.sh +22 -1
- package/managed/templates/github/workflows/managed-files.yml +4 -3
- package/nextest.toml +5 -5
- package/package.json +4 -3
- package/src/__tests__/fixture-nx-env.ts +31 -0
- package/src/__tests__/in-process-nx-index.ts +9 -0
- package/src/bin/smoo-nx-exec.ts +40 -11
- package/src/bin/smoo-nx-nextest-extract.ts +43 -0
- package/src/bounded-test-policy.test.ts +4 -1
- package/src/cargo-closure-input.test.ts +184 -0
- package/src/cargo-closure-input.ts +247 -0
- package/src/cargo-source-hash.test.ts +8 -9
- package/src/cargo-source-hash.ts +146 -47
- package/src/cross-check-policy.ts +15 -3
- package/src/ensure-built.test.ts +65 -5
- package/src/ensure-built.ts +40 -85
- package/src/index.test.ts +222 -75
- package/src/index.ts +213 -101
- package/src/managed-files/ci-workflow.ts +12 -15
- package/src/managed-files/files.ts +10 -0
- package/src/managed-files/generator.test.ts +29 -0
- package/src/managed-files/publish-workflow.ts +17 -6
- package/src/manifest-hash.test.ts +21 -1
- package/src/manifest-hash.ts +26 -29
- package/src/nextest-extraction.test.ts +74 -0
- package/src/nextest-extraction.ts +329 -0
- package/src/package-target-policy.ts +1 -1
- package/src/platform-targets.ts +8 -0
- package/src/workspace-config-policy.ts +6 -1
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
/* biome-ignore-all lint/suspicious/noTemplateCurlyInString: GitHub Actions expressions are emitted literally. */
|
|
2
|
-
import { LINUX_PLATFORM_TARGET_GLOBS, MACOS_PLATFORM_TARGET_GLOBS } from '../platform-targets.js';
|
|
2
|
+
import { LINUX_PLATFORM_TARGET_GLOBS, MACOS_PLATFORM_TARGET_GLOBS, RELEASE_CONFIGURATION, } from '../platform-targets.js';
|
|
3
3
|
import { isSmoothBricksCodebasePackageName } from '../workspace-package-policy.js';
|
|
4
4
|
import { artifactStepLines, CiWorkflowStepKind, cargoCredentialJobEnvLines, cargoCredentialStepLines, deployStepSecretEnvLines, remoteCacheJobEnvLines, sourceCheckoutsStepLines, } from './ci-workflow.js';
|
|
5
5
|
import { GITHUB_HOSTED_LINUX_RUNNER, renderRunsOnLine } from './github-runs-on.js';
|
|
6
|
+
/**
|
|
7
|
+
* Carried by every step that builds what ships: the build aggregate and each
|
|
8
|
+
* platform leg. Lint and unit tests keep the default configuration, cargo's
|
|
9
|
+
* dev profile, like every local and CI run.
|
|
10
|
+
*/
|
|
11
|
+
const RELEASE_BUILD_ARGUMENT = `--configuration ${RELEASE_CONFIGURATION}`;
|
|
6
12
|
export var PublishWorkflowStepKind;
|
|
7
13
|
(function (PublishWorkflowStepKind) {
|
|
8
14
|
PublishWorkflowStepKind["Checkout"] = "checkout";
|
|
@@ -446,7 +452,7 @@ function yamlLinesForStep(step, options) {
|
|
|
446
452
|
// blocks on actual package issues (smoo monorepo validate).
|
|
447
453
|
return conditionalRunStep(step, 'smoo monorepo check --warn');
|
|
448
454
|
case PublishWorkflowStepKind.Build:
|
|
449
|
-
return conditionalRunStep(step, `smoo github-ci nx-run-many --targets build --projects "${githubExpression('steps.version.outputs.projects')}"`);
|
|
455
|
+
return conditionalRunStep(step, `smoo github-ci nx-run-many --targets build --projects "${githubExpression('steps.version.outputs.projects')}" ${RELEASE_BUILD_ARGUMENT}`);
|
|
450
456
|
case PublishWorkflowStepKind.Lint:
|
|
451
457
|
return conditionalRunStep(step, `smoo github-ci nx-run-many --targets lint --projects "${githubExpression('steps.plan.outputs.projects')}"`);
|
|
452
458
|
case PublishWorkflowStepKind.UnitTests:
|
|
@@ -589,9 +595,9 @@ function renderSingleJobPublishWorkflowSteps(steps, options) {
|
|
|
589
595
|
lines.push(' - name: Check cross-platform toolchain prerequisites', ' working-directory: .', ' run: |', ' set -euo pipefail', ...producer.preflight.split('\n').map((line) => ` ${line}`), '');
|
|
590
596
|
}
|
|
591
597
|
if (step.kind === PublishWorkflowStepKind.Build) {
|
|
592
|
-
lines.push(' - name: 🐧 Build supplemental Linux targets', " if: steps.version.outputs.mode != 'none'", ` run: smoo github-ci nx-run-many --targets "${LINUX_PLATFORM_TARGET_GLOBS.join(',')}" --projects "${githubExpression('steps.version.outputs.projects')}"`, '');
|
|
598
|
+
lines.push(' - name: 🐧 Build supplemental Linux targets', " if: steps.version.outputs.mode != 'none'", ` run: smoo github-ci nx-run-many --targets "${LINUX_PLATFORM_TARGET_GLOBS.join(',')}" --projects "${githubExpression('steps.version.outputs.projects')}" ${RELEASE_BUILD_ARGUMENT}`, '');
|
|
593
599
|
if (crossOnThisRunner) {
|
|
594
|
-
lines.push(' - name: 🍎 Build selected macOS and iOS release outputs', " if: steps.version.outputs.mode != 'none'", ` run: smoo github-ci nx-run-many --targets "${macosPlatformFamilies(options).join(',')}" --projects "${githubExpression('steps.version.outputs.projects')}"`, '');
|
|
600
|
+
lines.push(' - name: 🍎 Build selected macOS and iOS release outputs', " if: steps.version.outputs.mode != 'none'", ` run: smoo github-ci nx-run-many --targets "${macosPlatformFamilies(options).join(',')}" --projects "${githubExpression('steps.version.outputs.projects')}" ${RELEASE_BUILD_ARGUMENT}`, '');
|
|
595
601
|
}
|
|
596
602
|
}
|
|
597
603
|
}
|
|
@@ -706,7 +712,7 @@ function renderLinuxReleaseCandidateSteps(steps, options) {
|
|
|
706
712
|
lines.push(` - name: ${step.name}`, ' uses: actions/checkout@v6.0.2', ' with:', ` ref: ${githubExpression('github.sha')}`, ' filter: blob:none', ' fetch-depth: 0');
|
|
707
713
|
}
|
|
708
714
|
else if (step.kind === PublishWorkflowStepKind.Build) {
|
|
709
|
-
lines.push(` - name: ${step.name}`, " if: steps.version.outputs.mode != 'none'", ' run:', ` smoo github-ci nx-run-many --targets build --projects "${githubExpression('steps.version.outputs.projects')}" --collect-outputs "${githubExpression('runner.temp')}/release-build-outputs"`);
|
|
715
|
+
lines.push(` - name: ${step.name}`, " if: steps.version.outputs.mode != 'none'", ' run:', ` smoo github-ci nx-run-many --targets build --projects "${githubExpression('steps.version.outputs.projects')}" ${RELEASE_BUILD_ARGUMENT} --collect-outputs "${githubExpression('runner.temp')}/release-build-outputs"`);
|
|
710
716
|
}
|
|
711
717
|
else {
|
|
712
718
|
lines.push(...yamlLinesForStep(step, options));
|
|
@@ -717,7 +723,7 @@ function renderLinuxReleaseCandidateSteps(steps, options) {
|
|
|
717
723
|
stepNumber += 1;
|
|
718
724
|
}
|
|
719
725
|
if (step.kind === PublishWorkflowStepKind.Build && hasLinuxPlatformTargets(options)) {
|
|
720
|
-
lines.push('', ` # Step ${stepNumber}`, ' - name: 🐧 Build supplemental Linux targets', " if: steps.version.outputs.mode != 'none'", ' run:', ` smoo github-ci nx-run-many --targets "${LINUX_PLATFORM_TARGET_GLOBS.join(',')}" --projects "${githubExpression('steps.version.outputs.projects')}" --collect-outputs "${githubExpression('runner.temp')}/linux-platform-outputs"`);
|
|
726
|
+
lines.push('', ` # Step ${stepNumber}`, ' - name: 🐧 Build supplemental Linux targets', " if: steps.version.outputs.mode != 'none'", ' run:', ` smoo github-ci nx-run-many --targets "${LINUX_PLATFORM_TARGET_GLOBS.join(',')}" --projects "${githubExpression('steps.version.outputs.projects')}" ${RELEASE_BUILD_ARGUMENT} --collect-outputs "${githubExpression('runner.temp')}/linux-platform-outputs"`);
|
|
721
727
|
stepNumber += 1;
|
|
722
728
|
}
|
|
723
729
|
lines.push('');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manifest-hash.d.ts","sourceRoot":"","sources":["../src/manifest-hash.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,IAAI,EAAE,MAAM,aAAa,CAAC;AAoEpD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,8BAA8B,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CA8CjF;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,6BAA6B,CAAC,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"manifest-hash.d.ts","sourceRoot":"","sources":["../src/manifest-hash.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,IAAI,EAAE,MAAM,aAAa,CAAC;AAoEpD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,8BAA8B,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CA8CjF;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,6BAA6B,CAAC,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAiB/G"}
|
package/dist/manifest-hash.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createHash } from 'node:crypto';
|
|
2
|
-
import {
|
|
3
|
-
import { join,
|
|
4
|
-
import {
|
|
2
|
+
import { readFile } from 'node:fs/promises';
|
|
3
|
+
import { join, posix } from 'node:path';
|
|
4
|
+
import { globWithWorkspaceContext } from 'nx/src/utils/workspace-context.js';
|
|
5
5
|
/**
|
|
6
6
|
* A release rewrites `version` in every manifest it publishes. Those manifests
|
|
7
7
|
* are inputs of the validation targets, so a publish run misses the cache for
|
|
@@ -145,41 +145,35 @@ export function updateVersionlessCrateManifest(hash, manifest) {
|
|
|
145
145
|
* answer: the dependency the digest describes really did change.
|
|
146
146
|
*/
|
|
147
147
|
export async function hashVersionlessCrateManifests(projectRoot, workspaceRoot) {
|
|
148
|
-
const
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
const manifests = await Promise.all(paths.map((path) => readFile(join(root, path))));
|
|
148
|
+
const manifests = await Promise.all((await listCrateManifests(projectRoot, workspaceRoot)).map(async (path) => ({
|
|
149
|
+
path,
|
|
150
|
+
bytes: await readFile(join(workspaceRoot, projectRoot, path)),
|
|
151
|
+
})));
|
|
153
152
|
const hash = createHash('sha256');
|
|
154
153
|
hash.update(DIGEST_TAG);
|
|
155
154
|
hash.update(SEPARATOR);
|
|
156
|
-
for (
|
|
157
|
-
hash.update(
|
|
155
|
+
for (const { path, bytes } of manifests) {
|
|
156
|
+
hash.update(path);
|
|
158
157
|
hash.update(SEPARATOR);
|
|
159
|
-
updateVersionlessCrateManifest(hash,
|
|
158
|
+
updateVersionlessCrateManifest(hash, bytes);
|
|
160
159
|
hash.update(SEPARATOR);
|
|
161
160
|
}
|
|
162
161
|
return hash.digest('hex');
|
|
163
162
|
}
|
|
164
|
-
/**
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
}
|
|
179
|
-
else if (entry.name === CARGO_MANIFEST) {
|
|
180
|
-
found.push(`${prefix}${entry.name}`);
|
|
181
|
-
}
|
|
182
|
-
}
|
|
163
|
+
/**
|
|
164
|
+
* Crate manifest paths relative to the project root, `/`-separated and sorted,
|
|
165
|
+
* so the digest is platform-independent. They come from Nx's own workspace
|
|
166
|
+
* file index — exactly the files the project's `Cargo.toml` exclusion removes
|
|
167
|
+
* from its filesets, with `.gitignore` applied — rather than from a walk of
|
|
168
|
+
* the tree: a walk reads ignored build output, which an Nx cache restore can
|
|
169
|
+
* delete while it is being read. No `catch`: a listing or read that fails
|
|
170
|
+
* would otherwise hash as a smaller manifest set, the silent staleness this
|
|
171
|
+
* module exists to avoid; the caller degrades to the raw manifests instead.
|
|
172
|
+
*/
|
|
173
|
+
async function listCrateManifests(projectRoot, workspaceRoot) {
|
|
174
|
+
const prefix = projectRoot === '.' ? '' : `${posix.normalize(projectRoot)}/`;
|
|
175
|
+
const files = await globWithWorkspaceContext(workspaceRoot, [`${prefix}**/${CARGO_MANIFEST}`]);
|
|
176
|
+
return files.map((file) => file.slice(prefix.length)).sort();
|
|
183
177
|
}
|
|
184
178
|
/** `from` is just past the `[`. */
|
|
185
179
|
function isOwnVersionTable(manifest, from, to) {
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The helper a per-crate runner calls before `nextest run`, as the root
|
|
3
|
+
* `node_modules` links it. Spelled through the package link rather than this
|
|
4
|
+
* file's real location: under an isolated install that location is a store
|
|
5
|
+
* path outside the workspace, which would differ per machine in a command Nx
|
|
6
|
+
* hashes.
|
|
7
|
+
*/
|
|
8
|
+
export declare const NEXTEST_EXTRACT_BIN = "node_modules/@smoothbricks/nx-plugin/dist/bin/smoo-nx-nextest-extract.js";
|
|
9
|
+
/**
|
|
10
|
+
* Where nextest puts things inside an extracted archive, relative to the
|
|
11
|
+
* extraction directory (nextest-runner's `reuse_build` constants). A run given
|
|
12
|
+
* these three paths reuses that build exactly as `--archive-file` would after
|
|
13
|
+
* unpacking it.
|
|
14
|
+
*/
|
|
15
|
+
export declare const EXTRACTED_TARGET_DIR = "target";
|
|
16
|
+
export declare const EXTRACTED_BINARIES_METADATA = "target/nextest/binaries-metadata.json";
|
|
17
|
+
export declare const EXTRACTED_CARGO_METADATA = "target/nextest/cargo-metadata.json";
|
|
18
|
+
/** Unpacks `archive` into the empty, existing directory `destination`. */
|
|
19
|
+
export type NextestArchiveExtractor = (archive: string, destination: string) => Promise<void>;
|
|
20
|
+
export type NextestExtraction = {
|
|
21
|
+
kind: 'reused';
|
|
22
|
+
key: string;
|
|
23
|
+
directory: string;
|
|
24
|
+
} | {
|
|
25
|
+
kind: 'extracted';
|
|
26
|
+
key: string;
|
|
27
|
+
directory: string;
|
|
28
|
+
elapsedMs: number;
|
|
29
|
+
} | {
|
|
30
|
+
kind: 'awaited';
|
|
31
|
+
key: string;
|
|
32
|
+
directory: string;
|
|
33
|
+
elapsedMs: number;
|
|
34
|
+
holder: string;
|
|
35
|
+
};
|
|
36
|
+
/** What a caller is told while it does not hold the extraction itself. */
|
|
37
|
+
export type NextestExtractionEvent = {
|
|
38
|
+
kind: 'waiting';
|
|
39
|
+
holder: string;
|
|
40
|
+
} | {
|
|
41
|
+
kind: 'stale-lock';
|
|
42
|
+
holder: string;
|
|
43
|
+
ageMs: number;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* How a lock proves its holder is alive: it rewrites the lock's mtime every
|
|
47
|
+
* `heartbeatMs`, and a lock older than `staleAfterMs` belongs to nobody. A pid
|
|
48
|
+
* cannot answer that — a holder SIGKILLed at its bound leaves a pid the system
|
|
49
|
+
* may already have handed to something else.
|
|
50
|
+
*/
|
|
51
|
+
export interface NextestExtractionTiming {
|
|
52
|
+
heartbeatMs: number;
|
|
53
|
+
staleAfterMs: number;
|
|
54
|
+
pollMs: number;
|
|
55
|
+
}
|
|
56
|
+
/** The SHA-256 of the archive's bytes: the only identity an extraction is ever looked up by. */
|
|
57
|
+
export declare function nextestArchiveKey(archive: string): Promise<string>;
|
|
58
|
+
/**
|
|
59
|
+
* One archive path's extractions live beside it, each under the hash of the
|
|
60
|
+
* bytes it came from; the lock and staging directories of a key carry that
|
|
61
|
+
* key as their prefix, so cleanup can tell them from another key's.
|
|
62
|
+
*/
|
|
63
|
+
export interface NextestExtractionPaths {
|
|
64
|
+
root: string;
|
|
65
|
+
directory: string;
|
|
66
|
+
lock: string;
|
|
67
|
+
stagingPrefix: string;
|
|
68
|
+
}
|
|
69
|
+
export declare function nextestExtractionPaths(archive: string, key: string): NextestExtractionPaths;
|
|
70
|
+
/**
|
|
71
|
+
* The directory holding `archive`'s extraction, extracting it first if no
|
|
72
|
+
* caller has yet.
|
|
73
|
+
*
|
|
74
|
+
* Correctness does not rest on the lock. An extraction lands under the hash of
|
|
75
|
+
* the bytes it came from by renaming a private staging directory into place,
|
|
76
|
+
* so a directory under a key is a complete extraction of exactly those bytes
|
|
77
|
+
* or it does not exist: concurrent extractors cannot corrupt it, the loser of
|
|
78
|
+
* a race discards its own copy, and an archive rewritten mid-extraction is
|
|
79
|
+
* caught by hashing it again before publishing. The lock only stops every
|
|
80
|
+
* runner of one Nx run from unpacking the same bytes side by side, which is the
|
|
81
|
+
* cost it exists to remove.
|
|
82
|
+
*
|
|
83
|
+
* Publishing a key removes every other key's extraction of this archive path,
|
|
84
|
+
* including stale locks and staging left by a holder that died. Leftovers of
|
|
85
|
+
* the CURRENT key are not touched: a holder that took over a stale lock may
|
|
86
|
+
* still be extracting into one.
|
|
87
|
+
*/
|
|
88
|
+
export declare function ensureNextestArchiveExtracted(archive: string, extract: NextestArchiveExtractor, onEvent: (event: NextestExtractionEvent) => void, timing?: NextestExtractionTiming): Promise<NextestExtraction>;
|
|
89
|
+
/**
|
|
90
|
+
* nextest's own extractor: `nextest list --list-type binaries-only` unpacks the
|
|
91
|
+
* archive and executes nothing from it.
|
|
92
|
+
*
|
|
93
|
+
* `list` loads nextest configuration after extracting, and a repository's
|
|
94
|
+
* `.config/nextest.toml` may name test groups only the plugin's tool config
|
|
95
|
+
* defines, so it is given an empty config of its own instead: unpacking bytes
|
|
96
|
+
* does not depend on how tests are scheduled. `--workspace-remap .` because
|
|
97
|
+
* nextest insists the workspace root exist, and the archive's own is the
|
|
98
|
+
* producing tree's path.
|
|
99
|
+
*/
|
|
100
|
+
export declare const extractWithNextest: NextestArchiveExtractor;
|
|
101
|
+
//# sourceMappingURL=nextest-extraction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nextest-extraction.d.ts","sourceRoot":"","sources":["../src/nextest-extraction.ts"],"names":[],"mappings":"AAQA;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,6EAA6E,CAAC;AAE9G;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,WAAW,CAAC;AAC7C,eAAO,MAAM,2BAA2B,0CAA0C,CAAC;AACnF,eAAO,MAAM,wBAAwB,uCAAuC,CAAC;AAE7E,0EAA0E;AAC1E,MAAM,MAAM,uBAAuB,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAE9F,MAAM,MAAM,iBAAiB,GACzB;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GAClD;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GACxE;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAE3F,0EAA0E;AAC1E,MAAM,MAAM,sBAAsB,GAC9B;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACnC;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAE1D;;;;;GAKG;AACH,MAAM,WAAW,uBAAuB;IACtC,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;CAChB;AAID,gGAAgG;AAChG,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAMxE;AAED;;;;GAIG;AACH,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,sBAAsB,CAQ3F;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,6BAA6B,CACjD,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,uBAAuB,EAChC,OAAO,EAAE,CAAC,KAAK,EAAE,sBAAsB,KAAK,IAAI,EAChD,MAAM,GAAE,uBAAwC,GAC/C,OAAO,CAAC,iBAAiB,CAAC,CAiD5B;AA4GD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,kBAAkB,EAAE,uBAiChC,CAAC"}
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
import { spawn } from 'node:child_process';
|
|
2
|
+
import { createHash, randomUUID } from 'node:crypto';
|
|
3
|
+
import { once } from 'node:events';
|
|
4
|
+
import { createReadStream } from 'node:fs';
|
|
5
|
+
import { mkdir, mkdtemp, open, readdir, readFile, rename, rm, stat, utimes, writeFile } from 'node:fs/promises';
|
|
6
|
+
import { join } from 'node:path';
|
|
7
|
+
import { setTimeout as sleep } from 'node:timers/promises';
|
|
8
|
+
/**
|
|
9
|
+
* The helper a per-crate runner calls before `nextest run`, as the root
|
|
10
|
+
* `node_modules` links it. Spelled through the package link rather than this
|
|
11
|
+
* file's real location: under an isolated install that location is a store
|
|
12
|
+
* path outside the workspace, which would differ per machine in a command Nx
|
|
13
|
+
* hashes.
|
|
14
|
+
*/
|
|
15
|
+
export const NEXTEST_EXTRACT_BIN = 'node_modules/@smoothbricks/nx-plugin/dist/bin/smoo-nx-nextest-extract.js';
|
|
16
|
+
/**
|
|
17
|
+
* Where nextest puts things inside an extracted archive, relative to the
|
|
18
|
+
* extraction directory (nextest-runner's `reuse_build` constants). A run given
|
|
19
|
+
* these three paths reuses that build exactly as `--archive-file` would after
|
|
20
|
+
* unpacking it.
|
|
21
|
+
*/
|
|
22
|
+
export const EXTRACTED_TARGET_DIR = 'target';
|
|
23
|
+
export const EXTRACTED_BINARIES_METADATA = 'target/nextest/binaries-metadata.json';
|
|
24
|
+
export const EXTRACTED_CARGO_METADATA = 'target/nextest/cargo-metadata.json';
|
|
25
|
+
const DEFAULT_TIMING = { heartbeatMs: 1_000, staleAfterMs: 10_000, pollMs: 100 };
|
|
26
|
+
/** The SHA-256 of the archive's bytes: the only identity an extraction is ever looked up by. */
|
|
27
|
+
export async function nextestArchiveKey(archive) {
|
|
28
|
+
const hash = createHash('sha256');
|
|
29
|
+
for await (const chunk of createReadStream(archive, { highWaterMark: 1 << 20 })) {
|
|
30
|
+
hash.update(chunk);
|
|
31
|
+
}
|
|
32
|
+
return hash.digest('hex');
|
|
33
|
+
}
|
|
34
|
+
export function nextestExtractionPaths(archive, key) {
|
|
35
|
+
const root = `${archive}.extracted`;
|
|
36
|
+
return {
|
|
37
|
+
root,
|
|
38
|
+
directory: join(root, key),
|
|
39
|
+
lock: join(root, `${key}.lock`),
|
|
40
|
+
stagingPrefix: join(root, `${key}.staging-`),
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* The directory holding `archive`'s extraction, extracting it first if no
|
|
45
|
+
* caller has yet.
|
|
46
|
+
*
|
|
47
|
+
* Correctness does not rest on the lock. An extraction lands under the hash of
|
|
48
|
+
* the bytes it came from by renaming a private staging directory into place,
|
|
49
|
+
* so a directory under a key is a complete extraction of exactly those bytes
|
|
50
|
+
* or it does not exist: concurrent extractors cannot corrupt it, the loser of
|
|
51
|
+
* a race discards its own copy, and an archive rewritten mid-extraction is
|
|
52
|
+
* caught by hashing it again before publishing. The lock only stops every
|
|
53
|
+
* runner of one Nx run from unpacking the same bytes side by side, which is the
|
|
54
|
+
* cost it exists to remove.
|
|
55
|
+
*
|
|
56
|
+
* Publishing a key removes every other key's extraction of this archive path,
|
|
57
|
+
* including stale locks and staging left by a holder that died. Leftovers of
|
|
58
|
+
* the CURRENT key are not touched: a holder that took over a stale lock may
|
|
59
|
+
* still be extracting into one.
|
|
60
|
+
*/
|
|
61
|
+
export async function ensureNextestArchiveExtracted(archive, extract, onEvent, timing = DEFAULT_TIMING) {
|
|
62
|
+
const started = performance.now();
|
|
63
|
+
const key = await nextestArchiveKey(archive);
|
|
64
|
+
const paths = nextestExtractionPaths(archive, key);
|
|
65
|
+
if (await isDirectory(paths.directory)) {
|
|
66
|
+
return { kind: 'reused', key, directory: paths.directory };
|
|
67
|
+
}
|
|
68
|
+
await mkdir(paths.root, { recursive: true });
|
|
69
|
+
let holder;
|
|
70
|
+
const settled = () => holder === undefined
|
|
71
|
+
? { kind: 'reused', key, directory: paths.directory }
|
|
72
|
+
: { kind: 'awaited', key, directory: paths.directory, elapsedMs: performance.now() - started, holder };
|
|
73
|
+
for (;;) {
|
|
74
|
+
const lock = await acquireLock(paths.lock, timing.heartbeatMs);
|
|
75
|
+
if (lock !== undefined) {
|
|
76
|
+
try {
|
|
77
|
+
if (await isDirectory(paths.directory)) {
|
|
78
|
+
return settled();
|
|
79
|
+
}
|
|
80
|
+
const published = await extractAndPublish(archive, key, paths, extract);
|
|
81
|
+
if (published) {
|
|
82
|
+
await removeOtherKeys(paths.root, key);
|
|
83
|
+
return { kind: 'extracted', key, directory: paths.directory, elapsedMs: performance.now() - started };
|
|
84
|
+
}
|
|
85
|
+
return settled();
|
|
86
|
+
}
|
|
87
|
+
finally {
|
|
88
|
+
await lock.release();
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
if (await isDirectory(paths.directory)) {
|
|
92
|
+
return settled();
|
|
93
|
+
}
|
|
94
|
+
const current = await readLock(paths.lock);
|
|
95
|
+
if (current === undefined) {
|
|
96
|
+
// Released between our attempt and this read: try again at once.
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
if (current.ageMs > timing.staleAfterMs) {
|
|
100
|
+
onEvent({ kind: 'stale-lock', holder: current.holder, ageMs: current.ageMs });
|
|
101
|
+
await rm(paths.lock, { force: true });
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
if (holder === undefined) {
|
|
105
|
+
holder = current.holder;
|
|
106
|
+
onEvent({ kind: 'waiting', holder });
|
|
107
|
+
}
|
|
108
|
+
await sleep(timing.pollMs);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Extract into a private staging directory and rename it to `paths.directory`.
|
|
113
|
+
* False when another extractor published the same key first, which leaves a
|
|
114
|
+
* complete extraction of the same bytes in place.
|
|
115
|
+
*/
|
|
116
|
+
async function extractAndPublish(archive, key, paths, extract) {
|
|
117
|
+
const staging = await mkdtemp(paths.stagingPrefix);
|
|
118
|
+
try {
|
|
119
|
+
await extract(archive, staging);
|
|
120
|
+
for (const file of [EXTRACTED_BINARIES_METADATA, EXTRACTED_CARGO_METADATA]) {
|
|
121
|
+
if (!(await statOrUndefined(join(staging, file)))?.isFile()) {
|
|
122
|
+
throw new Error(`extracting ${archive} produced no ${file}; a reuse run cannot read this layout`);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
const after = await nextestArchiveKey(archive);
|
|
126
|
+
if (after !== key) {
|
|
127
|
+
throw new Error(`${archive} changed while it was being extracted (sha256 ${key} before, ${after} after); ` +
|
|
128
|
+
'rerun once whatever is rewriting it has finished');
|
|
129
|
+
}
|
|
130
|
+
await rename(staging, paths.directory);
|
|
131
|
+
return true;
|
|
132
|
+
}
|
|
133
|
+
catch (error) {
|
|
134
|
+
await rm(staging, { recursive: true, force: true });
|
|
135
|
+
const code = errorCode(error);
|
|
136
|
+
if ((code === 'ENOTEMPTY' || code === 'EEXIST') && (await isDirectory(paths.directory))) {
|
|
137
|
+
return false;
|
|
138
|
+
}
|
|
139
|
+
throw error;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
async function removeOtherKeys(root, key) {
|
|
143
|
+
for (const entry of await readdir(root)) {
|
|
144
|
+
if (entry !== key && !entry.startsWith(`${key}.`)) {
|
|
145
|
+
await rm(join(root, entry), { recursive: true, force: true });
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
/** Create the lock exclusively, or report it held. A held lock is refreshed until released. */
|
|
150
|
+
async function acquireLock(path, heartbeatMs) {
|
|
151
|
+
const token = `${process.pid} ${randomUUID()}`;
|
|
152
|
+
try {
|
|
153
|
+
await writeFile(path, `${token}\n`, { flag: 'wx' });
|
|
154
|
+
}
|
|
155
|
+
catch (error) {
|
|
156
|
+
if (errorCode(error) === 'EEXIST') {
|
|
157
|
+
return undefined;
|
|
158
|
+
}
|
|
159
|
+
throw error;
|
|
160
|
+
}
|
|
161
|
+
const heartbeat = setInterval(() => {
|
|
162
|
+
const now = new Date();
|
|
163
|
+
// ENOENT: a waiter judged this lock stale and removed it. The extraction
|
|
164
|
+
// carries on; publishing is atomic whoever else extracts beside it.
|
|
165
|
+
utimes(path, now, now).catch((error) => {
|
|
166
|
+
if (errorCode(error) !== 'ENOENT')
|
|
167
|
+
throw error;
|
|
168
|
+
});
|
|
169
|
+
}, heartbeatMs);
|
|
170
|
+
return {
|
|
171
|
+
async release() {
|
|
172
|
+
clearInterval(heartbeat);
|
|
173
|
+
// Remove it only while it is still ours: a waiter that took it over owns it now.
|
|
174
|
+
const content = await readFile(path, 'utf8').catch((error) => {
|
|
175
|
+
if (errorCode(error) === 'ENOENT')
|
|
176
|
+
return undefined;
|
|
177
|
+
throw error;
|
|
178
|
+
});
|
|
179
|
+
if (content?.trim() === token) {
|
|
180
|
+
await rm(path, { force: true });
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
async function readLock(path) {
|
|
186
|
+
try {
|
|
187
|
+
const handle = await open(path, 'r');
|
|
188
|
+
try {
|
|
189
|
+
const [content, metadata] = await Promise.all([handle.readFile('utf8'), handle.stat()]);
|
|
190
|
+
const pid = content.trim().split(' ')[0];
|
|
191
|
+
return {
|
|
192
|
+
// Empty while its creator is between creating and writing it.
|
|
193
|
+
holder: pid === undefined || pid.length === 0 ? 'a process that has not yet named itself' : `pid ${pid}`,
|
|
194
|
+
ageMs: Date.now() - metadata.mtimeMs,
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
finally {
|
|
198
|
+
await handle.close();
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
catch (error) {
|
|
202
|
+
if (errorCode(error) === 'ENOENT') {
|
|
203
|
+
return undefined;
|
|
204
|
+
}
|
|
205
|
+
throw error;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* nextest's own extractor: `nextest list --list-type binaries-only` unpacks the
|
|
210
|
+
* archive and executes nothing from it.
|
|
211
|
+
*
|
|
212
|
+
* `list` loads nextest configuration after extracting, and a repository's
|
|
213
|
+
* `.config/nextest.toml` may name test groups only the plugin's tool config
|
|
214
|
+
* defines, so it is given an empty config of its own instead: unpacking bytes
|
|
215
|
+
* does not depend on how tests are scheduled. `--workspace-remap .` because
|
|
216
|
+
* nextest insists the workspace root exist, and the archive's own is the
|
|
217
|
+
* producing tree's path.
|
|
218
|
+
*/
|
|
219
|
+
export const extractWithNextest = async (archive, destination) => {
|
|
220
|
+
const config = join(destination, 'nextest-extract.toml');
|
|
221
|
+
await writeFile(config, '');
|
|
222
|
+
try {
|
|
223
|
+
const args = [
|
|
224
|
+
'--frozen',
|
|
225
|
+
'nextest',
|
|
226
|
+
'list',
|
|
227
|
+
'--archive-file',
|
|
228
|
+
archive,
|
|
229
|
+
'--extract-to',
|
|
230
|
+
destination,
|
|
231
|
+
'--workspace-remap',
|
|
232
|
+
'.',
|
|
233
|
+
'--list-type',
|
|
234
|
+
'binaries-only',
|
|
235
|
+
'--user-config-file',
|
|
236
|
+
'none',
|
|
237
|
+
'--config-file',
|
|
238
|
+
config,
|
|
239
|
+
];
|
|
240
|
+
// The binary list on stdout is not wanted; nextest's progress and errors are on stderr.
|
|
241
|
+
const child = spawn('cargo', args, { stdio: ['ignore', 'ignore', 'inherit'] });
|
|
242
|
+
// Rejects with the spawn error when cargo cannot be started at all.
|
|
243
|
+
const [code, signal] = await once(child, 'exit');
|
|
244
|
+
if (code !== 0) {
|
|
245
|
+
throw new Error(`cargo ${args.join(' ')} ${code === null ? `died of ${String(signal)}` : `exited with status ${String(code)}`}`);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
finally {
|
|
249
|
+
await rm(config, { force: true });
|
|
250
|
+
}
|
|
251
|
+
};
|
|
252
|
+
async function isDirectory(path) {
|
|
253
|
+
return (await statOrUndefined(path))?.isDirectory() ?? false;
|
|
254
|
+
}
|
|
255
|
+
async function statOrUndefined(path) {
|
|
256
|
+
try {
|
|
257
|
+
return await stat(path);
|
|
258
|
+
}
|
|
259
|
+
catch (error) {
|
|
260
|
+
if (errorCode(error) === 'ENOENT') {
|
|
261
|
+
return undefined;
|
|
262
|
+
}
|
|
263
|
+
throw error;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
function errorCode(error) {
|
|
267
|
+
return error instanceof Error && 'code' in error ? error.code : undefined;
|
|
268
|
+
}
|
|
@@ -236,7 +236,7 @@ function isRedundantBuildDeclaration(build, resolvedTargets) {
|
|
|
236
236
|
* Deliberately NOT decided against the resolved project graph. Nx replaces a
|
|
237
237
|
* named property of an inferred target with the declared one, so the resolved
|
|
238
238
|
* `build.dependsOn` IS the declaration: comparing them answered "redundant"
|
|
239
|
-
* for every noop aggregate anyone ever wrote.
|
|
239
|
+
* for every noop aggregate anyone ever wrote. A downstream runtime host lost seven
|
|
240
240
|
* edges that way — four of them targets no inference can reach — and a clean
|
|
241
241
|
* checkout then built it without its producers. The question this has to
|
|
242
242
|
* answer is what inference yields WITHOUT the declaration, so the test is
|
|
@@ -2,4 +2,11 @@
|
|
|
2
2
|
export declare const MACOS_PLATFORM_TARGET_GLOBS: readonly ['*-macos', '*-ios'];
|
|
3
3
|
export declare const LINUX_PLATFORM_TARGET_GLOBS: readonly ['*-linux'];
|
|
4
4
|
export declare const PLATFORM_TARGET_GLOBS: readonly ["*-macos", "*-ios", "*-linux"];
|
|
5
|
+
/**
|
|
6
|
+
* The Nx configuration that builds what ships. A cargo build target's default
|
|
7
|
+
* options compile cargo's `dev` profile, which every local build, test and
|
|
8
|
+
* gate shares; this configuration adds `--release`. Only release tooling
|
|
9
|
+
* selects it, so a shipped artifact is the only thing compiled twice.
|
|
10
|
+
*/
|
|
11
|
+
export declare const RELEASE_CONFIGURATION = "production";
|
|
5
12
|
//# sourceMappingURL=platform-targets.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platform-targets.d.ts","sourceRoot":"","sources":["../src/platform-targets.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F,eAAO,MAAM,2BAA2B,YAAI,SAAS,EAAE,OAAO,CAAU,CAAC;AACzE,eAAO,MAAM,2BAA2B,YAAI,SAAS,CAAU,CAAC;AAChE,eAAO,MAAM,qBAAqB,0CAA4E,CAAC"}
|
|
1
|
+
{"version":3,"file":"platform-targets.d.ts","sourceRoot":"","sources":["../src/platform-targets.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F,eAAO,MAAM,2BAA2B,YAAI,SAAS,EAAE,OAAO,CAAU,CAAC;AACzE,eAAO,MAAM,2BAA2B,YAAI,SAAS,CAAU,CAAC;AAChE,eAAO,MAAM,qBAAqB,0CAA4E,CAAC;AAE/G;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,eAAe,CAAC"}
|
package/dist/platform-targets.js
CHANGED
|
@@ -2,3 +2,10 @@
|
|
|
2
2
|
export const MACOS_PLATFORM_TARGET_GLOBS = ['*-macos', '*-ios'];
|
|
3
3
|
export const LINUX_PLATFORM_TARGET_GLOBS = ['*-linux'];
|
|
4
4
|
export const PLATFORM_TARGET_GLOBS = [...MACOS_PLATFORM_TARGET_GLOBS, ...LINUX_PLATFORM_TARGET_GLOBS];
|
|
5
|
+
/**
|
|
6
|
+
* The Nx configuration that builds what ships. A cargo build target's default
|
|
7
|
+
* options compile cargo's `dev` profile, which every local build, test and
|
|
8
|
+
* gate shares; this configuration adds `--release`. Only release tooling
|
|
9
|
+
* selects it, so a shipped artifact is the only thing compiled twice.
|
|
10
|
+
*/
|
|
11
|
+
export const RELEASE_CONFIGURATION = 'production';
|
|
@@ -5,7 +5,7 @@ export interface NxPolicyIssue {
|
|
|
5
5
|
message: string;
|
|
6
6
|
}
|
|
7
7
|
export declare const BUILD_OUTPUT_DEPENDENCIES: readonly ['*-js', '*-web', '*-html', '*-css', '*-android', '*-native', '*-napi', '*-bun', '*-wasm'];
|
|
8
|
-
export { LINUX_PLATFORM_TARGET_GLOBS, MACOS_PLATFORM_TARGET_GLOBS, PLATFORM_TARGET_GLOBS } from './platform-targets.js';
|
|
8
|
+
export { LINUX_PLATFORM_TARGET_GLOBS, MACOS_PLATFORM_TARGET_GLOBS, PLATFORM_TARGET_GLOBS, RELEASE_CONFIGURATION, } from './platform-targets.js';
|
|
9
9
|
/**
|
|
10
10
|
* The glob list above, spelled as a target name: a target whose name ends in a
|
|
11
11
|
* reserved family suffix EMITS that kind of artifact. Inference collects
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace-config-policy.d.ts","sourceRoot":"","sources":["../src/workspace-config-policy.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAKrD,eAAO,MAAM,4BAA4B,0CAA0C,CAAC;AAEpF,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,yBAAyB,YACpC,MAAM,EACN,OAAO,EACP,QAAQ,EACR,OAAO,EACP,WAAW,EACX,UAAU,EACV,QAAQ,EACR,OAAO,EACP,QAAQ,CACA,CAAC;AAEX,OAAO,
|
|
1
|
+
{"version":3,"file":"workspace-config-policy.d.ts","sourceRoot":"","sources":["../src/workspace-config-policy.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAKrD,eAAO,MAAM,4BAA4B,0CAA0C,CAAC;AAEpF,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,yBAAyB,YACpC,MAAM,EACN,OAAO,EACP,QAAQ,EACR,OAAO,EACP,WAAW,EACX,UAAU,EACV,QAAQ,EACR,OAAO,EACP,QAAQ,CACA,CAAC;AAEX,OAAO,EACL,2BAA2B,EAC3B,2BAA2B,EAC3B,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,uBAAuB,CAAC;AAI/B;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE7D;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAI5D;AAgBD;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,aAAa,EAAE,CA4DrF;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAqB7E;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,IAAI,GAAG,aAAa,EAAE,CAKpE;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAU5D;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,EAAE,CAYxE;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAWhE"}
|
|
@@ -14,7 +14,7 @@ export const BUILD_OUTPUT_DEPENDENCIES = [
|
|
|
14
14
|
'*-bun',
|
|
15
15
|
'*-wasm',
|
|
16
16
|
];
|
|
17
|
-
export { LINUX_PLATFORM_TARGET_GLOBS, MACOS_PLATFORM_TARGET_GLOBS, PLATFORM_TARGET_GLOBS } from './platform-targets.js';
|
|
17
|
+
export { LINUX_PLATFORM_TARGET_GLOBS, MACOS_PLATFORM_TARGET_GLOBS, PLATFORM_TARGET_GLOBS, RELEASE_CONFIGURATION, } from './platform-targets.js';
|
|
18
18
|
const buildOutputTargetSuffixes = BUILD_OUTPUT_DEPENDENCIES.map((glob) => glob.slice(1));
|
|
19
19
|
/**
|
|
20
20
|
* The glob list above, spelled as a target name: a target whose name ends in a
|
package/managed/raw/envrc
CHANGED
|
@@ -11,10 +11,47 @@ esac
|
|
|
11
11
|
|
|
12
12
|
watch_file tooling/direnv/envrc.sh
|
|
13
13
|
|
|
14
|
+
# devenv asks the Cachix API for the signing key of each binary cache it pulls
|
|
15
|
+
# from (`cachix.pull`, `devenv` by default) unless cachix_trusted_keys.json in
|
|
16
|
+
# its home already records it. A cowshed sandbox gives every workspace a private
|
|
17
|
+
# data home and no route to that API (devenv's TLS client rejects the gateway's
|
|
18
|
+
# certificate), so each activation there asked again and was refused. The key is
|
|
19
|
+
# public and fixed, so it is recorded before devenv starts; an existing file is
|
|
20
|
+
# devenv's and stays as it is.
|
|
21
|
+
devenv_keys="${DEVENV_HOME:-${XDG_DATA_HOME:-$HOME/.local/share}/devenv}/cachix_trusted_keys.json"
|
|
22
|
+
if [ ! -e "$devenv_keys" ]; then
|
|
23
|
+
mkdir -p "$(dirname "$devenv_keys")"
|
|
24
|
+
printf '{\n "devenv": "devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw="\n}\n' >"$devenv_keys.$$"
|
|
25
|
+
mv -f "$devenv_keys.$$" "$devenv_keys"
|
|
26
|
+
fi
|
|
27
|
+
unset devenv_keys
|
|
28
|
+
|
|
14
29
|
# Load local extensions and overrides from the project root (the gitignored
|
|
15
30
|
# .envrc-local); capture it before we cd into tooling/direnv, since envrc.sh
|
|
16
31
|
# leaves us there and a bare relative path would resolve under tooling/direnv.
|
|
17
|
-
|
|
32
|
+
project_root="$PWD"
|
|
33
|
+
local_override="$project_root/.envrc-local"
|
|
18
34
|
cd tooling/direnv
|
|
19
35
|
. envrc.sh
|
|
36
|
+
|
|
37
|
+
# Re-enter exactly when shell entry has something to do. The scripts it runs
|
|
38
|
+
# decide what that is, and setup-environment.ts records the files its install
|
|
39
|
+
# stamps cover — lockfiles, every workspace manifest, bunfig.toml, patches,
|
|
40
|
+
# every pyproject.toml — one per line in $DEVENV_STATE/install-inputs. A shell
|
|
41
|
+
# direnv keeps loaded, or a pool of them gated on direnv's watches, then
|
|
42
|
+
# reinstalls after a pull or a manifest edit and stays put otherwise.
|
|
43
|
+
install_inputs=()
|
|
44
|
+
if [ -f "${DEVENV_STATE:-}/install-inputs" ]; then
|
|
45
|
+
while IFS= read -r install_input; do
|
|
46
|
+
install_inputs+=("$install_input")
|
|
47
|
+
done <"$DEVENV_STATE/install-inputs"
|
|
48
|
+
fi
|
|
49
|
+
watch_file \
|
|
50
|
+
"$project_root/tooling/direnv/repo-path" \
|
|
51
|
+
"$project_root/tooling/direnv/shared-caches.sh" \
|
|
52
|
+
"$project_root/tooling/direnv/setup-environment.ts" \
|
|
53
|
+
"$project_root/tooling/direnv/secret-references.ts" \
|
|
54
|
+
"$project_root/tooling/direnv/toolchain-stamp.ts" \
|
|
55
|
+
${install_inputs[@]+"${install_inputs[@]}"}
|
|
56
|
+
|
|
20
57
|
source_env_if_exists "$local_override"
|