The contact importer and exporter plugin for the Kopano WebApp. See here for more details: https://community.zarafa.com/pg/plugins/project/20393/developer/h44z/webapp-contact-importer
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

build.xml 9.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. <project default="all">
  2. <property environment="env"/>
  3. <property name="root-folder" value="${basedir}/../.."/>
  4. <property name="tools-folder" value="${root-folder}/tools/"/>
  5. <property name="target-folder" value="${root-folder}/deploy/plugins"/>
  6. <property name="server-folder" value="${root-folder}/server"/>
  7. <property name="language-folder" value="${basedir}/languages"/>
  8. <import file="${tools-folder}/antutil.xml"/>
  9. <typedef file="${tools-folder}/antlib.xml">
  10. <classpath>
  11. <pathelement location="${tools-folder}/tools.jar"/>
  12. </classpath>
  13. </typedef>
  14. <taskdef resource="net/sf/antcontrib/antlib.xml">
  15. <classpath>
  16. <pathelement location="${tools-folder}/lib/ant-contrib-1.0b3.jar"/>
  17. </classpath>
  18. </taskdef>
  19. <!-- Determine plugin name -->
  20. <basename file="${basedir}" property="plugin"/>
  21. <!-- The Plugin distribution files -->
  22. <property name="plugin-folder" value="${plugin}"/>
  23. <property name="plugin-debugfile" value="${plugin}-debug.js"/>
  24. <property name="plugin-file" value="${plugin}.js"/>
  25. <!-- The Plugin CSS files -->
  26. <property name="plugin-css-folder" value="resources/css"/>
  27. <property name="plugin-css-file" value="${plugin}.css"/>
  28. <!-- Meta target -->
  29. <target name="all" depends="concat, compress"/>
  30. <!-- Clean -->
  31. <target name="clean">
  32. <delete includeemptydirs="true" failonerror="false">
  33. <!-- Delete the Plugin files -->
  34. <fileset dir="${target-folder}/${plugin-folder}/js">
  35. <include name="${plugin-file}"/>
  36. <include name="${plugin-debugfile}"/>
  37. </fileset>
  38. </delete>
  39. </target>
  40. <!-- Concatenates JavaScript files with automatic dependency generation -->
  41. <target name="concat">
  42. <!-- Concatenate plugin JS file -->
  43. <if>
  44. <available file="js" type="dir"/>
  45. <then>
  46. <mkdir dir="${target-folder}/${plugin-folder}/js"/>
  47. <echo message="Concatenating: ${plugin-debugfile}"/>
  48. <zConcat outputFolder="${target-folder}/${plugin-folder}/js" outputFile="${plugin-debugfile}"
  49. prioritize="\w+">
  50. <concatfiles>
  51. <fileset dir="js" includes="**/*.js"/>
  52. </concatfiles>
  53. </zConcat>
  54. </then>
  55. </if>
  56. <!-- Concatenate plugin CSS files -->
  57. <if>
  58. <available file="${plugin-css-folder}" type="dir"/>
  59. <then>
  60. <mkdir dir="${target-folder}/${plugin-folder}/${plugin-css-folder}"/>
  61. <echo message="Concatenating: ${plugin-css-file}"/>
  62. <zConcat outputFolder="${target-folder}/${plugin-folder}/${plugin-css-folder}"
  63. outputFile="${plugin-css-file}">
  64. <concatfiles>
  65. <fileset dir="${plugin-css-folder}" includes="**/*.css"/>
  66. </concatfiles>
  67. </zConcat>
  68. </then>
  69. </if>
  70. </target>
  71. <!-- Preformat the Concatenated Javascript files to improve compilation -->
  72. <target name="preformat" depends="concat">
  73. <if>
  74. <available file="${target-folder}/${plugin-folder}/js/${plugin-debugfile}" type="file"/>
  75. <then>
  76. <echo message="Preformatting: ${plugin-debugfile}"/>
  77. <replaceregexp byline="true">
  78. <regexp pattern="(^[ ,\t]*\*[ ,\t]@.*)\{(.*)\[\]\}"/>
  79. <substitution expression="\1{\2\|Array}"/>
  80. <fileset dir="${target-folder}/${plugin-folder}/js" includes="${plugin-debugfile}"/>
  81. </replaceregexp>
  82. </then>
  83. </if>
  84. </target>
  85. <!-- Compress JavaScript -->
  86. <target name="compress" depends="preformat">
  87. <if>
  88. <available file="${target-folder}/${plugin-folder}/js/${plugin-debugfile}" type="file"/>
  89. <then>
  90. <echo message="Compiling: ${plugin-debugfile}"/>
  91. <zCompile inputFolder="${target-folder}/${plugin-folder}/js" inputFile="${plugin-debugfile}"
  92. outputFolder="${target-folder}/${plugin-folder}/js" outputFile="${plugin-file}">
  93. <externs>
  94. var Ext = {};
  95. var Zarafa = {};
  96. var container = {};
  97. var _ = function(key, domain) {};
  98. var dgettext = function(domain, msgid) {};
  99. var dngettext = function(domain, msgid, msgid_plural, count) {};
  100. var dnpgettext = function(domain, msgctxt, msgid, msgid_plural, count) {};
  101. var dpgettext = function(domain, msgctxt, msgid) {};
  102. var ngettext = function(msgid, msgid_plural, count) {};
  103. var npgettext = function(msgctxt, msgid, msgid_plural, count) {};
  104. var pgettext = function(msgctxt, msgid) {};
  105. </externs>
  106. </zCompile>
  107. </then>
  108. </if>
  109. </target>
  110. <!-- syntax check all PHP files -->
  111. <target name="validate">
  112. <if>
  113. <available file="php" filepath="${env.PATH}"/>
  114. <then>
  115. <if>
  116. <available file="config.php" type="file"/>
  117. <then>
  118. <antcall target="syntax-check">
  119. <param name="file" value="config.php"/>
  120. </antcall>
  121. </then>
  122. </if>
  123. <if>
  124. <available file="php" type="dir"/>
  125. <then>
  126. <foreach target="syntax-check" param="file">
  127. <path>
  128. <fileset dir=".">
  129. <exclude name="php/vendor/**"/>
  130. <include name="**/*.php"/>
  131. </fileset>
  132. </path>
  133. </foreach>
  134. </then>
  135. </if>
  136. </then>
  137. <else>
  138. <echo message="WARNING: PHP not available, not performing syntax-check on php files"/>
  139. </else>
  140. </if>
  141. </target>
  142. <target name="syntax-check">
  143. <echo message="validating ${file}"/>
  144. <exec executable="php" failonerror="true">
  145. <arg value="-l"/>
  146. <arg value="${file}"/>
  147. </exec>
  148. </target>
  149. <!-- Generate language files -->
  150. <target name="language">
  151. <if>
  152. <available file="msgfmt" filepath="${env.PATH}" />
  153. <then>
  154. <for param="file" parallel="true">
  155. <fileset dir="${language-folder}">
  156. <include name="**/LC_MESSAGES/*.po"/>
  157. </fileset>
  158. <sequential>
  159. <antcall target="msgfmt">
  160. <param name="file" value="@{file}"/>
  161. </antcall>
  162. </sequential>
  163. </for>
  164. </then>
  165. <else>
  166. <echo message="WARNING: msgfmt not available, not generating *.mo files for translations"/>
  167. <!-- just copy files -->
  168. <copy todir="${target-folder}/${plugin-folder}">
  169. <fileset dir=".">
  170. <include name="languages/**/*.mo"/>
  171. <include name="languages/**/*.txt"/>
  172. </fileset>
  173. </copy>
  174. </else>
  175. </if>
  176. </target>
  177. <target name="msgfmt">
  178. <propertyregex property="outfile" input="${file}" regexp=".*\/(languages\/.*)\.po" replace="${target-folder}/${plugin-folder}/\1\.mo"/>
  179. <echo message="Converting ${file} to ${outfile}"/>
  180. <dirname property="outdir" file="${outfile}"/>
  181. <mkdir dir="${outdir}"/>
  182. <exec executable="msgfmt" failonerror="true">
  183. <arg value="-v"/>
  184. <arg value="-o"/>
  185. <arg value="${outfile}"/>
  186. <arg value="${file}"/>
  187. </exec>
  188. </target>
  189. <!-- Install all files into the target folder -->
  190. <target name="deploy" depends="compress, validate, language">
  191. <mkdir dir="${target-folder}/${plugin-folder}"/>
  192. <!-- Copy (and validate) manifest.xml -->
  193. <if>
  194. <available file="xmllint" filepath="${env.PATH}"/>
  195. <then>
  196. <exec executable="xmllint" output="${target-folder}/${plugin-folder}/manifest.xml" failonerror="true">
  197. <arg value="--valid"/>
  198. <arg value="--path"/>
  199. <arg value="${server-folder}"/>
  200. <arg value="manifest.xml"/>
  201. </exec>
  202. </then>
  203. <else>
  204. <echo message="WARNING: xmllint not available, not performing syntax-check on manifest.xml"/>
  205. <!-- xmllint is not available, so we must copy the file manually -->
  206. <copy todir="${target-folder}/${plugin-folder}">
  207. <fileset dir=".">
  208. <include name="manifest.xml"/>
  209. </fileset>
  210. </copy>
  211. </else>
  212. </if>
  213. <!-- copy files -->
  214. <copy todir="${target-folder}/${plugin-folder}">
  215. <fileset dir=".">
  216. <include name="resources/**/*.*"/>
  217. <include name="external/**/*.*"/>
  218. <include name="php/**/*.php"/>
  219. <include name="config.php"/>
  220. <!-- exclude the ant script -->
  221. <exclude name="build.xml"/>
  222. <!-- CSS is generated during build -->
  223. <exclude name="resources/css/*.*"/>
  224. </fileset>
  225. </copy>
  226. </target>
  227. </project>