OF-1149: Improve build speed

* 'override' defined just once (and set to false)
* a plugin can be skipped by setting a property 'plugin.pluginname.skip'
  to true (eg: -Dplugin.broadcast.skip=true)
* plugins that are built set the property above, to prevent rebuilding
  during the same Ant invocation (speeds up parent/child plugin builds)
parent e3dee9e5
...@@ -102,7 +102,6 @@ ...@@ -102,7 +102,6 @@
<property name="anttools.src.dir" value="${src.dir}/tools"/> <property name="anttools.src.dir" value="${src.dir}/tools"/>
<property name="anttools.target.dir" value="${work.dir}/tools"/> <property name="anttools.target.dir" value="${work.dir}/tools"/>
<property name="copy.dbscripts" value="true"/> <property name="copy.dbscripts" value="true"/>
<property name="overwrite" value="true"/>
<property name="installer.install4j.home" value="/home/j2ee-bamboo/install4j.5.1.11"/> <property name="installer.install4j.home" value="/home/j2ee-bamboo/install4j.5.1.11"/>
<property name="installer.src" value="${basedir}/build/installer"/> <property name="installer.src" value="${basedir}/build/installer"/>
...@@ -1322,66 +1321,50 @@ ...@@ -1322,66 +1321,50 @@
<antcall target="openfireHome"/> <antcall target="openfireHome"/>
</target> </target>
<macrodef name="buildparentplugin">
<attribute name="plugin"/>
<attribute name="pluginsrc"/>
<attribute name="pluginlib" default="${plugin.dev.dest.dir}/@{plugin}/work/lib" />
<attribute name="parentPlug"/>
<sequential>
<echo message="Read XML properties of @{pluginsrc}/@{parentPlug}/plugin.xml"/>
<xmlproperty file="@{pluginsrc}/@{parentPlug}/plugin.xml" prefix="@{parentPlug}" keepRoot="false"/>
<if>
<isset property="@{parentPlug}.parentPlugin"/>
<then>
<echo message="Compile parent of parent plugin ${@{parentPlug}.parentPlugin}"/>
<buildparentplugin parentPlug="${@{parentPlug}.parentPlugin}" plugin="@{plugin}" pluginsrc="@{pluginsrc}" pluginlib="@{pluginlib}"/>
</then>
</if>
<echo message="Compile parent plugin @{parentPlug}"/>
<javac
destdir="${plugin.dev.dest.dir}/@{plugin}/target/classes"
includeAntRuntime="no"
debug="on"
source="${javac.source}"
target="${javac.target}"
>
<src path="@{pluginsrc}/@{parentPlug}/src/java"/>
<classpath>
<path refid="plugin.dependencies"/>
<!-- Jars used by the plugin to compile with -->
<fileset dir="@{pluginsrc}/@{parentPlug}" includes="lib/*.jar"/>
</classpath>
</javac>
</sequential>
</macrodef>
<!-- buildplugin (MACRO) =================================================================== --> <!-- buildplugin (MACRO) =================================================================== -->
<macrodef name="buildplugin"> <macrodef name="buildplugin">
<attribute name="plugin"/> <attribute name="plugin"/>
<attribute name="pluginsrc"/> <attribute name="pluginsrc"/>
<attribute name="pluginlib" default="${plugin.dev.dest.dir}/@{plugin}/work/lib" /> <attribute name="pluginlib" default="${plugin.dev.dest.dir}/@{plugin}/work/lib" />
<sequential> <sequential>
<trycatch property="message_ref" reference="exception_ref" > <if>
<not>
<istrue value="${plugin.@{plugin}.skip}"/>
</not>
<then>
<trycatch property="message_ref" reference="exception_ref">
<try> <try>
<!-- For each plugin, copile code, make a jar and copy resources. --> <!-- For each plugin, compile code, make a jar and copy resources. -->
<mkdir dir="${plugin.dev.dest.dir}"/> <mkdir dir="${plugin.dev.dest.dir}"/>
<mkdir dir="${plugin.dev.dest.dir}/@{plugin}"/> <mkdir dir="${plugin.dev.dest.dir}/@{plugin}"/>
<mkdir dir="${plugin.dev.dest.dir}/@{plugin}/target"/> <mkdir dir="${plugin.dev.dest.dir}/@{plugin}/target"/>
<mkdir dir="${plugin.dev.dest.dir}/@{plugin}/target/classes"/> <mkdir dir="${plugin.dev.dest.dir}/@{plugin}/target/classes"/>
<mkdir dir="${plugin.dev.dest.dir}/@{plugin}/target/parentlibs"/>
<xmlproperty file="${plugin.src.dir}/@{plugin}/plugin.xml" prefix="@{plugin}" keeproot="false"/> <xmlproperty file="${plugin.src.dir}/@{plugin}/plugin.xml" prefix="@{plugin}" keeproot="false"/>
<if> <if>
<isset property="@{plugin}.parentPlugin"/> <isset property="@{plugin}.parentPlugin"/>
<then> <then>
<echo>Parent plugin found: ${@{plugin}.parentPlugin}</echo> <echo>Parent plugin found: ${@{plugin}.parentPlugin}</echo>
<buildparentplugin parentPlug="${@{plugin}.parentPlugin}" plugin="@{plugin}" pluginsrc="@{pluginsrc}" pluginlib="@{pluginlib}"/> <!--<buildparentplugin parentPlug="${@{plugin}.parentPlugin}" plugin="@{plugin}" pluginsrc="@{pluginsrc}" pluginlib="@{pluginlib}"/>-->
<buildplugin plugin="${@{plugin}.parentPlugin}" pluginsrc="${plugin.src.dir}"/>
<!-- Copy parent plugin code + dependencies into our own plugin directory. -->
<echo>Parent plugin built. Copying its resources and continuing with build for child plugin.</echo>
<copy todir="${plugin.dev.dest.dir}/@{plugin}/target/parentlibs">
<fileset dir="${plugin.dev.dest.dir}/${@{plugin}.parentPlugin}/target/parentlibs/" includes="**/*.jar" />
</copy>
<copy todir="${plugin.dev.dest.dir}/@{plugin}/target/parentlibs">
<fileset dir="${plugin.dev.dest.dir}/${@{plugin}.parentPlugin}/target/lib/" includes="**/*.jar" />
</copy>
</then> </then>
</if> </if>
<path id="plugin.classpath.source"> <path id="plugin.classpath.source">
<path refid="plugin.dependencies"/> <path refid="plugin.dependencies"/>
<fileset dir="${plugin.dev.dest.dir}/@{plugin}/target/parentlibs" includes="**/*.jar"/>
<fileset dir="@{pluginsrc}/@{plugin}" includes="lib/*.jar"/> <fileset dir="@{pluginsrc}/@{plugin}" includes="lib/*.jar"/>
</path> </path>
...@@ -1568,7 +1551,8 @@ ...@@ -1568,7 +1551,8 @@
<classpath> <classpath>
<path refid="jspc.dependencies"/> <path refid="jspc.dependencies"/>
<pathelement path="${compile.dir}"/> <pathelement path="${compile.dir}"/>
<fileset dir="${plugin.dev.dest.dir}/@{plugin}/target" includes="lib/*.jar"/> <fileset dir="${plugin.dev.dest.dir}/@{plugin}/target/lib" includes="*.jar"/>
<fileset dir="${plugin.dev.dest.dir}/@{plugin}/target/parentlibs" includes="**/*.jar"/>
</classpath> </classpath>
</of.javac> </of.javac>
...@@ -1613,6 +1597,9 @@ ...@@ -1613,6 +1597,9 @@
<!-- Delete the exploded plugin --> <!-- Delete the exploded plugin -->
<delete dir="${plugin.dev.dest.dir}/@{plugin}/jar"/> <delete dir="${plugin.dev.dest.dir}/@{plugin}/jar"/>
<!-- Plugin is done! No need to rebuilt it within the same Ant task -->
<property name="plugin.@{plugin}.skip" value="true"/>
</try> </try>
<catch> <catch>
<property name="exception" refid="exception_ref" /> <property name="exception" refid="exception_ref" />
...@@ -1625,6 +1612,8 @@ ...@@ -1625,6 +1612,8 @@
</fail> </fail>
</catch> </catch>
</trycatch> </trycatch>
</then>
</if>
</sequential> </sequential>
</macrodef> </macrodef>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment