Adding Command Line Tools Installer (for all versions) #378
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.
Summary
This supersedes #350 from @marcomorain as I used it as a base to work from on this idea.
The idea here is that while we can currently install the latest version of the CLI tools, this only installs the latest version via
softwareupdate
- this will always be the latest stable version.Where we are installing beta versions of Xcode, we may wish to install the beta CLI tools that go along with them. This is especially true in the beta images we create at CircleCI.
Usage
xcversion tools
will list all version of CLI tools available to download and install:xcversion tools --install="Command Line Tools for Xcode x.x.x"
will install the specified version (e.g.,xcversion tools --install="Command Line Tools for Xcode 11.2 beta 2"
)Implementation
This is piggybacking on the implementation for grabbing Xcode information and downloading it.
Listing the tools will ping the api and parse it, saving a copy of the response to the cache file.
The installation will use the info from the api to find and download the specified tools version. It will then proceed to install by mounting the dmg and installing the pkg. This has a simple check to compare the tools version number we have downloaded to that the version which is installed after the install is complete, just as an extra step of verification (this check will only work on macOS 10.9 and above for now due to the change in the way the CLI tools are packaged)
This will possibly need merging with the current
cli.rb
and I intend to look into that soon, but thought I would open this PR now to get any feedback!