Implemented iosDistribute flag, that allows someone to build iPhone distribution builds
This commit is contained in:
parent
f1531391c0
commit
729a112f72
@ -1,7 +1,7 @@
|
|||||||
{stdenv, androidsdk, titaniumsdk, xcodewrapper}:
|
{stdenv, androidsdk, titaniumsdk, xcodewrapper}:
|
||||||
{ appId, name, src, target, androidPlatformVersions ? [ "8" ]
|
{ appId, name, src, target, androidPlatformVersions ? [ "8" ]
|
||||||
, release ? false, androidKeyStore ? null, androidKeyAlias ? null, androidKeyStorePassword ? null
|
, release ? false, androidKeyStore ? null, androidKeyAlias ? null, androidKeyStorePassword ? null
|
||||||
, iosKeyFile ? null, iosCertificateName ? null, iosCertificate ? null, iosCertificatePassword ? null
|
, iosKeyFile ? null, iosCertificateName ? null, iosCertificate ? null, iosCertificatePassword ? null, iosDistribute ? false
|
||||||
}:
|
}:
|
||||||
|
|
||||||
assert (release && target == "android") -> androidKeyStore != null && androidKeyAlias != null && androidKeyStorePassword != null;
|
assert (release && target == "android") -> androidKeyStore != null && androidKeyAlias != null && androidKeyStorePassword != null;
|
||||||
@ -12,6 +12,8 @@ let
|
|||||||
platformVersions = androidPlatformVersions;
|
platformVersions = androidPlatformVersions;
|
||||||
useGoogleAPIs = true;
|
useGoogleAPIs = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
deleteKeychain = "security delete-keychain $keychainName";
|
||||||
in
|
in
|
||||||
stdenv.mkDerivation {
|
stdenv.mkDerivation {
|
||||||
inherit name src;
|
inherit name src;
|
||||||
@ -30,6 +32,33 @@ stdenv.mkDerivation {
|
|||||||
"${titaniumsdk}/mobilesdk/*/*/android/builder.py build ${name} ${androidsdkComposition}/libexec/android-sdk-* $(pwd) ${appId}"
|
"${titaniumsdk}/mobilesdk/*/*/android/builder.py build ${name} ${androidsdkComposition}/libexec/android-sdk-* $(pwd) ${appId}"
|
||||||
|
|
||||||
else if target == "iphone" then
|
else if target == "iphone" then
|
||||||
|
if iosDistribute then ''
|
||||||
|
export HOME=/Users/$(whoami)
|
||||||
|
export keychainName=$(basename $out)
|
||||||
|
|
||||||
|
# Create a keychain with the component hash name (should always be unique)
|
||||||
|
security create-keychain -p "" $keychainName
|
||||||
|
security default-keychain -s $keychainName
|
||||||
|
security unlock-keychain -p "" $keychainName
|
||||||
|
security import ${iosCertificate} -k $keychainName -P "${iosCertificatePassword}" -A
|
||||||
|
|
||||||
|
provisioningId=$(grep UUID -A1 -a ${iosKeyFile} | grep -o "[-A-Z0-9]\{36\}")
|
||||||
|
|
||||||
|
# Ensure that the requested provisioning profile can be found
|
||||||
|
|
||||||
|
if [ ! -f "$HOME/Library/MobileDevice/Provisioning Profiles" ]
|
||||||
|
then
|
||||||
|
mkdir -p "$HOME/Library/MobileDevice/Provisioning Profiles"
|
||||||
|
cp ${iosKeyFile} "$HOME/Library/MobileDevice/Provisioning Profiles/$provisioningId.mobileprovision"
|
||||||
|
fi
|
||||||
|
|
||||||
|
${titaniumsdk}/mobilesdk/*/*/iphone/builder.py distribute 6.0 $(pwd) ${appId} ${name} "$provisioningId" "${iosCertificateName}" $out universal "$HOME/Library/Keychains/$keychainName"
|
||||||
|
|
||||||
|
# Remove our generated keychain
|
||||||
|
|
||||||
|
${deleteKeychain}
|
||||||
|
''
|
||||||
|
else
|
||||||
if release then
|
if release then
|
||||||
''
|
''
|
||||||
export HOME=/Users/$(whoami)
|
export HOME=/Users/$(whoami)
|
||||||
@ -55,7 +84,7 @@ stdenv.mkDerivation {
|
|||||||
|
|
||||||
# Remove our generated keychain
|
# Remove our generated keychain
|
||||||
|
|
||||||
security delete-keychain $keychainName
|
${deleteKeychain}
|
||||||
''
|
''
|
||||||
else
|
else
|
||||||
''
|
''
|
||||||
@ -84,4 +113,6 @@ stdenv.mkDerivation {
|
|||||||
else if target == "iphone" then ""
|
else if target == "iphone" then ""
|
||||||
else throw "Target: ${target} is not supported!"}
|
else throw "Target: ${target} is not supported!"}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
failureHook = stdenv.lib.optionalString (release && target == "iphone") deleteKeychain;
|
||||||
}
|
}
|
||||||
|
@ -53,5 +53,8 @@ stdenv.mkDerivation {
|
|||||||
--prefix PYTHONPATH : ${python.modules.sqlite3}/lib/python*/site-packages \
|
--prefix PYTHONPATH : ${python.modules.sqlite3}/lib/python*/site-packages \
|
||||||
--prefix PATH : ${jdk}/bin \
|
--prefix PATH : ${jdk}/bin \
|
||||||
--prefix JAVA_HOME : ${jdk}
|
--prefix JAVA_HOME : ${jdk}
|
||||||
|
'' + stdenv.lib.optionalString (stdenv.system == "x86_64-darwin") ''
|
||||||
|
# 'ditto' utility is needed to copy stuff to the Xcode organizer. Dirty, but this allows it to work.
|
||||||
|
sed -i -e "s|ditto|/usr/bin/ditto|g" $out/mobilesdk/osx/*/iphone/builder.py
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user