Repository navigation
Detect the Xcode toolchain outside its default location - #35
Merged
Merged
Conversation
pkgdown's Bootstrap CSS sets `main img { height: auto }`, which overrides
the HTML height attribute, so the hex logo rendered at its intrinsic
400x462 instead of the intended 170px tall. Setting width instead
survives the cascade and renders 150x173, matching the other packages.
is_xcode_cli_installed() and is_xcode_app_installed() compared the active developer directory against a single hardcoded path with identical(), so both returned FALSE whenever anything else was selected, even with a working toolchain installed. A versioned bundle such as /Applications/Xcode_16.4.app/Contents/Developer is the normal multi-Xcode layout and is what every GitHub-hosted macOS runner selects, so this was live on this package's own CI. macos_rtools_install() treated the two predicates as exhaustive and would start a 10-15 minute softwareupdate install of Command Line Tools that were already present. Split the conflated question in three, following Homebrew: CLT package presence, any-Xcode-installed, and whether a compiler is actually reachable via xcrun. The install step now gates on the last of these. Path comparisons go through normalize_developer_dir(), and DEVELOPER_DIR is honored where it was previously ignored. Keep the destructive path keyed on package presence. Widening is_xcode_cli_installed() to mean "a usable toolchain is selected" would let a machine with Xcode selected delete the Command Line Tools. Add xcode_toolchains() to list every selectable developer directory, and let xcode_cli_switch() take one rather than always forcing the CLT.
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.
The problem
is_xcode_cli_installed()andis_xcode_app_installed()compared the active developer directory against a single hardcoded path withidentical(), so both returnedFALSEwhenever anything else was selected, even with a working toolchain installed:A versioned bundle like that is the normal multi-Xcode layout, and it is what every GitHub-hosted macOS runner selects, so this was live on this package's own CI.
macos_rtools_install()treated the two predicates as exhaustive and would start asoftwareupdateinstall of Command Line Tools that were already present.The fix
Split the conflated question in three, following Homebrew:
is_xcode_cli_installed()is_xcode_app_installed()is_xcode_toolchain_usable()The install step gates on the last of these, which is what determines whether R can build a package, since R is configured with a bare
clangthat resolves through the active developer directory. It now reports which toolchain is active instead of assuming a full Xcode at/Applications/Xcode.app, and reports a failure rather than "no action needed" when the tools are on disk but nothing can compile.Path comparisons go through
normalize_developer_dir(), andDEVELOPER_DIRis honored where the package previously did not account for it.The destructive path stays keyed on package presence. Widening
is_xcode_cli_installed()to mean "a usable toolchain is selected" would let a machine with Xcode selected delete the Command Line Tools.Listing the available toolchains
xcode_toolchains()reports every developer directoryxcode-selectcould be pointed at, found by bundle identifier so a renamed or relocated install is still detected:xcode_cli_switch()takes apathfrom that table rather than always forcing the Command Line Tools. The target is validated, and the selection being replaced is named.Also in here
macos_rtools_uninstall()no longer reports "Xcode CLI: Successfully removed" when nothing was removed.xcode-select --version, which reports the version ofxcode-selectitself and never changes with the toolchain.main img { height: auto }overrides the HTML height attribute, so the hex is sized by width instead.Breaking changes are listed in NEWS.