File:  [mozdev] / proanafilter / build.xml
Revision 1.2: download - view: text, annotated - select for diffs - revision graph
Sun Mar 23 15:54:49 2008 UTC (11 years, 11 months ago) by neilcowzer
Branches: MAIN
CVS tags: HEAD
Backup

    1: <!--+
    2:     |
    3:     |           +=======================================+
    4:     |           |  Java Firefox Extension Build System  |
    5:     |           +=======================================+
    6:     |
    7:     +-->
    8: 
    9: <project default="xpi" basedir="." name="Java Firefox Extension">
   10: 
   11:     <target name="start" depends="init">
   12: <echo>======================================================================
   13:                ${fullname} ${version} [${year}]
   14: ======================================================================
   15: Building with ${ant.version}
   16: ----------------------------------------------------------------------
   17: Using build file ${ant.file}
   18: ----------------------------------------------------------------------
   19: Running on Java version ${ant.java.version} on ${os.name}
   20: ----------------------------------------------------------------------
   21: Compiler options:
   22:  - debug ......... [${compiler.debug}]
   23:  - optimize ...... [${compiler.optimize}]
   24:  - deprecation ... [${compiler.deprecation}]
   25: ======================================================================
   26: </echo>
   27:     </target>
   28: 
   29:     <target name="init">
   30:         <!-- Set the timestamps -->
   31:         <tstamp/>
   32:     
   33:         <property environment="env" />
   34:     
   35:         <!-- Detecting the current jvm -->
   36:         <condition property="target.vm" value="1.4">
   37:             <equals arg1="1.5" arg2="${ant.java.version}"/>
   38:         </condition>
   39:         <condition property="target.vm" value="1.4">
   40:             <equals arg1="1.4" arg2="${ant.java.version}"/>
   41:         </condition>
   42:         <condition property="target.vm" value="1.3">
   43:           <not>
   44:             <or>
   45:               <equals arg1="1.4" arg2="${ant.java.version}"/>
   46:               <equals arg1="1.5" arg2="${ant.java.version}"/>
   47:             </or>
   48:           </not>
   49:         </condition>
   50:     
   51:         <!-- Describe the location of the java runtime library on different systems -->
   52:         <condition property="java.classes" value="/System/Library/Frameworks/JavaVM.framework/Classes/classes.jar">
   53:           <equals arg1="Mac OS X" arg2="${os.name}"/>
   54:         </condition>
   55:         <condition property="java.classes" value="${env.JAVA_HOME}/lib/rt.jar">
   56:            <not>
   57:             <equals arg1="Mac OS X" arg2="${os.name}"/>
   58:            </not>
   59:         </condition>
   60:     
   61:         <!-- Allow users a chance to override without editing the main file -->
   62:         <property file="${user.home}/${name}.build.properties"/>
   63:         <property file="local.build.properties"/>
   64:     
   65:         <!-- Get the build properties from an external file -->
   66:         <property file="build.properties"/>
   67:         
   68:         <!-- Set classpath -->
   69:         <path id="classpath">
   70:             <fileset dir="${lib}">
   71:             <include name="*.jar"/>
   72:             </fileset>
   73:             <path location="${build}"/>
   74:         </path>
   75:     </target>
   76: 
   77: <!-- === Preparation ============================================= -->
   78: 
   79:     <target name="prepare" depends="init">
   80:         <mkdir dir="${build}"/>
   81:     </target>
   82: 
   83: <!-- === Compile Java Code ================================================= -->
   84: 
   85:     <target name="compile" depends="prepare">
   86:         <mkdir dir="${build}"/>
   87:         <javac sourcepath="" 
   88:             srcdir="${src.java}"
   89:             destdir="${build}"
   90:             debug="${compiler.debug}"
   91:             optimize="${compiler.optimize}"
   92:             deprecation="${compiler.deprecation}"
   93:             target="${target.vm}"
   94:             source="${target.vm}"
   95:             nowarn="${compiler.nowarn}"
   96:             compiler="${compiler}"
   97:             classpathref="classpath">
   98:             
   99:             <include name="**/*.java"/>
  100:         </javac>
  101:         <copy todir="${build}">
  102:             <fileset dir="${src.java}" includes="**/*.properties" />
  103:             <filterset>
  104:                 <filter token="version" value="${version}"/>
  105:                 <filter token="fullname" value="${fullname}"/>
  106:             </filterset>
  107:         </copy>
  108:     </target>
  109: 
  110: <!-- === Prepare The Distribution ================================================= -->
  111: 
  112:     <target name="dist" depends="compile" description="Create the distribution">
  113:         <mkdir dir="${dist}"/>
  114:         
  115:         <copy todir="${dist}/chrome/java-firefox-extension">
  116:             <fileset dir="${src.extension}/chrome"
  117:                 includes="**" />
  118:         </copy>
  119:     	
  120:     	
  121:     	
  122:         
  123:         <copy todir="${dist}/components">
  124:             <fileset dir="${src.extension}/components" includes="*.js" />
  125:             <fileset dir="${src.extension}/components" includes="*.xpt" />
  126:         </copy>
  127:         
  128:         <copy todir="${dist}/components/lib/classes">
  129:             <fileset dir="${build}"
  130:                 includes="**" />
  131:         </copy>
  132:         <copy todir="${dist}/components/lib">
  133:             <fileset dir="${lib}"
  134:                 includes="*.jar" />
  135:         </copy>
  136:     	<!-- No longer using resources 
  137:     	
  138:     	<copy todir="${dist}/chrome/java-firefox-extension/content/resources">
  139:     	            <fileset dir="${resources}"
  140:     	                includes="**" />
  141:     	</copy> 
  142:     	-->
  143:     	
  144:         <copy file="${tools}/firefoxClassLoader.jar" tofile="${dist}/components/firefoxClassLoader.jar" />
  145: 
  146:         <copy file="${src.extension}/install.rdf" tofile="${dist}/install.rdf" />
  147:         <copy file="${src.extension}/chrome.manifest" tofile="${dist}/chrome.manifest"/>
  148:         
  149:         <!-- touch the directory so that firefox registry reloads (helps during development) -->
  150:         <touch>
  151:             <fileset dir="${dist}"/>
  152:         </touch>
  153:     </target>
  154: 
  155: <!-- === Package The Distribution XPI ================================================= -->
  156: 
  157:     <target name="xpi" depends="dist" description="Create the XPI extension">
  158:         <zip zipfile="${dist.target}/${dist.name}.xpi" basedir="${dist}" includes="**"/>
  159:     </target>
  160: </project>

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>