Replace xcodeenv with new implementation
This commit is contained in:
parent
74750dc67d
commit
907216a57d
@ -1,14 +1,13 @@
|
||||
{stdenv, xcodewrapper}:
|
||||
{stdenv, composeXcodeWrapper}:
|
||||
{ name
|
||||
, src
|
||||
, sdkVersion ? "11.2"
|
||||
, sdkVersion ? "11.3"
|
||||
, target ? null
|
||||
, configuration ? null
|
||||
, scheme ? null
|
||||
, sdk ? null
|
||||
, xcodeFlags ? ""
|
||||
, release ? false
|
||||
, codeSignIdentity ? null
|
||||
, certificateFile ? null
|
||||
, certificatePassword ? null
|
||||
, provisioningProfile ? null
|
||||
@ -18,13 +17,12 @@
|
||||
, enableWirelessDistribution ? false
|
||||
, installURL ? null
|
||||
, bundleId ? null
|
||||
, version ? null
|
||||
, title ? null
|
||||
, meta ? {}
|
||||
}:
|
||||
, appVersion ? null
|
||||
, ...
|
||||
}@args:
|
||||
|
||||
assert release -> codeSignIdentity != null && certificateFile != null && certificatePassword != null && provisioningProfile != null && signMethod != null;
|
||||
assert enableWirelessDistribution -> installURL != null && bundleId != null && version != null && title != null;
|
||||
assert release -> certificateFile != null && certificatePassword != null && provisioningProfile != null && signMethod != null;
|
||||
assert enableWirelessDistribution -> installURL != null && bundleId != null && appVersion != null;
|
||||
|
||||
let
|
||||
# Set some default values here
|
||||
@ -46,11 +44,15 @@ let
|
||||
security default-keychain -s login.keychain
|
||||
security delete-keychain $keychainName
|
||||
'';
|
||||
|
||||
xcodewrapperFormalArgs = builtins.functionArgs composeXcodeWrapper;
|
||||
xcodewrapperArgs = builtins.intersectAttrs xcodewrapperFormalArgs args;
|
||||
xcodewrapper = composeXcodeWrapper xcodewrapperArgs;
|
||||
|
||||
extraArgs = removeAttrs args ([ "name" "scheme" "xcodeFlags" "release" "certificateFile" "certificatePassword" "provisioningProfile" "signMethod" "generateIPA" "generateXCArchive" "enableWirelessDistribution" "installURL" "bundleId" "version" ] ++ builtins.attrNames xcodewrapperFormalArgs);
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
name = stdenv.lib.replaceChars [" "] [""] name;
|
||||
inherit src;
|
||||
inherit meta;
|
||||
stdenv.mkDerivation ({
|
||||
name = stdenv.lib.replaceChars [" "] [""] name; # iOS app names can contain spaces, but in the Nix store this is not allowed
|
||||
buildInputs = [ xcodewrapper ];
|
||||
buildPhase = ''
|
||||
${stdenv.lib.optionalString release ''
|
||||
@ -118,8 +120,9 @@ stdenv.mkDerivation {
|
||||
echo "file binary-dist \"$(echo $out/*.ipa)\"" > $out/nix-support/hydra-build-products
|
||||
|
||||
${stdenv.lib.optionalString enableWirelessDistribution ''
|
||||
appname=$(basename $out/*.ipa .ipa)
|
||||
sed -e "s|@INSTALL_URL@|${installURL}?bundleId=${bundleId}\&version=${version}\&title=$appname|" ${./install.html.template} > $out/$appname.html
|
||||
# Add another hacky build product that enables wireless adhoc installations
|
||||
appname="$(basename "$out/*.ipa" .ipa)"
|
||||
sed -e "s|@INSTALL_URL@|${installURL}?bundleId=${bundleId}\&version=${appVersion}\&title=$appname|" ${./install.html.template} > $out/$appname.html
|
||||
echo "doc install \"$out/$appname.html\"" >> $out/nix-support/hydra-build-products
|
||||
''}
|
||||
''}
|
||||
@ -136,4 +139,4 @@ stdenv.mkDerivation {
|
||||
failureHook = stdenv.lib.optionalString release deleteKeychain;
|
||||
|
||||
installPhase = "true";
|
||||
}
|
||||
} // extraArgs)
|
||||
|
@ -1,4 +1,7 @@
|
||||
{stdenv, version, xcodeBaseDir}:
|
||||
{stdenv}:
|
||||
{version ? "9.3", xcodeBaseDir ? "/Applications/Xcode.app"}:
|
||||
|
||||
assert stdenv.isDarwin;
|
||||
|
||||
stdenv.mkDerivation {
|
||||
name = "xcode-wrapper-"+version;
|
||||
@ -9,6 +12,7 @@ stdenv.mkDerivation {
|
||||
ln -s /usr/bin/security
|
||||
ln -s /usr/bin/codesign
|
||||
ln -s /usr/bin/xcrun
|
||||
ln -s /usr/bin/plutil
|
||||
ln -s "${xcodeBaseDir}/Contents/Developer/usr/bin/xcodebuild"
|
||||
ln -s "${xcodeBaseDir}/Contents/Developer/Applications/Simulator.app/Contents/MacOS/Simulator"
|
||||
|
@ -1,15 +1,15 @@
|
||||
{stdenv, version ? "9.2", xcodeBaseDir ? "/Applications/Xcode.app"}:
|
||||
{stdenv}:
|
||||
|
||||
rec {
|
||||
xcodewrapper = import ./xcodewrapper.nix {
|
||||
inherit stdenv version xcodeBaseDir;
|
||||
composeXcodeWrapper = import ./compose-xcodewrapper.nix {
|
||||
inherit stdenv;
|
||||
};
|
||||
|
||||
buildApp = import ./build-app.nix {
|
||||
inherit stdenv xcodewrapper;
|
||||
inherit stdenv composeXcodeWrapper;
|
||||
};
|
||||
|
||||
simulateApp = import ./simulate-app.nix {
|
||||
inherit stdenv xcodewrapper;
|
||||
inherit stdenv composeXcodeWrapper;
|
||||
};
|
||||
}
|
||||
|
@ -1,6 +1,13 @@
|
||||
{stdenv, xcodewrapper}:
|
||||
{name, bundleId, app}:
|
||||
{stdenv, composeXcodeWrapper}:
|
||||
{name, app ? null, bundleId ? null, ...}@args:
|
||||
|
||||
assert app != null -> bundleId != null;
|
||||
|
||||
let
|
||||
xcodewrapperArgs = builtins.intersectAttrs (builtins.functionArgs composeXcodeWrapper) args;
|
||||
|
||||
xcodewrapper = composeXcodeWrapper xcodewrapperArgs;
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
name = stdenv.lib.replaceChars [" "] [""] name;
|
||||
buildCommand = ''
|
||||
@ -23,6 +30,7 @@ stdenv.mkDerivation {
|
||||
# Open the simulator instance
|
||||
open -a "$(readlink "${xcodewrapper}/bin/Simulator")" --args -CurrentDeviceUDID $udid
|
||||
|
||||
${stdenv.lib.optionalString (app != null) ''
|
||||
# Copy the app and restore the write permissions
|
||||
appTmpDir=$(mktemp -d -t appTmpDir)
|
||||
cp -r "$(echo ${app}/*.app)" "$appTmpDir"
|
||||
@ -43,5 +51,6 @@ stdenv.mkDerivation {
|
||||
EOF
|
||||
|
||||
chmod +x $out/bin/run-test-simulator
|
||||
''}
|
||||
'';
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user