Changeset 15313

Show
Ignore:
Timestamp:
30.04.2008 19:37:09 (12 years ago)
Author:
ak19
Message:

Build.xml that uses ant 1.7 to: 1. Update CheckJavaVersion? and gs3_for_client.jar by copying files from Greenstone SVN; 2. Extract Dist folder's zip files neatly into a custom directory, as opposed to extracting all their contents into whereever.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • other-projects/trunk/gs3-webservices-democlient/build.xml

    r15306 r15313  
    2020 <property name="build" value="${basedir}/build" /> 
    2121 <property name="dist" value="${basedir}/dist" /> 
     22 
    2223 <property name="QBRdata.rel.path" value="org/greenstone/gs3client/data" /> 
    2324 <property name="dlservices.rel.path" value="org/greenstone/gs3client/dlservices" /> 
    2425 <property name="gui.rel.path" value="org/greenstone/gs3client" /> 
    2526 <property name="gs3services.rel.path" value="org/greenstone/gs3services" /> 
     27 
    2628 <property name="exec.jar.name" value="GS3democlient.jar" /> <!-- name of the executable--> 
    27  <property name="download.zip.name" value="gs3_webservices_democlient" /> 
     29 <property name="gs3.files.jar" value="gs3_for_client.jar" /> 
    2830 <property name="log4j.propFile" value="log4j.properties" /> 
     31 
     32 <property name="dist.zip.name" value="gs3_webservices_democlient" /> 
    2933 <property name="zip.excludes" value="dist/**,logs/**,gs3democlient.properties" /> 
     34 <property name="dist.dir.name" value="gs3-webservices-democlient" /> 
     35 
     36 <!-- svn paths for getting copies of the latest version of source code --> 
     37 <property name="gs3forclient.svn.path" value="http://svn.greenstone.org/greenstone3/trunk/src/java/org/greenstone/gsdl3/util/"/> 
     38 <property name="check.java.version.svn.file" value="http://svn.greenstone.org/gli/trunk/CheckJavaVersion.java"/> 
    3039 
    3140  <!-- ============ project classpath: everything in the lib folder =================== --> 
     
    5867 
    5968<!-- Main targets: to build the GS3 web services demo-client and to create the tar.gz file for downloading --> 
    60 <target name="build-demo-client" description="Creates the jar distribution file" depends="compile-demo-client"> 
     69<target name="build-demo-client" description="Creates the jar distribution file" depends="compile-demo-client,ensure-check-java-version"> 
    6170  <mkdir dir="${basedir}/logs" /> <!-- Need a logs dir for outputting log4j stuff--> 
    6271  <delete file="${exec.jar.name}" /> <!--For now: Let's delete it first and do a fresh rebuild--> 
     
    7685 
    7786<!-- Compilation first ensures the existence of QBRdata.jar AND fedoraGS3.jar by checking whether these jars exist and if not, generating them. Then actual compilation of the GS3democlient starts. By now the QBRdata classes of the GS3democlient src folder would have been compiled, but that does not matter as javac only compiles when class files that are outdated or when they have not been generated yet.--> 
    78 <target name="compile-demo-client" description="Compiles the GS3 demo-client" depends="ensure-QBRdata-jar,ensure-fedoraGS3-jar"> 
     87<target name="compile-demo-client" description="Compiles the GS3 demo-client" depends="ensure-QBRdata-jar,ensure-fedoraGS3-jar,ensure-gs3-for-client"> 
    7988    <javac srcdir="${democlient.rootdir}"> 
    8089      <classpath refid="project.classpath"/> 
     
    8493 
    8594<!-- Cleaning targets --> 
    86 <target name="clean-democlient" description="Removes all class files from the GS3demo-client"> 
     95<target name="clean-democlient" description="Removes all class files from the GS3demo-client (includes the data package that is used to create QBRdata.jar)"> 
    8796   <delete> 
    8897    <fileset dir="${democlient.src}" includes="**/*.class"/> 
     
    94103    <fileset dir="${fedorags3.src}" includes="**/*.class"/> 
    95104   </delete> 
     105</target> 
     106 
     107<!-- Explicit update. First make a directory and copy the old files in there (if they are present)--> 
     108<target name="update" description="Gets the latest version of CheckJavaVersion.java, and gs3-client-jar's files from Greenstone's SVN repository"> 
     109   <delete> 
     110      <fileset dir="${basedir}" includes="CheckJavaVersion.*"/> 
     111   </delete> 
     112   <antcall target="update-check-java-version" />    
     113   <antcall target="update-gs3-for-client" /> 
     114</target> 
     115 
     116<target name="ensure-check-java-version" description="Ensures the file CheckJavaVersion.java is there"> 
     117    <condition property="check.java.version.exists"> 
     118       <and> 
     119    <available file="${basedir}/CheckJavaVersion.java"/> 
     120        <available file="${basedir}/CheckJavaVersion.class"/> 
     121       </and> 
     122    </condition> 
     123    <antcall target="update-check-java-version" /> 
     124</target> 
     125 
     126<target name="ensure-gs3-for-client" description="Ensures the ${gs3.files.jar} file of required Greenstone3 support files is there"> 
     127    <condition property="gs3.for.client.exists"> 
     128    <available file="${basedir}/lib/${gs3.files.jar}"/> 
     129    </condition> 
     130    <antcall target="update-gs3-for-client" /> 
     131</target> 
     132 
     133 
     134<!-- "By default, files are only copied if the source file is newer than the destination file, or when the destination file does not exist. (However, you can explicitly overwrite files with the overwrite attribute.)" In other words, this method will only copy when necessary --> 
     135<target name="update-check-java-version" description="Gets the latest version of CheckJavaVersion.javafrom Greenstone's SVN repository" unless="check.java.version.exists"> 
     136   <copy todir="${basedir}" flatten="true"> 
     137    <resources> 
     138      <url url="${check.java.version.svn.file}"/> 
     139    </resources> 
     140  </copy> 
     141  <!-- compile it up: specifying the file to be compiled explicitly (sourcepath="")-->  
     142  <javac sourcepath="" srcdir="${basedir}" destdir="${basedir}" > 
     143    <include name="**/CheckJavaVersion.java"/> 
     144  </javac> 
     145</target> 
     146 
     147<target name="update-gs3-for-client" description="Gets the latest version of the files needed to create ${gs3.files.jar} from Greenstone's SVN repository" unless="gs3.for.client.exists"> 
     148  <mkdir dir="${basedir}/tmp" /> 
     149  <echo>Getting java files GSXML, XMLConverter, GSPath and MyNodeList from Greenstone's SVN repository (${gs3forclient.svn.path}). Compiling and jarring them up into ${gs3.files.jar}...</echo> 
     150  <copy todir="${basedir}/tmp" flatten="true"> 
     151    <resources> 
     152      <url url="${gs3forclient.svn.path}/GSXML.java"/> 
     153      <url url="${gs3forclient.svn.path}/XMLConverter.java"/> 
     154      <url url="${gs3forclient.svn.path}/GSPath.java"/> 
     155      <url url="${gs3forclient.svn.path}/MyNodeList.java"/> 
     156    </resources> 
     157  </copy> 
     158  <!-- compile it up: specifying the file to be compiled explicitly -->  
     159  <javac srcdir="${basedir}/tmp" destdir="${basedir}/tmp" > 
     160    <classpath refid="project.classpath"/> 
     161    <include name="**/*.java"/> 
     162  </javac>   
     163  <!-- jar it up (without the java files), placing the jar in the lib folder -->     
     164  <jar destfile="lib/${gs3.files.jar}" basedir="tmp/" excludes="tmp/*.java" /> 
     165  <delete dir="tmp" /> 
    96166</target> 
    97167 
     
    132202</target> 
    133203 
    134 <target name="update-gs3forclient.jar" description="Will update the class files in ${basedir}/lib/gs3_for_client.jar using svn to the latest versions of those files in Greenstone3's svn repository"> 
    135 </target> 
    136  
    137204<!-- Targets that check for and ensure the existence of project-specific jar files --> 
    138205<target name="check-QBRdata-jar" description="Checks for existence of dependency file QBRdata.jar"> 
     
    169236<!-- User input for generating compressed output file for one of the chosen file types. A choice of zip, tar.gz (tar gzip), or tar.bz2 (tar bzip)--> 
    170237<target name="create-targzip" if="zip.type" description="User chose to create a tar.gz file of the project"> 
    171     <tar destfile="${dist}/${download.zip.name}.tar.gz" basedir="${basedir}" compression="gzip" excludes="${zip.excludes}" longfile="gnu" />  
     238   <tar destfile="${dist}/${dist.zip.name}.tar.gz" compression="gzip" longfile="gnu">  
     239     <tarfileset dir="${basedir}" prefix="${dist.dir.name}" excludes="${zip.excludes}" /> 
     240   </tar> 
     241   <echo>If the filepaths are longer than 100 characters, GNU compatible tar commands are necessary to untar the tar.gz</echo> 
     242</target> 
     243 
     244<target name="create-tarbzip" if="zip.type" description="User chose to create a tar.bz2 file of the project"> 
     245    <tar destfile="${dist}/${dist.zip.name}.tar.bz2" compression="bzip2" longfile="gnu">  
     246      <tarfileset dir="${basedir}" prefix="${dist.dir.name}" excludes="${zip.excludes}" /> 
     247    </tar> 
    172248    <echo>If the filepaths are longer than 100 characters, GNU compatible tar commands are necessary to untar the tar.gz</echo> 
    173249</target> 
    174250 
    175 <target name="create-tarbzip" if="zip.type" description="User chose to create a tar.bz2 file of the project"> 
    176     <tar destfile="${dist}/${download.zip.name}.tar.bz2" basedir="${basedir}" compression="bzip2" excludes="${zip.excludes}" longfile="gnu" />  
    177     <echo>If the filepaths are longer than 100 characters, GNU compatible tar commands are necessary to untar the tar.gz</echo> 
    178 </target> 
    179  
    180251<target name="create-zip" if="zip.type" description="User chose to create a zip file of the project"> 
    181      <zip basedir="${basedir}" destfile="${dist}/${download.zip.name}.zip"  
    182     excludes="${zip.excludes}" /> 
     252    <zip destfile="${dist}/${dist.zip.name}.zip"> 
     253       <zipfileset dir="${basedir}" prefix="${dist.dir.name}" excludes="${zip.excludes}" /> 
     254    </zip> 
    183255</target> 
    184256