about summary refs log tree commit diff
path: root/pkgs/development/mobile
diff options
context:
space:
mode:
authorSander van der Burg <svanderburg@gmail.com>2018-03-22 14:33:15 +0100
committerSander van der Burg <svanderburg@gmail.com>2018-03-22 14:33:15 +0100
commitf2bd9d4745041fe0c0a49803094dd625ebd27342 (patch)
tree5578b3f3407f90bcb246c38b86d6d70395716a51 /pkgs/development/mobile
parentb21e398a75b53159ca7b2817da79bd65860950d4 (diff)
downloadnixlib-f2bd9d4745041fe0c0a49803094dd625ebd27342.tar
nixlib-f2bd9d4745041fe0c0a49803094dd625ebd27342.tar.gz
nixlib-f2bd9d4745041fe0c0a49803094dd625ebd27342.tar.bz2
nixlib-f2bd9d4745041fe0c0a49803094dd625ebd27342.tar.lz
nixlib-f2bd9d4745041fe0c0a49803094dd625ebd27342.tar.xz
nixlib-f2bd9d4745041fe0c0a49803094dd625ebd27342.tar.zst
nixlib-f2bd9d4745041fe0c0a49803094dd625ebd27342.zip
xcodeenv: replace deprecated package application procedure by the new export archive operation
Diffstat (limited to 'pkgs/development/mobile')
-rw-r--r--pkgs/development/mobile/xcodeenv/build-app.nix30
1 files changed, 26 insertions, 4 deletions
diff --git a/pkgs/development/mobile/xcodeenv/build-app.nix b/pkgs/development/mobile/xcodeenv/build-app.nix
index d208f26ab670..436b55631b6f 100644
--- a/pkgs/development/mobile/xcodeenv/build-app.nix
+++ b/pkgs/development/mobile/xcodeenv/build-app.nix
@@ -12,6 +12,7 @@
 , certificateFile ? null
 , certificatePassword ? null
 , provisioningProfile ? null
+, signMethod ? null
 , generateIPA ? false
 , generateXCArchive ? false
 , enableWirelessDistribution ? false
@@ -21,7 +22,7 @@
 , title ? null
 }:
 
-assert release -> codeSignIdentity != null && certificateFile != null && certificatePassword != null && provisioningProfile != null;
+assert release -> codeSignIdentity != null && certificateFile != null && certificatePassword != null && provisioningProfile != null && signMethod != null;
 assert enableWirelessDistribution -> installURL != null && bundleId != null && version != null && title != null;
 
 let
@@ -82,13 +83,34 @@ stdenv.mkDerivation {
     # Do the building
     export LD=clang # To avoid problem with -isysroot parameter that is unrecognized by the stock ld. Comparison with an impure build shows that it uses clang instead. Ugly, but it works
 
-    xcodebuild -target ${_target} -configuration ${_configuration} ${stdenv.lib.optionalString (scheme != null) "-scheme ${scheme}"} -sdk ${_sdk} TARGETED_DEVICE_FAMILY="1, 2" ONLY_ACTIVE_ARCH=NO CONFIGURATION_TEMP_DIR=$TMPDIR CONFIGURATION_BUILD_DIR=$out ${if generateXCArchive then "archive" else ""} ${xcodeFlags} ${if release then ''"CODE_SIGN_IDENTITY=${codeSignIdentity}" PROVISIONING_PROFILE=$PROVISIONING_PROFILE OTHER_CODE_SIGN_FLAGS="--keychain $HOME/Library/Keychains/$keychainName-db"'' else ""}
+    xcodebuild -target ${_target} -configuration ${_configuration} ${stdenv.lib.optionalString (scheme != null) "-scheme ${scheme}"} -sdk ${_sdk} TARGETED_DEVICE_FAMILY="1, 2" ONLY_ACTIVE_ARCH=NO CONFIGURATION_TEMP_DIR=$TMPDIR CONFIGURATION_BUILD_DIR=$out ${if generateIPA || generateXCArchive then "-archivePath \"${name}.xcarchive\" archive" else ""} ${if release then ''PROVISIONING_PROFILE=$PROVISIONING_PROFILE OTHER_CODE_SIGN_FLAGS="--keychain $HOME/Library/Keychains/$keychainName-db"'' else ""} ${xcodeFlags}
 
     ${stdenv.lib.optionalString release ''
       ${stdenv.lib.optionalString generateIPA ''
+        # Create export plist file
+        cat > "${name}.plist" <<EOF
+        <?xml version="1.0" encoding="UTF-8"?>
+        <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+        <plist version="1.0">
+        <dict>
+            <key>provisioningProfiles</key>
+            <dict>
+                <key>${bundleId}</key>
+                <string>$PROVISIONING_PROFILE</string>
+            </dict>
+            <key>method</key>
+            <string>${signMethod}</string>
+            ${stdenv.lib.optionalString (signMethod == "enterprise" || signMethod == "ad-hoc") ''
+              <key>compileBitcode</key>
+              <false/>
+            ''}
+        </dict>
+        </plist>
+        EOF
+
         # Produce an IPA file
-        xcrun -sdk iphoneos PackageApplication -v $out/*.app -o "$out/${name}.ipa"
-        
+        xcodebuild -exportArchive -archivePath "${name}.xcarchive" -exportOptionsPlist "${name}.plist" -exportPath $out
+
         # Add IPA to Hydra build products
         mkdir -p $out/nix-support
         echo "file binary-dist \"$(echo $out/*.ipa)\"" > $out/nix-support/hydra-build-products