@smoothbricks/nx-plugin 0.6.2 → 0.6.3-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +281 -73
- package/dist/.build-inputs.json +20 -14
- package/dist/bin/smoo-nx-publish.d.ts +3 -0
- package/dist/bin/smoo-nx-publish.d.ts.map +1 -0
- package/dist/bin/smoo-nx-publish.js +3 -0
- package/dist/cargo-retention-hook.d.ts +6 -2
- package/dist/cargo-retention-hook.d.ts.map +1 -1
- package/dist/cargo-retention-hook.js +13 -7
- package/dist/eslint-file-set.d.ts +4 -1
- package/dist/eslint-file-set.d.ts.map +1 -1
- package/dist/eslint-sources.d.ts +25 -0
- package/dist/eslint-sources.d.ts.map +1 -0
- package/dist/eslint-sources.js +99 -0
- package/dist/executors/all-verdicts/executor.d.ts +2 -1
- package/dist/executors/all-verdicts/executor.d.ts.map +1 -1
- package/dist/executors/all-verdicts/executor.js +48 -2
- package/dist/executors/all-verdicts/schema.d.ts +13 -0
- package/dist/executors/all-verdicts/schema.d.ts.map +1 -1
- package/dist/executors/all-verdicts/schema.js +7 -0
- package/dist/executors/bounded-exec/bounds.d.ts +57 -8
- package/dist/executors/bounded-exec/bounds.d.ts.map +1 -1
- package/dist/executors/bounded-exec/bounds.js +100 -11
- package/dist/executors/bounded-exec/executor.d.ts +2 -1
- package/dist/executors/bounded-exec/executor.d.ts.map +1 -1
- package/dist/executors/bounded-exec/executor.js +270 -27
- package/dist/executors/bounded-exec/hang-diagnostics.d.ts +2 -0
- package/dist/executors/bounded-exec/hang-diagnostics.d.ts.map +1 -1
- package/dist/executors/bounded-exec/hang-diagnostics.js +2 -2
- package/dist/executors/bounded-exec/mbx-pool.d.ts +20 -3
- package/dist/executors/bounded-exec/mbx-pool.d.ts.map +1 -1
- package/dist/executors/bounded-exec/mbx-pool.js +84 -4
- package/dist/executors/bounded-exec/mbx-queue.d.ts +30 -0
- package/dist/executors/bounded-exec/mbx-queue.d.ts.map +1 -0
- package/dist/executors/bounded-exec/mbx-queue.js +229 -0
- package/dist/executors/bounded-exec/progress.d.ts +9 -2
- package/dist/executors/bounded-exec/progress.d.ts.map +1 -1
- package/dist/executors/bounded-exec/progress.js +148 -22
- package/dist/executors/bounded-exec/test-result-writer.d.ts +30 -0
- package/dist/executors/bounded-exec/test-result-writer.d.ts.map +1 -0
- package/dist/executors/bounded-exec/test-result-writer.js +126 -0
- package/dist/executors/bounded-exec/test-results.d.ts +33 -0
- package/dist/executors/bounded-exec/test-results.d.ts.map +1 -0
- package/dist/executors/bounded-exec/test-results.js +33 -0
- package/dist/executors/bounded-exec/verdict.d.ts +20 -2
- package/dist/executors/bounded-exec/verdict.d.ts.map +1 -1
- package/dist/executors/bounded-exec/verdict.js +102 -4
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +67 -65
- package/dist/nx-publish.d.ts +24 -0
- package/dist/nx-publish.d.ts.map +1 -0
- package/dist/nx-publish.js +150 -0
- package/dist/runtime-input-policy.d.ts +14 -0
- package/dist/runtime-input-policy.d.ts.map +1 -1
- package/dist/runtime-input-policy.js +1 -1
- package/dist/tool-bins.d.ts +6 -8
- package/dist/tool-bins.d.ts.map +1 -1
- package/dist/tool-bins.js +7 -5
- package/dist/workspace-index.d.ts +7 -0
- package/dist/workspace-index.d.ts.map +1 -1
- package/dist/workspace-index.js +11 -0
- package/executors.json +1 -1
- package/managed/raw/patches/ttsc@0.34.1.patch +75 -0
- package/managed/raw/tooling/devenv +1 -2
- package/managed/raw/tooling/direnv/developer-links.ts +3 -0
- package/managed/raw/tooling/direnv/devenv.smoo.nix +34 -15
- package/managed/raw/tooling/direnv/github-actions-bootstrap.sh +20 -10
- package/managed/raw/tooling/direnv/setup-environment.ts +35 -20
- package/managed/raw/tooling/direnv/ttsc-env.sh +8 -6
- package/managed/templates/github/actions/cache-node-modules/action.yml +1 -1
- package/managed/templates/github/actions/cache-ttsc-plugins/action.yml +12 -11
- package/package.json +223 -7
- package/runtime/nx-publish/cache_adapter.js +45 -0
- package/runtime/nx-publish/nx_publish.js +60 -0
- package/runtime-input.sh +12 -3
- package/src/bin/smoo-nx-publish.ts +4 -0
- package/src/cargo-retention-hook.ts +16 -10
- package/src/eslint-file-set.ts +4 -1
- package/src/eslint-sources.ts +134 -0
- package/src/executors/all-verdicts/executor.ts +58 -3
- package/src/executors/all-verdicts/schema.json +4 -0
- package/src/executors/all-verdicts/schema.ts +14 -0
- package/src/executors/bounded-exec/bounds.ts +132 -15
- package/src/executors/bounded-exec/executor.ts +303 -27
- package/src/executors/bounded-exec/hang-diagnostics.ts +3 -2
- package/src/executors/bounded-exec/mbx-pool.ts +82 -5
- package/src/executors/bounded-exec/mbx-queue.ts +170 -0
- package/src/executors/bounded-exec/progress.ts +168 -15
- package/src/executors/bounded-exec/test-result-writer.ts +152 -0
- package/src/executors/bounded-exec/test-results.ts +39 -0
- package/src/executors/bounded-exec/verdict.ts +108 -5
- package/src/index.ts +74 -70
- package/src/nx-publish.ts +157 -0
- package/src/runtime-input-policy.ts +1 -1
- package/src/tool-bins.ts +13 -9
- package/src/workspace-index.ts +12 -0
- package/test-timings.json +8 -3
package/dist/tool-bins.d.ts
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import type { TargetConfiguration } from 'nx/src/devkit-exports.js';
|
|
2
|
-
/** The tool packages whose
|
|
3
|
-
declare const NATIVE_TOOL_PACKAGES: readonly ['build-inputs', 'cargo-retain', 'nextest-extract'];
|
|
2
|
+
/** The tool packages whose native artifacts inferred commands consume. */
|
|
3
|
+
declare const NATIVE_TOOL_PACKAGES: readonly ['build-inputs', 'cargo-retain', 'nextest-extract', 'cowshed'];
|
|
4
4
|
export type NativeToolPackage = (typeof NATIVE_TOOL_PACKAGES)[number];
|
|
5
5
|
type TargetDependency = NonNullable<TargetConfiguration['dependsOn']>[number];
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* that is a project of the workspace being inferred (a checkout of the repository that builds it) has only what its
|
|
10
|
-
* `scriptc-<arch>-<family>` target last wrote, so a command running it depends on that target.
|
|
7
|
+
* Native tools as the inferring host consumes them. Installed packages already ship their artifacts; a workspace
|
|
8
|
+
* package needs its declared producer. Scriptc tools use the host platform target, cowshed its napi-native addon.
|
|
11
9
|
*/
|
|
12
10
|
export interface NativeTools {
|
|
13
11
|
/** The host's directory under a tool package's `dist/bin`. */
|
|
@@ -27,7 +25,7 @@ export declare function resolveNativeTools(workspaceRoot: string, projectManifes
|
|
|
27
25
|
* where no tool package carries an executable to run.
|
|
28
26
|
*/
|
|
29
27
|
export declare function nativeToolCommand(tools: Pick<NativeTools, 'platform'> | null, cwd: string, tool: NativeToolPackage, bin: string): string;
|
|
30
|
-
/** The task
|
|
31
|
-
export declare function nativeToolDependsOn(tools: NativeTools | null, tool: NativeToolPackage): TargetDependency[];
|
|
28
|
+
/** The task producing a tool artifact, only when this workspace owns its package. */
|
|
29
|
+
export declare function nativeToolDependsOn(tools: NativeTools | null, tool: NativeToolPackage, target?: string): TargetDependency[];
|
|
32
30
|
export {};
|
|
33
31
|
//# sourceMappingURL=tool-bins.d.ts.map
|
package/dist/tool-bins.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-bins.d.ts","sourceRoot":"","sources":["../src/tool-bins.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAsBpE,
|
|
1
|
+
{"version":3,"file":"tool-bins.d.ts","sourceRoot":"","sources":["../src/tool-bins.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAsBpE,0EAA0E;AAC1E,QAAA,MAAM,oBAAoB,YAAI,cAAc,EAAE,cAAc,EAAE,iBAAiB,EAAE,SAAS,CAAU,CAAC;AAErG,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEtE,KAAK,gBAAgB,GAAG,WAAW,CAAC,mBAAmB,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;AAE9E;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,8DAA8D;IAC9D,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,6EAA6E;IAC7E,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,kFAAkF;IAClF,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC;CAC3D;AAED;;;GAGG;AACH,wBAAsB,kBAAkB,CACtC,aAAa,EAAE,MAAM,EACrB,gBAAgB,EAAE,SAAS,MAAM,EAAE,EACnC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,WAAW,CAAC,CAmBtB;AAUD;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,GAAG,IAAI,EAC3C,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,iBAAiB,EACvB,GAAG,EAAE,MAAM,GACV,MAAM,CAOR;AAED,qFAAqF;AACrF,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,WAAW,GAAG,IAAI,EACzB,IAAI,EAAE,iBAAiB,EACvB,MAAM,CAAC,EAAE,MAAM,GACd,gBAAgB,EAAE,CAKpB"}
|
package/dist/tool-bins.js
CHANGED
|
@@ -18,8 +18,8 @@ const PLUGIN_LINK = 'node_modules/@smoothbricks/nx-plugin';
|
|
|
18
18
|
function toolCommand(cwd, tool, file) {
|
|
19
19
|
return `${posix.join(posix.relative(cwd, '.'), PLUGIN_LINK)}/../${tool}/${file}`;
|
|
20
20
|
}
|
|
21
|
-
/** The tool packages whose
|
|
22
|
-
const NATIVE_TOOL_PACKAGES = ['build-inputs', 'cargo-retain', 'nextest-extract'];
|
|
21
|
+
/** The tool packages whose native artifacts inferred commands consume. */
|
|
22
|
+
const NATIVE_TOOL_PACKAGES = ['build-inputs', 'cargo-retain', 'nextest-extract', 'cowshed'];
|
|
23
23
|
/**
|
|
24
24
|
* The tools of the workspace at `workspaceRoot`, whose project manifests are `projectManifests` (workspace-relative):
|
|
25
25
|
* a tool package is a project when the plugin's link resolves beside one of them.
|
|
@@ -65,8 +65,10 @@ export function nativeToolCommand(tools, cwd, tool, bin) {
|
|
|
65
65
|
}
|
|
66
66
|
return toolCommand(cwd, tool, `dist/bin/${tools.platform}/${bin}`);
|
|
67
67
|
}
|
|
68
|
-
/** The task
|
|
69
|
-
export function nativeToolDependsOn(tools, tool) {
|
|
68
|
+
/** The task producing a tool artifact, only when this workspace owns its package. */
|
|
69
|
+
export function nativeToolDependsOn(tools, tool, target) {
|
|
70
70
|
const project = tools?.projects.get(tool);
|
|
71
|
-
return project === undefined || tools === null
|
|
71
|
+
return project === undefined || tools === null
|
|
72
|
+
? []
|
|
73
|
+
: [{ projects: [project], target: target ?? (tool === 'cowshed' ? 'napi-native' : tools.target) }];
|
|
72
74
|
}
|
|
@@ -9,4 +9,11 @@
|
|
|
9
9
|
* test fixture or a foreign checkout, is indexed by this process's context.
|
|
10
10
|
*/
|
|
11
11
|
export declare function globIndexedFiles(workspaceRoot: string, globs: string[]): Promise<string[]>;
|
|
12
|
+
/**
|
|
13
|
+
* Like {@link globIndexedFiles}, read from the filesystem now: a new native context, the same walk and the same ignore
|
|
14
|
+
* rules, never the table of this process or of the daemon. A table only learns of a write when a watcher event reaches
|
|
15
|
+
* it, so one the watcher missed leaves a deleted file listed and an added one unlisted until that process ends. What
|
|
16
|
+
* runs on the files as they are asks here; what describes a graph asks {@link globIndexedFiles}.
|
|
17
|
+
*/
|
|
18
|
+
export declare function freshIndexedFiles(workspaceRoot: string, globs: string[]): string[];
|
|
12
19
|
//# sourceMappingURL=workspace-index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace-index.d.ts","sourceRoot":"","sources":["../src/workspace-index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"workspace-index.d.ts","sourceRoot":"","sources":["../src/workspace-index.ts"],"names":[],"mappings":"AAKA;;;;;;;;;GASG;AACH,wBAAsB,gBAAgB,CAAC,aAAa,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAIhG;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,aAAa,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAElF"}
|
package/dist/workspace-index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import native from 'nx/src/native/index.js';
|
|
2
|
+
import { workspaceDataDirectoryForWorkspace } from 'nx/src/utils/cache-directory.js';
|
|
1
3
|
import { globWithWorkspaceContext, globWithWorkspaceContextSync } from 'nx/src/utils/workspace-context.js';
|
|
2
4
|
import { workspaceRoot as daemonWorkspaceRoot } from 'nx/src/utils/workspace-root.js';
|
|
3
5
|
/**
|
|
@@ -15,3 +17,12 @@ export async function globIndexedFiles(workspaceRoot, globs) {
|
|
|
15
17
|
? globWithWorkspaceContext(workspaceRoot, globs)
|
|
16
18
|
: globWithWorkspaceContextSync(workspaceRoot, globs);
|
|
17
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* Like {@link globIndexedFiles}, read from the filesystem now: a new native context, the same walk and the same ignore
|
|
22
|
+
* rules, never the table of this process or of the daemon. A table only learns of a write when a watcher event reaches
|
|
23
|
+
* it, so one the watcher missed leaves a deleted file listed and an added one unlisted until that process ends. What
|
|
24
|
+
* runs on the files as they are asks here; what describes a graph asks {@link globIndexedFiles}.
|
|
25
|
+
*/
|
|
26
|
+
export function freshIndexedFiles(workspaceRoot, globs) {
|
|
27
|
+
return new native.WorkspaceContext(workspaceRoot, workspaceDataDirectoryForWorkspace(workspaceRoot)).glob(globs);
|
|
28
|
+
}
|
package/executors.json
CHANGED
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"all-verdicts": {
|
|
44
44
|
"implementation": "./dist/executors/all-verdicts/executor.js",
|
|
45
45
|
"schema": "./src/executors/all-verdicts/schema.json",
|
|
46
|
-
"description": "Run every command at once to its own verdict and report each one a signal ended or that never ran as UNJUDGED"
|
|
46
|
+
"description": "Run every command at once to its own verdict and report each one a signal ended or that never ran as UNJUDGED; resolve an ESLint sources placeholder against the files that exist when the command runs"
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
}
|
|
@@ -90,6 +90,29 @@ index f6ee81fb1af41deea022b92e838a7c4665eb9778..112faf913ce38b1f4624b38db3783937
|
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
// forceNoEmit sets noEmit so the program type-checks without writing files.
|
|
93
|
+
diff --git a/lib/internal/javascriptRuntimeCapabilities.js b/lib/internal/javascriptRuntimeCapabilities.js
|
|
94
|
+
--- a/lib/internal/javascriptRuntimeCapabilities.js
|
|
95
|
+
+++ b/lib/internal/javascriptRuntimeCapabilities.js
|
|
96
|
+
@@ -43,6 +43,19 @@
|
|
97
|
+
* @evidence contracts/performance.md#bound-retention-and-release-resources The synchronous probe owns child completion and fallback captures; finally attempts capture close/removal, whose helper suppresses cleanup failures, so native/file release is unconfirmed on failure. Capability entries retain absolute spellings and path/identity text with no eviction quota; failed identity validation can remove an entry. Returned capability copies transfer to callers.
|
|
98
|
+
*/
|
|
99
|
+
function javascriptRuntimeCapabilities(runtime, env, cwd, identities) {
|
|
100
|
+
+ // The running process answers for itself. Under Bun, process.execPath names
|
|
101
|
+
+ // Bun (pluginDescriptorRuntimeBinary), and a probe of it can fail for reasons
|
|
102
|
+
+ // that say nothing about the executable: its 30 s timeout under load, or a
|
|
103
|
+
+ // spawn the host refused. Read as "not Bun", that failure handed Bun Node's
|
|
104
|
+
+ // `--input-type ""`, which Bun runs as an empty `bun run` script, so the
|
|
105
|
+
+ // plugin descriptor produced no output. This process knows what it is.
|
|
106
|
+
+ if (node_path_1.default.isAbsolute(runtime) && sameRuntimeExecutable(runtime, process.execPath)) {
|
|
107
|
+
+ return {
|
|
108
|
+
+ bun: typeof globalThis.Bun === "object",
|
|
109
|
+
+ executable: process.execPath,
|
|
110
|
+
+ registerHooks: typeof require("node:module").registerHooks === "function",
|
|
111
|
+
+ };
|
|
112
|
+
+ }
|
|
113
|
+
// Inside a ttsx run this is the user's NODE_OPTIONS, not ttsx's preloads,
|
|
114
|
+
// which would refuse the cache and run in the probe (#1740).
|
|
115
|
+
const effectiveEnv = TtsxNodeOptions_1.TtsxNodeOptions.forHelpers(SidecarEnvironment_1.SidecarEnvironment.merge(process.env, env));
|
|
93
116
|
diff --git a/lib/plugin/internal/source/PluginBuildEnvironmentReadings.js b/lib/plugin/internal/source/PluginBuildEnvironmentReadings.js
|
|
94
117
|
--- a/lib/plugin/internal/source/PluginBuildEnvironmentReadings.js
|
|
95
118
|
+++ b/lib/plugin/internal/source/PluginBuildEnvironmentReadings.js
|
|
@@ -117,3 +140,55 @@ diff --git a/lib/plugin/internal/source/PluginBuildEnvironmentReadings.js b/lib/
|
|
|
117
140
|
worker = created;
|
|
118
141
|
const retire = () => {
|
|
119
142
|
if (worker === created)
|
|
143
|
+
diff --git a/lib/plugin/internal/source/waitForPluginBinary.js b/lib/plugin/internal/source/waitForPluginBinary.js
|
|
144
|
+
--- a/lib/plugin/internal/source/waitForPluginBinary.js
|
|
145
|
+
+++ b/lib/plugin/internal/source/waitForPluginBinary.js
|
|
146
|
+
@@ -25,6 +25,12 @@
|
|
147
|
+
* run. An opted-in synchronous owner can cancel observation or interrupt a
|
|
148
|
+
* polling sleep; cancellation never retires the holder's generation.
|
|
149
|
+
*
|
|
150
|
+
+ * A published binary is not admission: the caller registers as its reader
|
|
151
|
+
+ * under the key, which only release or retirement frees. Each poll therefore
|
|
152
|
+
+ * inspects the lock before it reports publication, so a holder that died
|
|
153
|
+
+ * holding the key after its binary was published is reported abandoned
|
|
154
|
+
+ * instead of outwaiting the admission budget.
|
|
155
|
+
+ *
|
|
156
|
+
* @evidence contracts/common.md#principled-implementation Polling first refuses unknown/malformed native guards, suppresses publication while pending and rechecks after observed release; actual abandoned-owner observations retain their exact generation, while budget expiry fails without revoking a possibly active payload task.
|
|
157
|
+
* @evidence contracts/common.md#clear-and-simple-design The loop separates publication, release, retirement and periodic status reporting; generation interpretation belongs to inspectPluginBuildLock.
|
|
158
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Budget expiry throws instead of retiring a live-looking generation and compensating for concurrent callbacks; status output never substitutes for ownership evidence.
|
|
159
|
+
@@ -43,22 +49,9 @@
|
|
160
|
+
OwnedSynchronousProcess_1.OwnedSynchronousProcess.checkpoint();
|
|
161
|
+
SourceNativeRetirement_1.SourceNativeRetirement.assertAvailable(protocolDir);
|
|
162
|
+
const protectedNativeInputs = SourceNativeRetirement_1.SourceNativeRetirement.isProtected(protocolDir);
|
|
163
|
+
- if (!protectedNativeInputs && node_fs_1.default.existsSync(opts.binaryPath)) {
|
|
164
|
+
- OwnedSynchronousProcess_1.OwnedSynchronousProcess.checkpoint();
|
|
165
|
+
- return { outcome: "published" };
|
|
166
|
+
- }
|
|
167
|
+
const clock = performance.now();
|
|
168
|
+
const lock = (0, inspectPluginBuildLock_1.inspectPluginBuildLock)(opts.lockDir);
|
|
169
|
+
OwnedSynchronousProcess_1.OwnedSynchronousProcess.checkpoint();
|
|
170
|
+
- if (lock.state === "released") {
|
|
171
|
+
- // The holder retired its generation between the binary check above and
|
|
172
|
+
- // this observation. That is a normal release, not abandonment: prefer the
|
|
173
|
+
- // binary when it landed inside that window, otherwise hand the free key
|
|
174
|
+
- // back to the caller.
|
|
175
|
+
- return !protectedNativeInputs && node_fs_1.default.existsSync(opts.binaryPath)
|
|
176
|
+
- ? { outcome: "published" }
|
|
177
|
+
- : { outcome: "released" };
|
|
178
|
+
- }
|
|
179
|
+
if (lock.state === "abandoned") {
|
|
180
|
+
return {
|
|
181
|
+
outcome: "abandoned",
|
|
182
|
+
@@ -66,6 +59,12 @@
|
|
183
|
+
fence: lock.fence,
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
+ if (!protectedNativeInputs && node_fs_1.default.existsSync(opts.binaryPath)) {
|
|
187
|
+
+ return { outcome: "published" };
|
|
188
|
+
+ }
|
|
189
|
+
+ if (lock.state === "released") {
|
|
190
|
+
+ return { outcome: "released" };
|
|
191
|
+
+ }
|
|
192
|
+
if (clock - startedAt >= opts.timeoutMs) {
|
|
193
|
+
throw new Error(`ttsc: timed out after ${(0, formatDuration_1.formatDuration)(clock - startedAt)} waiting for ` +
|
|
194
|
+
`${opts.lockInfo.label} "${opts.lockInfo.pluginName}" at ${opts.lockDir}; ` +
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
# Save the current working directory
|
|
6
6
|
ORIGINAL_PWD="$(pwd)"
|
|
7
|
-
SELF_PATH="$(realpath "$0")"
|
|
8
7
|
|
|
9
8
|
# Locate this repository's tooling/ from the INVOCATION path, not from
|
|
10
9
|
# realpath($0). WHY: tooling/devenv is a symlink into
|
|
@@ -29,7 +28,7 @@ fi
|
|
|
29
28
|
# Find the actual Nix-built devenv binary, skipping every wrapper script.
|
|
30
29
|
# WHY: PATH routinely holds more than one of these wrappers at once — this
|
|
31
30
|
# repo's tooling/devenv, sibling repos' wrappers, and direnv-stacked parent
|
|
32
|
-
# environments.
|
|
31
|
+
# environments. Excluding only this wrapper's own path happily selects a
|
|
33
32
|
# *different* wrapper and exec's it, so `devenv` bounces into the wrong repo
|
|
34
33
|
# (or self-execs forever on cheap checks like `devenv version`). The real devenv
|
|
35
34
|
# is always the Nix-managed executable under /nix/store, so match that and ignore
|
|
@@ -446,6 +446,9 @@ export interface DeclaredLinksPlan {
|
|
|
446
446
|
* binding it inherited from the main checkout, or reach through a redirected or
|
|
447
447
|
* escaping path. Resolving a snapshot may capture one (linked-snapshots.ts),
|
|
448
448
|
* which writes only the snapshot store.
|
|
449
|
+
* A throw is a refusal. Shell entry fails on it: once the tasks have run, the
|
|
450
|
+
* enterShell prologue plans again (setup-environment.ts, `--links --refusal`),
|
|
451
|
+
* so a refusal is read from the providers at that entry and none is kept.
|
|
449
452
|
*/
|
|
450
453
|
export async function planDeclaredLinks(root: string): Promise<DeclaredLinksPlan> {
|
|
451
454
|
const declared = readDeclaredLinks(root);
|
|
@@ -487,6 +487,11 @@ in {
|
|
|
487
487
|
# digest under the install lock, so two shells entering at once install once.
|
|
488
488
|
# The scripts themselves are inputs: a new setup-environment.ts reruns.
|
|
489
489
|
#
|
|
490
|
+
# A uv project also has live installed state: a copied environment can hold
|
|
491
|
+
# an absolute editable mapping while every input digest is unchanged. Its
|
|
492
|
+
# status joins the installer's own input stamps and relocation witness;
|
|
493
|
+
# non-Python projects retain the input-only task cache below.
|
|
494
|
+
#
|
|
490
495
|
# smoo:cargo-fetch establishes what the Nx plugin's offline `cargo metadata
|
|
491
496
|
# --locked` needs: every Cargo workspace's locked packages in CARGO_HOME. Its
|
|
492
497
|
# stamps live in smoo's user cache and count only while CARGO_HOME names the
|
|
@@ -515,17 +520,25 @@ in {
|
|
|
515
520
|
# links its declaration does not describe runs another build than it says
|
|
516
521
|
# (a live checkout whose build is stale, with no sealed snapshot to serve
|
|
517
522
|
# instead), and the repair is in the provider checkout, not in this shell.
|
|
518
|
-
#
|
|
519
|
-
#
|
|
520
|
-
#
|
|
521
|
-
#
|
|
523
|
+
# So the prologue below asks `setup-environment.ts --links --refusal` once
|
|
524
|
+
# the tasks have run, and fails entry with the planner's reason: the answer
|
|
525
|
+
# is read from the providers at that entry, so the entry after the provider
|
|
526
|
+
# is rebuilt goes in with no step between, and nothing of a refusal outlives
|
|
527
|
+
# it. devenv also evaluates the whole enterShell script once before it runs
|
|
528
|
+
# any task, only to capture the environment (it sets DEVENV_SKIP_TASKS), and
|
|
529
|
+
# a script that fails in that pass stops the tasks that would repair: it
|
|
530
|
+
# asks nothing there, and a manifest that declares no links starts no
|
|
531
|
+
# process. CI runs both with `devenv tasks run`, which does fail;
|
|
532
|
+
# setup-environment.ts is strict there.
|
|
522
533
|
tasks = let
|
|
523
534
|
setup = ''bun "$DEVENV_ROOT/setup-environment.ts"'';
|
|
535
|
+
install = setup + lib.optionalString uvProject " --python ${python.package.interpreter}";
|
|
524
536
|
in {
|
|
525
537
|
"smoo:install" = {
|
|
526
538
|
description = "bun install / uv sync when what they read changed";
|
|
527
|
-
exec =
|
|
528
|
-
|
|
539
|
+
exec = install;
|
|
540
|
+
status = lib.mkIf uvProject (install + " --check");
|
|
541
|
+
execIfModified = lib.optionals (!uvProject) [
|
|
529
542
|
"../../package.json"
|
|
530
543
|
"../../bun.lock"
|
|
531
544
|
"../../bun.lockb"
|
|
@@ -569,7 +582,9 @@ in {
|
|
|
569
582
|
# Prologue, in order:
|
|
570
583
|
#
|
|
571
584
|
# 1. The devenv wrapper runs from tooling/direnv; every later step expects the
|
|
572
|
-
# workspace root.
|
|
585
|
+
# workspace root. Once the tasks have run, the planner's refusal of the
|
|
586
|
+
# declared links (smoo:developer-links above) fails entry before any
|
|
587
|
+
# later step.
|
|
573
588
|
# 2. PATH order is most-specific → least-specific, the same list the git hooks
|
|
574
589
|
# use, so a hook and a shell resolve one binary the same way. The Rust
|
|
575
590
|
# toolchain's store bin then goes ahead of all of it (rustToolchainBin
|
|
@@ -577,8 +592,10 @@ in {
|
|
|
577
592
|
# owns.
|
|
578
593
|
# 3. ttsc drives the native TypeScript 7 binary while Nx imports the TypeScript
|
|
579
594
|
# 6 API, so the two must be named separately.
|
|
580
|
-
# 4. ttsc caches in the checkout's .cache/ttsc (the
|
|
581
|
-
#
|
|
595
|
+
# 4. ttsc caches its plugin binaries in the checkout's .cache/ttsc-plugins (the
|
|
596
|
+
# path the CI ttsc-plugin cache restores, and the output a repository's
|
|
597
|
+
# plugin build target declares), its Go build cache in .cache/ttsc/go-build,
|
|
598
|
+
# a directory of its own outside that output, so
|
|
582
599
|
# `ttsc clean` can reclaim it: ttsc never deletes a GOCACHE it did not
|
|
583
600
|
# resolve itself, and sharing GOCACHE once left 35G nothing could empty.
|
|
584
601
|
# GOFLAGS carries -trimpath, Go's stable way to keep absolute build paths
|
|
@@ -658,12 +675,11 @@ in {
|
|
|
658
675
|
# they run.
|
|
659
676
|
(lib.mkBefore ''
|
|
660
677
|
cd "$DEVENV_ROOT/../.."
|
|
661
|
-
# smoo:developer-links
|
|
662
|
-
# shell entry with
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
exit 1
|
|
678
|
+
# smoo:developer-links (tasks above) refusing the declared links fails
|
|
679
|
+
# shell entry with the planner's reason, asked of the providers now. Only
|
|
680
|
+
# the entry proper asks, and only a manifest that declares links.
|
|
681
|
+
if [ -z "''${DEVENV_SKIP_TASKS:-}" ] && grep -qF developerLinks package.json; then
|
|
682
|
+
bun "$DEVENV_ROOT/setup-environment.ts" --links --refusal || exit $?
|
|
667
683
|
fi
|
|
668
684
|
# A bare assignment: export's status would hide repo-path's refusal of a
|
|
669
685
|
# cowshed workspace it could not serve, and the shell would enter with an
|
|
@@ -694,6 +710,9 @@ in {
|
|
|
694
710
|
unset GOROOT
|
|
695
711
|
${lib.optionalString uvProject ''
|
|
696
712
|
if [ -f pyproject.toml ]; then
|
|
713
|
+
# The installer above owns sync and rewrites editable mappings after it.
|
|
714
|
+
# A reader's uv run must not rewrite them to this checkout's absolute path.
|
|
715
|
+
export UV_NO_SYNC=1
|
|
697
716
|
export VIRTUAL_ENV="$UV_PROJECT_ENVIRONMENT"
|
|
698
717
|
export PATH="$VIRTUAL_ENV/bin:$PATH"
|
|
699
718
|
fi
|
|
@@ -11,11 +11,7 @@ repo_root="$(cd "$script_dir/../.." && pwd)"
|
|
|
11
11
|
# A separate name on purpose: assigning to TTSC_CACHE_DIR itself would mutate
|
|
12
12
|
# the (possibly exported) environment that persist_devenv_environment later
|
|
13
13
|
# fingerprints as the pre-shell baseline.
|
|
14
|
-
ttsc_cache_dir_default="${TTSC_CACHE_DIR:-$repo_root/.cache/ttsc}"
|
|
15
|
-
|
|
16
|
-
add_repo_paths() {
|
|
17
|
-
"$repo_root/tooling/direnv/repo-path" --github-path
|
|
18
|
-
}
|
|
14
|
+
ttsc_cache_dir_default="${TTSC_CACHE_DIR:-$repo_root/.cache/ttsc-plugins}"
|
|
19
15
|
|
|
20
16
|
# The CLI that evaluates the shell must be the commit whose modules the shell is
|
|
21
17
|
# locked to, so this installs the commit devenv.lock's `devenv` node names and
|
|
@@ -171,9 +167,6 @@ build_devenv_shell() {
|
|
|
171
167
|
if [ "${SMOO_ROOT_BUILD_INPUTS:-false}" = true ]; then
|
|
172
168
|
root_build_inputs "$since"
|
|
173
169
|
fi
|
|
174
|
-
# Add repo-local tools only after the shell exists; cleanup steps use an
|
|
175
|
-
# explicit PATH because failures before this point must still refresh caches.
|
|
176
|
-
add_repo_paths
|
|
177
170
|
}
|
|
178
171
|
|
|
179
172
|
# The store cache's post phase collects garbage down to the live roots before
|
|
@@ -218,6 +211,8 @@ root_build_inputs() {
|
|
|
218
211
|
persist_devenv_environment() {
|
|
219
212
|
[ -n "${GITHUB_ENV:-}" ] || return 0
|
|
220
213
|
local name entry value captured bkey persisted=""
|
|
214
|
+
local i
|
|
215
|
+
local -a path_entries
|
|
221
216
|
# Baseline: this step's own exported variables, before shell influence.
|
|
222
217
|
# Stored as smoo_baseline_<name> pseudo-map entries (printf -v), not a
|
|
223
218
|
# bash-4 associative array — macOS runners still ship bash 3.2. compgen -e
|
|
@@ -238,8 +233,23 @@ persist_devenv_environment() {
|
|
|
238
233
|
name="${entry%%=*}"
|
|
239
234
|
value="${entry#*=}"
|
|
240
235
|
case "$name" in
|
|
241
|
-
|
|
242
|
-
|
|
236
|
+
PATH)
|
|
237
|
+
# The profile alone is not the shell: mbx removes its Cargo shim's
|
|
238
|
+
# directory, which also holds the profile's linker. Keep the individual
|
|
239
|
+
# package bins the shell already selected, not a second tool list.
|
|
240
|
+
path_entries=()
|
|
241
|
+
while [[ "$value" == *:* ]]; do
|
|
242
|
+
path_entries+=("${value%%:*}")
|
|
243
|
+
value="${value#*:}"
|
|
244
|
+
done
|
|
245
|
+
path_entries+=("$value")
|
|
246
|
+
# GITHUB_PATH prepends; reverse to retain the shell's search order.
|
|
247
|
+
for (( i=${#path_entries[@]}-1; i>=0; i-- )); do
|
|
248
|
+
printf '%s\n' "${path_entries[i]}"
|
|
249
|
+
done >> "$GITHUB_PATH"
|
|
250
|
+
continue ;;
|
|
251
|
+
# The runner step owns these.
|
|
252
|
+
PWD | OLDPWD | SHLVL | SHELL | HOME | USER | LOGNAME | HOSTNAME | TERM | TMPDIR | TMP | TEMP | _ | PS1) continue ;;
|
|
243
253
|
GITHUB_* | RUNNER_* | ACTIONS_* | CI) continue ;;
|
|
244
254
|
# Shell-session bookkeeping, meaningful only inside the shell itself.
|
|
245
255
|
DIRENV_* | DEVENV_* | NIX_* | BASH* | XDG_* | IN_NIX_SHELL | SMOO_ENV_CAPTURE_OUT) continue ;;
|
|
@@ -212,6 +212,9 @@ const POST_COMMIT_BLOCK = [
|
|
|
212
212
|
// points the packages `smoo.developerLinks` declares at their local checkouts.
|
|
213
213
|
// devenv's smoo:developer-links task uses `--links --check` as its status:
|
|
214
214
|
// links can change without any smoo:install input changing.
|
|
215
|
+
// `--links --refusal` is the question the managed enterShell prologue asks once the tasks have run (devenv.smoo.nix):
|
|
216
|
+
// silent and exit 0 unless the planner refuses the declared links now, then its reason and exit 1. It reads the
|
|
217
|
+
// providers' state at that entry, and nothing is kept for the next.
|
|
215
218
|
// Declared above the bootstrap block for the same hoisting reason as above.
|
|
216
219
|
const { values: flags } = parseArgs({
|
|
217
220
|
options: {
|
|
@@ -219,15 +222,11 @@ const { values: flags } = parseArgs({
|
|
|
219
222
|
cargo: { type: 'boolean' },
|
|
220
223
|
links: { type: 'boolean' },
|
|
221
224
|
check: { type: 'boolean' },
|
|
225
|
+
refusal: { type: 'boolean' },
|
|
222
226
|
'repair-missing-payload': { type: 'string' },
|
|
223
227
|
},
|
|
224
228
|
});
|
|
225
229
|
const cargoMode = flags.cargo === true;
|
|
226
|
-
// What a `--links` exec that refused leaves for the enterShell prologue (devenv.smoo.nix), which then fails shell entry
|
|
227
|
-
// with its reason: a shell must not run on links the declaration does not describe (a live checkout whose build is
|
|
228
|
-
// stale with no sealed snapshot to serve, a declaration smoo refuses), and the repair is in the provider checkout, not
|
|
229
|
-
// in this shell. Every `--links` run that finds the links current, or makes them so, removes it.
|
|
230
|
-
const linksRefusal = path.join(projectRoot, 'node_modules', '.smoo-links-refused');
|
|
231
230
|
|
|
232
231
|
// The Nx plugin's test for a Cargo workspace root manifest (CARGO_WORKSPACE_PATTERN), which
|
|
233
232
|
// cargoWorkspaces applies during the bootstrap block; declared above it for the same reason.
|
|
@@ -237,6 +236,11 @@ const CARGO_WORKSPACE = /^\s*\[workspace\]/m;
|
|
|
237
236
|
process.chdir(projectRoot);
|
|
238
237
|
|
|
239
238
|
try {
|
|
239
|
+
if (flags.refusal === true && (flags.links !== true || flags.check === true)) {
|
|
240
|
+
reportSetupFailure(
|
|
241
|
+
new Error("--refusal is shell entry's question about the declared links: it takes --links and no --check"),
|
|
242
|
+
);
|
|
243
|
+
}
|
|
240
244
|
const requestedPayload = flags['repair-missing-payload'];
|
|
241
245
|
if (requestedPayload !== undefined) {
|
|
242
246
|
if (flags.links === true || flags.check === true || cargoMode || flags.python !== undefined) {
|
|
@@ -251,6 +255,11 @@ try {
|
|
|
251
255
|
if (process.env.GITHUB_ACTIONS === 'true') {
|
|
252
256
|
process.exit(0);
|
|
253
257
|
}
|
|
258
|
+
if (flags.refusal === true) {
|
|
259
|
+
// Asked once the tasks have run, so a refusal here is one they could not repair; it reaches the catch below.
|
|
260
|
+
await planDeclaredLinks(projectRoot);
|
|
261
|
+
process.exit(0);
|
|
262
|
+
}
|
|
254
263
|
if (flags.check === true) {
|
|
255
264
|
const plan = await planDeclaredLinks(projectRoot);
|
|
256
265
|
// A refused or unclaimed snapshot is current only when said: the exec that follows names its cause.
|
|
@@ -258,12 +267,13 @@ try {
|
|
|
258
267
|
plan.changes.length === 0 && plan.unavailable.every((unavailable) => unavailable.kind === 'absent');
|
|
259
268
|
// A stale pin is informational, not a stale install: say it even when devenv skips the exec.
|
|
260
269
|
if (current && plan.reports.length > 0) applyDeclaredLinks(projectRoot, plan);
|
|
261
|
-
|
|
270
|
+
process.exit(
|
|
262
271
|
current &&
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
272
|
+
!hasStaleDeveloperLinks(projectRoot, ['nx']) &&
|
|
273
|
+
danglingStoreLinks(projectRoot, () => workspaceMemberModules(projectRoot)).length === 0
|
|
274
|
+
? 0
|
|
275
|
+
: 1,
|
|
276
|
+
);
|
|
267
277
|
}
|
|
268
278
|
// Planning reads, apart from a snapshot it may capture, which seals by an atomic rename (linked-snapshots.ts),
|
|
269
279
|
// and applying a plan with no changes only says what this machine cannot honour. So an entry with nothing to
|
|
@@ -276,7 +286,6 @@ try {
|
|
|
276
286
|
!hasStaleDeveloperLinks(projectRoot, ['nx'])
|
|
277
287
|
) {
|
|
278
288
|
applyDeclaredLinks(projectRoot, plan);
|
|
279
|
-
rmSync(linksRefusal, { force: true });
|
|
280
289
|
process.exit(0);
|
|
281
290
|
}
|
|
282
291
|
await withInstallLock(async () => {
|
|
@@ -295,7 +304,6 @@ try {
|
|
|
295
304
|
}
|
|
296
305
|
applyDeclaredLinks(projectRoot, await planDeclaredLinks(projectRoot));
|
|
297
306
|
});
|
|
298
|
-
rmSync(linksRefusal, { force: true });
|
|
299
307
|
process.exit(0);
|
|
300
308
|
}
|
|
301
309
|
// Bootstrap only: install deps + wire local git hooks/config.
|
|
@@ -303,10 +311,14 @@ try {
|
|
|
303
311
|
// and package resolution/Typia transforms are not available yet.
|
|
304
312
|
const bunInputs = bunInstallInputs();
|
|
305
313
|
const cargoFetches = cargoMode ? cargoWorkspaces(bunInputs).map(cargoFetcher) : [];
|
|
306
|
-
if (flags.check === true) {
|
|
314
|
+
if (flags.check === true && cargoMode) {
|
|
307
315
|
process.exit(cargoFetches.every((fetch) => fetch.isCurrent()) ? 0 : 1);
|
|
308
316
|
}
|
|
309
317
|
const uvInputs = cargoMode ? [] : uvSyncInputs();
|
|
318
|
+
if (flags.check === true) {
|
|
319
|
+
const uv = uvInstaller(uvInputs, { locked: process.env.GITHUB_ACTIONS === 'true' });
|
|
320
|
+
process.exit(bunInstaller(bunInputs).isCurrent() && (uv === null || uv.isCurrent()) ? 0 : 1);
|
|
321
|
+
}
|
|
310
322
|
// A CI runner is GitHub Actions or Forgejo Actions, which mirrors every FORGEJO_*
|
|
311
323
|
// variable as GITHUB_*. Not `CI`: agent harnesses set CI=true on every command
|
|
312
324
|
// they run, and this branch installs unconditionally.
|
|
@@ -416,10 +428,11 @@ try {
|
|
|
416
428
|
}
|
|
417
429
|
}
|
|
418
430
|
} catch (error) {
|
|
419
|
-
// Thrown out of
|
|
420
|
-
if (flags.
|
|
421
|
-
|
|
422
|
-
|
|
431
|
+
// Thrown out of the refusal question, an error is the planner refusing the declared links.
|
|
432
|
+
if (flags.refusal === true) {
|
|
433
|
+
console.error(
|
|
434
|
+
"smoo:developer-links refuses this checkout's declared links; shell entry fails while the planner refuses them:",
|
|
435
|
+
);
|
|
423
436
|
}
|
|
424
437
|
reportSetupFailure(error);
|
|
425
438
|
}
|
|
@@ -1063,9 +1076,11 @@ function uvInstaller(inputs: readonly string[], options: { locked: boolean }): I
|
|
|
1063
1076
|
return stampOk && witnessOk;
|
|
1064
1077
|
},
|
|
1065
1078
|
install: async ({ quiet }) => {
|
|
1066
|
-
// An inherited VIRTUAL_ENV names
|
|
1067
|
-
//
|
|
1068
|
-
const env = Object.fromEntries(
|
|
1079
|
+
// The managed installer is the only environment writer. An inherited VIRTUAL_ENV names another checkout;
|
|
1080
|
+
// UV_NO_SYNC belongs to reader commands, not to this deliberate sync.
|
|
1081
|
+
const env = Object.fromEntries(
|
|
1082
|
+
Object.entries(process.env).filter(([name]) => name !== 'VIRTUAL_ENV' && name !== 'UV_NO_SYNC'),
|
|
1083
|
+
);
|
|
1069
1084
|
// Replacement is gated on the same witness currentness uses, not only on the config
|
|
1070
1085
|
// line: a valid config beside an absolute launcher or .pth would otherwise sync over
|
|
1071
1086
|
// the escape and stamp it. uv venv refuses a directory that already holds an
|
|
@@ -6,15 +6,17 @@
|
|
|
6
6
|
#
|
|
7
7
|
# Exports ttsc's environment for this workspace: TTSC_TSGO_BINARY, the native
|
|
8
8
|
# TypeScript compiler (ttsc resolves only the unscoped `typescript` package by
|
|
9
|
-
# default, which here is the JavaScript compiler API),
|
|
10
|
-
#
|
|
11
|
-
#
|
|
9
|
+
# default, which here is the JavaScript compiler API), TTSC_CACHE_DIR, where ttsc
|
|
10
|
+
# keeps the plugin binaries it compiles (<checkout>/.cache/ttsc-plugins, the path
|
|
11
|
+
# a repository's ttsc plugin build target declares as its output), and
|
|
12
|
+
# TTSC_GO_CACHE_DIR, the Go build cache that compiles them
|
|
13
|
+
# (<checkout>/.cache/ttsc/go-build), a byproduct kept outside that output.
|
|
12
14
|
#
|
|
13
15
|
# This checkout is the directory the script is sourced from: devenv.smoo.nix's
|
|
14
16
|
# enterShell enters the workspace root first, and each git hook enters
|
|
15
17
|
# `git rev-parse --show-toplevel`. Sourced from any other directory, $PWD names
|
|
16
18
|
# no checkout, and every cache below would land beside that directory instead:
|
|
17
|
-
# a shell in HOME would create ~/.cache/ttsc. That directory is refused.
|
|
19
|
+
# a shell in HOME would create ~/.cache/ttsc-plugins. That directory is refused.
|
|
18
20
|
if [ ! -f "$PWD/tooling/direnv/ttsc-env.sh" ]; then
|
|
19
21
|
echo "ttsc-env.sh: not a workspace root (no tooling/direnv/ttsc-env.sh): $PWD; source it from the checkout root" >&2
|
|
20
22
|
return 1
|
|
@@ -43,6 +45,6 @@ if [ -f "$PWD/tooling/direnv/typescript-go.nix" ]; then
|
|
|
43
45
|
else
|
|
44
46
|
export TTSC_TSGO_BINARY="$PWD/node_modules/@typescript/native/bin/tsc"
|
|
45
47
|
fi
|
|
46
|
-
export TTSC_CACHE_DIR="${TTSC_CACHE_DIR:-$PWD/.cache/ttsc}"
|
|
47
|
-
export TTSC_GO_CACHE_DIR="${TTSC_GO_CACHE_DIR:-$
|
|
48
|
+
export TTSC_CACHE_DIR="${TTSC_CACHE_DIR:-$PWD/.cache/ttsc-plugins}"
|
|
49
|
+
export TTSC_GO_CACHE_DIR="${TTSC_GO_CACHE_DIR:-$PWD/.cache/ttsc/go-build}"
|
|
48
50
|
mkdir -p "$TTSC_GO_CACHE_DIR"
|
|
@@ -8,7 +8,7 @@ runs:
|
|
|
8
8
|
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
|
|
9
9
|
with:
|
|
10
10
|
# Isolated Bun links and their targets are one dependency tree.
|
|
11
|
-
# ttsc
|
|
11
|
+
# ttsc plugins stay under $TTSC_CACHE_DIR (.cache/ttsc-plugins), its Go build cache under .cache/ttsc/go-build.
|
|
12
12
|
# v2 isolates restore-keys from older Darwin caches with a broken TS dual-package hoist.
|
|
13
13
|
path: |
|
|
14
14
|
node_modules
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
name: Cache ttsc plugins
|
|
2
2
|
description: >
|
|
3
|
-
Restore or save the compiled ttsc native plugin binaries (typia, etc.) under TTSC_CACHE_DIR/plugins
|
|
4
|
-
entry by a hash of what it was compiled from and skips the
|
|
5
|
-
them, and save-nix-devenv saves the entries the job used when
|
|
6
|
-
(go-build
|
|
3
|
+
Restore or save the compiled ttsc native plugin binaries (typia, etc.) under TTSC_CACHE_DIR/plugins
|
|
4
|
+
(.cache/ttsc-plugins/plugins). ttsc names every entry by a hash of what it was compiled from and skips the
|
|
5
|
+
multi-minute `go build` when one matches. Setup restores them, and save-nix-devenv saves the entries the job used when
|
|
6
|
+
the job ends, red or green. The Go object cache (.cache/ttsc/go-build, outside the plugin root) is NOT cached: it is
|
|
7
|
+
multi-GB and only helps when the plugin key misses.
|
|
7
8
|
|
|
8
9
|
inputs:
|
|
9
10
|
mode:
|
|
@@ -22,8 +23,8 @@ runs:
|
|
|
22
23
|
if: inputs.mode == 'restore'
|
|
23
24
|
shell: bash
|
|
24
25
|
run: |
|
|
25
|
-
mkdir -p .cache/ttsc
|
|
26
|
-
grep -E '^ +"(@ttsc/[^"]+|ttsc(/[^"]+)?)": |"ttsc": "' bun.lock > .cache/ttsc/plugin-lock-entries
|
|
26
|
+
mkdir -p .cache/ttsc-plugins
|
|
27
|
+
grep -E '^ +"(@ttsc/[^"]+|ttsc(/[^"]+)?)": |"ttsc": "' bun.lock > .cache/ttsc-plugins/plugin-lock-entries
|
|
27
28
|
|
|
28
29
|
# A prefix hit is safe. ttsc names every entry by a hash of what it was compiled from (the ttsc and tsgo versions,
|
|
29
30
|
# platform and architecture, the Go toolchain and its build environment, the plugin sources) and runs an entry only
|
|
@@ -35,10 +36,10 @@ runs:
|
|
|
35
36
|
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
|
|
36
37
|
with:
|
|
37
38
|
# Only the compiled plugin binaries (~30MB each). Path is relative to the
|
|
38
|
-
# workspace; devenv sets TTSC_CACHE_DIR to <repo>/.cache/ttsc.
|
|
39
|
-
path: .cache/ttsc/plugins
|
|
39
|
+
# workspace; devenv sets TTSC_CACHE_DIR to <repo>/.cache/ttsc-plugins.
|
|
40
|
+
path: .cache/ttsc-plugins/plugins
|
|
40
41
|
# prettier-ignore
|
|
41
|
-
key: ${{ runner.os }}-${{ runner.arch }}-ttsc-plugins-v1-${{ hashFiles('.cache/ttsc/plugin-lock-entries', 'patches/ttsc@*.patch', 'tooling/direnv/devenv.lock', 'tooling/direnv/devenv.smoo.nix') }}
|
|
42
|
+
key: ${{ runner.os }}-${{ runner.arch }}-ttsc-plugins-v1-${{ hashFiles('.cache/ttsc-plugins/plugin-lock-entries', 'patches/ttsc@*.patch', 'tooling/direnv/devenv.lock', 'tooling/direnv/devenv.smoo.nix') }}
|
|
42
43
|
restore-keys: |
|
|
43
44
|
${{ runner.os }}-${{ runner.arch }}-ttsc-plugins-v1-
|
|
44
45
|
|
|
@@ -73,7 +74,7 @@ runs:
|
|
|
73
74
|
shopt -s nullglob
|
|
74
75
|
: "${SMOO_TTSC_PLUGINS_RESTORED_AT_MS:?the restore of this action records when the job restored the cache}"
|
|
75
76
|
kept=0
|
|
76
|
-
for entry in "$GITHUB_WORKSPACE"/.cache/ttsc/plugins/*/; do
|
|
77
|
+
for entry in "$GITHUB_WORKSPACE"/.cache/ttsc-plugins/plugins/*/; do
|
|
77
78
|
entry="${entry%/}"
|
|
78
79
|
case "$entry" in *.lock | *.lock.*) continue ;; esac
|
|
79
80
|
used=0
|
|
@@ -92,5 +93,5 @@ runs:
|
|
|
92
93
|
if: inputs.mode == 'save' && steps.prune.outputs.kept > 0
|
|
93
94
|
uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
|
|
94
95
|
with:
|
|
95
|
-
path: .cache/ttsc/plugins
|
|
96
|
+
path: .cache/ttsc-plugins/plugins
|
|
96
97
|
key: ${{ env.SMOO_TTSC_PLUGINS_SAVE_KEY }}
|