samples/build.xml
author Jaroslav Tulach <jtulach@netbeans.org>
Sat, 14 Feb 2009 17:37:55 +0100
changeset 322 c12a563d36a4
parent 299 662b5d5b1b70
child 328 9e7c0ac38233
permissions -rw-r--r--
Giving description to all targets
     1 <?xml version="1.0" encoding="UTF-8"?>
     2 <project name="samples" default="test" basedir=".">
     3     <property name="samples.dir" location="${ant.file.samples}/.."/>
     4     <dirset id="examples" dir="${samples.dir}">
     5         <include name="**/nbproject"/>
     6         <exclude name="nbproject"/>
     7         <exclude name="apifest1/day3-intermezzo/**"/>
     8         <exclude name="apifest1/infrastructure/testing-template/**"/>
     9     </dirset>
    10     
    11     
    12     <target name="clean" description="Cleans all build products">
    13         <delete dir="${samples.dir}/build"/>
    14         <subant target="clean" antfile="../build.xml">
    15             <dirset refid="examples"/>
    16         </subant>
    17     </target>
    18 
    19     <target name="build" description="Compiles all samples" >
    20         <ant dir="${samples.dir}/libs"/>
    21         <subant target="compile" antfile="../build.xml">
    22             <dirset refid="examples"/>
    23         </subant>
    24     </target>
    25 
    26     <target name="test" depends="build" description="Executes tests for all samples">
    27         <subant target="test" antfile="../build.xml" failonerror="true">
    28             <dirset refid="examples"/>
    29             <property name="test-sys-prop.no.failures" value="true"/>
    30         </subant>
    31     </target>
    32     
    33     <target name="-version" unless="version">
    34         <exec dir="${samples.dir}" outputproperty="version" executable="/bin/sh">
    35             <arg file="${samples.dir}/version.sh"/>
    36         </exec>
    37     </target>
    38     <target name="-revision" unless="revision">
    39         <exec dir="${samples.dir}" outputproperty="revision" executable="/bin/sh">
    40             <arg file="${samples.dir}/tip.sh"/>
    41         </exec>
    42     </target>
    43 
    44     <target name="sources" depends="-version,clean" description="Creates source distribution of the samples">
    45         <fail unless="version"/>
    46         
    47         <loadfile srcfile="${samples.dir}/../.hgignore" property="hgignore"/>
    48         <mkdir dir="${samples.dir}/build"/>
    49         <zip basedir="${samples.dir}" destfile="${samples.dir}/build/apidesign-${version}.zip">
    50             <not>
    51                 <containsregexp expression="${hgignore}"/>
    52             </not>
    53             <not>
    54                 <filename name="version.sh"/>
    55             </not>
    56         </zip>
    57     </target>
    58 
    59     <target name="snippets" depends="-revision" description="Extracts code snippets">
    60         <fail unless="revision"/>
    61 
    62         <property name="snippets.dir" location="build/snippets"/>
    63         <ant dir="../java/ant"/>
    64         <taskdef name="grepcopy" classname="org.apidesign.infra.ant.GrepCopy" classpath="../java/ant/dist/apidesign-ant-tasks.jar"/>
    65         <grepcopy target="${snippets.dir}" baseurl="http://source.apidesign.org/hg/apidesign/file/${revision}/samples/">
    66             <fileset dir=".">
    67                 <include name="**/*"/>
    68                 <exclude name="**/build/**/*"/>
    69             </fileset>
    70         </grepcopy>
    71     </target>
    72 </project>