ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject cvs commit: jakarta-ant/proposal/myrmidon/src/samples primitive-tests.ant sample.ant template-simple.ati template-simple.properties template-simple.xsl testdata.txt
Date Fri, 29 Mar 2002 13:12:15 GMT
donaldp     02/03/29 05:12:15

  Added:       proposal/myrmidon/src/samples primitive-tests.ant sample.ant
                        template-simple.ati template-simple.properties
                        template-simple.xsl testdata.txt
  Removed:     proposal/myrmidon/src/make primitive-tests.ant sample.ant
                        template-simple.ati template-simple.properties
                        template-simple.xsl testdata.txt
  Log:
  Move samples into new directory
  
  Revision  Changes    Path
  1.1                  jakarta-ant/proposal/myrmidon/src/samples/primitive-tests.ant
  
  Index: primitive-tests.ant
  ===================================================================
  <?xml version="1.0"?>
  
  <!--
  ==============================================================================
  
   Basic tests build file
  
  Authors:
   Peter Donald <peter@apache.org>
  
  Legal:
    Copyright (c) 2000 The Apache Software Foundation. All Rights Reserved.
  
  ==============================================================================
  -->
  
  <project version="2.0.0">
  
    <import library="selftest" />
  
    <property name="year" value="2000"/>
  
    <target name="main" depends="extensions-test" />
  
    <target name="undefined-task">
      <log message="About to execute task that hasn't been defined"/>
      <log2 message="This should have failed"/>
    </target>
  
    <target name="prim-tests">
  
      <log message="Tests away"/>
  
      <prim-test
          integer="1"
          integer2="2"
          short="3"
          short2="4"
          long="5"
          long2="6"
          byte="7"
          byte2="8"
          string="aString"
          float="1.0"
          float2="2.0"
          double="3.0"
          double2="4.0" />
  
    </target>
  
    <target name="extensions-test">
      <extensions-test/>
    </target>
  
  </project>
  
  
  1.1                  jakarta-ant/proposal/myrmidon/src/samples/sample.ant
  
  Index: sample.ant
  ===================================================================
  <?xml version="1.0"?>
  
  <!--
  ==============================================================================
  
   Sample build file
  
  Authors:
   Peter Donald <peterp@apache.org>
  
  Legal:
    Copyright (c) 2000 The Apache Software Foundation. All Rights Reserved.
  
  ==============================================================================
  -->
  
  <project version="2.0.0">
  
      <projectref name="prim" location="primitive-tests.ant" />
  
      <property name="year" value="2000"/>
  
      <target name="main"
          depends="typedef-test, converterdef-test,
                   datatype-test, namespace-test,
                   ant1-tasklib-test,
                   prim->extensions-test" />
  
      <target name="xp-deployer-test" depends="typedef-test, prim->undefined-task" />
  
      <target name="all"
              depends="property-test, typedef-test, converterdef-test,
                       ant-call-test, datatype-test, namespace-test,
                       ant1-tasklib-test, prim->main, exec-test" />
  
      <!--
          <register-tasklib lib="../../dist/lib/core.atl" />
      -->
  
      <target name="if-test">
          <property name="blah" value="true" />
          <if test="${blah}">
              <log message="Sucessful if test!"/>
          </if>
      </target>
  
      <target name="property-test">
          <property name="blah" value="fred" />
          <property name="${blah}" value="barney" />
  
          <log message="Doing the funky Echo with ${blah} ${fred} Year=${year}!"/>
      </target>
  
      <target name="typedef-test">
          <type-def name="log2"
              role="task"
              classname="org.apache.antlib.core.Log"
              lib="../../dist/lib/core.atl" />
  
          <log2 message="Luke to Echo base. Can you hear me?"/>
      </target>
  
      <target name="converterdef-test">
          <converter-def classname="org.apache.myrmidon.libs.core.StringToClassConverter"
              source-type="java.lang.String"
              destination-type="java.lang.Class"
              lib="../../dist/lib/core.atl" />
      </target>
  
      <target name="ant-call-test">
          <!-- test elided until we decide scope and necessity of ant-call -->
          <log message="AntCall test elided until we decide scope and necessity of ant-call"/>
          <!--
              <ant-call target="ant-call-test-target">
                <param name="blah" value="blah-value" />
              </ant-call>
          -->
      </target>
  
      <target name="ant-call-test-target">
          <log message="This should fail ...."/>
          <log message="${blah}"/>
          <log message="Whoa - it no fail. You used ant-call to call me and set param blah!"/>
      </target>
  
      <target name="log-level-test">
          <log message="Testing log level debug" level="debug"/>
          <log message="Testing log level info" level="info"/>
          <log message="Testing log level warn" level="warn"/>
          <log message="Testing log level error" level="error"/>
  
          <log message="Testing log level fatal error" level="fatalError"/>
          <log message="Testing log level error" level="this-no-work"/>
      </target>
  
      <target name="datatype-test">
          <property name="foo">
              <pattern name="*.java"/>
          </property>
  
          <pattern id="foo2" name="*.java" if="..." />
  
          <log message="foo=${foo}" />
          <log message="foo2=${foo2}" />
      </target>
  
      <target name="namespace-test">
  
          <!-- ant and doc are built in namespaces -->
          <log ant:fail-on-error="true" message="Some random message">
              <doc:description>
                Test case for aspects
              </doc:description>
              <ant:some-element some-attribute="blah"/>
          </log>
  
          <!-- load facility for blee: namespace -->
          <facility namespace="blee">
              <noop/>
          </facility>
  
          <log blee:some-param="blah" message="Blee namespace test successful!"/>
  
      </target>
  
      <target name="fail-test1">
          <fail message="Build is failing"/>
      </target>
  
      <target name="fail-test2">
          <fail message="Build is failing if prop X is set" if="x"/>
      </target>
  
      <target name="fail-test3">
          <fail message="Build is failing unless prop X is set" unless="x"/>
      </target>
  
      <target name="fail-test4">
          <fail>Some multiline fail
          message.</fail>
      </target>
  
      <target name="ant1-tasklib-test">
  
          <!--
            <ant1-tasklib prefix="a1-" lib="../../dist/lib/ant1-compat.jar"/>
  
            <a1-log message="Boo!" />
            <a1-mkdir dir="../../dist/test"/>
            <a1-copy file="../../tools/lib/ant.jar" tofile="../../dist/test/ant1-compat.jar"
/>
          -->
  
      </target>
  
      <target name="loadenvironment-test">
          <load-environment prefix="env"/>
          <log message="env.TMP=${env.TMP}"/>
      </target>
  
      <target name="loadproperties-test">
          <load-properties prefix="myPrefix" file="template-simple.properties"/>
          <log message="myPrefix.foo=${myPrefix.foo}"/>
      </target>
  
      <target name="exec-test">
          <exec dir="../.." executable="java">
              <arg value="-version"/>
          </exec>
          <log message="exec cvs done!"/>
      </target>
  
      <target name="cvs-test">
          <cvs noexec="true" dest="../.." command="up"/>
          <log message="cvs done!"/>
      </target>
  
      <target name="ref-test">
          <property name="refme1" value="These are not the droids you are looking for."
/>
          <property name="refme2" value="Move along." />
  
          <log message="Following should be a deomnstration of the -ref attribute extension:"/>
          <log message-ref="refme1"/>
          <log message-ref="refme2"/>
      </target>
  
      <target name="gzip-test">
          <property name="zip" value="../../dist/bin/sample.gz" />
          <property name="unzip" value="../../dist/bin/sample.txt" />
  
          <gzip src="sample.ant" zipfile="${zip}"/>
          <log message="Gzipped file!"/>
  
          <gunzip src="${zip}" dest="${unzip}"/>
          <log message="Ungzipped file!"/>
      </target>
  
      <target name="bzip2-test">
          <property name="zip" value="../../dist/bin/sample.bz2" />
          <property name="unzip" value="../../dist/bin/sample.txt" />
  
          <bzip2 src="sample.ant" zipfile="${zip}"/>
          <log message="Gzipped file!"/>
  
          <bunzip2 src="${zip}" dest="${unzip}"/>
          <log message="Ungzipped file!"/>
      </target>
  
      <target name="file-test">
          <mkdir dir="/tmp/deleteme"/>
          <touch file="/tmp/deleteme/touch-test"/>
          <delete dir="/tmp/deleteme"/>
      </target>
  
      <target name="trycatch-test1">
          <try-catch>
              <try>
                  <log message="Reference to bad (undefined) variable! ${bad.variable}"/>
              </try>
              <catch>
                  <log message="Caught exception due to bad variable reference!"/>
              </catch>
          </try-catch>
      </target>
  
      <target name="trycatch-test2">
          <try-catch>
              <try>
                  <log message="Reference to bad (undefined) variable! ${bad.variable}"/>
              </try>
              <finally>
                  <log message="In final section!"/>
              </finally>
          </try-catch>
      </target>
  
      <target name="copy-test">
          <copy file="sample.ant" dest-file="../../dist/bin/sample.ant-copied.txt"/>
      </target>
  
      <target name="move-test">
          <move file="../../dist/bin/sample.ant-copied.txt"
                dest-file="../../dist/bin/sample.ant-moved.txt"/>
      </target>
  
      <target name="filtered-copy-test">
          <filtered-copy file="testdata.txt" dest-file="../../dist/bin/filtered-data.txt">
              <filter-set>
                  <filter token="REPLACEME" value="***replacement-data-here***"/>
              </filter-set>
          </filtered-copy>
      </target>
  
      <target name="ant-test">
          <!-- test elided until we decide scope and necessity of ant-call -->
          <log message="Testing ant task..."/>
          <ant file="sample.ant" target="if-test"/>
  
          <log message="Using params..."/>
          <ant file="sample.ant" target="prop-print">
              <param name="meep.meep" value="Meep!"/>
          </ant>
  
          <log message="Using params value-ref..."/>
          <pattern id="meep.data" name="*.java" if="..." />
          <ant file="sample.ant" target="prop-print">
              <param name="meep.meep" value-ref="meep.data"/>
          </ant>
  
          <log message="Using inheritall..."/>
          <pattern id="meep.meep" name="*.java" if="..." />
          <ant file="sample.ant" target="prop-print" inherit-all="true"/>
  
          <!--
          <log message="Fail as no define property..."/>
          <ant file="sample.ant" target="prop-print"/>
          -->
  
          <log message="Fail as no build.ant file in correct place..."/>
          <ant/>
      </target>
  
      <target name="antcall-test">
          <log message="Testing antcall task..."/>
          <ant-call target="if-test"/>
  
          <log message="Using params..."/>
          <ant-call target="prop-print">
              <param name="meep.meep" value="Meep!"/>
          </ant-call>
  
          <log message="Using params value-ref..."/>
          <pattern id="meep.data" name="*.java" if="..." />
          <ant-call target="prop-print">
              <param name="meep.meep" value-ref="meep.data"/>
          </ant-call>
  
          <log message="Using inheritall..."/>
          <pattern id="meep.meep" name="*.java" if="..." />
          <ant-call target="prop-print" inherit-all="true"/>
  
          <log message="Calling referenced project, default target..."/>
          <ant-call project="prim"/>
  
          <log message="Calling referenced project, named target..."/>
          <ant-call project="prim" target="extensions-test"/>
      </target>
  
      <target name="prop-print">
          <log message="Give me a property ... ${meep.meep}"/>
      </target>
  
      <target name="changelog-test">
          <changelog basedir="." destfile="../../changelog.txt"
              start="20 Feb 2002" end="20 Mar 2002">
              <user displayname="Peter Donald" userid="donaldp"/>
          </changelog>
      </target>
  
  </project>
  
  
  1.1                  jakarta-ant/proposal/myrmidon/src/samples/template-simple.ati
  
  Index: template-simple.ati
  ===================================================================
  <?xml version="1.0"?>
  
  <?xsl-params location="template-simple.properties"?>
  <?xsl-param name="bar" value="baz"?>
  <?xsl-stylesheet href="template-simple.xsl"?>
  
  <project default="main" basedir=".">
  
    <target name="main">
      <property name="year" value="2000"/>
  
      <log message="Before template"/>
      <log-template msg="Template log 1!" />
      <log-template msg="Template log 2!" />
      <log-template msg="Template log 3!" />
      <log message="After template"/>
    </target>
  
  </project>
  
  
  1.1                  jakarta-ant/proposal/myrmidon/src/samples/template-simple.properties
  
  Index: template-simple.properties
  ===================================================================
  # Here is sample property file
  foo=bar
  
  
  
  1.1                  jakarta-ant/proposal/myrmidon/src/samples/template-simple.xsl
  
  Index: template-simple.xsl
  ===================================================================
  <?xml version="1.0"?>
  
  <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  
    <xsl:template match="log-template">
      <log message="This is an example of how to use a template to expand" />
      <log message="a single element into a list of tasks to do. In this" />
      <log message="example it is largely a case of echoing an attribute" />
      <log message="ie. msg='{@msg}' and embeddding an ant variable ${{year}}" />
    </xsl:template>
  
    <xsl:template match="@*|node()">
      <xsl:copy>
        <xsl:apply-templates select="@*"/>
        <xsl:apply-templates/>
      </xsl:copy>
    </xsl:template>
  
  </xsl:stylesheet>
  
  
  1.1                  jakarta-ant/proposal/myrmidon/src/samples/testdata.txt
  
  Index: testdata.txt
  ===================================================================
  SOme values that have a REPLACEME in them to be replaced like @REPLACEME@ or
  @REPLACEME@
  or @REPLACEME
  @
  etc
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message