Replace titaniumenv with new implementation
This commit is contained in:
parent
907216a57d
commit
27f8b6b89e
@ -1,200 +1,181 @@
|
|||||||
{stdenv, androidsdk, titaniumsdk, titanium, alloy, xcodewrapper, jdk, python, nodejs, which, file, xcodeBaseDir}:
|
{stdenv, composeAndroidPackages, composeXcodeWrapper, titaniumsdk, titanium, alloy, jdk, python, nodejs, which, file}:
|
||||||
{ name, src, preBuild ? "", target, androidPlatformVersions ? [ "25" ], androidAbiVersions ? [ "armeabi" "armeabi-v7a" ], tiVersion ? null
|
{ name, src, preBuild ? "", target, tiVersion ? null
|
||||||
, release ? false, androidKeyStore ? null, androidKeyAlias ? null, androidKeyStorePassword ? null
|
, release ? false, androidKeyStore ? null, androidKeyAlias ? null, androidKeyStorePassword ? null
|
||||||
, iosMobileProvisioningProfile ? null, iosCertificateName ? null, iosCertificate ? null, iosCertificatePassword ? null, iosVersion ? "11.2"
|
, iosMobileProvisioningProfile ? null, iosCertificateName ? null, iosCertificate ? null, iosCertificatePassword ? null, iosVersion ? "11.3", iosBuildStore ? false
|
||||||
, enableWirelessDistribution ? false, iosBuildStore ? false, installURL ? null
|
, enableWirelessDistribution ? false, installURL ? null
|
||||||
}:
|
, xcodeBaseDir ? "/Applications/Xcode.app"
|
||||||
|
, androidsdkArgs ? {}
|
||||||
|
, xcodewrapperArgs ? {}
|
||||||
|
, ...
|
||||||
|
}@args:
|
||||||
|
|
||||||
assert (release && target == "android") -> androidKeyStore != null && androidKeyAlias != null && androidKeyStorePassword != null;
|
assert (release && target == "android") -> androidKeyStore != null && androidKeyAlias != null && androidKeyStorePassword != null;
|
||||||
assert (release && target == "iphone") -> iosMobileProvisioningProfile != null && iosCertificateName != null && iosCertificate != null && iosCertificatePassword != null;
|
assert (release && target == "iphone") -> iosMobileProvisioningProfile != null && iosCertificateName != null && iosCertificate != null && iosCertificatePassword != null;
|
||||||
assert enableWirelessDistribution -> installURL != null;
|
assert enableWirelessDistribution -> installURL != null;
|
||||||
|
|
||||||
let
|
let
|
||||||
androidsdkComposition = androidsdk {
|
realAndroidsdkArgs = {
|
||||||
platformVersions = androidPlatformVersions;
|
platformVersions = [ "26" ];
|
||||||
abiVersions = androidAbiVersions;
|
} // androidsdkArgs;
|
||||||
useGoogleAPIs = true;
|
|
||||||
};
|
androidsdk = (composeAndroidPackages realAndroidsdkArgs).androidsdk;
|
||||||
|
|
||||||
|
realXcodewrapperArgs = {
|
||||||
|
inherit xcodeBaseDir;
|
||||||
|
} // xcodewrapperArgs;
|
||||||
|
|
||||||
|
xcodewrapper = composeXcodeWrapper xcodewrapperArgs;
|
||||||
|
|
||||||
deleteKeychain = ''
|
deleteKeychain = ''
|
||||||
security default-keychain -s login.keychain
|
if [ -f $HOME/lock-keychain ]
|
||||||
security delete-keychain $keychainName
|
then
|
||||||
rm -f $HOME/lock-keychain
|
security default-keychain -s login.keychain
|
||||||
|
security delete-keychain $keychainName
|
||||||
|
rm -f $HOME/lock-keychain
|
||||||
|
fi
|
||||||
'';
|
'';
|
||||||
in
|
|
||||||
stdenv.mkDerivation {
|
|
||||||
name = stdenv.lib.replaceChars [" "] [""] name;
|
|
||||||
inherit src;
|
|
||||||
|
|
||||||
buildInputs = [ nodejs titanium alloy jdk python which file ] ++ stdenv.lib.optional (stdenv.hostPlatform.system == "x86_64-darwin") xcodewrapper;
|
extraArgs = removeAttrs args [ "name" "preRebuild" "androidsdkArgs" "xcodewrapperArgs" ];
|
||||||
|
in
|
||||||
|
stdenv.mkDerivation ({
|
||||||
|
name = stdenv.lib.replaceChars [" "] [""] name;
|
||||||
|
|
||||||
|
buildInputs = [ nodejs titanium alloy python which file jdk ]
|
||||||
|
++ stdenv.lib.optional (target == "iphone") xcodewrapper;
|
||||||
|
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
${preBuild}
|
${preBuild}
|
||||||
|
|
||||||
export HOME=$TMPDIR
|
export HOME=${if target == "iphone" then "/Users/$(whoami)" else "$TMPDIR"}
|
||||||
|
|
||||||
${stdenv.lib.optionalString (tiVersion != null) ''
|
${stdenv.lib.optionalString (tiVersion != null) ''
|
||||||
# Replace titanium version by the provided one
|
# Replace titanium version by the provided one
|
||||||
sed -i -e "s|<sdk-version>[0-9a-zA-Z\.]*</sdk-version>|<sdk-version>${tiVersion}</sdk-version>|" tiapp.xml
|
sed -i -e "s|<sdk-version>[0-9a-zA-Z\.]*</sdk-version>|<sdk-version>${tiVersion}</sdk-version>|" tiapp.xml
|
||||||
''}
|
''}
|
||||||
|
|
||||||
# Simulate a login
|
# Simulate a login
|
||||||
mkdir -p $HOME/.titanium
|
mkdir -p $HOME/.titanium
|
||||||
cat > $HOME/.titanium/auth_session.json <<EOF
|
cat > $HOME/.titanium/auth_session.json <<EOF
|
||||||
{ "loggedIn": true }
|
{ "loggedIn": true }
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
# Configure the paths to the Titanium SDK and modules
|
||||||
echo "{}" > $TMPDIR/config.json
|
echo "{}" > $TMPDIR/config.json
|
||||||
titanium --config-file $TMPDIR/config.json --no-colors config sdk.defaultInstallLocation ${titaniumsdk}
|
titanium --config-file $TMPDIR/config.json --no-colors config sdk.defaultInstallLocation ${titaniumsdk}
|
||||||
titanium --config-file $TMPDIR/config.json --no-colors config paths.modules ${titaniumsdk}
|
titanium --config-file $TMPDIR/config.json --no-colors config paths.modules ${titaniumsdk}
|
||||||
|
|
||||||
mkdir -p $out
|
mkdir -p $out
|
||||||
|
|
||||||
${if target == "android" then
|
|
||||||
''
|
|
||||||
titanium config --config-file $TMPDIR/config.json --no-colors android.sdkPath ${androidsdkComposition}/libexec
|
|
||||||
|
|
||||||
export PATH=$(echo ${androidsdkComposition}/libexec/tools):$(echo ${androidsdkComposition}/libexec/build-tools/android-*):$PATH
|
|
||||||
export GRADLE_USER_HOME=$TMPDIR/gradle
|
|
||||||
|
|
||||||
${if release then
|
|
||||||
''
|
|
||||||
${stdenv.lib.optionalString stdenv.isDarwin ''
|
|
||||||
# Signing the app does not work with OpenJDK on macOS, use host SDK instead
|
|
||||||
export JAVA_HOME="$(/usr/libexec/java_home -v 1.8)"
|
|
||||||
''}
|
|
||||||
titanium build --config-file $TMPDIR/config.json --no-colors --force --platform android --target dist-playstore --keystore ${androidKeyStore} --alias ${androidKeyAlias} --store-password ${androidKeyStorePassword} --output-dir $out
|
|
||||||
''
|
|
||||||
else
|
|
||||||
''titanium build --config-file $TMPDIR/config.json --no-colors --force --platform android --target emulator --build-only -B foo --output $out''}
|
|
||||||
''
|
|
||||||
else if target == "iphone" then
|
|
||||||
''
|
|
||||||
${if release 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
|
|
||||||
security set-key-partition-list -S apple-tool:,apple: -s -k "" $keychainName
|
|
||||||
provisioningId=$(grep UUID -A1 -a ${iosMobileProvisioningProfile} | grep -o "[-A-Za-z0-9]\{36\}")
|
|
||||||
|
|
||||||
# Ensure that the requested provisioning profile can be found
|
|
||||||
|
|
||||||
if [ ! -f "$HOME/Library/MobileDevice/Provisioning Profiles/$provisioningId.mobileprovision" ]
|
|
||||||
then
|
|
||||||
mkdir -p "$HOME/Library/MobileDevice/Provisioning Profiles"
|
|
||||||
cp ${iosMobileProvisioningProfile} "$HOME/Library/MobileDevice/Provisioning Profiles/$provisioningId.mobileprovision"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Simulate a login
|
|
||||||
mkdir -p $HOME/.titanium
|
|
||||||
cat > $HOME/.titanium/auth_session.json <<EOF
|
|
||||||
{ "loggedIn": true }
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# Configure the path to Xcode
|
|
||||||
titanium --config-file $TMPDIR/config.json --no-colors config paths.xcode ${xcodeBaseDir}
|
|
||||||
|
|
||||||
# Make plutil available
|
|
||||||
mkdir -p $TMPDIR/bin
|
|
||||||
ln -s /usr/bin/plutil $TMPDIR/bin
|
|
||||||
export PATH=$TMPDIR/bin:$PATH
|
|
||||||
|
|
||||||
# Link the modules folder
|
|
||||||
if [ ! -e modules ]
|
|
||||||
then
|
|
||||||
ln -s ${titaniumsdk}/modules modules
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Take precautions to prevent concurrent builds blocking the keychain
|
|
||||||
while [ -f $HOME/lock-keychain ]
|
|
||||||
do
|
|
||||||
echo "Keychain locked, waiting for a couple of seconds, or remove $HOME/lock-keychain to unblock..."
|
|
||||||
sleep 3
|
|
||||||
done
|
|
||||||
|
|
||||||
touch $HOME/lock-keychain
|
|
||||||
|
|
||||||
security default-keychain -s $keychainName
|
|
||||||
|
|
||||||
# Do the actual build
|
|
||||||
titanium build --config-file $TMPDIR/config.json --force --no-colors --platform ios --target ${if iosBuildStore then "dist-appstore" else "dist-adhoc"} --pp-uuid $provisioningId --distribution-name "${iosCertificateName}" --keychain $HOME/Library/Keychains/$keychainName-db --device-family universal --ios-version ${iosVersion} --output-dir $out
|
|
||||||
|
|
||||||
# Remove our generated keychain
|
|
||||||
${deleteKeychain}
|
|
||||||
''
|
|
||||||
else
|
|
||||||
''
|
|
||||||
# Copy all sources to the output store directory.
|
|
||||||
# Why? Debug application include *.js files, which are symlinked into their
|
|
||||||
# sources. If they are not copied, we have dangling references to the
|
|
||||||
# temp folder.
|
|
||||||
|
|
||||||
cp -av * $out
|
|
||||||
cd $out
|
|
||||||
|
|
||||||
# We need to consult a real home directory to find the available simulators
|
|
||||||
export HOME=/Users/$(whoami)
|
|
||||||
|
|
||||||
# Configure the path to Xcode
|
|
||||||
titanium --config-file $TMPDIR/config.json --no-colors config paths.xcode ${xcodeBaseDir}
|
|
||||||
|
|
||||||
# Link the modules folder
|
|
||||||
if [ ! -e modules ]
|
|
||||||
then
|
|
||||||
ln -s ${titaniumsdk}/modules modules
|
|
||||||
createdModulesSymlink=1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Execute the build
|
|
||||||
titanium build --config-file $TMPDIR/config.json --force --no-colors --platform ios --target simulator --build-only --device-family universal --ios-version ${iosVersion} --output-dir $out
|
|
||||||
|
|
||||||
# Remove the modules symlink
|
|
||||||
if [ "$createdModulesSymlink" = "1" ]
|
|
||||||
then
|
|
||||||
rm $out/modules
|
|
||||||
fi
|
|
||||||
''}
|
|
||||||
''
|
|
||||||
|
|
||||||
else throw "Target: ${target} is not supported!"}
|
|
||||||
'';
|
|
||||||
|
|
||||||
installPhase = ''
|
|
||||||
mkdir -p $out
|
|
||||||
|
|
||||||
${if target == "android" && release then ""
|
|
||||||
else
|
|
||||||
if target == "android" then
|
|
||||||
''cp "$(ls build/android/bin/*.apk | grep -v '\-unsigned.apk')" $out''
|
|
||||||
else if target == "iphone" && release then
|
|
||||||
''
|
|
||||||
cp -av build/iphone/build/* $out
|
|
||||||
mkdir -p $out/nix-support
|
|
||||||
echo "file binary-dist \"$(echo $out/*.ipa)\"" > $out/nix-support/hydra-build-products
|
|
||||||
|
|
||||||
${stdenv.lib.optionalString enableWirelessDistribution ''
|
|
||||||
appname=$(basename $out/*.ipa .ipa)
|
|
||||||
bundleId=$(grep '<id>[a-zA-Z0-9.]*</id>' tiapp.xml | sed -e 's|<id>||' -e 's|</id>||' -e 's/ //g')
|
|
||||||
version=$(grep '<version>[a-zA-Z0-9.]*</version>' tiapp.xml | sed -e 's|<version>||' -e 's|</version>||' -e 's/ //g')
|
|
||||||
|
|
||||||
sed -e "s|@INSTALL_URL@|${installURL}?bundleId=$bundleId\&version=$version\&title=$appname|" ${../xcodeenv/install.html.template} > "$out/$appname.html"
|
|
||||||
echo "doc install \"$out/$appname.html\"" >> $out/nix-support/hydra-build-products
|
|
||||||
''}
|
|
||||||
''
|
|
||||||
else if target == "iphone" then ""
|
|
||||||
else throw "Target: ${target} is not supported!"}
|
|
||||||
|
|
||||||
${if target == "android" then ''
|
${if target == "android" then ''
|
||||||
mkdir -p $out/nix-support
|
titanium config --config-file $TMPDIR/config.json --no-colors android.sdkPath ${androidsdk}/libexec/android-sdk
|
||||||
echo "file binary-dist \"$(ls $out/*.apk)\"" > $out/nix-support/hydra-build-products
|
|
||||||
'' else ""}
|
export PATH=${androidsdk}/libexec/android-sdk/tools:$(echo ${androidsdk}/libexec/android-sdk/build-tools/android-*):$PATH
|
||||||
|
export GRADLE_USER_HOME=$TMPDIR/gradle
|
||||||
|
|
||||||
|
${if release then ''
|
||||||
|
${stdenv.lib.optionalString stdenv.isDarwin ''
|
||||||
|
# Signing the app does not work with OpenJDK on macOS, use host SDK instead
|
||||||
|
export JAVA_HOME="$(/usr/libexec/java_home -v 1.8)"
|
||||||
|
''}
|
||||||
|
titanium build --config-file $TMPDIR/config.json --no-colors --force --platform android --target dist-playstore --keystore ${androidKeyStore} --alias "${androidKeyAlias}" --store-password "${androidKeyStorePassword}" --output-dir $out
|
||||||
|
'' else ''
|
||||||
|
titanium build --config-file $TMPDIR/config.json --no-colors --force --platform android --target emulator --build-only -B foo --output $out
|
||||||
|
''}
|
||||||
|
''
|
||||||
|
else if target == "iphone" then ''
|
||||||
|
# Configure the path to Xcode
|
||||||
|
titanium --config-file $TMPDIR/config.json --no-colors config paths.xcode ${xcodeBaseDir}
|
||||||
|
|
||||||
|
# Link the modules folder
|
||||||
|
if [ ! -e modules ]
|
||||||
|
then
|
||||||
|
ln -s ${titaniumsdk}/modules modules
|
||||||
|
createdModulesSymlink=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
${if release then ''
|
||||||
|
# Create a keychain with the component hash name (should always be unique)
|
||||||
|
export keychainName=$(basename $out)
|
||||||
|
|
||||||
|
security create-keychain -p "" $keychainName
|
||||||
|
security default-keychain -s $keychainName
|
||||||
|
security unlock-keychain -p "" $keychainName
|
||||||
|
security import ${iosCertificate} -k $keychainName -P "${iosCertificatePassword}" -A
|
||||||
|
security set-key-partition-list -S apple-tool:,apple: -s -k "" $keychainName
|
||||||
|
provisioningId=$(grep UUID -A1 -a ${iosMobileProvisioningProfile} | grep -o "[-A-Za-z0-9]\{36\}")
|
||||||
|
|
||||||
|
# Ensure that the requested provisioning profile can be found
|
||||||
|
|
||||||
|
if [ ! -f "$HOME/Library/MobileDevice/Provisioning Profiles/$provisioningId.mobileprovision" ]
|
||||||
|
then
|
||||||
|
mkdir -p "$HOME/Library/MobileDevice/Provisioning Profiles"
|
||||||
|
cp ${iosMobileProvisioningProfile} "$HOME/Library/MobileDevice/Provisioning Profiles/$provisioningId.mobileprovision"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Take precautions to prevent concurrent builds blocking the keychain
|
||||||
|
while [ -f $HOME/lock-keychain ]
|
||||||
|
do
|
||||||
|
echo "Keychain locked, waiting for a couple of seconds, or remove $HOME/lock-keychain to unblock..."
|
||||||
|
sleep 3
|
||||||
|
done
|
||||||
|
|
||||||
|
touch $HOME/lock-keychain
|
||||||
|
|
||||||
|
security default-keychain -s $keychainName
|
||||||
|
|
||||||
|
# Do the actual build
|
||||||
|
titanium build --config-file $TMPDIR/config.json --force --no-colors --platform ios --target ${if iosBuildStore then "dist-appstore" else "dist-adhoc"} --pp-uuid $provisioningId --distribution-name "${iosCertificateName}" --keychain $HOME/Library/Keychains/$keychainName-db --device-family universal --ios-version ${iosVersion} --output-dir $out
|
||||||
|
|
||||||
|
# Remove our generated keychain
|
||||||
|
${deleteKeychain}
|
||||||
|
'' else ''
|
||||||
|
# Copy all sources to the output store directory.
|
||||||
|
# Why? Debug application include *.js files, which are symlinked into their
|
||||||
|
# sources. If they are not copied, we have dangling references to the
|
||||||
|
# temp folder.
|
||||||
|
|
||||||
|
cp -av * $out
|
||||||
|
cd $out
|
||||||
|
|
||||||
|
# Execute the build
|
||||||
|
titanium build --config-file $TMPDIR/config.json --force --no-colors --platform ios --target simulator --build-only --device-family universal --ios-version ${iosVersion} --output-dir $out
|
||||||
|
|
||||||
|
# Remove the modules symlink
|
||||||
|
if [ "$createdModulesSymlink" = "1" ]
|
||||||
|
then
|
||||||
|
rm $out/modules
|
||||||
|
fi
|
||||||
|
''}
|
||||||
|
'' else throw "Target: ${target} is not supported!"}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
${if target == "android" then ''
|
||||||
|
${if release then ""
|
||||||
|
else ''
|
||||||
|
cp "$(ls build/android/bin/*.apk | grep -v '\-unsigned.apk')" $out
|
||||||
|
''}
|
||||||
|
|
||||||
|
mkdir -p $out/nix-support
|
||||||
|
echo "file binary-dist \"$(ls $out/*.apk)\"" > $out/nix-support/hydra-build-products
|
||||||
|
''
|
||||||
|
else if target == "iphone" then
|
||||||
|
if release then ''
|
||||||
|
mkdir -p $out/nix-support
|
||||||
|
echo "file binary-dist \"$(echo $out/*.ipa)\"" > $out/nix-support/hydra-build-products
|
||||||
|
|
||||||
|
${stdenv.lib.optionalString enableWirelessDistribution ''
|
||||||
|
appname="$(basename "$out/*.ipa" .ipa)"
|
||||||
|
bundleId=$(grep '<id>[a-zA-Z0-9.]*</id>' tiapp.xml | sed -e 's|<id>||' -e 's|</id>||' -e 's/ //g')
|
||||||
|
version=$(grep '<version>[a-zA-Z0-9.]*</version>' tiapp.xml | sed -e 's|<version>||' -e 's|</version>||' -e 's/ //g')
|
||||||
|
|
||||||
|
sed -e "s|@INSTALL_URL@|${installURL}?bundleId=$bundleId\&version=$version\&title=$appname|" ${../xcodeenv/install.html.template} > "$out/$appname.html"
|
||||||
|
echo "doc install \"$out/$appname.html\"" >> $out/nix-support/hydra-build-products
|
||||||
|
''}
|
||||||
|
''
|
||||||
|
else ""
|
||||||
|
else throw "Target: ${target} is not supported!"}
|
||||||
|
'';
|
||||||
|
|
||||||
failureHook = stdenv.lib.optionalString (release && target == "iphone") deleteKeychain;
|
failureHook = stdenv.lib.optionalString (release && target == "iphone") deleteKeychain;
|
||||||
}
|
} // extraArgs)
|
||||||
|
@ -1,27 +1,19 @@
|
|||||||
{pkgs, xcodeVersion ? "9.2", xcodeBaseDir ? "/Applications/Xcode.app", tiVersion ? "7.1.0.GA"}:
|
{pkgs, pkgs_i686, androidenv, xcodeenv, tiVersion ? "7.1.0.GA"}:
|
||||||
|
|
||||||
rec {
|
rec {
|
||||||
androidenv = pkgs.androidenv;
|
|
||||||
|
|
||||||
xcodeenv = if pkgs.stdenv.hostPlatform.system == "x86_64-darwin" then pkgs.xcodeenv.override {
|
|
||||||
version = xcodeVersion;
|
|
||||||
inherit xcodeBaseDir;
|
|
||||||
} else null;
|
|
||||||
|
|
||||||
titaniumsdk = let
|
titaniumsdk = let
|
||||||
titaniumSdkFile = if tiVersion == "6.3.1.GA" then ./titaniumsdk-6.3.nix
|
titaniumSdkFile = if tiVersion == "7.1.0.GA" then ./titaniumsdk-7.1.nix
|
||||||
else if tiVersion == "7.1.0.GA" then ./titaniumsdk-7.1.nix
|
|
||||||
else throw "Titanium version not supported: "+tiVersion;
|
else throw "Titanium version not supported: "+tiVersion;
|
||||||
in
|
in
|
||||||
import titaniumSdkFile {
|
import titaniumSdkFile {
|
||||||
inherit (pkgs) stdenv fetchurl unzip makeWrapper python jdk;
|
inherit (pkgs) stdenv fetchurl unzip makeWrapper;
|
||||||
};
|
};
|
||||||
|
|
||||||
buildApp = import ./build-app.nix {
|
buildApp = import ./build-app.nix {
|
||||||
inherit (pkgs) stdenv python which file jdk nodejs;
|
inherit (pkgs) stdenv python which file jdk nodejs;
|
||||||
inherit (pkgs.nodePackages_6_x) alloy titanium;
|
inherit (pkgs.nodePackages_8_x) alloy titanium;
|
||||||
inherit (androidenv) androidsdk;
|
inherit (androidenv) composeAndroidPackages;
|
||||||
inherit (xcodeenv) xcodewrapper;
|
inherit (xcodeenv) composeXcodeWrapper;
|
||||||
inherit titaniumsdk xcodeBaseDir;
|
inherit titaniumsdk;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,91 +0,0 @@
|
|||||||
{ nixpkgs ? <nixpkgs>
|
|
||||||
, systems ? [ "x86_64-linux" "x86_64-darwin" ]
|
|
||||||
, xcodeVersion ? "9.2"
|
|
||||||
, xcodeBaseDir ? "/Applications/Xcode.app"
|
|
||||||
, tiVersion ? "7.1.0.GA"
|
|
||||||
, rename ? false
|
|
||||||
, newBundleId ? "com.example.kitchensink", iosMobileProvisioningProfile ? null, iosCertificate ? null, iosCertificateName ? "Example", iosCertificatePassword ? "", iosVersion ? "11.2"
|
|
||||||
, enableWirelessDistribution ? false, installURL ? null
|
|
||||||
}:
|
|
||||||
|
|
||||||
let
|
|
||||||
pkgs = import nixpkgs {};
|
|
||||||
in
|
|
||||||
rec {
|
|
||||||
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 xcodeBaseDir tiVersion; };
|
|
||||||
inherit tiVersion;
|
|
||||||
target = "android";
|
|
||||||
});
|
|
||||||
|
|
||||||
kitchensink_android_release = pkgs.lib.genAttrs systems (system:
|
|
||||||
let
|
|
||||||
pkgs = import nixpkgs { inherit system; };
|
|
||||||
in
|
|
||||||
import ./kitchensink {
|
|
||||||
inherit (pkgs) fetchgit;
|
|
||||||
titaniumenv = pkgs.titaniumenv.override { inherit xcodeVersion xcodeBaseDir tiVersion; };
|
|
||||||
inherit tiVersion;
|
|
||||||
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_ios_development = import ./kitchensink {
|
|
||||||
inherit (pkgs) fetchgit;
|
|
||||||
titaniumenv = pkgs.titaniumenv.override { inherit xcodeVersion xcodeBaseDir tiVersion; };
|
|
||||||
inherit tiVersion iosVersion;
|
|
||||||
target = "iphone";
|
|
||||||
};
|
|
||||||
|
|
||||||
simulate_kitchensink = import ./simulate-kitchensink {
|
|
||||||
inherit (pkgs) stdenv;
|
|
||||||
xcodeenv = pkgs.xcodeenv.override { version = xcodeVersion; inherit xcodeBaseDir; };
|
|
||||||
kitchensink = kitchensink_ios_development;
|
|
||||||
bundleId = if rename then newBundleId else "com.appcelerator.kitchensink";
|
|
||||||
};
|
|
||||||
} 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 xcodeBaseDir tiVersion; };
|
|
||||||
target = "iphone";
|
|
||||||
inherit tiVersion;
|
|
||||||
release = true;
|
|
||||||
rename = true;
|
|
||||||
inherit newBundleId iosMobileProvisioningProfile iosCertificate iosCertificateName iosCertificatePassword iosVersion;
|
|
||||||
inherit enableWirelessDistribution installURL;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
else {})
|
|
@ -1,10 +0,0 @@
|
|||||||
{androidenv, kitchensink}:
|
|
||||||
|
|
||||||
androidenv.emulateApp {
|
|
||||||
name = "emulate-${kitchensink.name}";
|
|
||||||
app = kitchensink;
|
|
||||||
platformVersion = "16";
|
|
||||||
useGoogleAPIs = true;
|
|
||||||
package = "com.appcelerator.kitchensink";
|
|
||||||
activity = ".KitchensinkActivity";
|
|
||||||
}
|
|
@ -1,44 +0,0 @@
|
|||||||
{ titaniumenv, fetchgit, target, androidPlatformVersions ? [ "25" "26" ], tiVersion ? "7.1.0.GA", release ? false
|
|
||||||
, rename ? false, stdenv ? null, newBundleId ? null, iosMobileProvisioningProfile ? null, iosCertificate ? null, iosCertificateName ? null, iosCertificatePassword ? null, iosVersion ? "11.2"
|
|
||||||
, enableWirelessDistribution ? false, installURL ? null
|
|
||||||
}:
|
|
||||||
|
|
||||||
assert rename -> (stdenv != null && newBundleId != null && iosMobileProvisioningProfile != null && iosCertificate != null && iosCertificateName != null && iosCertificatePassword != null);
|
|
||||||
|
|
||||||
let
|
|
||||||
src = fetchgit {
|
|
||||||
url = https://github.com/appcelerator/kitchensink-v2.git;
|
|
||||||
rev = "94364df2ef60a80bd354a4273e3cb5f4c5185537";
|
|
||||||
sha256 = "0q4gzidpsq401frkngy4yk5kqvm8dz00ls74bw3fnpvg4714d6gf";
|
|
||||||
};
|
|
||||||
|
|
||||||
# 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
|
|
||||||
'';
|
|
||||||
installPhase = ''
|
|
||||||
mkdir -p $out
|
|
||||||
mv * $out
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
in
|
|
||||||
titaniumenv.buildApp {
|
|
||||||
name = "KitchenSink-${target}-${if release then "release" else "debug"}";
|
|
||||||
src = if rename then renamedSrc else src;
|
|
||||||
preBuild = ''
|
|
||||||
sed -i -e "s|23|25|" tiapp.xml
|
|
||||||
''; # Raise minimum android SDK from 23 to 25
|
|
||||||
inherit tiVersion;
|
|
||||||
|
|
||||||
inherit target androidPlatformVersions release;
|
|
||||||
|
|
||||||
androidKeyStore = ./keystore;
|
|
||||||
androidKeyAlias = "myfirstapp";
|
|
||||||
androidKeyStorePassword = "mykeystore";
|
|
||||||
|
|
||||||
inherit iosMobileProvisioningProfile iosCertificate iosCertificateName iosCertificatePassword iosVersion;
|
|
||||||
inherit enableWirelessDistribution installURL;
|
|
||||||
}
|
|
@ -1,10 +0,0 @@
|
|||||||
#!/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
|
|
Binary file not shown.
@ -1,7 +0,0 @@
|
|||||||
{xcodeenv, kitchensink, bundleId}:
|
|
||||||
|
|
||||||
xcodeenv.simulateApp {
|
|
||||||
name = "simulate-${kitchensink.name}";
|
|
||||||
inherit bundleId;
|
|
||||||
app = "${kitchensink}/build/iphone/build/Products/Debug-iphonesimulator";
|
|
||||||
}
|
|
@ -1,43 +0,0 @@
|
|||||||
{stdenv, fetchurl, unzip, makeWrapper}:
|
|
||||||
|
|
||||||
stdenv.mkDerivation {
|
|
||||||
name = "mobilesdk-6.3.1.GA";
|
|
||||||
src = if (stdenv.hostPlatform.system == "i686-linux" || stdenv.hostPlatform.system == "x86_64-linux") then fetchurl {
|
|
||||||
url = http://builds.appcelerator.com/mobile/6_3_X/mobilesdk-6.3.1.v20171101154403-linux.zip;
|
|
||||||
sha256 = "0g8dqqf5ffa7ll3rqm5naywipnv2vvfxcj9fmqg1wnvvxf0rflqj";
|
|
||||||
}
|
|
||||||
else if stdenv.hostPlatform.system == "x86_64-darwin" then fetchurl {
|
|
||||||
url = http://builds.appcelerator.com/mobile/6_3_X/mobilesdk-6.3.1.v20171101154403-osx.zip;
|
|
||||||
sha256 = "00bm8vv70mg4kd7jvmxd1bfqafv6zdpdx816i0hvf801zwnak4nj";
|
|
||||||
}
|
|
||||||
else throw "Platform: ${stdenv.hostPlatform.system} not supported!";
|
|
||||||
|
|
||||||
buildInputs = [ unzip makeWrapper ];
|
|
||||||
|
|
||||||
buildCommand = ''
|
|
||||||
mkdir -p $out
|
|
||||||
cd $out
|
|
||||||
(yes y | unzip $src) || true
|
|
||||||
|
|
||||||
# Rename ugly version number
|
|
||||||
cd mobilesdk/*
|
|
||||||
mv * 6.3.1.GA
|
|
||||||
cd *
|
|
||||||
${stdenv.lib.optionalString (stdenv.hostPlatform.system == "x86_64-darwin") ''
|
|
||||||
# Fixes a bad archive copying error when generating an IPA file
|
|
||||||
sed -i -e "s|cp -rf|/bin/cp -rf|" iphone/cli/commands/_build.js
|
|
||||||
''}
|
|
||||||
|
|
||||||
# Patch some executables
|
|
||||||
|
|
||||||
${if stdenv.hostPlatform.system == "i686-linux" then
|
|
||||||
''
|
|
||||||
patchelf --set-interpreter ${stdenv.cc.libc}/lib/ld-linux.so.2 android/titanium_prep.linux32
|
|
||||||
''
|
|
||||||
else if stdenv.hostPlatform.system == "x86_64-linux" then
|
|
||||||
''
|
|
||||||
patchelf --set-interpreter ${stdenv.cc.libc}/lib/ld-linux-x86-64.so.2 android/titanium_prep.linux64
|
|
||||||
''
|
|
||||||
else ""}
|
|
||||||
'';
|
|
||||||
}
|
|
@ -35,7 +35,7 @@ let
|
|||||||
sha256 = "11nwdb9y84cghcx319nsjjf9m035s4s1184zrhzpvaxq2wvqhbhx";
|
sha256 = "11nwdb9y84cghcx319nsjjf9m035s4s1184zrhzpvaxq2wvqhbhx";
|
||||||
};
|
};
|
||||||
|
|
||||||
# Put the download plugins in a fake Maven repository
|
# Put the downloaded plugins in a fake Maven repository
|
||||||
fakeMavenRepo = stdenv.mkDerivation {
|
fakeMavenRepo = stdenv.mkDerivation {
|
||||||
name = "fake-maven-repo";
|
name = "fake-maven-repo";
|
||||||
buildCommand = ''
|
buildCommand = ''
|
||||||
@ -54,15 +54,15 @@ let
|
|||||||
in
|
in
|
||||||
stdenv.mkDerivation {
|
stdenv.mkDerivation {
|
||||||
name = "mobilesdk-7.1.0.GA";
|
name = "mobilesdk-7.1.0.GA";
|
||||||
src = if (stdenv.hostPlatform.system == "i686-linux" || stdenv.hostPlatform.system == "x86_64-linux") then fetchurl {
|
src = if (stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux") then fetchurl {
|
||||||
url = http://builds.appcelerator.com/mobile/7_1_X/mobilesdk-7.1.0.v20180314133955-linux.zip;
|
url = http://builds.appcelerator.com/mobile/7_1_X/mobilesdk-7.1.0.v20180314133955-linux.zip;
|
||||||
sha256 = "18b3jnr65sdn5wj191bcl48gvhyklxmighxakv4vrz1fb59kyvqn";
|
sha256 = "18b3jnr65sdn5wj191bcl48gvhyklxmighxakv4vrz1fb59kyvqn";
|
||||||
}
|
}
|
||||||
else if stdenv.hostPlatform.system == "x86_64-darwin" then fetchurl {
|
else if stdenv.system == "x86_64-darwin" then fetchurl {
|
||||||
url = http://builds.appcelerator.com/mobile/7_1_X/mobilesdk-7.1.0.v20180314133955-osx.zip;
|
url = http://builds.appcelerator.com/mobile/7_1_X/mobilesdk-7.1.0.v20180314133955-osx.zip;
|
||||||
sha256 = "1f62616biwsw1fqxz2sq7lpa6bsfjazffliplyf5dpnh298cnc1m";
|
sha256 = "1f62616biwsw1fqxz2sq7lpa6bsfjazffliplyf5dpnh298cnc1m";
|
||||||
}
|
}
|
||||||
else throw "Platform: ${stdenv.hostPlatform.system} not supported!";
|
else throw "Platform: ${stdenv.system} not supported!";
|
||||||
|
|
||||||
buildInputs = [ unzip makeWrapper ];
|
buildInputs = [ unzip makeWrapper ];
|
||||||
|
|
||||||
@ -89,11 +89,11 @@ stdenv.mkDerivation {
|
|||||||
|
|
||||||
# Patch some executables
|
# Patch some executables
|
||||||
|
|
||||||
${if stdenv.hostPlatform.system == "i686-linux" then
|
${if stdenv.system == "i686-linux" then
|
||||||
''
|
''
|
||||||
patchelf --set-interpreter ${stdenv.cc.libc}/lib/ld-linux.so.2 android/titanium_prep.linux32
|
patchelf --set-interpreter ${stdenv.cc.libc}/lib/ld-linux.so.2 android/titanium_prep.linux32
|
||||||
''
|
''
|
||||||
else if stdenv.hostPlatform.system == "x86_64-linux" then
|
else if stdenv.system == "x86_64-linux" then
|
||||||
''
|
''
|
||||||
patchelf --set-interpreter ${stdenv.cc.libc}/lib/ld-linux-x86-64.so.2 android/titanium_prep.linux64
|
patchelf --set-interpreter ${stdenv.cc.libc}/lib/ld-linux-x86-64.so.2 android/titanium_prep.linux64
|
||||||
''
|
''
|
||||||
|
@ -815,7 +815,9 @@ in
|
|||||||
|
|
||||||
ssh-agents = callPackage ../tools/networking/ssh-agents { };
|
ssh-agents = callPackage ../tools/networking/ssh-agents { };
|
||||||
|
|
||||||
titaniumenv = callPackage ../development/mobile/titaniumenv { };
|
titaniumenv = callPackage ../development/mobile/titaniumenv {
|
||||||
|
pkgs_i686 = pkgsi686Linux;
|
||||||
|
};
|
||||||
|
|
||||||
abootimg = callPackage ../development/mobile/abootimg {};
|
abootimg = callPackage ../development/mobile/abootimg {};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user