Home | History | Annotate | Download | only in src
      1 <?xml version="1.0" encoding="UTF-8"?>
      2 <project name="AndroidMockGenerator" default="mockgen.build" basedir="..">
      3   <!-- Global Properties -->
      4   <property file="../build.properties"/>
      5 
      6   <!-- Android Mock Generator Properties -->
      7   <property name="mockgen.bin" value="bin"/>
      8   <property name="mockgen.class-bin" value="bin/classes"/>
      9   <property name="mockgen.deploy-jar" value="AndroidMockGenerator.jar"/>
     10   <property name="mockgen.includes" value="${java-package}/GeneratedMockJar.readme"/>
     11   <property name="mockgen.java-files" value="com/google/android/testing/mocking/*.java"/>
     12   <property name="mockgen.nodeps-jar" value="AndroidMockGenerator-nodeps.jar"/>
     13   <property name="meta-service-folder" value="META-INF/services"/>
     14   <property name="annotations-meta-file"
     15       value="${meta-service-folder}/javax.annotation.processing.Processor"/>
     16 
     17   <!-- Classpaths -->
     18   <path id="generator.path">
     19     <pathelement location="${lib-folder}/${easymock-jar}"/>
     20     <pathelement location="${lib-folder}/${javassist-jar}"/>
     21   </path>
     22 
     23   <!--  Private Targets -->
     24   <target name="-mockgen.dirs">
     25     <mkdir dir="${mockgen.bin}"/>
     26     <mkdir dir="${mockgen.class-bin}"/>
     27     <mkdir dir="${mockgen.class-bin}/${meta-service-folder}"/>
     28   </target>
     29 
     30   <target name="-mockgen.clean-staging">
     31     <delete dir="${staging}"/>
     32   </target>
     33 
     34   <!--  Public Targets -->
     35   <target name="mockgen.clean" depends="-mockgen.clean-staging">
     36     <delete file="${mockgen.deploy-jar}"/>
     37     <delete file="${mockgen.nodeps-jar}"/>
     38     <delete dir="${mockgen.class-bin}"/>
     39   </target>
     40 
     41   <target name="mockgen.build" depends="-mockgen.clean-staging,-mockgen.dirs"
     42       description="Builds the Mock Generator jar file">
     43     <javac destdir="${mockgen.class-bin}" srcdir="${source-base}"
     44            includes="${mockgen.java-files}" debug="true">
     45       <classpath refid="generator.path"/>
     46     </javac>
     47     <copy todir="${mockgen.class-bin}">
     48       <fileset dir="${source-base}" includes="${mockgen.includes}"/>
     49     </copy>
     50     <echo file="${mockgen.class-bin}/${annotations-meta-file}"
     51         message="com.google.android.testing.mocking.UsesMocksProcessor"/>
     52     <manifestclasspath property="frameworkjar.classpath"
     53                        jarfile="${mockgen.bin}/${mockgen.nodeps-jar}">
     54       <classpath location="${framework.mock-bin}/${framework.mock-jar}"/>
     55     </manifestclasspath>
     56     <tstamp>
     57       <format property="build.time" pattern="dd-MMMM-yyyy hh:mm aa"/>
     58     </tstamp>
     59     <jar destfile="${mockgen.bin}/${mockgen.nodeps-jar}" basedir="${mockgen.class-bin}">
     60       <manifest>
     61         <attribute name="Built-On" value="${build.time}"/>
     62       </manifest>
     63     </jar>
     64   </target>
     65 
     66   <target name="mockgen.build-deploy" depends="mockgen.build"
     67       description="Builds the Mock Generator jar file with dependencies included.">
     68     <unjar dest="${staging}">
     69       <fileset dir=".">
     70         <include name="${mockgen.bin}/${mockgen.nodeps-jar}"/>
     71         <include name="${lib-folder}/${easymock-jar}"/>
     72         <include name="${lib-folder}/${javassist-jar}"/>
     73       </fileset>
     74     </unjar>
     75     <tstamp/>
     76     <jar destfile="${mockgen.bin}/${mockgen.deploy-jar}" basedir="${staging}">
     77       <manifest>
     78         <attribute name="Built-On" value="${build.time}"/>
     79       </manifest>
     80     </jar>
     81   </target>
     82 </project>