Skip to content

feat(prepare): accept comma-separated --target list (image-bake friendly)#925

Merged
zackees merged 1 commit into
mainfrom
feat/prepare-target-list
Jun 22, 2026
Merged

feat(prepare): accept comma-separated --target list (image-bake friendly)#925
zackees merged 1 commit into
mainfrom
feat/prepare-target-list

Conversation

@zackees

@zackees zackees commented Jun 22, 2026

Copy link
Copy Markdown
Owner

Summary

soldr prepare --target all requires a workspace Cargo.toml with [workspace.metadata.soldr].targets populated. Docker-image bake steps don't have one mounted yet — the source volume is mounted at docker run time, not at docker build time.

Extend --target to accept three shapes:

  • <triple> — single triple (unchanged)
  • <a>,<b>,<c> — explicit comma-separated list (new)
  • all — workspace-metadata resolution (unchanged)

Why this matters

The new comma-separated form lets a Dockerfile bake the full cross-toolchain into the image without inventing a placeholder Cargo.toml:

RUN soldr prepare --target \
      x86_64-pc-windows-msvc,aarch64-apple-darwin,x86_64-unknown-linux-musl,...

That's exactly what the upcoming examples/docker-cross-all/ recipe (#924) needs — it has no source volume mounted at image bake time.

Implementation

  • Parsing in prepare_cmd::parse_target_arg returns ParsedTargetArg::All or ParsedTargetArg::Explicit(Vec<String>).
  • main.rs dispatches on the enum: Allresolve_all_targets(), Explicit → use as-is.
  • Whitespace around comma-separated entries is trimmed; leading / trailing / consecutive commas are silently dropped (copy-paste tolerance); an all-empty list errors instead of producing a zero-target run.

Tests

Six new unit tests cover the parser. Existing CLI surface unchanged; the legacy single-triple and all shapes pass through identical to before.

running 6 tests
test prepare_cmd::tests::parse_target_arg_all_is_sentinel ... ok
test prepare_cmd::tests::parse_target_arg_single_triple ... ok
test prepare_cmd::tests::parse_target_arg_drops_empty_entries ... ok
test prepare_cmd::tests::parse_target_arg_comma_separated ... ok
test prepare_cmd::tests::parse_target_arg_trims_whitespace ... ok
test prepare_cmd::tests::parse_target_arg_all_empty_errors ... ok

Refs #914.

🤖 Generated with Claude Code

…dly)

`soldr prepare --target all` requires a workspace `Cargo.toml` with
`[workspace.metadata.soldr].targets` populated. Docker-image bake
steps don't have one mounted yet — the source volume is mounted at
`docker run` time, not at `docker build` time.

Extend `--target` to accept three shapes:

  * `<triple>`              — single triple (unchanged)
  * `<a>,<b>,<c>`           — explicit comma-separated list (NEW)
  * `all`                   — workspace-metadata resolution (unchanged)

The new comma-separated form lets a Dockerfile bake the full cross-
toolchain into the image without inventing a placeholder Cargo.toml:

  RUN soldr prepare --target \
        x86_64-pc-windows-msvc,aarch64-apple-darwin,...

Parsing lives in `prepare_cmd::parse_target_arg` so it's unit-
testable; main.rs dispatches on the `ParsedTargetArg` enum. Whitespace
around comma-separated entries is trimmed, leading/trailing/
consecutive commas are silently dropped (copy-paste tolerance), and
an all-empty list errors instead of producing a zero-target run.

Six new unit tests cover the parser. No existing CLI surface
changes; the legacy single-triple and `all` shapes pass through
unchanged.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
zackees added a commit that referenced this pull request Jun 22, 2026
The seed/Cargo.toml workaround existed only so `soldr prepare --target
all` had a `[workspace.metadata.soldr].targets` table to read from at
image-build time. Switching to the explicit comma-separated form
(soldr PR #925) lets the bake step pass the 8 triples directly and
removes the seed manifest entirely.

Now requires a soldr release containing #925. Bump SOLDR_VERSION when
that lands.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@zackees zackees merged commit 7b397d5 into main Jun 22, 2026
28 of 30 checks passed
zackees added a commit that referenced this pull request Jun 22, 2026
Replace the `pipx install soldr==<ver>` step with a two-stage build:

  Stage 1 — debian + rust 1.94.1 + git clone soldr at `SOLDR_GIT_REF`
            (default main) + `cargo build --release`
  Stage 2 — runtime image with the built binary copied in + the
            existing soldr bootstrap / toolchain install / prepare
            sequence

Avoids the PyPI release cadence — the example always builds against
latest main (which now includes #925's comma-separated --target
form). Override with `--build-arg SOLDR_GIT_REF=<sha|branch>` to
pin a specific revision.

Image grows by the rust-toolchain layer in stage 1 but stage 2
remains lean; the final image carries only the soldr binary.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant