Updated build scripts

This commit is contained in:
Christoph Haas 2016-11-29 18:21:58 +01:00
parent 4f4ccfda80
commit b10415a3fe
3 changed files with 272 additions and 198 deletions

View File

@ -2,17 +2,8 @@
<project version="4"> <project version="4">
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="aae153d8-808f-4371-b0e9-9ee7ff904cab" name="Default" comment=""> <list default="true" id="aae153d8-808f-4371-b0e9-9ee7ff904cab" name="Default" comment="">
<change type="DELETED" beforePath="$PROJECT_DIR$/js/dialogs/fields.txt" afterPath="" /> <change type="MODIFICATION" beforePath="$PROJECT_DIR$/Makefile" afterPath="$PROJECT_DIR$/Makefile" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/languages/en_US.UTF-8/LC_MESSAGES/plugin_calendarimporter.mo" afterPath="$PROJECT_DIR$/languages/en_US.UTF-8/LC_MESSAGES/plugin_calendarimporter.mo" /> <change type="MODIFICATION" beforePath="$PROJECT_DIR$/build.xml" afterPath="$PROJECT_DIR$/build.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/js/ABOUT.js" afterPath="$PROJECT_DIR$/js/ABOUT.js" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/js/data/ResponseHandler.js" afterPath="$PROJECT_DIR$/js/data/ResponseHandler.js" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/js/dialogs/ImportContentPanel.js" afterPath="$PROJECT_DIR$/js/dialogs/ImportContentPanel.js" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/js/dialogs/ImportPanel.js" afterPath="$PROJECT_DIR$/js/dialogs/ImportPanel.js" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/js/plugin.contactimporter.js" afterPath="$PROJECT_DIR$/js/plugin.contactimporter.js" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/js/ui/ContextMenu.js" afterPath="$PROJECT_DIR$/js/ui/ContextMenu.js" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/languages/en_US.UTF-8/LC_MESSAGES/plugin_calendarimporter.po" afterPath="$PROJECT_DIR$/languages/en_US.UTF-8/LC_MESSAGES/plugin_calendarimporter.po" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/php/upload.php" afterPath="$PROJECT_DIR$/php/upload.php" />
</list> </list>
<ignored path="contactimporter.iws" /> <ignored path="contactimporter.iws" />
<ignored path=".idea/workspace.xml" /> <ignored path=".idea/workspace.xml" />
@ -100,7 +91,7 @@
</provider> </provider>
</entry> </entry>
</file> </file>
<file leaf-file-name="plugin_calendarimporter.po" pinned="false" current-in-tab="true"> <file leaf-file-name="plugin_calendarimporter.po" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/languages/en_US.UTF-8/LC_MESSAGES/plugin_calendarimporter.po"> <entry file="file://$PROJECT_DIR$/languages/en_US.UTF-8/LC_MESSAGES/plugin_calendarimporter.po">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0"> <state relative-caret-position="0">
@ -110,6 +101,26 @@
</provider> </provider>
</entry> </entry>
</file> </file>
<file leaf-file-name="build.xml" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/build.xml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="165">
<caret line="167" column="18" selection-start-line="167" selection-start-column="18" selection-end-line="167" selection-end-column="18" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="manifest.xml" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/manifest.xml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="ImportContentPanel.js" pinned="false" current-in-tab="false"> <file leaf-file-name="ImportContentPanel.js" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/js/dialogs/ImportContentPanel.js"> <entry file="file://$PROJECT_DIR$/js/dialogs/ImportContentPanel.js">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
@ -141,6 +152,7 @@
<option value="$PROJECT_DIR$/js/dialogs/ImportPanel.js" /> <option value="$PROJECT_DIR$/js/dialogs/ImportPanel.js" />
<option value="$PROJECT_DIR$/js/data/ResponseHandler.js" /> <option value="$PROJECT_DIR$/js/data/ResponseHandler.js" />
<option value="$PROJECT_DIR$/php/upload.php" /> <option value="$PROJECT_DIR$/php/upload.php" />
<option value="$PROJECT_DIR$/build.xml" />
</list> </list>
</option> </option>
</component> </component>
@ -410,18 +422,18 @@
<updated>1480428196914</updated> <updated>1480428196914</updated>
<workItem from="1480428199144" duration="44000" /> <workItem from="1480428199144" duration="44000" />
<workItem from="1480428259775" duration="69000" /> <workItem from="1480428259775" duration="69000" />
<workItem from="1480428330068" duration="2756000" /> <workItem from="1480428330068" duration="5601000" />
</task> </task>
<servers /> <servers />
</component> </component>
<component name="TimeTrackingManager"> <component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="2869000" /> <option name="totallyTimeSpent" value="5714000" />
</component> </component>
<component name="ToolWindowManager"> <component name="ToolWindowManager">
<frame x="65" y="24" width="1792" height="999" extended-state="6" /> <frame x="65" y="24" width="1792" height="999" extended-state="6" />
<editor active="true" /> <editor active="false" />
<layout> <layout>
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" /> <window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" /> <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" /> <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" /> <window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
@ -590,6 +602,22 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/manifest.xml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/build.xml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="165">
<caret line="167" column="18" selection-start-line="167" selection-start-column="18" selection-end-line="167" selection-end-column="18" />
<folding />
</state>
</provider>
</entry>
</component> </component>
<component name="masterDetails"> <component name="masterDetails">
<states> <states>

View File

@ -1,2 +1,2 @@
default: default:
ant deploy; cp -r /home/osboxes/Documents/kopano-webapp-3.2.0.285/deploy/plugins/contactimporter /usr/share/kopano-webapp/plugins/ rm -rf /home/osboxes/Documents/kopano-webapp-3.2.0.285/deploy/plugins/contactimporter; ant deploy; cp -r /home/osboxes/Documents/kopano-webapp-3.2.0.285/deploy/plugins/contactimporter /usr/share/kopano-webapp/plugins/

408
build.xml
View File

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