fix: stop warning about invalid Linux target on every default build#1287
Open
LuisMIguelFurlanettoSousa wants to merge 1 commit into
Open
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1286
What
mergeLinuxConfigchecked whether the entire comma-separatedoptions.targetsstring 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 leavingbundle.targetsuntouched.Change
bin/utils/targets.ts— add a pureresolveLinuxBundleTargets(targets)helper that parses the list via the already-testedfilterLinuxTargets, mapszst→deb(zst is repacked from the deb payload), dedupes, and reportshasValidTarget. 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
LinuxBuilderper-target--bundlesloop, not bybundle.targets. The Debian default resolves to['deb','appimage'], which already matchessrc-tauri/tauri.linux.conf.json. On RPM distros it now correctly resolves to the rpm/appimage set instead of leaving the deb default.Verify
Full suite: 210 passed;
pnpm run format:checkclean.