This plugin for the Zarafa Webapp provides a PDF and ODF previewpanel based on ViewerJS.
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 6.2KB

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