@zackees/soldr 0.7.104 → 0.8.1
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 +4 -2
- package/bin/soldr.js +0 -17
- package/contracts/zccache-integration-guardrails.v1.json +3 -4
- package/contracts/zccache-runtime.v1.json +2 -1
- package/package.json +1 -1
- package/scripts/install.js +18 -15
- package/scripts/test-npm-package.js +14 -8
- package/scripts/zccache-contract.js +16 -5
package/README.md
CHANGED
|
@@ -128,7 +128,9 @@ soldr cargo build --target aarch64-pc-windows-msvc
|
|
|
128
128
|
|
|
129
129
|
The canonical multi-platform GitHub Actions tutorial lives in [`zackees/setup-soldr#90`](https://github.com/zackees/setup-soldr/issues/90).
|
|
130
130
|
|
|
131
|
-
For
|
|
131
|
+
For Windows x64 → Windows GNU builds via managed MinGW-w64 GCC, and Linux →
|
|
132
|
+
Windows MSVC cross-compilation via `cargo-xwin`,
|
|
133
|
+
see [docs/CROSS_COMPILE.md](./docs/CROSS_COMPILE.md).
|
|
132
134
|
|
|
133
135
|
### CI cache lineage
|
|
134
136
|
|
|
@@ -329,7 +331,7 @@ If you also have many separate test binaries, consider consolidating them under
|
|
|
329
331
|
- **Pre-built first**: Download a pre-built binary before compiling from source. Fall back gracefully.
|
|
330
332
|
- **Cargo-compatible**: soldr preserves normal cargo arguments instead of forcing a separate workflow.
|
|
331
333
|
- **Cross-platform**: Linux, macOS, Windows (x86_64 + aarch64).
|
|
332
|
-
- **MSVC by default on Windows**: Always targets `x86_64-pc-windows-msvc` (or `aarch64-pc-windows-msvc`) unless the active project explicitly selects another target in `.cargo/config.toml`, `.cargo/config`, or `rust-toolchain.toml`. MSVC links against `vcruntime140.dll` which ships with every modern Windows install. The GNU target requires shipping `libgcc_s_seh-1.dll` and `libwinpthread-1.dll` with every binary, which is extra baggage for
|
|
334
|
+
- **MSVC by default on Windows**: Always targets `x86_64-pc-windows-msvc` (or `aarch64-pc-windows-msvc`) unless the active project explicitly selects another target in `.cargo/config.toml`, `.cargo/config`, or `rust-toolchain.toml`. MSVC links against `vcruntime140.dll` which ships with every modern Windows install. The GNU target requires shipping `libgcc_s_seh-1.dll` and `libwinpthread-1.dll` with every binary, which is extra baggage for most projects; when a project explicitly needs `x86_64-pc-windows-gnu`, `soldr prepare --target x86_64-pc-windows-gnu` provisions managed MinGW-w64 GCC on Windows x64. This matches the Rust ecosystem default: rustup, cargo-binstall, and nearly all published release binaries target MSVC. crgx gets this wrong by baking the target at compile time, causing it to look for GNU binaries when compiled under MSYS2.
|
|
333
335
|
|
|
334
336
|
## Architecture
|
|
335
337
|
|
package/bin/soldr.js
CHANGED
|
@@ -21,25 +21,8 @@ if (!fs.existsSync(binaryPath)) {
|
|
|
21
21
|
process.exit(1);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
// Wire the bundled zccache trio (zccache, zccache-daemon, zccache-fp,
|
|
25
|
-
// shipped alongside soldr in `bin/native/` since the combined-archive
|
|
26
|
-
// release format landed) into soldr's local-zccache resolution path.
|
|
27
|
-
// Soldr's ZccacheResolver checks SOLDR_ZCCACHE_LOCAL_DIR ahead of the
|
|
28
|
-
// pinned and managed-download chain, so this turns the bundled
|
|
29
|
-
// binaries into the active zccache automatically — no manual env
|
|
30
|
-
// setup, no managed fetch over the network. Users who explicitly set
|
|
31
|
-
// the env var themselves keep their override.
|
|
32
24
|
const exeExt = process.platform === "win32" ? ".exe" : "";
|
|
33
25
|
const childEnv = { ...process.env };
|
|
34
|
-
const zccacheLocalDirEnv = zccacheContract.CONTRACT.zccache.local_dir_env;
|
|
35
|
-
if (
|
|
36
|
-
!childEnv[zccacheLocalDirEnv] &&
|
|
37
|
-
zccacheContract.ZCCACHE_BUNDLED_BINARIES.every((baseName) =>
|
|
38
|
-
fs.existsSync(path.join(nativeDir, `${baseName}${exeExt}`)),
|
|
39
|
-
)
|
|
40
|
-
) {
|
|
41
|
-
childEnv[zccacheLocalDirEnv] = nativeDir;
|
|
42
|
-
}
|
|
43
26
|
|
|
44
27
|
// Same wiring for the bundled crgx binary (shipped alongside soldr
|
|
45
28
|
// since the crgx-bundling follow-up to the combined-archive release
|
|
@@ -77,9 +77,8 @@
|
|
|
77
77
|
"gate": "hard",
|
|
78
78
|
"covers": [
|
|
79
79
|
"SOLDR_TEST_ZCCACHE_BIN override",
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
"managed cached/runtime fallback",
|
|
80
|
+
"embedded soldr/soldr-daemon runtime",
|
|
81
|
+
"managed cache directory selection",
|
|
83
82
|
"system fallback diagnostics"
|
|
84
83
|
],
|
|
85
84
|
"test_files": [
|
|
@@ -221,7 +220,7 @@
|
|
|
221
220
|
"gate": "hard",
|
|
222
221
|
"covers": [
|
|
223
222
|
"release archive manifest",
|
|
224
|
-
"zccache
|
|
223
|
+
"embedded zccache runtime",
|
|
225
224
|
"crgx binary",
|
|
226
225
|
"setup-soldr manifest validation",
|
|
227
226
|
"npm bundled contract files"
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"sha256_algorithm": "sha256",
|
|
10
10
|
"required_binaries": [
|
|
11
11
|
"soldr",
|
|
12
|
+
"soldr-daemon",
|
|
12
13
|
"crgx",
|
|
13
14
|
"cargo-chef"
|
|
14
15
|
],
|
|
@@ -16,7 +17,7 @@
|
|
|
16
17
|
},
|
|
17
18
|
"zccache": {
|
|
18
19
|
"embedded": true,
|
|
19
|
-
"note": "zccache
|
|
20
|
+
"note": "zccache is embedded into soldr/soldr-daemon (soldr#1368); no standalone zccache binaries are bundled or downloaded.",
|
|
20
21
|
"cache_dir_env": "ZCCACHE_CACHE_DIR"
|
|
21
22
|
},
|
|
22
23
|
"crgx": {
|
package/package.json
CHANGED
package/scripts/install.js
CHANGED
|
@@ -14,12 +14,11 @@ const PACKAGE_ROOT = path.resolve(__dirname, "..");
|
|
|
14
14
|
const PACKAGE_JSON = require(path.join(PACKAGE_ROOT, "package.json"));
|
|
15
15
|
|
|
16
16
|
// Every release ships a single .tar.zst per target that bundles soldr
|
|
17
|
-
// alongside
|
|
18
|
-
//
|
|
19
|
-
//
|
|
20
|
-
//
|
|
21
|
-
//
|
|
22
|
-
// without going through the managed-download path.
|
|
17
|
+
// alongside soldr-daemon, same-target crgx, and same-target
|
|
18
|
+
// cargo-chef. One fetch installs everything, and `bin/soldr.js` wires
|
|
19
|
+
// SOLDR_CRGX_LOCAL_DIR and SOLDR_CARGO_CHEF_LOCAL_DIR to the install dir
|
|
20
|
+
// so soldr's runtime resolver finds those bundled tools without going
|
|
21
|
+
// through the managed-download path.
|
|
23
22
|
const ARCHIVE_EXT = zccacheContract.ARCHIVE_EXT;
|
|
24
23
|
|
|
25
24
|
const TARGETS = {
|
|
@@ -27,17 +26,20 @@ const TARGETS = {
|
|
|
27
26
|
"linux-x64-musl": { triple: "x86_64-unknown-linux-musl", binary: "soldr" },
|
|
28
27
|
"linux-arm64-gnu": { triple: "aarch64-unknown-linux-gnu", binary: "soldr" },
|
|
29
28
|
"linux-arm64-musl": { triple: "aarch64-unknown-linux-musl", binary: "soldr" },
|
|
30
|
-
"darwin-x64": { triple: "x86_64-apple-darwin", binary: "soldr" },
|
|
31
29
|
"darwin-arm64": { triple: "aarch64-apple-darwin", binary: "soldr" },
|
|
32
30
|
"win32-x64": { triple: "x86_64-pc-windows-msvc", binary: "soldr.exe" },
|
|
33
31
|
"win32-arm64": { triple: "aarch64-pc-windows-msvc", binary: "soldr.exe" },
|
|
34
32
|
};
|
|
35
33
|
|
|
34
|
+
const UNSUPPORTED_TARGETS = {
|
|
35
|
+
"darwin-x64":
|
|
36
|
+
"x86_64-apple-darwin release archives are intentionally not published; install from PyPI sdist or build from source",
|
|
37
|
+
};
|
|
38
|
+
|
|
36
39
|
// Files we expect to find at the root of every extracted release
|
|
37
40
|
// archive. Names line up with what `release-auto.yml`'s
|
|
38
|
-
// `
|
|
39
|
-
// `Build
|
|
40
|
-
// source` steps drop into `dist/package/`
|
|
41
|
+
// `Stage soldr release binaries`, `Build crgx from pinned source`, and
|
|
42
|
+
// `Build cargo-chef from pinned source` steps drop into `dist/package/`
|
|
41
43
|
// before the tar.zst is built. `.exe` suffix is appended at install
|
|
42
44
|
// time based on `target.binary`.
|
|
43
45
|
const BUNDLED_BINARIES = zccacheContract.RELEASE_BUNDLED_BINARIES;
|
|
@@ -88,7 +90,8 @@ function platformTarget(platform = process.platform, arch = process.arch, libc =
|
|
|
88
90
|
: `${platform}-${arch}`;
|
|
89
91
|
const target = TARGETS[key];
|
|
90
92
|
if (!target) {
|
|
91
|
-
|
|
93
|
+
const detail = UNSUPPORTED_TARGETS[key] ? `: ${UNSUPPORTED_TARGETS[key]}` : "";
|
|
94
|
+
throw new Error(`unsupported platform for soldr npm package: ${key}${detail}`);
|
|
92
95
|
}
|
|
93
96
|
return target;
|
|
94
97
|
}
|
|
@@ -250,9 +253,9 @@ async function install() {
|
|
|
250
253
|
fs.rmSync(nativeDir, { recursive: true, force: true });
|
|
251
254
|
fs.mkdirSync(nativeDir, { recursive: true });
|
|
252
255
|
|
|
253
|
-
// Copy every bundled binary so soldr
|
|
254
|
-
//
|
|
255
|
-
//
|
|
256
|
+
// Copy every bundled binary so soldr has its daemon and can find
|
|
257
|
+
// crgx via SOLDR_CRGX_LOCAL_DIR and cargo-chef via
|
|
258
|
+
// SOLDR_CARGO_CHEF_LOCAL_DIR.
|
|
256
259
|
// `bin/soldr.js` wires these env vars before exec. The archive
|
|
257
260
|
// layout is flat: all bundled binaries live at the archive root.
|
|
258
261
|
const binaryExt = target.binary.endsWith(".exe") ? ".exe" : "";
|
|
@@ -298,7 +301,7 @@ async function install() {
|
|
|
298
301
|
fs.copyFileSync(manifestSrc, path.join(nativeDir, zccacheContract.MANIFEST_NAME));
|
|
299
302
|
|
|
300
303
|
console.log(
|
|
301
|
-
`soldr: installed ${target.triple} (soldr +
|
|
304
|
+
`soldr: installed ${target.triple} (soldr + daemon + crgx + cargo-chef) into ${nativeDir}`,
|
|
302
305
|
);
|
|
303
306
|
} finally {
|
|
304
307
|
fs.rmSync(tmp, { recursive: true, force: true });
|
|
@@ -100,7 +100,10 @@ assert.strictEqual(
|
|
|
100
100
|
// Default (no libc arg) falls back to detectLibc; on most CI hosts that's
|
|
101
101
|
// gnu. We don't assert the triple here — just that the call resolves.
|
|
102
102
|
assert.ok(install.platformTarget("linux", "x64").triple.startsWith("x86_64-unknown-linux-"));
|
|
103
|
-
assert.
|
|
103
|
+
assert.throws(
|
|
104
|
+
() => install.platformTarget("darwin", "x64"),
|
|
105
|
+
/x86_64-apple-darwin release archives are intentionally not published/,
|
|
106
|
+
);
|
|
104
107
|
assert.strictEqual(install.platformTarget("darwin", "arm64").triple, "aarch64-apple-darwin");
|
|
105
108
|
assert.strictEqual(install.platformTarget("win32", "x64").triple, "x86_64-pc-windows-msvc");
|
|
106
109
|
assert.strictEqual(install.platformTarget("win32", "arm64").triple, "aarch64-pc-windows-msvc");
|
|
@@ -128,8 +131,8 @@ assert.deepStrictEqual(
|
|
|
128
131
|
install.BUNDLED_BINARIES,
|
|
129
132
|
zccacheContract.RELEASE_BUNDLED_BINARIES,
|
|
130
133
|
);
|
|
131
|
-
// zccache is
|
|
132
|
-
//
|
|
134
|
+
// zccache is embedded into soldr/soldr-daemon; no standalone zccache
|
|
135
|
+
// binaries are bundled or downloaded.
|
|
133
136
|
assert.deepStrictEqual(zccacheContract.ZCCACHE_BUNDLED_BINARIES, []);
|
|
134
137
|
assert.strictEqual(zccacheContract.CRGX_BUNDLED_BINARY, "crgx");
|
|
135
138
|
assert.strictEqual(zccacheContract.CARGO_CHEF_BUNDLED_BINARY, "cargo-chef");
|
|
@@ -165,15 +168,18 @@ for (const [key, target] of Object.entries(install.TARGETS || {})) {
|
|
|
165
168
|
);
|
|
166
169
|
}
|
|
167
170
|
|
|
168
|
-
// BUNDLED_BINARIES must include soldr, crgx, and
|
|
169
|
-
//
|
|
170
|
-
// bundled. Locks the per-archive layout contract so a future bundling
|
|
171
|
-
// refactor can't quietly drop a binary.
|
|
171
|
+
// BUNDLED_BINARIES must include soldr, soldr-daemon, crgx, and
|
|
172
|
+
// cargo-chef. It must not require standalone zccache binaries.
|
|
172
173
|
assert.ok(
|
|
173
174
|
Array.isArray(install.BUNDLED_BINARIES),
|
|
174
175
|
"install.BUNDLED_BINARIES must be exported as an array",
|
|
175
176
|
);
|
|
176
|
-
for (const required of [
|
|
177
|
+
for (const required of [
|
|
178
|
+
"soldr",
|
|
179
|
+
"soldr-daemon",
|
|
180
|
+
"crgx",
|
|
181
|
+
"cargo-chef",
|
|
182
|
+
]) {
|
|
177
183
|
assert.ok(
|
|
178
184
|
install.BUNDLED_BINARIES.includes(required),
|
|
179
185
|
`BUNDLED_BINARIES must include "${required}" (got ${JSON.stringify(install.BUNDLED_BINARIES)})`,
|
|
@@ -13,10 +13,10 @@ const ARCHIVE_EXT = CONTRACT.release_archive.extension;
|
|
|
13
13
|
const MANIFEST_NAME = CONTRACT.release_archive.manifest_name;
|
|
14
14
|
const MANIFEST_MIN_SCHEMA_VERSION = CONTRACT.release_archive.manifest_min_schema_version;
|
|
15
15
|
const RELEASE_BUNDLED_BINARIES = Object.freeze([...CONTRACT.release_archive.required_binaries]);
|
|
16
|
-
// zccache is
|
|
17
|
-
// binaries are bundled or downloaded
|
|
16
|
+
// zccache is embedded into soldr/soldr-daemon; no standalone zccache
|
|
17
|
+
// binaries are bundled or downloaded.
|
|
18
18
|
const ZCCACHE_BUNDLED_BINARIES = Object.freeze([
|
|
19
|
-
...(CONTRACT.zccache.required_binaries || []),
|
|
19
|
+
...((CONTRACT.zccache && CONTRACT.zccache.required_binaries) || []),
|
|
20
20
|
]);
|
|
21
21
|
const CRGX_BUNDLED_BINARY = CONTRACT.crgx.required_binaries[0];
|
|
22
22
|
const CARGO_CHEF_BUNDLED_BINARY = CONTRACT.cargo_chef.required_binaries[0];
|
|
@@ -30,6 +30,9 @@ function releaseBinaryNames(platform = process.platform) {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
function zccacheTargetForSoldrTarget(soldrTarget) {
|
|
33
|
+
if (CONTRACT.zccache && CONTRACT.zccache.embedded === true) {
|
|
34
|
+
return soldrTarget;
|
|
35
|
+
}
|
|
33
36
|
if (!soldrTarget.includes("-unknown-linux-")) {
|
|
34
37
|
return soldrTarget;
|
|
35
38
|
}
|
|
@@ -46,6 +49,12 @@ function collectManifestBinaries(manifest) {
|
|
|
46
49
|
if (manifest.soldr && manifest.soldr.binary && manifest.soldr.sha256) {
|
|
47
50
|
binaries.set(manifest.soldr.binary, manifest.soldr.sha256);
|
|
48
51
|
}
|
|
52
|
+
const soldrSidecars = (manifest.soldr && manifest.soldr.sidecars) || [];
|
|
53
|
+
for (const entry of soldrSidecars) {
|
|
54
|
+
if (entry && entry.name && entry.sha256) {
|
|
55
|
+
binaries.set(entry.name, entry.sha256);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
49
58
|
const zccacheBinaries = (manifest.zccache && manifest.zccache.binaries) || [];
|
|
50
59
|
for (const entry of zccacheBinaries) {
|
|
51
60
|
if (entry && entry.name && entry.sha256) {
|
|
@@ -79,8 +88,10 @@ function validateReleaseManifest(manifest, options) {
|
|
|
79
88
|
if (!manifest.soldr || manifest.soldr.target !== soldrTarget) {
|
|
80
89
|
throw new Error(`release manifest soldr.target must be ${soldrTarget}`);
|
|
81
90
|
}
|
|
82
|
-
|
|
83
|
-
|
|
91
|
+
const expectedZccacheTarget = zccacheTargetForSoldrTarget(soldrTarget);
|
|
92
|
+
if (!manifest.zccache || manifest.zccache.target !== expectedZccacheTarget) {
|
|
93
|
+
throw new Error(`release manifest zccache.target must be ${expectedZccacheTarget}`);
|
|
94
|
+
}
|
|
84
95
|
if (!manifest.crgx || manifest.crgx.target !== soldrTarget) {
|
|
85
96
|
throw new Error(`release manifest crgx.target must be ${soldrTarget}`);
|
|
86
97
|
}
|