alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Ant example source code file (scriptcondition.xml)

This example Ant source code file (scriptcondition.xml) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Ant tags/keywords

The scriptcondition.xml source code

<project name="testscriptcondition" >


  <macrodef name="t">
    <element name="test" implicit="yes" />
    <attribute name="message"/>
    <sequential>
      <fail message="query @{message} failed; result was false">
        <condition>
          <not>
            <test />
          </not>
        </condition>
      </fail>
    </sequential>
  </macrodef>  

  <macrodef name="f">
    <element name="test" implicit="yes" />
    <attribute name="message"/>
    <sequential>
      <fail message="test @{message} failed; result was true">
        <condition>
          <test/>
        </condition>
      </fail>
    </sequential>
  </macrodef>  
  
  <!-- this is here to test the macro is well coded -->
 <target name="testMacro">
    <t message="testMacro" >
        <istrue value="true"/>
    </t>
    <f message="testMacro2" >
        <istrue value="false"/>
    </f>
  </target>  

 <target name="testNolanguage">
    <t message="testNolanguage" >
      <scriptcondition >
        self.setValue(true);
      </scriptcondition>
    </t>
  </target>

  <target name="testClearByDefault">
    <f message="testClearByDefault" >
      <scriptcondition language="javascript">
      </scriptcondition>
    </f>
  </target>  
  
  <target name="testValueWorks">
    <t message="testValueWorks" >
      <scriptcondition language="javascript"
        value="true" />
    </t>
  </target>    
  
  <target name="testSetWorks">
    <t message="testSetWorks" >
      <scriptcondition language="javascript" value="false">
        self.setValue(true);
      </scriptcondition>
    </t>
  </target>

  <target name="testClearWorks">
    <f message="testClearWorks">
      <scriptcondition language="javascript" value="true">
        self.setValue(false);
      </scriptcondition>
    </f>
  </target>  
</project>

Other Ant examples (source code examples)

Here is a short list of links related to this Ant scriptcondition.xml source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.