Skip to content

fix: stop warning about invalid Linux target on every default build#1287

Open
LuisMIguelFurlanettoSousa wants to merge 1 commit into
tw93:mainfrom
LuisMIguelFurlanettoSousa:fix/linux-default-target-warning
Open

fix: stop warning about invalid Linux target on every default build#1287
LuisMIguelFurlanettoSousa wants to merge 1 commit into
tw93:mainfrom
LuisMIguelFurlanettoSousa:fix/linux-default-target-warning

Conversation

@LuisMIguelFurlanettoSousa

Copy link
Copy Markdown

Closes #1286

What

mergeLinuxConfig checked whether the entire comma-separated options.targets string was a single allow-list member. The distro-aware default is multi-valued (deb,appimage / rpm,appimage), so the check always failed and every default Linux build printed ✼ The target must be one of ..., the default 'deb' will be used — while leaving bundle.targets untouched.

Change

  • bin/utils/targets.ts — add a pure resolveLinuxBundleTargets(targets) helper that parses the list via the already-tested filterLinuxTargets, maps zstdeb (zst is repacked from the deb payload), dedupes, and reports hasValidTarget. Mirrors the repo's existing "exported for testing" pattern (buildWindowConfigOverrides).
  • bin/helpers/merge.ts — use the helper; warn only when no known target is present.
  • tests/unit/builders.test.ts — unit tests for the helper (default multi-target, RPM default, zst→deb mapping, dedupe, no-valid-target).
  • dist/cli.js — rebuilt.

No build-output change

Actual built formats are driven by the LinuxBuilder per-target --bundles loop, not by bundle.targets. The Debian default resolves to ['deb','appimage'], which already matches src-tauri/tauri.linux.conf.json. On RPM distros it now correctly resolves to the rpm/appimage set instead of leaving the deb default.

Verify

npx vitest run tests/unit/builders.test.ts

Full suite: 210 passed; pnpm run format:check clean.

mergeLinuxConfig validated options.targets by checking whether the whole
comma-separated string was a member of a single-token allow-list. The
distro-aware default is multi-valued ('deb,appimage' on Debian/Ubuntu,
'rpm,appimage' on RPM distros), so it never matched and every default Linux
build printed a misleading "The target must be one of ..., the default 'deb'
will be used" warning while silently leaving bundle.targets at the config
default.

Extract a pure resolveLinuxBundleTargets() helper (mirroring the existing
exported-for-testing pattern), validate the parsed target list via the
already-tested filterLinuxTargets, and only warn when no known target is
present. Actual built formats are still driven by the LinuxBuilder
--bundles loop, so build output is unchanged; the Debian default resolves to
the same ['deb','appimage'] already in tauri.linux.conf.json. Adds unit
tests for the helper.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant