samples/build.xml
author Jaroslav Tulach <jtulach@netbeans.org>
Sun, 06 Jul 2008 00:24:58 +0200
changeset 270 c020523e86e1
parent 263 7e8e995065c5
child 274 e1a7420cea38
permissions -rw-r--r--
Ability to generate code snippets
     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">
    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">
    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">
    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 
    39     <target name="sources" depends="-version,clean">
    40         <fail unless="version"/>
    41         
    42         <loadfile srcfile="${samples.dir}/../.hgignore" property="hgignore"/>
    43         <mkdir dir="${samples.dir}/build"/>
    44         <zip basedir="${samples.dir}" destfile="${samples.dir}/build/apidesign-${version}.zip">
    45             <not>
    46                 <containsregexp expression="${hgignore}"/>
    47             </not>
    48             <not>
    49                 <filename name="version.sh"/>
    50             </not>
    51         </zip>
    52     </target>
    53 
    54     <target name="snippets">
    55         <property name="snippets.dir" location="build/snippets"/>
    56         <ant dir="../java/ant"/>
    57         <taskdef name="grepcopy" classname="org.apidesign.infra.ant.GrepCopy" classpath="../java/ant/dist/apidesign-ant-tasks.jar"/>
    58         <grepcopy target="${snippets.dir}">
    59             <fileset dir=".">
    60                 <include name="**/*"/>
    61                 <exclude name="**/build/**/*"/>
    62             </fileset>
    63         </grepcopy>
    64     </target>
    65 </project>