blob: 5f21527e7cca8d37e6119aee2a395adf9316445f [file] [log] [blame]
<project basedir="." default="help">
<!--Set your elcipse home directory -->
<property environment="env" />
<property name="eclipse.home" value="${env.ECLIPSE_HOME}"></property>
<!-- properties file to load the versions of dependencies -->
<property file="../../../etc/project.properties"/>
<property name="service.plugin.version" value="Axis2_Service_Archiver_1.0.0"></property>
<property name="service.plugin.zip.name" value="axis2-eclipse-service-archiver-wizard.zip"></property>
<property name="src" value="./src"></property>
<property name="service.src.dir" value="../axis2-eclipse-service-plugin/src/main/java"></property>
<property name="output" value="../target/eclipse_plugins"></property>
<property name="output.target" value="${output}/release"></property>
<property name="service.output.dir" value="${output}/service-archiver"></property>
<property name="plugin.output.dir" value="${output}/plugin"></property>
<property name="service.plugin.output.dir" value="${plugin.output.dir}/${service.plugin.version}"></property>
<property name="source.dir.name" value="src"></property>
<property name="lib.dir.name" value="lib"></property>
<property name="bin.dir.name" value="bin"></property>
<property name="help.dir.name" value="help"></property>
<property name="icons.dir.name" value="icons"></property>
<property name="plugin.project.file.name" value=".project"></property>
<property name="plugin.classpath.file.name" value=".classpath"></property>
<property name="plugin.help.file.name" value="help_toc.xml"></property>
<property name="service.resource.dir" value="../conf/service"></property>
<property name="service.help.resource.file" value="../../../xdocs/tools/1_1/eclipse/servicearchiver-plugin.html"></property>
<property name="service.help.images.dir" value="../../../xdocs/tools/1_1/eclipse/images"></property>
<property name="axis2.lib.dir" value="../../../target/lib"></property>
<!--Filter tockens for the copy command to filter the versions of external dependencies -->
<filter token="version_number" value="${version_number}" />
<filter token="ant.version" value="${ant.version}" />
<filter token="commons.logging.version" value="${commons.logging.version}" />
<filter token="log4j.version" value="${log4j.version}" />
<!--Service wizard libraries -->
<fileset id="service.libs" dir="${axis2.lib.dir}">
<include name="ant-${ant.version}.jar" />
<include name="log4j-${log4j.version}.jar" />
<include name="commons-logging-${commons.logging.version}.jar" />
<include name="axis2-${version_number}.jar" />
</fileset>
<!-- Default target to generate all the services -->
<target name="all">
<antcall target="clean" />
<antcall target="generate-service-plugin"/>
<antcall target="release-plugin"/>
</target>
<!-- init-->
<target name="init">
<mkdir dir="${output}"></mkdir>
<mkdir dir="${service.output.dir}"></mkdir>
</target>
<!-- Service Archiver Project -->
<!-- Generete the Service Project that can be imported as a readymade eclipse project in to workspace -->
<target name="generate-service-project" depends="init">
<!-- delete the existing files -->
<delete file="plugin.xml" />
<delete file="build.properties" />
<delete file=".project" />
<delete file=".classpath" />
<delete dir="icons" />
<delete dir="help" />
<delete dir="lib" />
<!-- Copy with the filtering on-->
<copy todir="." filtering="on" >
<fileset dir="${service.resource.dir}">
<include name="plugin.xml" />
<include name="build.properties" />
<include name="${plugin.classpath.file.name}" />
</fileset>
</copy>
<!-- copy the libs -->
<mkdir dir="${lib.dir.name}" />
<copy todir="${lib.dir.name}">
<fileset refid="service.libs" />
</copy>
<!-- copy the icons-->
<mkdir dir="${icons.dir.name}" />
<copy todir="${icons.dir.name}">
<fileset dir="${service.resource.dir}/${icons.dir.name}" />
</copy>
<!-- copy the other project files-->
<copy todir=".">
<fileset file="${service.resource.dir}/${plugin.project.file.name}" />
<fileset file="${service.resource.dir}/${plugin.help.file.name}" />
</copy>
</target>
<!-- generate the service archiver project -->
<target name="create-service-project" depends="init">
<!-- copy the source -->
<copy todir="${service.output.dir}/${source.dir.name}">
<fileset dir="${service.src.dir}/" excludes="**/codegen/**/*.java"/>
</copy>
<!-- Copy the other stuff -->
<copy todir="${service.output.dir}" filtering="on">
<fileset dir="${service.resource.dir}" excludes="**/*.gif"></fileset>
</copy>
<!-- Copy the icons folder -->
<copy todir="${service.output.dir}">
<fileset dir="${service.resource.dir}" includes="**/*.gif" ></fileset>
</copy>
<!-- create bin directory -->
<mkdir dir="${service.output.dir}/${bin.dir.name}"></mkdir>
<!-- create the help directory -->
<mkdir dir="${service.output.dir}/${help.dir.name}"></mkdir>
<!-- copy the help directory -->
<copy todir="${service.output.dir}/${help.dir.name}">
<fileset file="${service.help.resource.file}"></fileset>
</copy>
<!-- copy the libraries to the plugin-->
<copy todir="${service.output.dir}/${lib.dir.name}">
<fileset refid="service.libs" />
</copy>
<available property="images.dir"
file="${service.help.images.dir}"
type="dir"
value="${service.help.images.dir}"/>
<copy todir="${service.output.dir}/${help.dir.name}/images">
<fileset dir="${images.dir}"/>
</copy>
</target>
<!--Generate the service plugin -->
<target name="generate-service-plugin" depends="init,create-service-project">
<mkdir dir="${service.plugin.output.dir}"></mkdir>
<!-- copy the plugin.xml,build.properties and help_toc.xml -->
<copy todir="${service.plugin.output.dir}">
<fileset dir="${service.output.dir}" >
<include name="plugin.xml" />
<include name="help_toc.xml" />
<include name="build.properties" />
<include name="**/ServiceResources.properties" />
</fileset>
</copy>
<!-- copy the help directory-->
<copy todir="${service.plugin.output.dir}/help">
<fileset dir="${service.output.dir}/help" />
</copy>
<!-- copy the icons directory-->
<copy todir="${service.plugin.output.dir}/icons">
<fileset dir="${service.output.dir}/icons" />
</copy>
<!-- copy the libraries to the plugin-->
<copy todir="${service.plugin.output.dir}/${lib.dir.name}">
<fileset refid="service.libs" />
</copy>
<!-- copy the sources to the plugin-->
<copy todir="${service.plugin.output.dir}/${source.dir.name}">
<fileset dir="${service.output.dir}/${source.dir.name}">
<include name="org/**" />
</fileset>
</copy>
<!-- compile the plugin java files -->
<delete dir="${service.plugin.output.dir}/class"></delete>
<mkdir dir="${service.plugin.output.dir}/class"></mkdir>
<javac srcdir="${service.output.dir}/${source.dir.name}"
destdir="${service.plugin.output.dir}/class"
includes="org/apache/axis2/**">
<classpath>
<fileset dir="${service.plugin.output.dir}/lib">
<include name="**/*.jar" />
</fileset>
<fileset dir="${eclipse.home}/plugins/">
<include name="**/*.jar" />
</fileset>
</classpath>
</javac>
<!-- create the Axis2_Service_Archiver.jar -->
<copy todir="${service.plugin.output.dir}/class">
<fileset dir="${service.output.dir}/${source.dir.name}" >
<include name="**/ServiceResources.properties" />
</fileset>
</copy>
<jar destfile="${service.plugin.output.dir}/Axis2_Service_Archiver.jar"
basedir="${service.plugin.output.dir}/class"
includes="org/apache/**"
/>
</target>
<!--Install the service plugin -->
<target name="install-service-plugin" depends="init,generate-service-project,generate-service-plugin">
<delete dir="${eclipse.home}/plugins/${service.plugin.version}"></delete>
<copy todir="${eclipse.home}/plugins">
<fileset dir="${plugin.output.dir}"/>
</copy>
</target>
<!--Relese the plugins (this will install the plugins and build the zip version)-->
<target name="release-plugin">
<mkdir dir="${output.target}" />
<mkdir dir="${output.target}/service/${service.plugin.version}" />
<antcall target="generate-service-plugin"/>
<copy todir="${output.target}/service/${service.plugin.version}">
<fileset dir="${plugin.output.dir}/${service.plugin.version}"/>
</copy>
<!--Zip the eclipse plugins to eclipse_plugins/target -->
<zip destfile="${output.target}/${service.plugin.zip.name}"
basedir="${output.target}/service"
update="true"
/>
<delete dir="${output.target}/service" />
</target>
<!-- Clean the directory -->
<target name="clean">
<delete dir="${service.output.dir}"></delete>
<delete dir="${plugin.output.dir}/${service.plugin.version}"></delete>
<delete file="${output.target}/${service.file.zip.name}"></delete>
</target>
<!-- help, list of targets -->
<target name="help">
<echo message="****************************************************************************" />
<echo message="** Eclipse Service Archiver Plugin Build **" />
<echo message="** pre-requisit : env.ECLIPSE_HOME **" />
<echo message="** **" />
<echo message="** **" />
<echo message="** build eclipse project : generate-service-project **" />
<echo message="** **" />
<echo message="** build eclipse plugin : generate-service-plugin **" />
<echo message="** **" />
<echo message="** install plugin : install-service-plugin **" />
<echo message="** **" />
<echo message="** release eclipse plugin : release-plugin **" />
<echo message="** **" />
<echo message="** **" />
<echo message="****************************************************************************" />
</target>
</project>