Added testcases for signed Android and iOS apps

This commit is contained in:
Sander van der Burg 2014-01-15 13:37:40 +01:00
parent cf502a3166
commit abf6896aaf
6 changed files with 128 additions and 50 deletions

View File

@ -56,7 +56,7 @@ stdenv.mkDerivation {
cp ${iosMobileProvisioningProfile} "$HOME/Library/MobileDevice/Provisioning Profiles/$provisioningId.mobileprovision"
fi
${titaniumsdk}/mobilesdk/*/*/iphone/builder.py distribute 6.0 $(pwd) ${appId} "${_appName}" "$provisioningId" "${iosCertificateName}" $out universal "$HOME/Library/Keychains/$keychainName"
${titaniumsdk}/mobilesdk/*/*/iphone/builder.py distribute 7.0 $(pwd) ${appId} "${_appName}" "$provisioningId" "${iosCertificateName}" $out universal "$HOME/Library/Keychains/$keychainName"
# Remove our generated keychain
@ -84,7 +84,7 @@ stdenv.mkDerivation {
cp ${iosMobileProvisioningProfile} "$HOME/Library/MobileDevice/Provisioning Profiles/$provisioningId.mobileprovision"
fi
${titaniumsdk}/mobilesdk/*/*/iphone/builder.py adhoc 6.0 $(pwd) ${appId} "${_appName}" "$provisioningId" "${iosCertificateName}" universal "$HOME/Library/Keychains/$keychainName"
${titaniumsdk}/mobilesdk/*/*/iphone/builder.py adhoc 7.0 $(pwd) ${appId} "${_appName}" "$provisioningId" "${iosCertificateName}" universal "$HOME/Library/Keychains/$keychainName"
# Remove our generated keychain
@ -99,7 +99,7 @@ stdenv.mkDerivation {
cp -av * $out
cd $out
${titaniumsdk}/mobilesdk/*/*/iphone/builder.py build 6.0 $(pwd) ${appId} "${_appName}" universal
${titaniumsdk}/mobilesdk/*/*/iphone/builder.py build 7.0 $(pwd) ${appId} "${_appName}" universal
''
else throw "Target: ${target} is not supported!"}

View File

@ -1,53 +1,90 @@
{ nixpkgs ? <nixpkgs>
, systems ? [ "x86_64-linux" "x86_64-darwin" ]
, xcodeVersion ? "5.0"
, rename ? false
, newBundleId ? "com.example.kitchensink", iosMobileProvisioningProfile ? null, iosCertificate ? null, iosCertificateName ? "Example", iosCertificatePassword ? ""
}:
let
pkgs = import nixpkgs {};
in
rec {
kitchensink_android = pkgs.lib.genAttrs systems (system:
kitchensink_android_debug = pkgs.lib.genAttrs systems (system:
let
pkgs = import nixpkgs { inherit system; };
in
import ./kitchensink {
inherit (pkgs) fetchgit;
titaniumenv = pkgs.titaniumenv.override { inherit xcodeVersion; };
target = "android";
});
import ./kitchensink {
inherit (pkgs) fetchgit;
titaniumenv = pkgs.titaniumenv.override { inherit xcodeVersion; };
target = "android";
});
emulate_kitchensink = pkgs.lib.genAttrs systems (system:
kitchensink_android_release = pkgs.lib.genAttrs systems (system:
let
pkgs = import nixpkgs { inherit system; };
in
import ./emulate-kitchensink {
inherit (pkgs) androidenv;
kitchensink = builtins.getAttr system kitchensink_android;
});
import ./kitchensink {
inherit (pkgs) fetchgit;
titaniumenv = pkgs.titaniumenv.override { inherit xcodeVersion; };
target = "android";
release = true;
});
emulate_kitchensink_debug = pkgs.lib.genAttrs systems (system:
let
pkgs = import nixpkgs { inherit system; };
in
import ./emulate-kitchensink {
inherit (pkgs) androidenv;
kitchensink = builtins.getAttr system kitchensink_android_debug;
});
emulate_kitchensink_release = pkgs.lib.genAttrs systems (system:
let
pkgs = import nixpkgs { inherit system; };
in
import ./emulate-kitchensink {
inherit (pkgs) androidenv;
kitchensink = builtins.getAttr system kitchensink_android_release;
});
} // (if builtins.elem "x86_64-darwin" systems then
let
pkgs = import nixpkgs { system = "x86_64-darwin"; };
in
rec {
kitchensink_iphone = import ./kitchensink {
inherit (pkgs) fetchgit;
kitchensink_ios_development = import ./kitchensink {
inherit (pkgs) fetchgit;
titaniumenv = pkgs.titaniumenv.override { inherit xcodeVersion; };
target = "iphone";
};
simulate_kitchensink_iphone = import ./simulate-kitchensink {
inherit (pkgs) stdenv;
xcodeenv = pkgs.xcodeenv.override { version = xcodeVersion; };
kitchensink = kitchensink_ios_development;
device = "iPhone";
};
simulate_kitchensink_ipad = import ./simulate-kitchensink {
inherit (pkgs) stdenv;
xcodeenv = pkgs.xcodeenv.override { version = xcodeVersion; };
kitchensink = kitchensink_ios_development;
device = "iPad";
};
} else {}) // (if rename then
let
pkgs = import nixpkgs { system = "x86_64-darwin"; };
in
{
kitchensink_ipa = import ./kitchensink {
inherit (pkgs) stdenv fetchgit;
titaniumenv = pkgs.titaniumenv.override { inherit xcodeVersion; };
target = "iphone";
release = true;
rename = true;
inherit newBundleId iosMobileProvisioningProfile iosCertificate iosCertificateName iosCertificatePassword;
};
simulate_kitchensink_iphone = import ./simulate-kitchensink {
inherit (pkgs) stdenv;
xcodeenv = pkgs.xcodeenv.override { version = xcodeVersion; };
kitchensink = kitchensink_iphone;
device = "iPhone";
};
}
simulate_kitchensink_ipad = import ./simulate-kitchensink {
inherit (pkgs) stdenv;
xcodeenv = pkgs.xcodeenv.override { version = xcodeVersion; };
kitchensink = kitchensink_iphone;
device = "iPad";
};
} else {})
else {})

View File

@ -1,25 +1,41 @@
{titaniumenv, fetchgit, target, androidPlatformVersions ? [ "11" ]}:
{ titaniumenv, fetchgit, target, androidPlatformVersions ? [ "11" ], release ? false
, rename ? false, stdenv ? null, newBundleId ? null, iosMobileProvisioningProfile ? null, iosCertificate ? null, iosCertificateName ? null, iosCertificatePassword ? null
}:
titaniumenv.buildApp {
name = "KitchenSink-${target}";
appName = "KitchenSink";
appId = "com.appcelerator.kitchensink";
assert rename -> (stdenv != null && newBundleId != null && iosMobileProvisioningProfile != null && iosCertificate != null && iosCertificateName != null && iosCertificatePassword != null);
let
src = fetchgit {
url = https://github.com/appcelerator/KitchenSink.git;
rev = "d9f39950c0137a1dd67c925ef9e8046a9f0644ff";
sha256 = "0aj42ac262hw9n9blzhfibg61kkbp3wky69rp2yhd11vwjlcq1qc";
};
inherit target androidPlatformVersions;
# Rename the bundle id to something else
renamedSrc = stdenv.mkDerivation {
name = "KitchenSink-renamedsrc";
inherit src;
buildPhase = ''
sed -i -e "s|com.appcelerator.kitchensink|${newBundleId}|" tiapp.xml
sed -i -e "s|com.appcelerator.kitchensink|${newBundleId}|" manifest
'';
installPhase = ''
mkdir -p $out
mv * $out
'';
};
in
titaniumenv.buildApp {
name = "KitchenSink-${target}-${if release then "release" else "debug"}";
appName = "KitchenSink";
appId = if rename then newBundleId else "com.appcelerator.kitchensink";
src = if rename then renamedSrc else src;
/*release = true;
androidKeyStore = /home/sander/keystore;
androidKeyAlias = "sander";
androidKeyStorePassword = "foobar";*/
inherit target androidPlatformVersions release;
/*release = true;
iosMobileProvisioningProfile = /Users/sander/Downloads/profile.mobileprovision;
iosCertificateName = "My Company";
iosCertificate = /Users/sander/Downloads/c.p12;
iosCertificatePassword = "";*/
androidKeyStore = ./keystore;
androidKeyAlias = "myfirstapp";
androidKeyStorePassword = "mykeystore";
inherit iosMobileProvisioningProfile iosCertificate iosCertificateName iosCertificatePassword;
}

View File

@ -0,0 +1,10 @@
#!/bin/sh -e
( echo "John Doe"
echo "My Company"
echo "My Organization"
echo "My City"
echo "My State"
echo "US"
echo "yes"
) | keytool --genkeypair --alias myfirstapp --keystore ./keystore --storepass mykeystore

View File

@ -26,10 +26,15 @@ stdenv.mkDerivation {
sed -i -e "s|#!/usr/bin/env python|#!${python}/bin/python|" $i
done
# Rename ugly version number
cd mobilesdk/*
mv 3.1.4.v20130926144546 3.1.4.GA
cd 3.1.4.GA
# Zip files do not support timestamps lower than 1980. We have to apply a few work-arounds to cope with that
# Yes, I know it's nasty :-)
cd mobilesdk/*/*/android
cd android
sed -i -f ${./fixtiverify.sed} builder.py
sed -i -f ${./fixtiprofiler.sed} builder.py
@ -50,10 +55,20 @@ stdenv.mkDerivation {
# Wrap builder script
wrapProgram `pwd`/builder.py \
--prefix PYTHONPATH : ${python.modules.sqlite3}/lib/python*/site-packages \
--prefix PATH : ${jdk}/bin \
--prefix JAVA_HOME : ${jdk}
mv builder.py .builder.py
cat > builder.py <<EOF
#!${python}/bin/python
import os, sys
os.environ['PYTHONPATH'] = '$(echo ${python.modules.sqlite3}/lib/python*/site-packages)'
os.environ['JAVA_HOME'] = '${jdk}'
os.execv('$(pwd)/.builder.py', sys.argv)
EOF
chmod +x builder.py
'' + 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