Generalizing the snippets ant script so it can be used from other locations
authorJaroslav Tulach <jtulach@netbeans.org>
Fri, 24 Apr 2009 22:58:54 +0200
changeset 3289e7c0ac38233
parent 327 d7344ad9310d
child 329 918e6f7f8136
Generalizing the snippets ant script so it can be used from other locations
java/ant/build.xml
java/ant/tip.sh
samples/build.xml
samples/tip.sh
     1.1 --- a/java/ant/build.xml	Fri Apr 24 21:26:04 2009 +0200
     1.2 +++ b/java/ant/build.xml	Fri Apr 24 22:58:54 2009 +0200
     1.3 @@ -2,6 +2,11 @@
     1.4  <!-- You may freely edit this file. See commented blocks below for -->
     1.5  <!-- some examples of how to customize the build. -->
     1.6  <!-- (If you delete it and reopen the project it will be recreated.) -->
     1.7 +<!-- By default, only the Clean and Build commands use this build script. -->
     1.8 +<!-- Commands such as Run, Debug, and Test only use this build script if -->
     1.9 +<!-- the Compile on Save feature is turned off for the project. -->
    1.10 +<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
    1.11 +<!-- in the project's Project Properties dialog box.-->
    1.12  <project name="ant" default="default" basedir=".">
    1.13      <description>Builds, tests, and runs the project ant.</description>
    1.14      <import file="nbproject/build-impl.xml"/>
    1.15 @@ -66,4 +71,27 @@
    1.16      nbproject/build-impl.xml file. 
    1.17  
    1.18      -->
    1.19 +    <target name="-revision" unless="revision">
    1.20 +        <fail unless="snippets.code.dir"/>
    1.21 +        <exec dir="${snippets.code.dir}" outputproperty="revision" executable="/bin/sh">
    1.22 +            <arg file="${ant.file}/../tip.sh"/>
    1.23 +        </exec>
    1.24 +    </target>
    1.25 +
    1.26 +    <target name="snippets" depends="jar,-revision" description="Extracts code snippets">
    1.27 +        <fail unless="revision"/>
    1.28 +        <fail unless="snippets.dir"/>
    1.29 +        <fail unless="snippets.repo"/>
    1.30 +        <fail unless="snippets.path"/>
    1.31 +        <fail unless="snippets.code.dir"/>
    1.32 +
    1.33 +        <taskdef name="grepcopy" classname="org.apidesign.infra.ant.GrepCopy" classpath="dist/apidesign-ant-tasks.jar"/>
    1.34 +        <grepcopy target="${snippets.dir}" baseurl="${snippets.repo}/file/${revision}/${snippets.path}">
    1.35 +            <fileset dir="${snippets.code.dir}">
    1.36 +                <include name="**/*"/>
    1.37 +                <exclude name="**/build/**/*"/>
    1.38 +            </fileset>
    1.39 +        </grepcopy>
    1.40 +    </target>
    1.41 +
    1.42  </project>
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/java/ant/tip.sh	Fri Apr 24 22:58:54 2009 +0200
     2.3 @@ -0,0 +1,2 @@
     2.4 +#!/bin/sh
     2.5 +hg id | cut -c1-12
     3.1 --- a/samples/build.xml	Fri Apr 24 21:26:04 2009 +0200
     3.2 +++ b/samples/build.xml	Fri Apr 24 22:58:54 2009 +0200
     3.3 @@ -35,11 +35,6 @@
     3.4              <arg file="${samples.dir}/version.sh"/>
     3.5          </exec>
     3.6      </target>
     3.7 -    <target name="-revision" unless="revision">
     3.8 -        <exec dir="${samples.dir}" outputproperty="revision" executable="/bin/sh">
     3.9 -            <arg file="${samples.dir}/tip.sh"/>
    3.10 -        </exec>
    3.11 -    </target>
    3.12  
    3.13      <target name="sources" depends="-version,clean" description="Creates source distribution of the samples">
    3.14          <fail unless="version"/>
    3.15 @@ -56,17 +51,13 @@
    3.16          </zip>
    3.17      </target>
    3.18  
    3.19 -    <target name="snippets" depends="-revision" description="Extracts code snippets">
    3.20 -        <fail unless="revision"/>
    3.21 -
    3.22 +    <target name="snippets" description="Extracts code snippets">
    3.23          <property name="snippets.dir" location="build/snippets"/>
    3.24 -        <ant dir="../java/ant"/>
    3.25 -        <taskdef name="grepcopy" classname="org.apidesign.infra.ant.GrepCopy" classpath="../java/ant/dist/apidesign-ant-tasks.jar"/>
    3.26 -        <grepcopy target="${snippets.dir}" baseurl="http://source.apidesign.org/hg/apidesign/file/${revision}/samples/">
    3.27 -            <fileset dir=".">
    3.28 -                <include name="**/*"/>
    3.29 -                <exclude name="**/build/**/*"/>
    3.30 -            </fileset>
    3.31 -        </grepcopy>
    3.32 +        <ant dir="../java/ant" target="snippets">
    3.33 +            <property name="snippets.dir" value="${snippets.dir}"/>
    3.34 +            <property name="snippets.repo" value="http://source.apidesign.org/hg/apidesign"/>
    3.35 +            <property name="snippets.path" value="samples/"/>
    3.36 +            <property name="snippets.code.dir" location="."/>
    3.37 +        </ant>
    3.38      </target>
    3.39  </project>
     4.1 --- a/samples/tip.sh	Fri Apr 24 21:26:04 2009 +0200
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,2 +0,0 @@
     4.4 -#!/bin/sh
     4.5 -hg id | cut -c1-12