Skip to content

Standardize Xcode bundle naming with a configurable separator#156

Merged
Redth merged 1 commit intomainfrom
redth/xcode-bundle-separator-setting
Apr 21, 2026
Merged

Standardize Xcode bundle naming with a configurable separator#156
Redth merged 1 commit intomainfrom
redth/xcode-bundle-separator-setting

Conversation

@Redth
Copy link
Copy Markdown
Owner

@Redth Redth commented Apr 19, 2026

Sherpa's managed Xcode bundles currently use a custom Xcode_<version>_<build>.app format, which doesn't match GitHub's runner-images (Xcode_<version>.app) or the xcodes CLI (Xcode-<version>.app). This PR standardizes on the common shape and lets users pick which separator they prefer. Refs #155.

What changed

  • Drop the build-number suffix from the default name. Managed bundles are now Xcode<sep><version>.app (e.g. Xcode_26.3.app). The build number is appended only when needed to disambiguate two installs of the same marketing version, and a numeric suffix is the final fallback.
  • New XcodeBundleSeparator preference (_ default, - alternative) surfaced as a dropdown in Settings under the Xcode section.
  • Migration flow when the setting changes. The UI computes a rename plan across /Applications, shows a confirm dialog listing the exact renames, then runs an admin-elevated shell script to mv each bundle and retarget /Applications/Xcode.app via xcode-select if its symlink target was one of the renamed bundles.
  • CLI parity. XcodeCommand threads the same separator through its helpers, and a new maui-sherpa apple xcode normalize-names subcommand exposes the planner with --separator and --dry-run flags for scripted use.
  • Tests. XcodeServiceTests now has parameterized coverage for both separators, the plain-name / build-suffix / numeric-suffix collision ladder, and four normalization-plan scenarios (no-op, cross-format rename, symlink retarget, and collision-via-build-number when two installs land in the same slot).

Notes for reviewers

  • The selection and install flows in XcodeService (CreateSelectionPlan, InstallXcodeAsync, SelectXcodeAsync) all take the separator as a parameter now; SelectXcodeAsync reads the current user pref via GetBundleSeparatorAsync() so callers don't need to know about it.
  • ComputeNormalizationPlan is kept as a pure static so it's easy to unit test; the async GetNormalizationPlanAsync / NormalizeBundleNamesAsync are thin wrappers over the filesystem and the existing RunElevatedShellScriptAsync helper.
  • The managed-bundle heuristic (LooksLikeManagedBundleName) intentionally skips plain Xcode.app (Mac App Store) and Xcodes.app so those are never renamed. Only bundles starting with Xcode_ or Xcode- are considered.
  • build.yml already assumes the Xcode_<version>.app shape in a few places, so the underscore default is consistent with CI expectations.
  • All 307 Core tests pass; the MAUI macOS head also builds cleanly.

Closes #155.

Adds a user-selectable separator ('_' or '-') controlling managed Xcode
bundle names, and drops the build-number suffix from the default format
(issue #155). Build number is now appended only on collision.

- New AppPreferences.XcodeBundleSeparator preference (default '_').
- XcodeService: thread separator through name generation, install, and
  selection flows. Default name is Xcode<sep><version>.app; collision
  falls back to Xcode<sep><version><sep><build>.app, then numeric suffix.
- New IXcodeService.GetNormalizationPlanAsync + NormalizeBundleNamesAsync
  so the UI can offer to rename existing bundles when the setting
  changes, retargeting /Applications/Xcode.app if needed via admin shell.
- Settings.razor: new separator dropdown with confirm-and-normalize
  migration flow.
- CLI parity in XcodeCommand, plus a new 'apple xcode normalize-names'
  subcommand with --separator and --dry-run.
- Parameterized tests for both separators, collision handling, and
  normalization planning (symlink retarget, collisions, no-op cases).

Refs #155

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Redth Redth merged commit 5102cd3 into main Apr 21, 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.

Standardize managed Xcode bundle naming to match GitHub runner-images / xcodes conventions

1 participant