@zackees/soldr 0.7.89 → 0.7.90
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 +64 -21
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -198,18 +198,56 @@ soldr rustfmt src/main.rs
|
|
|
198
198
|
|
|
199
199
|
## How it works
|
|
200
200
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
201
|
+
soldr is a **chameleon binary**: one executable that picks its role from `argv[1]` on every invocation. Three roles:
|
|
202
|
+
|
|
203
|
+
```mermaid
|
|
204
|
+
flowchart TD
|
|
205
|
+
A["soldr <argv[1]> ..."] --> B{"classify argv[1]"}
|
|
206
|
+
B -->|"path to rustc"| C["<b>Cache mode</b><br/>invoked as RUSTC_WRAPPER by cargo.<br/>hash inputs, query cache,<br/>forward to real rustc on miss."]
|
|
207
|
+
B -->|"built-in verb<br/>cargo · rustup · status · cache · ..."| D["<b>Dispatch mode</b><br/>run internal handler,<br/>or exec a toolchain binary<br/>resolved via rustup."]
|
|
208
|
+
B -->|"anything else<br/>maturin · cargo-nextest · cbindgen · ..."| E["<b>Tool-fetch mode</b><br/>resolve via known_tools,<br/>download from GitHub Releases,<br/>exec the fetched binary."]
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
When you run `soldr cargo build`, the two other modes both come into play. soldr acts as the dispatch-mode front door, then cargo re-invokes soldr once per crate as the RUSTC_WRAPPER — that second soldr is the cache-mode instance that talks to the managed zccache daemon:
|
|
212
|
+
|
|
213
|
+
```mermaid
|
|
214
|
+
sequenceDiagram
|
|
215
|
+
autonumber
|
|
216
|
+
participant U as User
|
|
217
|
+
participant S1 as soldr (front door)
|
|
218
|
+
participant C as cargo
|
|
219
|
+
participant S2 as soldr (RUSTC_WRAPPER)
|
|
220
|
+
participant Z as zccache daemon
|
|
221
|
+
participant R as real rustc
|
|
222
|
+
|
|
223
|
+
U->>S1: soldr cargo build --release
|
|
224
|
+
S1->>S1: dispatch mode: cargo verb
|
|
225
|
+
S1->>Z: start managed zccache if needed
|
|
226
|
+
S1->>C: exec cargo (RUSTC_WRAPPER=soldr)
|
|
227
|
+
loop per crate
|
|
228
|
+
C->>S2: soldr [path-to-rustc] [args]
|
|
229
|
+
S2->>Z: query cache (hash of inputs)
|
|
230
|
+
alt cache hit
|
|
231
|
+
Z-->>S2: cached artifact
|
|
232
|
+
S2-->>C: emit artifact, exit 0
|
|
233
|
+
else cache miss
|
|
234
|
+
Z->>R: forward to rustc
|
|
235
|
+
R-->>Z: fresh artifact
|
|
236
|
+
Z->>Z: store keyed by input hash
|
|
237
|
+
Z-->>S2: artifact
|
|
238
|
+
S2-->>C: emit artifact, exit 0
|
|
239
|
+
end
|
|
240
|
+
end
|
|
241
|
+
C-->>S1: build complete
|
|
242
|
+
S1-->>U: exit
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
Tool fetches are much simpler — no cargo, no rustc, no wrapper handshake:
|
|
209
246
|
|
|
247
|
+
```text
|
|
210
248
|
soldr maturin build --release
|
|
211
|
-
+-- maturin cached?
|
|
212
|
-
+-- not cached?
|
|
249
|
+
+-- maturin cached? --> run instantly
|
|
250
|
+
+-- not cached? --> download pre-built binary (2s) --> run
|
|
213
251
|
```
|
|
214
252
|
|
|
215
253
|
## Linker speed (the other half of fast CI)
|
|
@@ -256,25 +294,30 @@ If you also have many separate test binaries, consider consolidating them under
|
|
|
256
294
|
|
|
257
295
|
## Architecture
|
|
258
296
|
|
|
297
|
+
**Monocrate.** A single Rust crate `soldr-cli` under `crates/soldr-cli/`, with four module trees inside it. The earlier four-crate workspace (`soldr-core` / `soldr-fetch` / `soldr-cache` / `soldr-cli`) was collapsed in 2026-05; the regression guard `crates/soldr-cli/tests/monocrate_guard.rs` fails the build if anyone reintroduces a second crate.
|
|
298
|
+
|
|
259
299
|
```
|
|
260
300
|
soldr/
|
|
261
301
|
|-- crates/
|
|
262
|
-
|
|
|
263
|
-
|
|
|
264
|
-
| |--
|
|
265
|
-
|
|
|
266
|
-
|--
|
|
302
|
+
| `-- soldr-cli/
|
|
303
|
+
| |-- src/
|
|
304
|
+
| | |-- core/ # Shared types, config, cache paths (formerly soldr-core)
|
|
305
|
+
| | |-- fetch/ # Binary resolution + download (formerly soldr-fetch)
|
|
306
|
+
| | |-- cache_lib/ # RUSTC_WRAPPER + daemon IPC (formerly soldr-cache)
|
|
307
|
+
| | `-- main.rs + cli/ # Mode detection, dispatch, cargo front door
|
|
308
|
+
| `-- tests/
|
|
309
|
+
|-- src/soldr/ # Python package (maturin bin bindings)
|
|
267
310
|
`-- tests/
|
|
268
311
|
```
|
|
269
312
|
|
|
270
|
-
|
|
|
313
|
+
| Module | Role |
|
|
271
314
|
|---|---|
|
|
272
|
-
| `
|
|
273
|
-
| `
|
|
274
|
-
| `
|
|
275
|
-
| `
|
|
315
|
+
| `src/core/` | Shared types, config (`~/.soldr/config.toml`), target-triple resolution (MSVC default on Windows), cache paths, error types. No I/O beyond config files. |
|
|
316
|
+
| `src/fetch/` | Binary resolution. `known_tools` registry, `trust` (SHA-256 pins + `SOLDR_TRUST_MODE` enforcement), rustup auto-bootstrap, resolution chain (local cache → repo lookup → GitHub Releases → extract). |
|
|
317
|
+
| `src/cache_lib/` | `RUSTC_WRAPPER` mode: hash inputs (blake3), check `~/.soldr/cache/`, daemon IPC (Unix socket / Windows named pipe), LRU eviction, `soldr save` / `soldr load` archive transport, auto-GC. |
|
|
318
|
+
| `src/main.rs` + cli/ | Mode detection (chameleon dispatch), clap for built-ins, exec for tool fetch, cargo front door (`soldr cargo ...`). |
|
|
276
319
|
|
|
277
|
-
|
|
320
|
+
A thin `src/lib.rs` re-exports `pub mod core; pub mod fetch; pub mod cache_lib;` so the library integration tests can keep `use soldr_cli::core::*`-style imports. This is not a supported public Rust library API.
|
|
278
321
|
|
|
279
322
|
## Prior art
|
|
280
323
|
|