alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

What this is

This file is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Other links

The source code

<!--
  ~ Licensed to the Apache Software Foundation (ASF) under one
  ~ or more contributor license agreements. See the NOTICE file
  ~ distributed with this work for additional information
  ~ regarding copyright ownership. The ASF licenses this file
  ~ to you under the Apache License, Version 2.0 (the
  ~ "License"); you may not use this file except in compliance
  ~ with the License. You may obtain a copy of the License at
  ~
  ~ http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing,
  ~ software distributed under the License is distributed on an
  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  ~ KIND, either express or implied. See the License for the
  ~ specific language governing permissions and limitations
  ~ under the License.
  -->
<project basedir="." default="help">

    <!--Set your elcipse home directory  -->
    <property environment="env" />
    <property name="eclipse.home" value="${env.ECLIPSE_HOME}">
	
    <!-- properties file to load the versions of dependencies -->
    <property file="../../../etc/project.properties"/>
    <property name="service.plugin.version" value="Axis2_Service_Archiver_${version_number}">
    <property name="service.plugin.zip.name" value="axis2-eclipse-service-archiver-wizard.zip">
	
    <property name="src" value="./src">
    <property name="service.src.dir" value="../axis2-eclipse-service-plugin/src/main/java">
    <property name="output" value="../target/eclipse_plugins">
    <property name="output.target" value="${output}/release">
    <property name="service.output.dir" value="${output}/service-archiver">
    <property name="plugin.output.dir" value="${output}/plugin">
    <property name="service.plugin.output.dir" value="${plugin.output.dir}/${service.plugin.version}">

    <property name="source.dir.name" value="src">
    <property name="lib.dir.name" value="lib">
    <property name="bin.dir.name" value="bin">
    <property name="help.dir.name" value="help">
    <property name="icons.dir.name" value="icons">

    <property name="plugin.project.file.name" value=".project">
    <property name="plugin.classpath.file.name" value=".classpath">
    <property name="plugin.help.file.name" value="help_toc.xml">
    <property name="tool_docs_version" value="1_3">

    <property name="service.resource.dir" value="../conf/service">
    <property name="service.help.resource.file" value="../../../modules/documentation/xdocs/tools/${tool_docs_version}/eclipse/servicearchiver-plugin.html">
    <property name="service.help.images.dir" value="../../../modules/documentation/xdocs/tools/${tool_docs_version}/eclipse/images">
    <property name="axis2.lib.dir" value="../../../target/lib">

    <!--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 dir="${service.output.dir}">
    </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">
	        </copy>
		    <!-- Copy the icons folder -->
            <copy todir="${service.output.dir}">
                 <fileset dir="${service.resource.dir}" includes="**/*.gif" >
            </copy>
		    <!-- create bin directory -->
		    <mkdir dir="${service.output.dir}/${bin.dir.name}">
		    <!-- create the help directory -->
	        	<mkdir dir="${service.output.dir}/${help.dir.name}">
		    <!-- copy the help directory -->
	        <copy todir="${service.output.dir}/${help.dir.name}">
	            <fileset file="${service.help.resource.file}">
	        </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}">
        <!-- 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">
 	<mkdir dir="${service.plugin.output.dir}/class">
	<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>
	
	<!--Make available the resources for the plugin -->
          <copy todir="${service.plugin.output.dir}/class">
            <fileset dir="${service.output.dir}/${source.dir.name}" >
                <include name="**/ServiceResources.properties" />
		<exclude name="**/*.class" />
            </fileset>
          </copy>

          <!-- create the Axis2_Service_Archiver.jar -->
	  <jar destfile="${service.plugin.output.dir}/Axis_Service_Archiver.jar" 
	       basedir="${service.plugin.output.dir}/class"
           includes="org/apache/**"
          />
	<delete dir="${service.plugin.output.dir}/src">
	<delete dir="${service.plugin.output.dir}/class">
    </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}">
          <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 dir="${plugin.output.dir}/${service.plugin.version}">
        <delete file="${output.target}/${service.file.zip.name}">
    </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>



... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.