| 1 | <?xml version="1.0" encoding="ISO-8859-1"?> |
|---|
| 2 | <!-- |
|---|
| 3 | * LICENCE[[ |
|---|
| 4 | * Version: MPL 1.1/GPL 2.0/LGPL 2.1/CeCILL 2.O |
|---|
| 5 | * |
|---|
| 6 | * The contents of this file are subject to the Mozilla Public License Version |
|---|
| 7 | * 1.1 (the "License"); you may not use this file except in compliance with |
|---|
| 8 | * the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ |
|---|
| 9 | * |
|---|
| 10 | * Software distributed under the License is distributed on an "AS IS" basis, |
|---|
| 11 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License |
|---|
| 12 | * for the specific language governing rights and limitations under the |
|---|
| 13 | * License. |
|---|
| 14 | * |
|---|
| 15 | * The Original Code is kelis.fr code. |
|---|
| 16 | * |
|---|
| 17 | * The Initial Developer of the Original Code is |
|---|
| 18 | * samuel.monsarrat@kelis.fr |
|---|
| 19 | * |
|---|
| 20 | * Portions created by the Initial Developer are Copyright (C) 2007 |
|---|
| 21 | * the Initial Developer. All Rights Reserved. |
|---|
| 22 | * |
|---|
| 23 | * Contributor(s): |
|---|
| 24 | * |
|---|
| 25 | * |
|---|
| 26 | * Alternatively, the contents of this file may be used under the terms of |
|---|
| 27 | * either of the GNU General Public License Version 2 or later (the "GPL"), |
|---|
| 28 | * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), |
|---|
| 29 | * or the CeCILL Licence Version 2.0 (http://www.cecill.info/licences.en.html), |
|---|
| 30 | * in which case the provisions of the GPL, the LGPL or the CeCILL are applicable |
|---|
| 31 | * instead of those above. If you wish to allow use of your version of this file |
|---|
| 32 | * only under the terms of either the GPL or the LGPL, and not to allow others |
|---|
| 33 | * to use your version of this file under the terms of the MPL, indicate your |
|---|
| 34 | * decision by deleting the provisions above and replace them with the notice |
|---|
| 35 | * and other provisions required by the GPL or the LGPL. If you do not delete |
|---|
| 36 | * the provisions above, a recipient may use your version of this file under |
|---|
| 37 | * the terms of any one of the MPL, the GPL, the LGPL or the CeCILL. |
|---|
| 38 | * ]]LICENCE |
|---|
| 39 | --> |
|---|
| 40 | <project name="Bui_postPackMac.core" default="All.appNoDefine" basedir="."> |
|---|
| 41 | <import file="${basedir}/properties.xml"/> |
|---|
| 42 | <import file="${basedir}/xBuildTools.xml"/> |
|---|
| 43 | |
|---|
| 44 | <!-- Post packaging work folder --> |
|---|
| 45 | <property name="app.work.path" value="${releasedir}/postPackMac/${appFolder}"/> |
|---|
| 46 | |
|---|
| 47 | <!-- Post packaging source folder --> |
|---|
| 48 | <property name="app.src.path" value="${app.work.path}/src"/> |
|---|
| 49 | |
|---|
| 50 | <!-- Run principal --> |
|---|
| 51 | <target name="All.appNoDefine"> |
|---|
| 52 | <echo message="Aucune application n'est spécifié. Veuillez lancer le build.xml des sous projets." level="error"/> |
|---|
| 53 | </target> |
|---|
| 54 | |
|---|
| 55 | <target name="main.package"> |
|---|
| 56 | <tstamp> |
|---|
| 57 | <format property="ts" pattern="yyMMdd-HHmm"/> |
|---|
| 58 | </tstamp> |
|---|
| 59 | <antcall target="xInit"/> |
|---|
| 60 | <exec dir="${app.src.path}" executable="find" outputproperty="app.src.path.macApp" failonerror="true"> |
|---|
| 61 | <arg line="${app.src.path} -type d -name ${app.name}*.app"/> |
|---|
| 62 | </exec> |
|---|
| 63 | <echo message="Mac app real path: ${app.src.path.macApp}"/> |
|---|
| 64 | <antcall target="xMountDmg"> |
|---|
| 65 | <param name="pDmgFile" value="${app.work.path}/${app.name}.dmg"/> |
|---|
| 66 | <param name="pDmgMountPoint" value="${app.work.path}/tmpDmgMount"/> |
|---|
| 67 | </antcall> |
|---|
| 68 | <echo message="Copie de ${app.name}.app vers ${app.work.path}/tmpDmgMount"/> |
|---|
| 69 | <exec dir="${app.work.path}" executable="cp" failonerror="true"> |
|---|
| 70 | <arg line="-R '${app.src.path.macApp}' ${app.work.path}/tmpDmgMount"/> |
|---|
| 71 | </exec> |
|---|
| 72 | <antcall target="xUnmountDmg"> |
|---|
| 73 | <param name="pDmgMountPoint" value="${app.work.path}/tmpDmgMount"/> |
|---|
| 74 | </antcall> |
|---|
| 75 | <antcall target="xResizeDmg"> |
|---|
| 76 | <param name="pDmgFile" value="${app.work.path}/${app.name}.dmg"/> |
|---|
| 77 | </antcall> |
|---|
| 78 | <antcall target="xCompressDmg"> |
|---|
| 79 | <param name="pDmgFileIn" value="${app.work.path}/${app.name}.dmg"/> |
|---|
| 80 | <param name="pDmgFileOut" value="${releasedir}/${app.name}_${app.version}_${ts}.dmg"/> |
|---|
| 81 | </antcall> |
|---|
| 82 | </target> |
|---|
| 83 | |
|---|
| 84 | <target name="xInit"> |
|---|
| 85 | <echo message="Post-packaging MacOSX de ${app.name(fullName)} (${app.tgz.path})"/> |
|---|
| 86 | <fail message="Ce build doit être lancer sous un environnement MacOSX."> |
|---|
| 87 | <condition><not><os family="mac"/></not></condition> |
|---|
| 88 | </fail> |
|---|
| 89 | <propertyregex property="app.tgz.ext" input="${app.tgz.path}" regexp="([^.]*)$" select="\1"/> |
|---|
| 90 | <fail message="ATTENTION: le paramètre app.tgz.path doit pointer obligatoirement vers un fichier tgz !"> |
|---|
| 91 | <condition><not><equals arg1="${app.tgz.ext}" arg2="tgz" casesensitive="no"/></not></condition> |
|---|
| 92 | </fail> |
|---|
| 93 | <echo message="Init : décompression de ${app.tgz.path}"/> |
|---|
| 94 | <delete dir="${app.src.path}"/> |
|---|
| 95 | |
|---|
| 96 | <mkdir dir="${app.src.path}"/> |
|---|
| 97 | <antcall target="xUntar"> |
|---|
| 98 | <param name="pSourceTarPath" value="${app.tgz.path}"/> |
|---|
| 99 | <param name="pDestPath" value="${app.src.path}"/> |
|---|
| 100 | <param name="pFilePatern" value="${app.name}*.app"/> |
|---|
| 101 | </antcall> |
|---|
| 102 | <if> |
|---|
| 103 | <available file="${app.res.path}/${app.name}.dmg.zip" type="file"/> |
|---|
| 104 | <then> |
|---|
| 105 | <echo message="Template DMG disponible (${app.res.path}/${app.name}.dmg.zip)"/> |
|---|
| 106 | <unzip src="${app.res.path}/${app.name}.dmg.zip" dest="${app.work.path}"/> |
|---|
| 107 | </then> |
|---|
| 108 | <else> |
|---|
| 109 | <echo message="DMG template introuvable : ${app.res.path}/${app.name}.dmg.zip"/> |
|---|
| 110 | <antcall target="xCreateDmg"> |
|---|
| 111 | <param name="pDmgFile" value="${app.work.path}/${app.name}.dmg"/> |
|---|
| 112 | <param name="pDmgName" value="${app.name(fullName)}"/> |
|---|
| 113 | </antcall> |
|---|
| 114 | </else> |
|---|
| 115 | </if> |
|---|
| 116 | </target> |
|---|
| 117 | |
|---|
| 118 | <target name="xCleanup.core"> |
|---|
| 119 | <echo message="Cleanup : Démontage de ${app.work.path}/tmpDmgMount"/> |
|---|
| 120 | <antcall target="xUnmountDmg"> |
|---|
| 121 | <param name="pDmgMountPoint" value="${app.work.path}/tmpDmgMount"/> |
|---|
| 122 | </antcall> |
|---|
| 123 | |
|---|
| 124 | <echo message="Cleanup : Suppression de ${app.work.path}"/> |
|---|
| 125 | <delete dir="${app.work.path}"/> |
|---|
| 126 | </target> |
|---|
| 127 | |
|---|
| 128 | <target name="xBuildExtraProps.core" description="Build extra name and version properties if needed"> |
|---|
| 129 | <!-- versions --> |
|---|
| 130 | <property name="app.version(minor).length" value="1"/> |
|---|
| 131 | <propertyregex property="app.version(major)" input="${app.version}" regexp="([0-9]+)\.[0-9]+\.[0-9]+" select="\1"/> |
|---|
| 132 | <propertyregex property="app.version(medium)" input="${app.version}" regexp="[0-9]+\.([0-9]+)\.[0-9]+" select="\1"/> |
|---|
| 133 | <propertyregex property="app.version(minor)" input="${app.version}" regexp="[0-9]+\.[0-9]+\.([0-9]+)" select="\1"/> |
|---|
| 134 | <!-- gestion des chiffres significatifs de vMineur --> |
|---|
| 135 | <propertyregex property="app.version(minor).begin" input="${app.version(minor)}" regexp="([0-9]{${app.version(minor).length}})" select="\1"/> |
|---|
| 136 | <propertyregex property="app.version(minor).end" input="${app.version(minor)}" regexp="[0-9]{${app.version(minor).length}}([0-9]*)" select="\1"/> |
|---|
| 137 | <condition property="app.version(full)" value="${app.version}" else="${app.version(major)}.${app.version(medium)}.${app.version(minor).begin}.${app.version(minor).end}"><equals arg1="${app.version(minor).length}" arg2="0"/></condition><!-- on transforme la vMineure en ww.yy --> |
|---|
| 138 | |
|---|
| 139 | <!-- names --> |
|---|
| 140 | <property name="app.name(shortName)" value="${app.name}"/> |
|---|
| 141 | <property name="app.name(fullName)" value="${app.name} ${app.version(major)}.${app.version(medium)}"/> |
|---|
| 142 | </target> |
|---|
| 143 | |
|---|
| 144 | </project> |
|---|