ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject cvs commit: ant/docs/manual/CoreTasks echoxml.html
Date Tue, 24 May 2005 20:49:55 GMT
mbenson     2005/05/24 13:49:55

  Modified:    docs/manual coretasklist.html
               .        WHATSNEW
               src/main/org/apache/tools/ant/taskdefs defaults.properties
  Added:       src/main/org/apache/tools/ant/taskdefs EchoXML.java
               src/testcases/org/apache/tools/ant/taskdefs EchoXMLTest.java
               src/etc/testcases/taskdefs echoxml.xml
               docs/manual/CoreTasks echoxml.html
  Log:
  Add an echoxml task just for Steve!
  
  Revision  Changes    Path
  1.63      +1 -0      ant/docs/manual/coretasklist.html
  
  Index: coretasklist.html
  ===================================================================
  RCS file: /home/cvs/ant/docs/manual/coretasklist.html,v
  retrieving revision 1.62
  retrieving revision 1.63
  diff -u -r1.62 -r1.63
  --- coretasklist.html	23 May 2005 21:35:45 -0000	1.62
  +++ coretasklist.html	24 May 2005 20:49:55 -0000	1.63
  @@ -46,6 +46,7 @@
   <a href="CoreTasks/dirname.html">Dirname</a><br>
   <a href="CoreTasks/ear.html">Ear</a><br>
   <a href="CoreTasks/echo.html">Echo</a><br>
  +<a href="CoreTasks/echoxml.html">EchoXML</a><br>
   <a href="CoreTasks/exec.html">Exec</a><br>
   <a href="CoreTasks/fail.html">Fail</a><br>
   <a href="CoreTasks/filter.html">Filter</a><br>
  
  
  
  1.833     +5 -3      ant/WHATSNEW
  
  Index: WHATSNEW
  ===================================================================
  RCS file: /home/cvs/ant/WHATSNEW,v
  retrieving revision 1.832
  retrieving revision 1.833
  diff -u -r1.832 -r1.833
  --- WHATSNEW	23 May 2005 22:34:04 -0000	1.832
  +++ WHATSNEW	24 May 2005 20:49:55 -0000	1.833
  @@ -110,9 +110,6 @@
   * <xmlvalidate> and <schemavalidate> create a new parser for every file in
a
     fileset, and so validate multiple files properly. Bugzilla Report 32791
   
  -* New mapper, <scriptmapper>, supports scripted mapping of source files/strings to
  -  destination strings.
  -
   Other changes:
   --------------
   
  @@ -228,6 +225,11 @@
   * Added initial support for Resource Collections, including the
     resourcecount task.
   
  +* New mapper, <scriptmapper>, supports scripted mapping of source files/strings
  +  to destination strings.
  +
  +* Add the echoxml task.
  +
   Changes from Ant 1.6.3 to Ant 1.6.4
   ===================================
   
  
  
  
  1.170     +1 -0      ant/src/main/org/apache/tools/ant/taskdefs/defaults.properties
  
  Index: defaults.properties
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/defaults.properties,v
  retrieving revision 1.169
  retrieving revision 1.170
  diff -u -r1.169 -r1.170
  --- defaults.properties	23 May 2005 19:51:57 -0000	1.169
  +++ defaults.properties	24 May 2005 20:49:55 -0000	1.170
  @@ -208,6 +208,7 @@
   schemavalidate=org.apache.tools.ant.taskdefs.optional.SchemaValidate
   verifyjar=org.apache.tools.ant.taskdefs.VerifyJar
   resourcecount=org.apache.tools.ant.taskdefs.ResourceCount
  +echoxml=org.apache.tools.ant.taskdefs.EchoXML
   
   # deprecated ant tasks (kept for back compatibility)
   starteam=org.apache.tools.ant.taskdefs.optional.scm.AntStarTeamCheckOut
  
  
  
  1.1                  ant/src/main/org/apache/tools/ant/taskdefs/EchoXML.java
  
  Index: EchoXML.java
  ===================================================================
  /*
   * Copyright 2005 The Apache Software Foundation
   *
   *  Licensed under the Apache License, Version 2.0 (the "License");
   *  you may not use this file except in compliance with the License.
   *  You may obtain a copy of the License at
   *
   *      http://www.apache.org/licenses/LICENSE-2.0
   *
   *  Unless required by applicable law or agreed to in writing, software
   *  distributed under the License is distributed on an "AS IS" BASIS,
   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   *  See the License for the specific language governing permissions and
   *  limitations under the License.
   *
   */
  package org.apache.tools.ant.taskdefs;
  
  import java.io.File;
  import java.io.IOException;
  import java.io.OutputStream;
  import java.io.FileOutputStream;
  import java.io.FileNotFoundException;
  
  import org.apache.tools.ant.Project;
  import org.apache.tools.ant.BuildException;
  import org.apache.tools.ant.util.XMLFragment;
  import org.apache.tools.ant.util.DOMElementWriter;
  
  import org.w3c.dom.Node;
  import org.w3c.dom.Element;
  
  /**
   * Echo XML.
   * @since Ant 1.7
   */
  public class EchoXML extends XMLFragment {
  
      private static final DOMElementWriter writer = new DOMElementWriter();
  
      private File file;
      private boolean append;
  
      /**
       * Set the output file.
       * @param f the output file.
       */
      public void setFile(File f) {
          file = f;
      }
  
      /**
       * Set whether to append the output file.
       * @param b boolean append flag.
       */
      public void setAppend(boolean b) {
          append = b;
      }
  
      /**
       * Execute the task.
       */
      public void execute() {
          try {
              OutputStream os = null;
              if (file != null) {
                  os = new FileOutputStream(file, append);
              } else {
                  os = new LogOutputStream(this, Project.MSG_INFO);
              }
              Node n = getFragment().getFirstChild();
              if (n == null) {
                  throw new BuildException("No nested XML specified");
              }
              writer.write((Element) n, os);
          } catch (Exception e) {
              throw new BuildException(e);
          }
      }
  
  }
  
  
  
  1.1                  ant/src/testcases/org/apache/tools/ant/taskdefs/EchoXMLTest.java
  
  Index: EchoXMLTest.java
  ===================================================================
  /*
   * Copyright 2005 The Apache Software Foundation
   *
   *  Licensed under the Apache License, Version 2.0 (the "License");
   *  you may not use this file except in compliance with the License.
   *  You may obtain a copy of the License at
   *
   *      http://www.apache.org/licenses/LICENSE-2.0
   *
   *  Unless required by applicable law or agreed to in writing, software
   *  distributed under the License is distributed on an "AS IS" BASIS,
   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   *  See the License for the specific language governing permissions and
   *  limitations under the License.
   *
   */
  
  package org.apache.tools.ant.taskdefs;
  
  import org.apache.tools.ant.BuildFileTest;
  
  public class EchoXMLTest extends BuildFileTest {
  
      public EchoXMLTest(String name) {
          super(name);
      }
  
      public void setUp() {
          configureProject("src/etc/testcases/taskdefs/echoxml.xml");
      }
  
      public void tearDown() {
          executeTarget("tearDown");
      }
  
      public void testPass() {
          executeTarget("testPass");
      }
  
      public void testFail() {
          expectBuildExceptionContaining("testFail", "must fail", "${foo}=bar");
      }
  
      public void testEmpty() {
          expectBuildExceptionContaining("testEmpty", "must fail", "No nested XML specified");
      }
  
  }
  
  
  
  1.1                  ant/src/etc/testcases/taskdefs/echoxml.xml
  
  Index: echoxml.xml
  ===================================================================
  <project>
    <property name="file" location="echoed.xml" />
    <target name="init">
      <echoxml file="${file}">
        <project>
          <property name="foo" value="bar" />
          <fail message="$$$${foo}=$${foo}">
            <condition>
              <istrue value="${mustfail}" />
            </condition>
          </fail>
        </project>
      </echoxml>
    </target>
    <target name="tearDown">
      <delete file="${file}" />
    </target>
    <target name="testPass" depends="init">
      <ant antfile="${file}" />
    </target>
    <target name="testFail" depends="init">
      <ant antfile="${file}">
        <property name="mustfail" value="true" />
      </ant>
    </target>
    <target name="testEmpty">
      <echoxml />
    </target>
  </project>
  
  
  
  1.1                  ant/docs/manual/CoreTasks/echoxml.html
  
  Index: echoxml.html
  ===================================================================
  <html>
  
  <head>
  <meta http-equiv="Content-Language" content="en-us">
  <link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
  <title>EchoXML Task</title>
  </head>
  
  <body>
  
  <h2>EchoXML</h2>
  <h3>Description</h3>
  <p>Echo nested XML to the console or a file. <b>Since Ant 1.7</b></p>
  <h3>Parameters</h3>
  <table border="1" cellpadding="2" cellspacing="0">
    <tr>
      <td valign="top"><b>Attribute</b></td>
      <td valign="top"><b>Description</b></td>
      <td align="center" valign="top"><b>Required</b></td>
    </tr>
    <tr>
      <td valign="top">file</td>
      <td valign="top">The file to receive the XML. If omitted nested
        XML will be echoed to the log.</td>
      <td valign="top" align="center">No</td>
    </tr>
    <tr>
      <td valign="top">append</td>
      <td valign="top">Whether to append <code>file</code>, if specified.</td>
      <td valign="top" align="center">No</td>
    </tr>
  </table>
  <h3>Parameters specified as nested elements</h3>
  Nested XML content is required.
  
  <h3>Examples</h3>
  <pre>&lt;echoxml file=&quot;subbuild.xml&quot;&gt;
    &lt;project default=&quot;foo&quot;&gt;
      &lt;target name=&quot;foo&quot;&gt;
        &lt;echo&gt;foo&lt;/echo&gt;
      &lt;/target&gt;
    &lt;/project&gt;
  &lt;/echoxml&gt;
  </pre>
  <p>Creates an Ant buildfile, <code>subbuild.xml</code>.</p>
  <hr>
  <p align="center">Copyright &copy; 2005 The Apache Software Foundation.
    All rights Reserved.</p>
  </body>
  </html>
  
  
  
  

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


Mime
View raw message