-
Notifications
You must be signed in to change notification settings - Fork 987
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
modify xcodewrapper to do a runtime version check
- Loading branch information
1 parent
b907881
commit 561a0da
Showing
2 changed files
with
51 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
{ stdenv, lib, writeShellScriptBin }: | ||
{ versions ? [ "15.1" ] | ||
, xcodeBaseDir ? "/Applications/Xcode.app" }: | ||
|
||
assert stdenv.isDarwin; | ||
|
||
let | ||
xcodebuildPath = "${xcodeBaseDir}/Contents/Developer/usr/bin/xcodebuild"; | ||
|
||
xcodebuildWrapper = writeShellScriptBin "xcodebuild" '' | ||
currentVer="$(${xcodebuildPath} -version | awk 'NR==1{print $2}')" | ||
wrapperVers=(${lib.concatStringsSep " " versions}) | ||
for ver in "''${wrapperVers[@]}"; do | ||
if [[ "$currentVer" == "$ver" ]]; then | ||
exec "${xcodebuildPath}" "$@" | ||
exit 0 | ||
fi | ||
done | ||
echo "The installed Xcode version ($currentVer) does not match any of the allowed versions: ${lib.concatStringsSep ", " versions}" | ||
echo "Please update your local Xcode installation to match one of the allowed versions" | ||
exit 1 | ||
''; | ||
in | ||
stdenv.mkDerivation { | ||
pname = "xcode-wrapper-plus"; | ||
version = lib.concatStringsSep "," versions; | ||
# Fails in sandbox. Use `--option sandbox relaxed` or `--option sandbox false`. | ||
__noChroot = true; | ||
buildCommand = '' | ||
mkdir -p $out/bin | ||
cd $out/bin | ||
ln -s "${xcodebuildWrapper}/bin/xcode-select" | ||
ln -s /usr/bin/security | ||
ln -s /usr/bin/codesign | ||
ln -s /usr/bin/xcrun | ||
ln -s /usr/bin/plutil | ||
ln -s /usr/bin/clang | ||
ln -s /usr/bin/lipo | ||
ln -s /usr/bin/file | ||
ln -s /usr/bin/rev | ||
ln -s "${xcodebuildWrapper}/bin/xcodebuild" | ||
ln -s "${xcodeBaseDir}/Contents/Developer/Applications/Simulator.app/Contents/MacOS/Simulator" | ||
cd .. | ||
ln -s "${xcodeBaseDir}/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs" | ||
''; | ||
} |