ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adammurd...@apache.org
Subject cvs commit: jakarta-ant-myrmidon/myrmidon/src/script ant ant.bat antRun antRun.bat
Date Fri, 19 Apr 2002 12:13:30 GMT
adammurdoch    02/04/19 05:13:30

  Added:       myrmidon/src/samples primitive-tests.ant sample.ant
                        template-simple.ati template-simple.properties
                        template-simple.xsl testdata.txt
               myrmidon/src/script ant ant.bat antRun antRun.bat
  Log:
  Copy across scripts and samples.
  
  Revision  Changes    Path
  1.1                  jakarta-ant-myrmidon/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-myrmidon/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>
  
          <!-- start in future will test that catch case where certain
          files will have 0 changes-->
          <changelog basedir="." destfile="../../changelog2.txt"
              start="20 Feb 2004">
              <user displayname="Peter Donald" userid="donaldp"/>
          </changelog>
      </target>
  
      <target name="extension-test">
          <jarlib-display file="../../src/ant1compat/jar/ant.jar"/>
          <jarlib-display>
              <fileset dir="../../">
                  <include name="src/ant1compat/jar/*.jar"/>
                  <include name="lib/*.jar"/>
              </fileset>
          </jarlib-display>
      </target>
  
      <!--
      -->
  
      <target name="manifest-test">
  
          <extension-set id="my-dependencies">
              <libfileset dir="../../">
                  <include name="src/ant1compat/jar/*.jar"/>
              </libfileset>
              <extension
                  extension-name="MrMadeUpExtension"
                  specification-version="1.0"
                  specification-vendor="Peter Donald"/>
          </extension-set>
  
          <extension-set id="my-options">
              <libfileset dir="../../">
                  <include name="lib/*.jar"/>
              </libfileset>
          </extension-set>
  
          <extension id="my-extension"
              extension-name="org.realityforge.dve"
              specification-version="1.0"
              specification-vendor="Peter Donald"/>
  
          <jarlib-manifest destfile="../../generated-manifest.txt">
              <attribute name="Main-class" value="org.realityforg.dve.WorldGen"/>
              <extension-ref id="my-extension"/>
              <depends-ref id="my-dependencies"/>
              <options-ref id="my-options"/>
          </jarlib-manifest>
      </target>
  
  </project>
  
  
  1.1                  jakarta-ant-myrmidon/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-myrmidon/myrmidon/src/samples/template-simple.properties
  
  Index: template-simple.properties
  ===================================================================
  # Here is sample property file
  foo=bar
  
  
  
  1.1                  jakarta-ant-myrmidon/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-myrmidon/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
  
  
  1.1                  jakarta-ant-myrmidon/myrmidon/src/script/ant
  
  Index: ant
  ===================================================================
  #!/bin/sh
  
  if [ -f $HOME/.antrc ] ; then 
    . $HOME/.antrc
  fi
  
  # Cygwin support.
  if [ "$OSTYPE" == "cygwin32" ] || [ "$OSTYPE" = "cygwin" ]; then
    if [ ! "$JAVA_HOME" = "" ]; then
      JAVA_HOME=`cygpath --path --unix $JAVA_HOME`
    fi
  fi
  
  ## resolve links - $0 may be a link to ant's home
  PRG=$0
  progname=`basename $0`
    
  while [ -h "$PRG" ] ; do
    ls=`ls -ld "$PRG"`
    link=`expr "$ls" : '.*-> \(.*\)$'`
    if expr "$link" : '.*/.*' > /dev/null; then
      PRG="$link"
    else
      PRG="`dirname $PRG`/$link"
    fi
  done
    
  ANT_HOME=`dirname "$PRG"`/..
  
  if [ "$JAVA_HOME" == "" ] ; then
    if [ "$JAVACMD" = "" ] ; then
      JAVACMD=java
    fi
  else
    if [ "$JAVACMD" = "" ] ; then 
      JAVACMD=$JAVA_HOME/bin/java
    fi
  fi
  
  $JAVACMD $ANT_OPTS -jar $ANT_HOME/bin/myrmidon-launcher.jar $@
  
  
  
  1.1                  jakarta-ant-myrmidon/myrmidon/src/script/ant.bat
  
  Index: ant.bat
  ===================================================================
  @echo off
  
  if exist "%HOME%\antrc_pre.bat" call "%HOME%\antrc_pre.bat"
  
  if not "%OS%"=="Windows_NT" goto start
  
  rem %~dp0 is name of current script under NT
  set DEFAULT_ANT_HOME=%~dp0
  
  rem : operator works similar to make : operator
  set DEFAULT_ANT_HOME=%DEFAULT_ANT_HOME:\bin\=%
  
  if "%ANT_HOME%"=="" set ANT_HOME=%DEFAULT_ANT_HOME%
  set DEFAULT_ANT_HOME=
  
  :start
  
  if not "%ANT_HOME%" == "" goto ant_home_found
  
  echo.
  echo Warning: ANT_HOME environment variable is not set.
  echo   This needs to be set for Win9x as it's command prompt 
  echo   scripting bites
  echo.
  goto end
  
  :ant_home_found
  
  if not "%JAVA_HOME%" == "" goto javaCmdSetup
  
  rem hope that there is java command in path
  if "%JAVACMD%" == "" set JAVACMD=java
  goto argSetup
  
  rem if JAVA_HOME is set then make sure we use that java exe
  :javaCmdSetup
  if "%JAVACMD%" == "" set JAVACMD=%JAVA_HOME%\bin\java
  
  :argSetup
  
  set ANT_CMD_LINE_ARGS=
  
  rem Slurp all args...
  :setupArgs
  if "%0" == "" goto doneArgs
  set ANT_CMD_LINE_ARGS=%ANT_CMD_LINE_ARGS% %1
  shift
  goto setupArgs
  
  :doneArgs
  rem Mmmmmm tasty - finished slurping args
  
  %JAVACMD% %ANT_OPTS% -jar %ANT_HOME%\bin\myrmidon-launcher.jar %ANT_CMD_LINE_ARGS%
  
  :end
  if exist "%HOME%\antrc_post.bat" call "%HOME%\antrc_post.bat"
  set ANT_CMD_LINE_ARGS=
  
  
  
  1.1                  jakarta-ant-myrmidon/myrmidon/src/script/antRun
  
  Index: antRun
  ===================================================================
  #! /bin/sh
  
  # Args: DIR command
  cd "$1"
  CMD="$2"
  shift
  shift
  
  exec $CMD "$@"
  
  
  
  1.1                  jakarta-ant-myrmidon/myrmidon/src/script/antRun.bat
  
  Index: antRun.bat
  ===================================================================
  @echo off
  
  cd %1
  set ANT_RUN_CMD=%2
  shift
  shift
  
  set PARAMS=
  :loop
  if "%1" == "" goto runCommand
  set PARAMS=%PARAMS% %1
  shift
  goto loop
  
  :runCommand
  echo %ANT_RUN_CMD% %PARAMS%
  %ANT_RUN_CMD% %PARAMS%
  
  
  
  

--
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