Changeset 4822 for trunk/common.xml


Ignore:
Timestamp:
02/19/09 12:50:03 (11 years ago)
Author:
curtis
Message:

Better build system for Bio-Formats C++ bindings on Linux.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/common.xml

    r4612 r4822  
    1414  <condition property="isUnix"><os family="unix"/></condition> 
    1515 
     16  <!-- 
     17  Guess location of the Java runtime classes, saving to jre.runtime property. 
     18  Stolen and adapted from: 
     19    http://forums.gamegardens.com/discussion/mvnforum/viewthread?thread=324 
     20  --> 
     21  <!-- if Mac OS X --> 
     22  <property name="jre.macosx.classes" 
     23    value="/System/Library/Frameworks/JavaVM.framework/Classes/classes.jar"/> 
     24  <property name="jre.macosx.ui" 
     25    value="/System/Library/Frameworks/JavaVM.framework/Classes/ui.jar"/> 
     26  <condition property="jre.runtime" 
     27    value="${jre.macosx.classes}:${jre.macosx.ui}"> 
     28    <and> 
     29      <os family="mac"/> 
     30      <os family="unix"/> 
     31    </and> 
     32  </condition> 
     33  <!-- Default for Unix --> 
     34  <property name="jre.runtime" value="${java.home}/lib/rt.jar"/> 
     35 
    1636  <!-- Non-core ant tasks --> 
    17  
    18   <!-- NB - We do not reference ${artifact.dir}/loci-checks.jar directly, 
    19     as doing so causes loci-checks.jar to be locked by some file systems 
    20     (Windows in particular), which causes the clean and clean-jars targets 
    21     to fail. --> 
    22   <taskdef resource="checkstyletask.properties" 
    23     classpath="${lib.dir}/checkstyle-all-4.2.jar:${lib.dir}/loci-checks.jar"/> 
    2437 
    2538  <taskdef resource="net/sf/antcontrib/antcontrib.properties" 
    2639    classpath="${lib.dir}/ant-contrib-1.0b1.jar"/> 
    2740  <!-- HACK - some environments do not install the antcontrib tasks properly 
    28   from antcontrib.properties above; also load them from antlib.xml --> 
     41    from antcontrib.properties above; also load them from antlib.xml --> 
    2942  <taskdef resource="net/sf/antcontrib/antlib.xml" 
    3043    classpath="${lib.dir}/ant-contrib-1.0b1.jar"/> 
    3144 
    32   <taskdef resource="edu/umd/cs/findbugs/anttask/tasks.properties" 
    33     classpath="${lib.dir}/findbugs-ant.jar"/> 
    34  
    35   <!-- 
    36   <taskdef resource="proguard/ant/task.properties" 
    37     classpath="${lib.dir}/proguard.jar"/> 
    38   --> 
    39  
    4045  <!-- Main build targets --> 
    41  
    42   <target name="compile" depends="copy-source" 
    43     description="compile classes"> 
    44     <javac debug="true" deprecation="true" 
    45       source="${component.java-version}" 
    46       target="${component.java-version}" 
    47       srcdir="${dest.dir}" destdir="${classes.dir}" 
    48       classpath="${component.classpath}" 
    49       includes="${component.source}"/> 
    50   </target> 
    51  
    52   <target name="exec" depends="compile" description="execute package"> 
    53     <java fork="true" classname="${component.main-class}" 
    54       classpath="${classes.dir}:${component.runtime-cp}"/> 
    55   </target> 
    56  
    57   <target name="findbugs" depends="compile" 
    58     description="check source code for bugs"> 
    59     <if> 
    60       <isset property="findbugs.home"/> 
    61       <then> 
    62         <findbugs home="${findbugs.home}" jvmargs="-Xmx512m" 
    63           output="xml" outputFile="${build.dir}/findbugs.xml"> 
    64           <auxClasspath path="${component.classpath}"/> 
    65           <sourcePath path="${dest.dir}"/> 
    66           <class location="${classes.dir}"/> 
    67         </findbugs> 
    68         <java jar="${findbugs.home}/findbugs.jar" fork="true"> 
    69           <arg value="${build.dir}/findbugs.xml"/> 
    70         </java> 
    71       </then> 
    72       <else> 
    73         <echo>Please set the findbugs.home property to point to your</echo> 
    74         <echo>FindBugs installation's lib directory. E.g.:</echo> 
    75         <echo>  ant -Dfindbugs.home=${user.home}/findbugs/lib findbugs</echo> 
    76       </else> 
    77     </if> 
    78   </target> 
    79  
    80   <target name="style" depends="compile" 
    81     description="check source code style"> 
    82     <checkstyle config="${root.dir}/checkstyle.xml" failOnViolation="false" 
    83       classpath="${classes.dir}:${component.classpath}"> 
    84       <fileset dir="${dest.dir}" includes="${component.source}"/> 
    85     </checkstyle> 
    86   </target> 
    87  
    88   <target name="jar" depends="compile" 
    89     description="generate JAR file"> 
    90     <mkdir dir="${artifact.dir}"/> 
    91     <jar jarfile="${artifact.dir}/${component.jar}" basedir="${classes.dir}"> 
    92       <manifest> 
    93         <attribute name="Main-Class" value="${component.main-class}"/> 
    94         <attribute name="Class-Path" value="${component.manifest-cp}"/> 
    95       </manifest> 
    96     </jar> 
    97   </target> 
    98  
    99   <target name="docs" depends="compile" 
    100     description="generate javadocs"> 
    101     <javadoc sourcepath="${dest.dir}" destdir="${docs.dir}/api" 
    102       classpath="${component.classpath}:${classes.dir}" 
    103       author="true" version="true" use="true" 
    104       nodeprecated="true" windowtitle="Bio-Formats API"> 
    105       <packageset dir="${dest.dir}"/> 
    106       <doctitle><![CDATA[<h1>Bio-Formats</h1>]]></doctitle> 
    107       <bottom><![CDATA[${copyright.begin} ${YEAR} ${copyright.end}]]></bottom> 
    108       <link href="http://java.sun.com/j2se/1.5.0/docs/api/"/> 
    109       <link href="http://hudson.openmicroscopy.org.uk/job/OMEJAVA/javadoc/"/> 
    110       <link href="http://rsbweb.nih.gov/ij/developer/api/"/> 
    111       <link href="http://www.ssec.wisc.edu/~dglo/docs/"/> 
    112       <!--<link href="http://www.jdocs.com/formlayout/1.0.4/api/"/>--> 
    113       <!--<link href="http://www.jdocs.com/looks/1.2.2/api/"/>--> 
    114     </javadoc> 
    115   </target> 
    11646 
    11747  <target name="clean" description="remove all build files except artifacts"> 
     
    11949  </target> 
    12050 
    121   <target name="clean-classes" description="remove classes from build folder"> 
    122     <delete dir="${classes.dir}"/> 
    123   </target> 
    124  
    125   <target name="clean-dist" 
    126     description="remove distribution bundles from build folder"> 
    127     <delete dir="${dist.dir}"/> 
    128   </target> 
    129  
    130   <target name="clean-docs" description="remove javadocs from build folder"> 
    131     <delete dir="${docs.dir}"/> 
    132   </target> 
    133  
    134   <target name="clean-src" description="remove source files from build folder"> 
    135     <delete dir="${dest.dir}"/> 
    136   </target> 
    137  
    138   <target name="clean-jar" description="remove JAR file from artifacts folder"> 
    139     <delete> 
    140       <fileset dir="${artifact.dir}" includes="${component.jar}"/> 
    141     </delete> 
    142   </target> 
    143  
    14451  <!-- Internal build targets --> 
    14552 
    146   <target name="init"> 
     53  <target name="init-timestamp"> 
    14754    <tstamp> 
    14855      <format property="DATE" pattern="d MMMMM yyyy"/> 
    14956      <format property="YEAR" pattern="yyyy"/> 
    15057    </tstamp> 
     58  </target> 
     59 
     60  <target name="init-revision"> 
    15161    <!-- determine SVN revision number --> 
    15262    <if> 
     
    17484      </else> 
    17585    </if> 
    176     <!-- construct manifest classpath --> 
    177     <propertyregex property="component.manifest-cp-temp" 
    178       input="${component.runtime-cp}" replace="" 
    179       defaultValue="${component.runtime-cp}"> 
    180       <regexp pattern="[^\:]*\/"/> 
    181     </propertyregex> 
    182     <propertyregex property="component.manifest-cp" 
    183       input="${component.manifest-cp-temp}" replace=" " 
    184       defaultValue="${component.manifest-cp-temp}"> 
    185       <regexp pattern=":"/> 
    186     </propertyregex> 
    187     <!--<echo>Manifest-Classpath: ${component.manifest-cp}</echo>--> 
    188   </target> 
    189  
    190   <target name="copy-source" depends="init"> 
    191     <!-- copy binary resources without filtering --> 
    192     <copy todir="${dest.dir}" preservelastmodified="true"> 
    193       <fileset dir="${src.dir}" includes="${component.resources-bin}"/> 
    194     </copy> 
    195     <!-- copy source files and text resources with filtering --> 
    196     <filter token="date" value="${DATE}"/> 
    197     <filter token="year" value="${YEAR}"/> 
    198     <filter token="svn.revision" value="${svn.revision}"/> 
    199     <filter token="visbio.version" value="${visbio.version}"/> 
    200     <copy todir="${dest.dir}" filtering="true" preservelastmodified="true"> 
    201       <fileset dir="${src.dir}" 
    202         includes="${component.source} ${component.resources-text}"/> 
    203     </copy> 
    204     <!-- copy resources to classes folder --> 
    205     <copy todir="${classes.dir}" preservelastmodified="true"> 
    206       <fileset dir="${dest.dir}" excludes="${component.source}"/> 
    207     </copy> 
    20886  </target> 
    20987 
Note: See TracChangeset for help on using the changeset viewer.