2013-05-20 23:09:51 +02:00
|
|
|
<project default="all">
|
2016-06-13 10:18:47 +02:00
|
|
|
<property environment="env"/>
|
|
|
|
<property name="root-folder" value="${basedir}/../../"/>
|
|
|
|
<property name="tools-folder" value="${root-folder}/tools/"/>
|
|
|
|
<property name="target-folder" value="${root-folder}/deploy/plugins"/>
|
|
|
|
<property name="server-folder" value="${root-folder}/server"/>
|
2013-05-20 23:09:51 +02:00
|
|
|
|
|
|
|
<import file="${tools-folder}/antutil.xml"/>
|
|
|
|
|
|
|
|
<typedef file="${tools-folder}/antlib.xml">
|
|
|
|
<classpath>
|
|
|
|
<pathelement location="${tools-folder}/tools.jar"/>
|
|
|
|
</classpath>
|
|
|
|
</typedef>
|
|
|
|
|
|
|
|
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
|
|
|
|
<classpath>
|
|
|
|
<pathelement location="${tools-folder}/lib/ant-contrib-1.0b3.jar"/>
|
|
|
|
</classpath>
|
|
|
|
</taskdef>
|
|
|
|
|
|
|
|
<!-- Determine plugin name -->
|
|
|
|
<basename file="${basedir}" property="plugin"/>
|
|
|
|
|
|
|
|
<!-- The Plugin distribution files -->
|
|
|
|
<property name="plugin-folder" value="${plugin}"/>
|
|
|
|
<property name="plugin-debugfile" value="${plugin}-debug.js"/>
|
|
|
|
<property name="plugin-file" value="${plugin}.js"/>
|
|
|
|
|
|
|
|
<!-- The Plugin CSS files -->
|
|
|
|
<property name="plugin-css-folder" value="resources/css"/>
|
2016-06-13 10:18:47 +02:00
|
|
|
<property name="plugin-css-file" value="${plugin}.css"/>
|
2013-05-20 23:09:51 +02:00
|
|
|
|
|
|
|
<!-- Meta target -->
|
|
|
|
<target name="all" depends="concat, compress"/>
|
|
|
|
|
|
|
|
<!-- Clean -->
|
|
|
|
<target name="clean">
|
|
|
|
<delete includeemptydirs="true" failonerror="false">
|
|
|
|
<!-- Delete the Plugin files -->
|
|
|
|
<fileset dir="${target-folder}/${plugin-folder}/js">
|
|
|
|
<include name="${plugin-file}"/>
|
|
|
|
<include name="${plugin-debugfile}"/>
|
|
|
|
</fileset>
|
|
|
|
</delete>
|
|
|
|
</target>
|
|
|
|
|
|
|
|
<!-- Concatenates JavaScript files with automatic dependency generation -->
|
|
|
|
<target name="concat">
|
|
|
|
<!-- Concatenate plugin JS file -->
|
|
|
|
<if>
|
|
|
|
<available file="js" type="dir" />
|
|
|
|
<then>
|
|
|
|
<mkdir dir="${target-folder}/${plugin-folder}/js"/>
|
|
|
|
<echo message="Concatenating: ${plugin-debugfile}"/>
|
2016-06-13 10:18:47 +02:00
|
|
|
<zConcat outputFolder="${target-folder}/${plugin-folder}/js" outputFile="${plugin-debugfile}" prioritize="\w+">
|
2013-05-20 23:09:51 +02:00
|
|
|
<concatfiles>
|
|
|
|
<fileset dir="js" includes="**/*.js" />
|
|
|
|
</concatfiles>
|
2016-06-13 10:18:47 +02:00
|
|
|
</zConcat>
|
2013-05-20 23:09:51 +02:00
|
|
|
</then>
|
|
|
|
</if>
|
|
|
|
|
|
|
|
<!-- Concatenate plugin CSS files -->
|
|
|
|
<if>
|
|
|
|
<available file="${plugin-css-folder}" type="dir" />
|
|
|
|
<then>
|
|
|
|
<mkdir dir="${target-folder}/${plugin-folder}/${plugin-css-folder}"/>
|
2016-06-13 10:18:47 +02:00
|
|
|
<echo message="Concatenating: ${plugin-css-file}"/>
|
|
|
|
<zConcat outputFolder="${target-folder}/${plugin-folder}/${plugin-css-folder}" outputFile="${plugin-css-file}">
|
2013-05-20 23:09:51 +02:00
|
|
|
<concatfiles>
|
|
|
|
<fileset dir="${plugin-css-folder}" includes="**/*.css" />
|
|
|
|
</concatfiles>
|
|
|
|
</zConcat>
|
|
|
|
</then>
|
|
|
|
</if>
|
|
|
|
</target>
|
|
|
|
|
|
|
|
<!-- Preformat the Concatenated Javascript files to improve compilation -->
|
|
|
|
<target name="preformat" depends="concat">
|
|
|
|
<if>
|
|
|
|
<available file="${target-folder}/${plugin-folder}/js/${plugin-debugfile}" type="file" />
|
|
|
|
<then>
|
|
|
|
<echo message="Preformatting: ${plugin-debugfile}"/>
|
|
|
|
<replaceregexp byline="true">
|
|
|
|
<regexp pattern="(^[ ,\t]*\*[ ,\t]@.*)\{(.*)\[\]\}"/>
|
|
|
|
<substitution expression="\1{\2\|Array}"/>
|
|
|
|
<fileset dir="${target-folder}/${plugin-folder}/js" includes="${plugin-debugfile}"/>
|
|
|
|
</replaceregexp>
|
|
|
|
</then>
|
|
|
|
</if>
|
|
|
|
</target>
|
|
|
|
|
|
|
|
<!-- Compress JavaScript -->
|
|
|
|
<target name="compress" depends="preformat">
|
|
|
|
<if>
|
|
|
|
<available file="${target-folder}/${plugin-folder}/js/${plugin-debugfile}" type="file" />
|
|
|
|
<then>
|
|
|
|
<echo message="Compiling: ${plugin-debugfile}" />
|
|
|
|
<zCompile inputFolder="${target-folder}/${plugin-folder}/js" inputFile="${plugin-debugfile}" outputFolder="${target-folder}/${plugin-folder}/js" outputFile="${plugin-file}">
|
|
|
|
<externs>
|
|
|
|
var Ext = {};
|
|
|
|
var Zarafa = {};
|
|
|
|
var container = {};
|
|
|
|
var _ = function(key, domain) {};
|
|
|
|
var dgettext = function(domain, msgid) {};
|
|
|
|
var dngettext = function(domain, msgid, msgid_plural, count) {};
|
|
|
|
var dnpgettext = function(domain, msgctxt, msgid, msgid_plural, count) {};
|
|
|
|
var dpgettext = function(domain, msgctxt, msgid) {};
|
|
|
|
var ngettext = function(msgid, msgid_plural, count) {};
|
|
|
|
var npgettext = function(msgctxt, msgid, msgid_plural, count) {};
|
|
|
|
var pgettext = function(msgctxt, msgid) {};
|
|
|
|
</externs>
|
2016-06-13 10:18:47 +02:00
|
|
|
</zCompile>
|
2013-05-20 23:09:51 +02:00
|
|
|
</then>
|
|
|
|
</if>
|
|
|
|
</target>
|
|
|
|
|
|
|
|
<!-- syntax check all PHP files -->
|
|
|
|
<target name="validate">
|
|
|
|
<if>
|
2016-06-13 10:18:47 +02:00
|
|
|
<available file="php" filepath="${env.PATH}" />
|
2013-05-20 23:09:51 +02:00
|
|
|
<then>
|
2016-06-13 10:18:47 +02:00
|
|
|
<if>
|
|
|
|
<available file="config.php" type="file" />
|
|
|
|
<then>
|
|
|
|
<antcall target="syntax-check">
|
|
|
|
<param name="file" value="config.php"/>
|
|
|
|
</antcall>
|
|
|
|
</then>
|
|
|
|
</if>
|
|
|
|
<if>
|
|
|
|
<available file="php" type="dir" />
|
|
|
|
<then>
|
|
|
|
<foreach target="syntax-check" param="file">
|
|
|
|
<path>
|
|
|
|
<fileset dir=".">
|
2016-06-13 13:41:52 +02:00
|
|
|
<exclude name="php/vendor/**" />
|
2016-06-13 10:18:47 +02:00
|
|
|
<include name="**/*.php"/>
|
|
|
|
</fileset>
|
|
|
|
</path>
|
|
|
|
</foreach>
|
|
|
|
</then>
|
|
|
|
</if>
|
2013-05-20 23:09:51 +02:00
|
|
|
</then>
|
2016-06-13 10:18:47 +02:00
|
|
|
<else>
|
|
|
|
<echo message="WARNING: PHP not available, not performing syntax-check on php files"/>
|
|
|
|
</else>
|
2013-05-20 23:09:51 +02:00
|
|
|
</if>
|
|
|
|
</target>
|
|
|
|
|
|
|
|
<target name="syntax-check">
|
|
|
|
<echo message="validating ${file}"/>
|
2016-06-13 10:18:47 +02:00
|
|
|
<exec executable="php" failonerror="true">
|
2013-05-20 23:09:51 +02:00
|
|
|
<arg value="-l"/>
|
|
|
|
<arg value="${file}"/>
|
|
|
|
</exec>
|
|
|
|
</target>
|
|
|
|
|
|
|
|
<!-- Install all files into the target folder -->
|
2016-06-13 10:18:47 +02:00
|
|
|
<target name="deploy" depends="compress, validate">
|
2013-05-20 23:09:51 +02:00
|
|
|
<mkdir dir="${target-folder}/${plugin-folder}"/>
|
|
|
|
|
2016-06-13 10:18:47 +02:00
|
|
|
<!-- Copy (and validate) manifest.xml -->
|
|
|
|
<if>
|
|
|
|
<available file="xmllint" filepath="${env.PATH}" />
|
|
|
|
<then>
|
|
|
|
<exec executable="xmllint" output="${target-folder}/${plugin-folder}/manifest.xml" failonerror="true">
|
|
|
|
<arg value="--valid"/>
|
|
|
|
<arg value="--path"/>
|
|
|
|
<arg value="${server-folder}"/>
|
|
|
|
<arg value="manifest.xml"/>
|
|
|
|
</exec>
|
|
|
|
</then>
|
|
|
|
<else>
|
|
|
|
<echo message="WARNING: xmllint not available, not performing syntax-check on manifest.xml"/>
|
|
|
|
<!-- xmllint is not available, so we must copy the file manually -->
|
|
|
|
<copy todir="${target-folder}/${plugin-folder}">
|
|
|
|
<fileset dir=".">
|
|
|
|
<include name="manifest.xml"/>
|
|
|
|
</fileset>
|
|
|
|
</copy>
|
|
|
|
</else>
|
|
|
|
</if>
|
|
|
|
|
2013-05-20 23:09:51 +02:00
|
|
|
<!-- copy files -->
|
|
|
|
<copy todir="${target-folder}/${plugin-folder}">
|
|
|
|
<fileset dir=".">
|
2016-06-13 10:18:47 +02:00
|
|
|
<include name="resources/**/*.*"/>
|
|
|
|
<include name="external/**/*.*"/>
|
2013-05-20 23:09:51 +02:00
|
|
|
<include name="php/**/*.php"/>
|
|
|
|
<include name="config.php"/>
|
|
|
|
<!-- exclude the ant script -->
|
|
|
|
<exclude name="build.xml"/>
|
|
|
|
<!-- CSS is generated during build -->
|
|
|
|
<exclude name="resources/css/*.*"/>
|
|
|
|
</fileset>
|
|
|
|
</copy>
|
|
|
|
</target>
|
2016-06-13 10:18:47 +02:00
|
|
|
</project>
|