Skip to content

Let a file need several components (installer.shared_files) - #37

Merged
leifiyoo merged 6 commits into
mainfrom
feat/component-combine-all
Nov 26, 2026
Merged

leifiyoo merged 6 commits into
mainfrom
feat/component-combine-all

Conversation

@leifiyoo

Copy link
Copy Markdown
Member

Closes #36.

What

A new setting, installer.shared_files, for components whose patterns overlap:

  • "first" (default): unchanged. A file belongs to the first component that matches it.
  • "all": a file belongs to every component that matches it and is installed only when all of them are ticked.

That gives the layout from the issue: one "Applications" box, one "Tools" box and one box per vendor, instead of vendors × kinds.

[installer]
shared_files = "all"

[[components]]
id = "tools"
title = "Tools"
files = ["vendor*/tools/**"]

[[components]]
id = "vendor1"
title = "Vendor 1"
files = ["vendor1/**"]
default = true

The issue suggested [files] combine = "all". It lives under [installer] instead, because a macOS-only config has no [files] section.

How

  • The manifest keeps component and adds an optional also_needs list, left out when empty, so existing configs build the same manifest.
  • Choices::installs requires every claim. Unpacking, updates, removal of stale files, free-space and size figures, shortcuts and ZIP profiles all go through it.
  • [[run]] steps whose program isn't installed are skipped.
  • Downloaded components work too: a shared file travels in the download of the claiming component that has one, and is fetched only when all its claims are ticked.
  • bach check and bach inspect show every claim. bach build --msi refuses shared files, since an MSI file belongs to one feature.

Compatibility

FORMAT_VERSION stays 1 on purpose. The updater of an installed app reads the new setup file's manifest with its old code, so a new format number would stop existing installs from updating. The one gap: an online installer built by an older Bach ignores also_needs and goes by one component per file. The docs say to publish the newly built web installer with the release that first uses "all".

Also in here

bach inspect --json prints platform, which schema/bach-output.schema.json didn't list. json_output_is_one_object_with_stable_fields failed on a checkout with a built runtime because of it. Fixed in its own commit.

Checks

  • cargo test --workspace, cargo clippy --workspace --all-targets -- -D warnings and cargo fmt --check pass on Windows.
  • Not run: a real install. a_silent_install_adds_and_removes_shared_files_with_the_boxes in crates/cli/tests/components.rs is #[ignore] like the other install tests: cargo test -p bach-cli --test components -- --ignored.
  • No window code changed, so there are no new screenshots.

The attachment in the issue was not downloaded or opened; this is based on the issue text.

🤖 Generated with Claude Code

@leifiyoo
leifiyoo merged commit 92fe5c9 into main Nov 26, 2026
7 checks passed
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.

[Feature Request] Components conditions

1 participant