diff --git a/proposal/sandbox/antunit/README b/proposal/sandbox/antunit/README new file mode 100644 index 000000000..40e7a14ad --- /dev/null +++ b/proposal/sandbox/antunit/README @@ -0,0 +1 @@ +Moved to http://svn.apache.org/repos/asf/ant/sandbox/antlibs/antunit/trunk/ \ No newline at end of file diff --git a/proposal/sandbox/antunit/build.xml b/proposal/sandbox/antunit/build.xml deleted file mode 100644 index c28f8615a..000000000 --- a/proposal/sandbox/antunit/build.xml +++ /dev/null @@ -1,93 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - At least one test has failed. - - \ No newline at end of file diff --git a/proposal/sandbox/antunit/src/etc/testcases/assert.xml b/proposal/sandbox/antunit/src/etc/testcases/assert.xml deleted file mode 100644 index 8b9a87377..000000000 --- a/proposal/sandbox/antunit/src/etc/testcases/assert.xml +++ /dev/null @@ -1,143 +0,0 @@ - - - - - - - - Only run via JUnit - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/proposal/sandbox/antunit/src/main/org/apache/ant/antlib/antunit/AssertTask.java b/proposal/sandbox/antunit/src/main/org/apache/ant/antlib/antunit/AssertTask.java deleted file mode 100644 index e2fb1f9d8..000000000 --- a/proposal/sandbox/antunit/src/main/org/apache/ant/antlib/antunit/AssertTask.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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.ant.antlib.antunit; - -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.taskdefs.condition.Condition; -import org.apache.tools.ant.taskdefs.condition.ConditionBase; - -/** - * Exits the active build, giving an additional message if the single - * nested condition fails. - * - *

This one could as well be implemented as - * - *

- * <macrodef name="assertTrue">
- *   <attribute name="message" default="Assertion failed"/>
- *   <element name="assertion" implicit="true"/>
- *   <sequential>
- *     <fail message="@{message}">
- *       <condition>
- *         <assertion/>
- *       </condition>
- *     </fail>
- *   </sequential>
- * </macrodef>
- * 
- * - * but wouldn't be able to throw a specialized exception that way - - * and the macrodef would nest the exception in yet another - * BuildException.

- */ -public class AssertTask extends ConditionBase { - - private String message = AssertionFailedException.DEFAULT_MESSAGE; - - public void setMessage(String value) { - this.message = value; - } - - public void execute() throws BuildException { - int count = countConditions(); - if (count > 1) { - throw new BuildException("You must not specify more tha one " - + "conditions"); - } - if (count < 1) { - throw new BuildException("You must specify a condition"); - } - if (!((Condition) getConditions().nextElement()).eval()) { - throw new AssertionFailedException(message); - } - } - -} \ No newline at end of file diff --git a/proposal/sandbox/antunit/src/main/org/apache/ant/antlib/antunit/AssertionFailedException.java b/proposal/sandbox/antunit/src/main/org/apache/ant/antlib/antunit/AssertionFailedException.java deleted file mode 100644 index 5e5e20a07..000000000 --- a/proposal/sandbox/antunit/src/main/org/apache/ant/antlib/antunit/AssertionFailedException.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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.ant.antlib.antunit; - -import org.apache.tools.ant.BuildException; - -/** - * Specialized BuildException thrown by the AssertTask task. - */ -public class AssertionFailedException extends BuildException { - - public static final String DEFAULT_MESSAGE = "Assertion failed"; - - public AssertionFailedException(String message) { - super(message); - } -} \ No newline at end of file diff --git a/proposal/sandbox/antunit/src/main/org/apache/ant/antlib/antunit/antlib.xml b/proposal/sandbox/antunit/src/main/org/apache/ant/antlib/antunit/antlib.xml deleted file mode 100644 index 82f89e226..000000000 --- a/proposal/sandbox/antunit/src/main/org/apache/ant/antlib/antunit/antlib.xml +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/proposal/sandbox/antunit/src/testcases/org/apache/ant/antlib/antunit/AssertTest.java b/proposal/sandbox/antunit/src/testcases/org/apache/ant/antlib/antunit/AssertTest.java deleted file mode 100644 index 133b4dbe2..000000000 --- a/proposal/sandbox/antunit/src/testcases/org/apache/ant/antlib/antunit/AssertTest.java +++ /dev/null @@ -1,138 +0,0 @@ -/* - * 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.ant.antlib.antunit; - -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.BuildFileTest; - -public class AssertTest extends BuildFileTest { - - public AssertTest(String name) { - super(name); - } - - public void setUp() { - configureProject("src/etc/testcases/assert.xml"); - } - - public void testTruePass() { - testPass("assertTruePass"); - } - public void testFalsePass() { - testPass("assertFalsePass"); - } - public void testEqualsPass() { - testPass("assertEqualsPass"); - } - public void testEqualsCasePass() { - testPass("assertEqualsCasePass"); - } - public void testPropertySetPass() { - testPass("assertPropertySetPass"); - } - public void testPropertyEqualsPass() { - testPass("assertPropertyEqualsPass"); - } - public void testPropertyEqualsCasePass() { - testPass("assertPropertyEqualsCasePass"); - } - public void testFileExistsPass() { - testPass("assertFileExistsPass"); - } - public void testFileDoesntExistPass() { - testPass("assertFileDoesntExistPass"); - } - public void testDestIsUptodatePass() { - testPass("assertDestIsUptodatePass"); - } - public void testDestIsOutofdatePass() { - testPass("assertDestIsOutofdatePass"); - } - - public void testTrueFail() { - testFail("assertTrueFail"); - } - public void testFalseFail() { - testFail("assertFalseFail"); - } - public void testEqualsFail1() { - testFail("assertEqualsFail1", "Expected 'bar' but was 'baz'"); - } - public void testEqualsFail2() { - testFail("assertEqualsFail2", "Expected 'bar' but was 'BAR'"); - } - public void testPropertySetFail() { - testFail("assertPropertySetFail", "Expected property 'foo'"); - } - public void testPropertyEqualsFail1() { - testFail("assertPropertyEqualsFail1", "Expected property 'foo' to have value 'bar' but was '${foo}'"); - } - public void testPropertyEqualsFail2() { - testFail("assertPropertyEqualsFail2", "Expected property 'foo' to have value 'baz' but was 'bar'"); - } - public void testPropertyEqualsFail3() { - testFail("assertPropertyEqualsFail3", "Expected property 'foo' to have value 'BAR' but was 'bar'"); - } - public void testFileExistsFail() { - testFail("assertFileExistsFail", - "Expected file 'assert.txt' to exist"); - } - public void testFileDoesntExistFail() { - testFail("assertFileDoesntExistFail", - "Didn't expect file 'assert.xml' to exist"); - } - public void testDestIsUptodateFail() { - testFail("assertDestIsUptodateFail", - "Expected '../../main/org/apache/ant/antlib/antunit/AssertTask.java' to be more recent than '../../../build/classes/org/apache/ant/antlib/antunit/AssertTask.class'"); - } - public void testDestIsOutofdateFail() { - testFail("assertDestIsOutofdateFail", - "Expected '../../main/org/apache/ant/antlib/antunit/AssertTask.java' to be more recent than '../../../build/classes/org/apache/ant/antlib/antunit/AssertTask.class'"); - } - - - private void testPass(String target) { - executeTarget(target); - } - - private void testFail(String target) { - testFail(target, "Assertion failed"); - } - - private void testFail(String target, String message) { - try { - executeTarget(target); - fail("Expected failed assetion"); - } catch (AssertionFailedException e) { - assertEquals(message, e.getMessage()); - } catch (BuildException e) { - // depending on the number of macrodef indirections, this - // can become arbitrarily deep - while (true) { - Throwable t = e.getCause(); - assertNotNull(t); - assertTrue("nested is a BuildException", - t instanceof BuildException); - if (t instanceof AssertionFailedException) { - assertEquals(message, e.getMessage()); - break; - } - e = (BuildException) t; - } - } // end of try-catch - } -} \ No newline at end of file diff --git a/proposal/sandbox/dotnet/README b/proposal/sandbox/dotnet/README index 70bc73d2d..a748baac0 100644 --- a/proposal/sandbox/dotnet/README +++ b/proposal/sandbox/dotnet/README @@ -1,38 +1 @@ -dotnet sandbox README -===================== - -Author: -------- - -Stefan Bodewig, but feel free to go ahead and modify to your liking. - -Goal: ------ - -Provide a simple infrastructure to execute .NET applications from -within Ant for different VMs so that the user doesn't have to change -the build file when she wants to run Mono on Linux and Microsoft's VM -on Windows. - -This sounds far more ambitioned than it actually is. - -Short term goals are: - -* A task that can be used as - - - - without testing for the environment (see the dotnet.xml build file - for Ant's tests as an example for what may become simpler with - this). - -* A task. - -* A task - if only for the fun of having it. - -* A task. - -* A task. - -Those tasks should end up in an antlib of their own in order to be -distributable independent of Ant. +Moved to http://svn.apache.org/repos/asf/ant/sandbox/antlibs/dotnet/trunk/ \ No newline at end of file diff --git a/proposal/sandbox/dotnet/build.xml b/proposal/sandbox/dotnet/build.xml deleted file mode 100644 index 6db1d04c7..000000000 --- a/proposal/sandbox/dotnet/build.xml +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - At least one test has failed. - - \ No newline at end of file diff --git a/proposal/sandbox/dotnet/docs/dotnetexec.html b/proposal/sandbox/dotnet/docs/dotnetexec.html deleted file mode 100644 index f66cd4a1c..000000000 --- a/proposal/sandbox/dotnet/docs/dotnetexec.html +++ /dev/null @@ -1,32 +0,0 @@ - - - - DotNetExec Task - - - -

DotNetExec

- -

Description

- -

Executes a .NET assembly that's on your PATH or pointed to - directly by the executable attribute.

- -

This task is an extension of Ant's exec - task and supports all attributes and nested child elements of that - task. Use the executable attribute to specify the name of the - assembly (including the extension).

- -

This task allows you to choose the .NET framework via the - vm attribute. The default value is "microsoft" on - Windows and "mono" on all other platforms. "microsoft" is a magic - name that means "run the assembly as executable directly" - this - may also work for Mono on Linux systems with the binfmt feature - described in the Mono FAQ.

- -
-

Copyright © 2003-2004 The Apache Software Foundation. All rights Reserved.

- - \ No newline at end of file diff --git a/proposal/sandbox/dotnet/docs/index.html b/proposal/sandbox/dotnet/docs/index.html deleted file mode 100644 index f5fcb9139..000000000 --- a/proposal/sandbox/dotnet/docs/index.html +++ /dev/null @@ -1,142 +0,0 @@ - - - - Dotnet Ant Library - - - -

Introduction

- -

This is a library of Ant tasks that support using .NET - executables accross different platforms and in particular support - using common .NET development tools like NAnt or NUnit from within Ant.

- -

Requirements

- -

The current version requires Ant 1.6.2 or later and may even - work better for a CVS build of Ant created from CVS HEAD.

- -

Where is it?

- -

The source code for the library currently lives in the - developer sandbox in Ant's CVS - http://cvs.apache.org/viewcvs.cgi/ant/proposal/sandbox/dotnet/. - A binary can be found at http://cvs.apache.org/~bodewig/dotnet/dotnet.jar. - A zip file containing the docs is also available.

- -

Note that these are temporary locations and may change later.

- -

Feedback

- -

Right now direct any feedback either directly to me or the Ant - developer list. - -

Installation

- -

If you are building this from sources, run the antlib target - and you'll get a file dotnet.jar. If you've - downloaded dotnet.jar, you are already ready.

- -

There are several ways to use the tasks:

- -
    -
  • The traditional way: -
    -          <taskdef 
    -            resource="org/apache/tools/ant/taskdefs/optional/dotnet/antlib.xml">
    -            <classpath>
    -              <pathelement location="YOUR-PATH-TO/dotnet.jar"/>
    -            </classpath>
    -          </taskdef>
    -        
    - - With this you can use the tasks like plain Ant tasks, they'll - live in the default namespace. I.e. if you can run - <exec> without any namespace prefix, you can do so for - <dotnetexec> as well. -
  • - -
  • Similar, but assigning a namespace URI -
    -          <taskdef 
    -            uri="antlib:org.apache.tools.ant.taskdefs.optional.dotnet"
    -            resource="org/apache/tools/ant/taskdefs/optional/dotnet/antlib.xml">
    -            <classpath>
    -              <pathelement location="YOUR-PATH-TO/dotnet.jar"/>
    -            </classpath>
    -          </taskdef>
    -        
    - - This puts you task into a separate namespace than Ant's - namespace. You would use the tasks like - -
    -          <project
    -            xmlns:dn="antlib:org.apache.tools.ant.taskdefs.optional.dotnet"
    -            xmlns="antlib:org.apache.tools.ant">
    -            ...
    -            <dn:nant>
    -              <dn:target name="my-target"/>
    -            </dn:nant>
    -        
    - - or - -
    -          <nant xmlns="antlib:org.apache.tools.ant.taskdefs.optional.dotnet">
    -            <target name="my-target"/>
    -          </nant>
    -        
    - - or a variation thereof. -
  • - -
  • Using Ant's autodiscovery. Place dotnet.jar - into a directory and use ant -lib - DIR-CONTAINING-THE-JAR or copy it into - ANT_HOME/lib - and then in your build file, simply - declare the namespace on the project tag: - -
    -          <project
    -            xmlns:dn="antlib:org.apache.tools.ant.taskdefs.optional.dotnet"
    -            xmlns="antlib:org.apache.tools.ant">
    -        
    - - And all tasks of this library will automatically be available - in the dn namespace without any - taskdef. -
  • -
- -

Tasks

- -
    -
  • dotnetexec - run a .NET - assembly that's in your PATH. You can chose the framework that - is going to be used - defaults to Mono on non-Windows platforms - and Microsoft's on Windows.
  • - -
  • nant - execute the NAnt build - tool.
  • - -
  • msbuild - execute the MSBuild build - tool, untested.
  • - -
  • wix - execute the WiX toolset, untested.
  • - -
  • nunit - execute the - nunit-console.exe NUnit - test runner.
  • -
- -
-

Copyright © 2003-2004 The Apache Software Foundation. All rights Reserved.

- - diff --git a/proposal/sandbox/dotnet/docs/msbuild.html b/proposal/sandbox/dotnet/docs/msbuild.html deleted file mode 100644 index 2ac93bc78..000000000 --- a/proposal/sandbox/dotnet/docs/msbuild.html +++ /dev/null @@ -1,109 +0,0 @@ - - - - MSBuild Task - - - -

MSBuild

- -

Description

- -

Runs the MSBuild build tool presented at the 2003 PDC. This - task is completely untested as the developers have no access to - the tool, it has been implemented by looking at the docs only.

- -

You can either use an existing build file or nest a build file - (snippet) as a child into the task. If you don't specify either, - MSBuild's default build file search algorithm will apply.

- -

Parameters

- - - - - - - - - - - - - - - - -
AttributeDescriptionRequired
buildfileExternal build file to invoke MSBuild on.No.
vmSame as dotnetexec's vm attribute. - Specify the framework to use.No.
- -

Parameters specified as nested elements

-

target

- -

target has a single required attribute name - - specifies a target to be run.

- -

property

- -

property has two required attributes. name and - value that specify name and value of a property that is to be - defined in the MSBuild invocation.

- -

build

- -

This element allows no attributes. You can nest a MSBuild build - file into it and MSBuild will be executed on that. You can also nest - a build file snippet instead and Ant will wrap the necessary MSBuild - <Project> around it.

- -

Examples

- -

Let MSBuild search for a *.proj file in the (Ant) project's base - directory and execute the default target in it:

- -
<msbuild/>
- -

Let MSBuild execute the targets named foo and bar in the build - file msbuild.proj in Ant's basedir and pass the property - /property:test=testvalue to it:

- -
-      <msbuild buildfile="msbuild.proj">
-        <target name="foo"/>
-        <target name="bar"/>
-        <property name="test" value="testvalue"/>
-      </msbuild>
-    
- -

Define a build file embeded into the task, let MSBuild execute the - echo target of that build file.

- -
-      <msbuild>
-        <target name="echo">
-        <build>
-          <Project DefaultTargets="empty">
-            <Target Name="empty"/>
-            <Target Name="echo">
-              <Task Name="Echo" Message="This is MSBuild"/>
-            </Target>
-          </Project>
-        </build>
-      </msbuild>
-    
- -

Run MSBuild's Echo task (if there actually is one):

- -
-      <msbuild>
-        <build>
-          <Task Name="Echo" Message="This is MSBuild"/>
-        </build>
-      </msbuild>
-    
- -
-

Copyright © 2003-2004 The Apache Software Foundation. All rights Reserved.

- - \ No newline at end of file diff --git a/proposal/sandbox/dotnet/docs/nant.html b/proposal/sandbox/dotnet/docs/nant.html deleted file mode 100644 index 07a92a28e..000000000 --- a/proposal/sandbox/dotnet/docs/nant.html +++ /dev/null @@ -1,108 +0,0 @@ - - - - NAnt Task - - - -

NAnt

- -

Description

- -

Runs the NAnt build - tool.

- -

You can either use an existing build file or nest a build file - (snippet) as a child into the task. If you don't specify either, - NAnt's default build file search algorithm will apply.

- -

Parameters

- - - - - - - - - - - - - - - - -
AttributeDescriptionRequired
buildfileExternal build file to invoke NAnt on.No.
vmSame as dotnetexec's vm attribute. - Specify the framework to use.No.
- -

Parameters specified as nested elements

-

target

- -

target has a single required attribute name - - specifies a target to be run.

- -

property

- -

property has two required attributes. name and - value that specify name and value of a property that is to be - defined in the NAnt invocation.

- -

build

- -

This element allows no attributes. You can nest a NAnt build - file into it and NAnt will be executed on that. You can also nest - a build file snippet instead and Ant will wrap the necessary NAnt - <project> around it.

- -

Examples

- -

Let NAnt search for a *.build file in the (Ant) project's base - directory and execute the default target in it:

- -
<nant/>
- -

Let NAnt execute the targets named foo and bar in the build - file nant.build in Ant's basedir and pass the property - -D:test=testvalue to it:

- -
-      <nant buildfile="nant.build">
-        <target name="foo"/>
-        <target name="bar"/>
-        <property name="test" value="testvalue"/>
-      </nant>
-    
- -

Define a build file embeded into the task, let NAnt execute the - echo target of that build file.

- -
-      <nant>
-        <target name="echo">
-        <build>
-          <project basedir="." default="empty">
-            <target name="empty"/>
-            <target name="echo">
-              <echo message="this is NAnt"/>
-            </target>
-          </project>
-        </build>
-      </nant>
-    
- -

Run NAnt's echo task:

- -
-      <nant>
-        <build>
-          <echo message="this is NAnt"/>
-        </build>
-      </nant>
-    
- -
-

Copyright © 2003-2004 The Apache Software Foundation. All rights Reserved.

- - \ No newline at end of file diff --git a/proposal/sandbox/dotnet/docs/nunit.html b/proposal/sandbox/dotnet/docs/nunit.html deleted file mode 100644 index e7ddd11f2..000000000 --- a/proposal/sandbox/dotnet/docs/nunit.html +++ /dev/null @@ -1,177 +0,0 @@ - - - - NUnit Task - - - -

NUnit

- -

Description

- -

Runs the NUnit console - test runner.

- -

Parameters

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AttributeDescriptionRequired
vmSame as dotnetexec's vm attribute. - Specify the framework to use.No.
configConfig file to useNo.
outputWhere test output should go.No.
errorWhere test error output should go.No.
xmloutWhere NUnit's XML output should go.No.
transformThe transformation to apply.No.
threadCauses a separate thread to be created for - running the tests - see the NUnit documentation for - details.No - defaults to false.
noshadowDisables shadow copying of the assembly in - order to provide improved performance..No - defaults to false.
fixtureTest fixture to run.No.
labelsCauses an identifying label to be displayed - at the start of each test case.No - defaults to false.
failOnErrorStops the build if NUnit returns with a code - indicating an error or failure.No - defaults to false.
- -

Parameters specified as nested elements

-

testassembly

- -

testassembly has a single required attribute name - - specifies an assembly or a project file holding tests.

- -

include/exclude

- -

in/exclude have a single required attribute name - - specifies a category to include or exclude from the tests.

- -

Note that in current versions of NUnit (up to 2.2) you - may choose to either include or exclude categories in a run, but - not both. This task does not enforce this restriction - since future versions of NUnit may change behavior.

- -

redirector

- -

A nested I/O - Redirector can be specified. Any file mapping is done using a - null sourcefile; therefore not all Mapper - types will return results.

- -

env

It is possible to specify environment variables to - pass to the system command via nested <env> - elements. They support the same attributes as the nested env - element of the <exec> task.

- -

Examples

- -

Specify an assembly or project:

- -
-      <nunit>
-        <testassembly name="nunit.tests.dll"/>
-      </nunit>
-    
- -

or

- -
-      <nunit>
-        <testassembly name="nunit.tests.csproj"/>
-      </nunit>
-    
- -

Specifying an Assembly and a Fixture

- -
-      <nunit fixture="NUnit.Tests.AssertionTests">
-        <testassembly name="nunit.tests.dll"/>
-      </nunit>
-    
- -

Specifying Test Categories to Include

- -
-      <nunit>
-        <testassembly name="nunit.tests.dll"/>
-        <include name="Baseline"/>
-      </nunit>
-    
- -

Specifying the XML file name

- -
-      <nunit xmlout="console-test.xml">
-        <testassembly name="nunit.tests.dll"/>
-      </nunit>
-    
- -

changes the name of the output file to "console-test.xml" - - note that this task will resolve file names relative to the - project's base directory, not the current working directory.

- -

Specifying Multiple Assemblies

- -
-      <nunit>
-        <testassembly name="assembly1.dll"/>
-        <testassembly name="assembly2.dll"/>
-        <testassembly name="assembly3.dll"/>
-      </nunit>
-    
- -
-

Copyright © 2004 The Apache Software Foundation. All rights Reserved.

- - \ No newline at end of file diff --git a/proposal/sandbox/dotnet/docs/wix.html b/proposal/sandbox/dotnet/docs/wix.html deleted file mode 100644 index a79ff991e..000000000 --- a/proposal/sandbox/dotnet/docs/wix.html +++ /dev/null @@ -1,177 +0,0 @@ - - - - Wix Task - - - -

Wix

- -

Description

- -

Runs the candle, light or both from the Wix toolset.

- -

Parameters

- - - - - - - - - - - - - - - - - - - - - - - - - - -
AttributeDescriptionRequired
sourceThe single source file to process.Either this or at least one nested - <sources> set.
targetThe expected target file.Yes, unless you run candle without light.
modeWhich part of the toolset to run, one of - "candle", "light" or - "both".No, default is "both".
vmSame as dotnetexec's vm attribute. - Specify the framework to use.No.
- -

Parameters specified as nested elements

- -

sources

- -

Specify source files that shall be passed on the command line. - This is a fileset.

- -

moresources

- -

Specify source files that shall not be passed on the command - line. This is a fileset.

- -

Typically this would list include files when running candle or - the files that vecome part of the MSI file when running light. - The files in this set are only used for timestamp comparisons. If - neither these files nor the given "normal" sources are - newer than the expected target, the task won't do anything.

- - -

Examples

- -

Create product.wixobj from product.wxs:

- -
-      <wix mode="candle" source="product.wxs"/>
-    
- -

The same but using a nested sources element:

- -
-      <wix mode="candle">
-        <sources dir=".">
-          <include name="product.wxs"/>
-        </sources>
-      </wix>
-    
- -

Create product.msi from product.wixobj:

- -
-      <wix mode="light" source="product.wixobj" target="product.msi"/>
-    
- -

Combine the examples into a single step:

- -
-      <wix source="product.wxs" target="product.msi"/>
-    
- -

Note that the task wouldn't do anything if - product.wxs was older than - product.wixobj and product.wixobj was - older than product.msi.

- -

Compile multiple .wxs files at once:

- -
-      <wix mode="candle">
-        <sources dir=".">
-          <include name="*.wxs"/>
-        </sources>
-      </wix>
-    
- -

Compile multiple .wxs files at once, specify some - include files in addition to that:

- -
-      <wix mode="candle">
-        <sources dir=".">
-          <include name="*.wxs"/>
-        </sources>
-        <moresources dir=".">
-          <include name="*.wxi"/>
-        </moresources>
-      </wix>
-    
- -

Link multiple .wixobj files at once:

- -
-      <wix mode="light" target="product.msi">
-        <sources dir=".">
-          <include name="*.wixobj"/>
-        </sources>
-      </wix>
-    
- -

Link multiple .wixobj files at once and specify - that the files in directory "source" will become part of - the package:

- -
-      <wix mode="light" target="product.msi">
-        <sources dir=".">
-          <include name="*.wixobj"/>
-        </sources>
-        <moresources dir="source"/>
-      </wix>
-    
- -
Combine multiple .wxs files and include files
-    into a single package and specify that the package will contain
-    files from the source directory:
- -
-      <wix target="product.msi">
-        <sources dir=".">
-          <include name="*.wxs"/>
-        </sources>
-        <moresources dir=".">
-          <include name="*.wxi"/>
-        </moresources>
-        <moresources dir="source"/>
-      </wix>
-    
- -

Again, if the intermediate .wixobj files are newer - that the corresponding .wxs files (and all include - files) the candle step will be skipped. If - product.msi is newer than all files, the task won't - do anything.

- -
-

Copyright © 2004 The Apache Software Foundation. All rights Reserved.

- - \ No newline at end of file diff --git a/proposal/sandbox/dotnet/src/etc/testcases/dotnetexec.xml b/proposal/sandbox/dotnet/src/etc/testcases/dotnetexec.xml deleted file mode 100644 index 2aaef4bcb..000000000 --- a/proposal/sandbox/dotnet/src/etc/testcases/dotnetexec.xml +++ /dev/null @@ -1,89 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - csc.found=${csc.found} - - - - - - mcs.found=${mcs.found} - - - - - - - - - - - - - - - - - - - - - Needed C# compiler is missing - - - - - - - - No app ${testCSC.exe} created - - - - - - diff --git a/proposal/sandbox/dotnet/src/etc/testcases/msbuild.xml b/proposal/sandbox/dotnet/src/etc/testcases/msbuild.xml deleted file mode 100644 index dd1f13659..000000000 --- a/proposal/sandbox/dotnet/src/etc/testcases/msbuild.xml +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/proposal/sandbox/dotnet/src/etc/testcases/nant.xml b/proposal/sandbox/dotnet/src/etc/testcases/nant.xml deleted file mode 100644 index 172d0e77c..000000000 --- a/proposal/sandbox/dotnet/src/etc/testcases/nant.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/proposal/sandbox/dotnet/src/etc/testcases/nunit.xml b/proposal/sandbox/dotnet/src/etc/testcases/nunit.xml deleted file mode 100644 index ded9b586a..000000000 --- a/proposal/sandbox/dotnet/src/etc/testcases/nunit.xml +++ /dev/null @@ -1,81 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/proposal/sandbox/dotnet/src/etc/testcases/src/example.cs b/proposal/sandbox/dotnet/src/etc/testcases/src/example.cs deleted file mode 100644 index 0616e3362..000000000 --- a/proposal/sandbox/dotnet/src/etc/testcases/src/example.cs +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2001-2004 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. - * - */ - -using System; - -public class Example { - - public static void Main(String[] args) { - Example2.echo(); - } -} diff --git a/proposal/sandbox/dotnet/src/etc/testcases/src/example2.cs b/proposal/sandbox/dotnet/src/etc/testcases/src/example2.cs deleted file mode 100644 index f373ec041..000000000 --- a/proposal/sandbox/dotnet/src/etc/testcases/src/example2.cs +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2001-2004 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. - * - */ - -using System; - -/** - * this is just here to create confusion - */ -public class Example2 { - - public int some_variable=3; - - public static void echo() { - Console.WriteLine("hello, I look like Java, but I'm really .NET"); - } - -} diff --git a/proposal/sandbox/dotnet/src/etc/testcases/src/fail.cs b/proposal/sandbox/dotnet/src/etc/testcases/src/fail.cs deleted file mode 100644 index 44c1205b4..000000000 --- a/proposal/sandbox/dotnet/src/etc/testcases/src/fail.cs +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2004 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. - * - */ - -using System; -using NUnit.Framework; - -[TestFixture] -public class FailingTest -{ - - [Test] - public void Fail() - { - Assert.IsTrue(false); - } -} diff --git a/proposal/sandbox/dotnet/src/etc/testcases/src/msbuild.proj b/proposal/sandbox/dotnet/src/etc/testcases/src/msbuild.proj deleted file mode 100644 index ded05af89..000000000 --- a/proposal/sandbox/dotnet/src/etc/testcases/src/msbuild.proj +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - diff --git a/proposal/sandbox/dotnet/src/etc/testcases/src/nant.build b/proposal/sandbox/dotnet/src/etc/testcases/src/nant.build deleted file mode 100644 index cf59b7619..000000000 --- a/proposal/sandbox/dotnet/src/etc/testcases/src/nant.build +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - diff --git a/proposal/sandbox/dotnet/src/etc/testcases/src/pass.cs b/proposal/sandbox/dotnet/src/etc/testcases/src/pass.cs deleted file mode 100644 index 51fabf40e..000000000 --- a/proposal/sandbox/dotnet/src/etc/testcases/src/pass.cs +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2004 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. - * - */ - -using System; -using NUnit.Framework; - -[TestFixture] -public class PassingTest -{ - - [Test] - public void Pass() - { - Assert.IsTrue(true); - } -} diff --git a/proposal/sandbox/dotnet/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/AbstractBuildTask.java b/proposal/sandbox/dotnet/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/AbstractBuildTask.java deleted file mode 100644 index 3db543979..000000000 --- a/proposal/sandbox/dotnet/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/AbstractBuildTask.java +++ /dev/null @@ -1,259 +0,0 @@ -/* - * Copyright 2003-2004 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.optional.dotnet; - -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.Task; -import org.apache.tools.ant.util.DOMElementWriter; -import org.apache.tools.ant.util.FileUtils; -import org.apache.tools.ant.util.XMLFragment; - -import org.w3c.dom.DocumentFragment; -import org.w3c.dom.Element; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -/** - * Base class for NAntTask and MSBuildTask. - */ -public abstract class AbstractBuildTask extends Task { - - /** - * The buildfile to invoke the build tool for. - */ - private File buildFile; - - /** - * The targets to execute. - */ - private List targets = new ArrayList(); - - /** - * Properties to set. - */ - private List properties = new ArrayList(1); - - /** - * Nested build file fragment. - */ - private XMLFragment buildSnippet; - - /** - * The vm attribute - if given. - */ - private String vm; - - /** - * Empty constructor. - */ - protected AbstractBuildTask() { - } - - /** - * Sets the name of the build file. - */ - public final void setBuildfile(File f) { - buildFile = f; - } - - /** - * Adds a build file fragment. - */ - public void addBuild(XMLFragment f) { - if (buildSnippet == null) { - buildSnippet = f; - } else { - throw new BuildException("You must not specify more than one " - + "build element"); - } - } - - /** - * Set the name of the executable for the virtual machine. - * - * @param value the name of the executable for the virtual machine - */ - public void setVm(String value) { - this.vm = value; - } - - /** - * A target. - */ - public static class Target { - private String name; - - public void setName(String name) { - this.name = name; - } - - public String getName() { - return name; - } - - } - - /** - * A target to execute. - */ - public final void addTarget(Target t) { - targets.add(t); - } - - /** - * A property. - */ - // XXX, could have reused Property or Environment.Variable - // - not decided so far - public static class Property { - private String name; - private String value; - - public void setName(String name) { - this.name = name; - } - - public String getName() { - return name; - } - - public void setValue(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - } - - /** - * A target to execute. - */ - public final void addProperty(Property t) { - properties.add(t); - } - - /** - * Must return the executable. - * - * @return must not return null - */ - protected abstract String getExecutable(); - - /** - * Must return buildfile argument(s). - * - * @param buildFile the absolute File for the buildfile or null if - * the user didn't specify a buildfile. - * - * @return must not return null - */ - protected abstract String[] getBuildfileArguments(File buildFile); - - /** - * Must return target argument(s). - * - * @return must not return null - */ - protected abstract String[] getTargetArguments(List targets); - - /** - * Must return property argument(s). - * - * @return must not return null - */ - protected abstract String[] getPropertyArguments(List properties); - - /** - * Turn the DoucmentFragment into a DOM tree suitable as a build - * file when serialized. - * - *

Must throw a BuildException if the snippet can not be turned - * into a build file.

- */ - protected abstract Element makeTree(DocumentFragment f); - - /** - * Perform the build. - */ - public void execute() { - if (buildFile != null && buildSnippet != null) { - throw new BuildException("You must not specify the build file" - + " attribute and a nested build at the" - + " same time"); - } - - DotNetExecTask exec = DotNetExecTask.getTask(this, vm, - getExecutable(), null); - String[] args = getPropertyArguments(properties); - for (int i = 0; i < args.length; i++) { - exec.createArg().setValue(args[i]); - } - args = getTargetArguments(targets); - for (int i = 0; i < args.length; i++) { - exec.createArg().setValue(args[i]); - } - - File generatedFile = null; - if (buildSnippet != null) { - try { - generatedFile = getBuildFile(); - } catch (IOException e) { - throw new BuildException(e); - } - args = getBuildfileArguments(generatedFile); - } else { - args = getBuildfileArguments(buildFile); - } - - for (int i = 0; i < args.length; i++) { - exec.createArg().setValue(args[i]); - } - - try { - exec.execute(); - } finally { - if (generatedFile != null) { - generatedFile.delete(); - } - } - } - - private File getBuildFile() throws IOException { - File f = null; - if (buildSnippet != null) { - Element e = makeTree(buildSnippet.getFragment()); - f = FileUtils.newFileUtils().createTempFile("build", ".xml", null); - f.deleteOnExit(); - FileOutputStream out = null; - try { - out = new FileOutputStream(f); - (new DOMElementWriter()).write(e, out); - } finally { - if (out != null) { - out.close(); - } - } - } - return f; - } -} diff --git a/proposal/sandbox/dotnet/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/DotNetExecTask.java b/proposal/sandbox/dotnet/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/DotNetExecTask.java deleted file mode 100644 index e546cfd6e..000000000 --- a/proposal/sandbox/dotnet/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/DotNetExecTask.java +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Copyright 2003-2004 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.optional.dotnet; - -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.Task; -import org.apache.tools.ant.taskdefs.ExecTask; -import org.apache.tools.ant.taskdefs.condition.Os; -import org.apache.tools.ant.types.Environment; - -/** - * Specialized that knows how to deal with Mono vs. Microsoft's - * VM - and maybe Rotor at some point. - */ -public class DotNetExecTask extends ExecTask { - - /** - * "Magic" VM argument for Microsoft's VM. - */ - private static final String MS_VM = "microsoft"; - - /** - * The user supplied executable attribute. - */ - private String executable; - - /** - * The .NET VM to use. - * - *

Defaults to Microsoft's on Windows and mono on any other - * platform.

- */ - private String vm = Os.isFamily("windows") ? MS_VM : "mono"; - - /** - * Empty Constructor. - */ - public DotNetExecTask() { - super(); - } - - /** - * Set the name of the executable program. - * @param value the name of the executable program - */ - public void setExecutable(String value) { - this.executable = value; - } - - /** - * Set the name of the executable for the virtual machine or the - * magic name "microsoft" which implies that we can invoke the - * executable directly. - * - * @param value the name of the executable for the virtual machine - */ - public void setVm(String value) { - this.vm = value; - } - - /** - * Do the work. - * - * @throws BuildException if executable is empty or <exec> - * throws an exception. - */ - public void execute() throws BuildException { - if (executable == null) { - throw new BuildException("The executable attribute is required"); - } - setupCommandline(); - super.execute(); - } - - /** - * If the inherited Commandline doesn't know about the executable - * yet, set it and deal with the vm attribute. - * - *

The inherited Commandline may know the executable already if - * this task instance is getting reused.

- */ - protected void setupCommandline() { - if (cmdl.getExecutable() == null) { - if (vm.equals(MS_VM)) { - // can invoke executable directly - super.setExecutable(executable); - } else { - boolean b = getResolveExecutable(); - // Mono wants the absolte path of the assembly - setResolveExecutable(b || isMono(vm)); - super.setExecutable(vm); - cmdl.createArgument(true) - .setValue(resolveExecutable(executable, isMono(vm))); - setResolveExecutable(b); - } - } - } - - /** - * Whether the given vm looks like the Mono executable. - */ - protected final static boolean isMono(String vm) { - return "mono".equals(vm) || "mint".equals(vm); - } - - /** - * Creates an instance of this task based on a different tasks settings. - */ - public static DotNetExecTask getTask(Task t, String vm, - String executable, - Environment env) { - DotNetExecTask exec = new DotNetExecTask(); - if (vm != null) { - exec.setVm(vm); - } - exec.setProject(t.getProject()); - exec.setExecutable(executable); - exec.setTaskName(t.getTaskName()); - if (env != null) { - String[] environment = env.getVariables(); - if (environment != null) { - for (int i = 0; i < environment.length; i++) { - int idx = environment[i].indexOf("="); - Environment.Variable v = new Environment.Variable(); - v.setKey(environment[i].substring(0, idx)); - v.setValue(environment[i].substring(idx + 1)); - exec.addEnv(v); - } - } - } - - return exec; - } - -} diff --git a/proposal/sandbox/dotnet/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/MSBuildTask.java b/proposal/sandbox/dotnet/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/MSBuildTask.java deleted file mode 100644 index 9fe31bced..000000000 --- a/proposal/sandbox/dotnet/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/MSBuildTask.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright 2003-2004 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.optional.dotnet; - -import java.io.File; -import java.util.Iterator; -import java.util.ArrayList; -import java.util.List; - -import org.w3c.dom.DocumentFragment; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - -/** - * Runs a MSBuild build process. - */ -public class MSBuildTask extends AbstractBuildTask { - - private static final String TARGET = "generated-by-ant"; - - public MSBuildTask() { - super(); - } - - protected String getExecutable() { - return "MSBuild.exe"; - } - - protected String[] getBuildfileArguments(File buildFile) { - if (buildFile != null) { - return new String[] { - buildFile.getAbsolutePath() - }; - } else { - return new String[0]; - } - } - - protected String[] getTargetArguments(List targets) { - if (targets.size() > 0) { - StringBuffer sb = new StringBuffer("/targets:"); - Iterator iter = targets.iterator(); - boolean first = true; - while (iter.hasNext()) { - AbstractBuildTask.Target t = - (AbstractBuildTask.Target) iter.next(); - if (!first) { - sb.append(";"); - } - sb.append(t.getName()); - } - return new String[]{sb.toString()}; - } else { - return new String[0]; - } - } - - protected String[] getPropertyArguments(List properties) { - if (properties.size() > 0) { - StringBuffer sb = new StringBuffer("/property:"); - Iterator iter = properties.iterator(); - boolean first = true; - while (iter.hasNext()) { - AbstractBuildTask.Property p = - (AbstractBuildTask.Property) iter.next(); - if (!first) { - sb.append(";"); - } - sb.append(p.getName()).append("=").append(p.getValue()); - } - return new String[]{sb.toString()}; - } else { - return new String[0]; - } - } - - /** - * Turn the DocumentFragment into a DOM tree suitable as a build - * file when serialized. - * - *

If we have exactly one child, return that. - * Otherwise if we have only children, wrap them into a - * which in turn gets wrapped into a . - * Otherwise, fail.

- */ - protected Element makeTree(DocumentFragment f) { - NodeList nl = f.getChildNodes(); - if (nl.getLength() == 1 - && nl.item(0).getNodeType() == Node.ELEMENT_NODE - && nl.item(0).getNodeName().equals("Project")) { - return (Element) nl.item(0); - } else { - Element p = f.getOwnerDocument().createElement("Project"); - p.setAttribute("DefaultTargets", TARGET); - - Element t = f.getOwnerDocument().createElement("Target"); - t.setAttribute("Name", TARGET); - - p.appendChild(t); - t.appendChild(f); - return p; - } - } -} diff --git a/proposal/sandbox/dotnet/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/NAntTask.java b/proposal/sandbox/dotnet/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/NAntTask.java deleted file mode 100644 index 274a6d823..000000000 --- a/proposal/sandbox/dotnet/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/NAntTask.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright 2003-2004 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.optional.dotnet; - -import java.io.File; -import java.util.Iterator; -import java.util.ArrayList; -import java.util.List; - -import org.w3c.dom.DocumentFragment; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - -/** - * Runs a NAnt build process. - */ -public class NAntTask extends AbstractBuildTask { - - public NAntTask() { - super(); - } - - protected String getExecutable() { - return "NAnt.exe"; - } - - protected String[] getBuildfileArguments(File buildFile) { - if (buildFile != null) { - return new String[] { - "-buildfile:" + buildFile.getAbsolutePath() - }; - } else { - return new String[0]; - } - } - - protected String[] getTargetArguments(List targets) { - ArrayList al = new ArrayList(targets.size()); - Iterator iter = targets.iterator(); - while (iter.hasNext()) { - AbstractBuildTask.Target t = (AbstractBuildTask.Target) iter.next(); - al.add(t.getName()); - } - return (String[]) al.toArray(new String[al.size()]); - } - - protected String[] getPropertyArguments(List properties) { - ArrayList al = new ArrayList(properties.size()); - Iterator iter = properties.iterator(); - while (iter.hasNext()) { - AbstractBuildTask.Property p = - (AbstractBuildTask.Property) iter.next(); - al.add("-D:" + p.getName() + "=" + p.getValue()); - } - return (String[]) al.toArray(new String[al.size()]); - } - - /** - * Turn the DocumentFragment into a DOM tree suitable as a build - * file when serialized. - * - *

If we have exactly one child, return that. - * Otherwise assume that this is a valid build file snippet that - * just needs an empty project wrapped around it.

- */ - protected Element makeTree(DocumentFragment f) { - NodeList nl = f.getChildNodes(); - if (nl.getLength() == 1 - && nl.item(0).getNodeType() == Node.ELEMENT_NODE - && nl.item(0).getNodeName().equals("project")) { - return (Element) nl.item(0); - } else { - Element e = f.getOwnerDocument().createElement("project"); - e.appendChild(f); - return e; - } - } -} diff --git a/proposal/sandbox/dotnet/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/NUnitTask.java b/proposal/sandbox/dotnet/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/NUnitTask.java deleted file mode 100644 index 97cf39588..000000000 --- a/proposal/sandbox/dotnet/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/NUnitTask.java +++ /dev/null @@ -1,335 +0,0 @@ -/* - * Copyright 2004 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.optional.dotnet; - -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.Task; -import org.apache.tools.ant.types.Environment; -import org.apache.tools.ant.types.RedirectorElement; - -import java.io.File; -import java.util.ArrayList; -import java.util.Iterator; - -/** - * Task to run the NUnit Console test runner. - * - * @see http://www.nunit.org/ - */ -public class NUnitTask extends Task { - - /** - * The vm attribute - if given. - */ - private String vm; - - /** - * Test assemblies. - */ - private ArrayList testAssemblies = new ArrayList(); - - /** - * The /config argument. - */ - private File configFile; - - /** - * The /output argument. - */ - private File out; - - /** - * The /err argument. - */ - private File err; - - /** - * The /xml argument. - */ - private File xmlOut; - - /** - * The /transform argument. - */ - private File transform; - - /** - * The /thread argument. - */ - private boolean thread = false; - - /** - * The /fixture argument. - */ - private String fixture; - - /** - * Categories to include. - */ - private ArrayList includes = new ArrayList(); - - /** - * Categories to exclude. - */ - private ArrayList excludes = new ArrayList(); - - /** - * The /noshadow argument. - */ - private boolean noshadow = false; - - /** - * The /labels argument. - */ - private boolean labels = false; - - /** - * Redirects everything that NUnit wants to send to the console. - */ - private RedirectorElement redirectorElement; - - /** - * Whether a failure should stop the build. - */ - private boolean failOnError = false; - - /** - * Support for nested environment variables. - */ - private Environment env = new Environment(); - - public NUnitTask() { - super(); - } - - /** - * Set the name of the executable for the virtual machine. - * - * @param value the name of the executable for the virtual machine - */ - public void setVm(String value) { - this.vm = value; - } - - /** - * Sets the name of the config file. - */ - public void setConfig(File c) { - configFile = c; - } - - /** - * The /output argument. - */ - public void setOut(File out) { - this.out = out; - } - - /** - * The /err argument. - */ - public void setError(File err) { - this.err = err; - } - - /** - * The /xml argument. - */ - public void setXmlOut(File out) { - this.xmlOut = out; - } - - /** - * The /transform argument. - */ - public void setTransform(File transform) { - this.transform = transform; - } - - /** - * The /thread argument. - */ - public void setThread(boolean thread) { - this.thread = thread; - } - - /** - * The /fixture argument. - */ - public void setFixture(String fixture) { - this.fixture = fixture; - } - - /** - * The /noshadow argument. - */ - public void setNoshadow(boolean noshadow) { - this.noshadow = noshadow; - } - - /** - * The /labels argument. - */ - public void setLabels(boolean labels) { - this.labels = labels; - } - - /** - * Whether a failure should stop the build. - */ - public void setFailOnError(boolean b) { - failOnError = b; - } - - /** - * Adds a test assembly by name. - */ - public void addTestAssembly(NamedElement a) { - testAssemblies.add(a); - } - - /** - * Adds a category to the include list. - */ - public void addInclude(NamedElement a) { - includes.add(a); - } - - /** - * Adds a category to the exclude list. - */ - public void addExclude(NamedElement a) { - excludes.add(a); - } - - /** - * Add an environment variable to the launched process. - * - * @param var new environment variable - */ - public void addEnv(Environment.Variable var) { - env.addVariable(var); - } - - /** - * Add a RedirectorElement to this task. - * - *

This does not use the out and - * error attributes, it only captures NUnits output - * that has not been redirected by those attributes.

- */ - public void addConfiguredRedirector(RedirectorElement redirectorElement) { - if (this.redirectorElement != null) { - throw new BuildException("cannot have > 1 nested s"); - } else { - this.redirectorElement = redirectorElement; - } - } - - public void execute() { - if (testAssemblies.size() == 0) { - throw new BuildException("You must specify at least one test " - + "assembly."); - } - - DotNetExecTask exec = DotNetExecTask.getTask(this, vm, - "nunit-console.exe", - env); - Iterator iter = testAssemblies.iterator(); - while (iter.hasNext()) { - NamedElement a = (NamedElement) iter.next(); - exec.createArg().setValue(a.getName()); - } - if (configFile != null) { - exec.createArg().setValue("/config=" - + configFile.getAbsolutePath()); - } - exec.createArg().setValue("/nologo"); - - if (out != null) { - exec.createArg().setValue("/output=" + out.getAbsolutePath()); - } - if (err != null) { - exec.createArg().setValue("/err=" + err.getAbsolutePath()); - } - if (xmlOut != null) { - exec.createArg().setValue("/xml=" + xmlOut.getAbsolutePath()); - } - if (transform != null) { - exec.createArg().setValue("/transform=" - + transform.getAbsolutePath()); - } - - if (thread) { - exec.createArg().setValue("/thread"); - } - if (noshadow) { - exec.createArg().setValue("/noshadow"); - } - if (labels) { - exec.createArg().setValue("/labels"); - } - if (fixture != null) { - exec.createArg().setValue("/fixture=" + fixture); - } - - if (includes.size() > 0) { - StringBuffer sb = new StringBuffer("/include="); - iter = includes.iterator(); - boolean first = false; - while (iter.hasNext()) { - if (first) { - first = false; - } else { - sb.append(","); - } - NamedElement a = (NamedElement) iter.next(); - sb.append(a.getName()); - } - exec.createArg().setValue(sb.toString()); - } - if (excludes.size() > 0) { - StringBuffer sb = new StringBuffer("/exclude="); - iter = excludes.iterator(); - boolean first = false; - while (iter.hasNext()) { - if (first) { - first = false; - } else { - sb.append(","); - } - NamedElement a = (NamedElement) iter.next(); - sb.append(a.getName()); - } - exec.createArg().setValue(sb.toString()); - } - - if (redirectorElement != null) { - exec.addConfiguredRedirector(redirectorElement); - } - exec.setFailonerror(failOnError); - - exec.execute(); - } - - public static class NamedElement { - private String name; - public String getName() {return name;} - public void setName(String s) {name = s;} - } -} \ No newline at end of file diff --git a/proposal/sandbox/dotnet/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/WixTask.java b/proposal/sandbox/dotnet/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/WixTask.java deleted file mode 100644 index 69a8feb97..000000000 --- a/proposal/sandbox/dotnet/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/WixTask.java +++ /dev/null @@ -1,296 +0,0 @@ -/* - * Copyright 2004 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.optional.dotnet; - -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.DirectoryScanner; -import org.apache.tools.ant.Task; -import org.apache.tools.ant.types.EnumeratedAttribute; -import org.apache.tools.ant.types.FileSet; - -import java.io.File; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -/** - * Task to run the WiX utility to create MSI files from an XML description. - * - * @see http://sf.net/projects/wix - */ -public class WixTask extends Task { - - /** - * The vm attribute - if given. - */ - private String vm; - - /** - * The source files. - */ - private ArrayList sources = new ArrayList(); - - /** - * Additional source files (include files in the case of candle, - * or media/files/whatever in the case of light). - */ - private ArrayList moreSources = new ArrayList(); - - /** - * A single source file. - */ - private File source; - - /** - * The target file. - */ - private File target; - - /** - * What to do. - */ - private Mode mode; - - public WixTask() { - super(); - } - - /** - * Set the name of the executable for the virtual machine. - * - * @param value the name of the executable for the virtual machine - */ - public void setVm(String value) { - this.vm = value; - } - - /** - * The main source file. - * - *

candle may include more files than this one, - * the main source is the one passed on the command line.

- * - * @param File object of the main source file. - */ - public void setSource(File f) { - source = f; - } - - /** - * A set of source files. - */ - public void addSources(FileSet fs) { - sources.add(fs); - } - - /** - * A set of additional source files (include files in the case of - * candle, or media/files/whatever in the case of light). - * - *

Unlike the files specified as sources, these will not be - * passed on the command line, they only help Ant to determine - * whether the target is out-of-date.

- */ - public void addMoreSources(FileSet fs) { - moreSources.add(fs); - } - - public void execute() { - if (source == null && sources.size() == 0) { - throw new BuildException("You must specify at least one source" - + " file."); - } - String m = Mode.BOTH; - if (mode != null) { - m = mode.getValue(); - } - - if (target == null && !m.equals(Mode.CANDLE)) { - throw new BuildException("You must specify the target if you want" - + " to run light."); - } - - List lightSources = new ArrayList(); - if (!m.equals(Mode.LIGHT)) { - doCandle(lightSources); - } else { - if (source != null) { - lightSources.add(source); - } - if (sources.size() > 0) { - lightSources.addAll(grabFiles(sources)); - } - } - List moreLightSources = new ArrayList(); - if (moreSources.size() > 0) { - moreLightSources = grabFiles(moreSources); - } - if (!m.equals(Mode.CANDLE)) { - doLight(lightSources, moreLightSources); - } - } - - /** - * Invoke candle on all sources that are newer than their targets. - * - * @param lightSources list that will be filled with File objects - * pointing to the generated object files. - */ - private void doCandle(List lightSources) { - List s = new ArrayList(); - if (source != null) { - s.add(source); - } - if (sources != null) { - s.addAll(grabFiles(sources)); - } - List ms = new ArrayList(); - if (moreSources != null) { - ms.addAll(grabFiles(moreSources)); - } - Iterator iter = s.iterator(); - List toProcess = new ArrayList(); - while (iter.hasNext()) { - File thisSource = (File) iter.next(); - File t = target; - if (t == null) { - t = getTarget(thisSource); - } - if (isOutOfDate(t, thisSource, ms)) { - toProcess.add(thisSource); - lightSources.add(t); - } - } - if (toProcess.size() != 0) { - runCandle(toProcess); - } - } - - /** - * Invoke light on all sources that are newer than their targets. - */ - private void doLight(List lightSources, List moreLightSources) { - List tmp = new ArrayList(lightSources); - tmp.addAll(moreLightSources); - if (isOutOfDate(target, tmp)) { - runLight(lightSources); - } - } - - /** - * Run candle passing all files in list on the command line. - */ - private void runCandle(List s) { - run("candle.exe", s, null); - } - - /** - * Run light passing all files in list on the command line. - */ - private void runLight(List s) { - run("light.exe", s, target); - } - - /** - * Runs the specified command passing list on the command line an - * potentially adding an /out parameter. - */ - private void run(String executable, List s, File target) { - DotNetExecTask exec = DotNetExecTask.getTask(this, vm, - executable, null); - Iterator iter = s.iterator(); - while (iter.hasNext()) { - File f = (File) iter.next(); - exec.createArg().setValue(f.getAbsolutePath()); - } - if (target != null) { - exec.createArg().setValue("/out"); - exec.createArg().setValue(target.getAbsolutePath()); - } - - exec.execute(); - } - - /** - * Is t older than s or any of the files in list? - */ - private boolean isOutOfDate(File t, File s, List l) { - return t.lastModified() < s.lastModified() || isOutOfDate(t, l); - } - - /** - * Is t older than any of the files in list? - */ - private boolean isOutOfDate(File t, List l) { - Iterator iter = l.iterator(); - while (iter.hasNext()) { - File f = (File) iter.next(); - if (t.lastModified() < f.lastModified()) { - return true; - } - } - return false; - } - - /** - * Turn the fileset collection into a list of Files. - */ - private List grabFiles(List s) { - List r = new ArrayList(); - Iterator iter = s.iterator(); - while (iter.hasNext()) { - FileSet fs = (FileSet) iter.next(); - DirectoryScanner ds = fs.getDirectoryScanner(getProject()); - String[] f = ds.getIncludedFiles(); - File base = fs.getDir(getProject()); - for (int i = 0; i < f.length; i++) { - r.add(new File(base, f[i])); - } - } - return r; - } - - /** - * Generates the name of a candle target from the source file. - * - *

Simply chops of the extension and adds .wixobj.

- */ - private File getTarget(File s) { - String name = s.getAbsolutePath(); - int dot = name.lastIndexOf("."); - if (dot > -1) { - return new File(name.substring(0, dot) + ".wixobj"); - } else { - return new File(name + ".wixobj"); - } - } - - public static class Mode extends EnumeratedAttribute { - private final static String CANDLE = "candle"; - private final static String LIGHT = "light"; - private final static String BOTH = "both"; - - public Mode() { - super(); - } - - public String[] getValues() { - return new String[] {CANDLE, LIGHT, BOTH,}; - } - } -} \ No newline at end of file diff --git a/proposal/sandbox/dotnet/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/antlib.xml b/proposal/sandbox/dotnet/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/antlib.xml deleted file mode 100644 index ee05e2386..000000000 --- a/proposal/sandbox/dotnet/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/antlib.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - diff --git a/proposal/sandbox/dotnet/src/testcases/org/apache/tools/ant/taskdefs/optional/dotnet/DotNetExecTaskTest.java b/proposal/sandbox/dotnet/src/testcases/org/apache/tools/ant/taskdefs/optional/dotnet/DotNetExecTaskTest.java deleted file mode 100644 index 665f9a167..000000000 --- a/proposal/sandbox/dotnet/src/testcases/org/apache/tools/ant/taskdefs/optional/dotnet/DotNetExecTaskTest.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2003-2004 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.optional.dotnet; - -import org.apache.tools.ant.BuildFileTest; - -/** - * Tests the DotNetExecTask task, based off Ant's DotnetTest. - * - */ -public class DotNetExecTaskTest extends BuildFileTest { - - /** - * Description of the Field - */ - private final static String TASKDEFS_DIR = "src/etc/testcases/"; - - - /** - * Constructor - * - * @param name testname - */ - public DotNetExecTaskTest(String name) { - super(name); - } - - - /** - * The JUnit setup method - */ - public void setUp() { - configureProject(TASKDEFS_DIR + "dotnetexec.xml"); - } - - - /** - * The teardown method for JUnit - */ - public void tearDown() { - executeTarget("teardown"); - } - - - /** - * A unit test for JUnit - */ - public void testCSC() throws Exception { - executeTarget("testCSC"); - } -} diff --git a/proposal/sandbox/dotnet/src/testcases/org/apache/tools/ant/taskdefs/optional/dotnet/MSBuildTaskTest.java b/proposal/sandbox/dotnet/src/testcases/org/apache/tools/ant/taskdefs/optional/dotnet/MSBuildTaskTest.java deleted file mode 100644 index 40dab15c4..000000000 --- a/proposal/sandbox/dotnet/src/testcases/org/apache/tools/ant/taskdefs/optional/dotnet/MSBuildTaskTest.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2003-2004 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.optional.dotnet; - -import org.apache.tools.ant.BuildFileTest; - -/** - * Tests the MSBuildTask task. - */ -public class MSBuildTaskTest extends BuildFileTest { - - /** - * Description of the Field - */ - private final static String TASKDEFS_DIR = "src/etc/testcases/"; - - /** - * Constructor - * - * @param name testname - */ - public MSBuildTaskTest(String name) { - super(name); - } - - /** - * The JUnit setup method - */ - public void setUp() { - configureProject(TASKDEFS_DIR + "msbuild.xml"); - } - - public void testEcho() throws Exception { - if (getProject().getProperty("msbuild.found") != null) { - expectLogContaining("echo", "foo is bar"); - } - } - - public void testNestedFile() throws Exception { - if (getProject().getProperty("msbuild.found") != null) { - expectLogContaining("nested-file", "foo is bar"); - } - } - - public void testNestedTask() throws Exception { - if (getProject().getProperty("msbuild.found") != null) { - expectLogContaining("nested-task", "foo is bar"); - } - } -} diff --git a/proposal/sandbox/dotnet/src/testcases/org/apache/tools/ant/taskdefs/optional/dotnet/NAntTaskTest.java b/proposal/sandbox/dotnet/src/testcases/org/apache/tools/ant/taskdefs/optional/dotnet/NAntTaskTest.java deleted file mode 100644 index edce890f0..000000000 --- a/proposal/sandbox/dotnet/src/testcases/org/apache/tools/ant/taskdefs/optional/dotnet/NAntTaskTest.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2003-2004 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.optional.dotnet; - -import org.apache.tools.ant.BuildFileTest; - -/** - * Tests the NAntTask task. - */ -public class NAntTaskTest extends BuildFileTest { - - /** - * Description of the Field - */ - private final static String TASKDEFS_DIR = "src/etc/testcases/"; - - /** - * Constructor - * - * @param name testname - */ - public NAntTaskTest(String name) { - super(name); - } - - /** - * The JUnit setup method - */ - public void setUp() { - configureProject(TASKDEFS_DIR + "nant.xml"); - } - - public void testEcho() throws Exception { - if (getProject().getProperty("nant.found") != null) { - expectLogContaining("echo", "foo is bar"); - } - } - - public void testNestedFile() throws Exception { - if (getProject().getProperty("nant.found") != null) { - expectLogContaining("nested-file", "foo is bar"); - } - } - - public void testNestedTask() throws Exception { - if (getProject().getProperty("nant.found") != null) { - expectLogContaining("nested-task", "foo is bar"); - } - } -} diff --git a/proposal/sandbox/dotnet/src/testcases/org/apache/tools/ant/taskdefs/optional/dotnet/NUnitTaskTest.java b/proposal/sandbox/dotnet/src/testcases/org/apache/tools/ant/taskdefs/optional/dotnet/NUnitTaskTest.java deleted file mode 100644 index 3ccefb4ed..000000000 --- a/proposal/sandbox/dotnet/src/testcases/org/apache/tools/ant/taskdefs/optional/dotnet/NUnitTaskTest.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright 2004 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.optional.dotnet; - -import org.apache.tools.ant.BuildFileTest; - -/** - * Tests the NUnitTask task. - */ -public class NUnitTaskTest extends BuildFileTest { - - /** - * Description of the Field - */ - private final static String TASKDEFS_DIR = "src/etc/testcases/"; - - /** - * Constructor - * - * @param name testname - */ - public NUnitTaskTest(String name) { - super(name); - } - - /** - * The JUnit setup method - */ - public void setUp() { - configureProject(TASKDEFS_DIR + "nunit.xml"); - } - - /** - * The teardown method for JUnit - */ - public void tearDown() { - executeTarget("teardown"); - } - - public void testNoAssembly() { - expectSpecificBuildException("no-assembly", "no assembly", - "You must specify at least one test assembly."); - } - - public void testPass() { - if (getProject().getProperty("nunit.found") != null) { - expectLogContaining("passing-test", - "Tests run: 1, Failures: 0, Not run: 0"); - } - } - - public void testFail() { - if (getProject().getProperty("nunit.found") != null) { - expectLogContaining("failing-test", - "Tests run: 1, Failures: 1, Not run: 0"); - } - } - - public void testFailOnFail() { - if (getProject().getProperty("nunit.found") != null) { - expectBuildException("failing-test-with-fail", "test should fail"); - } - } - -} diff --git a/proposal/sandbox/svn/README b/proposal/sandbox/svn/README index ef133a15b..b1076d2d8 100644 --- a/proposal/sandbox/svn/README +++ b/proposal/sandbox/svn/README @@ -1,20 +1 @@ -This library provides Ant task(s) as wrapper(s) over the svn command -line utility. - -Alternative approaches like JNI or even a native Java SVN client exist -and have been taken by other teams. In particular we know (this list -is certainly incomplete): - -* using javahl JNI bindings - of subversion - -* using a pure Java SVN client - -each of which provides Ant tasks. - -The task(s) of this library only provides very rudimentary support for -SVN, matching what the traditional Ant task(s) for CVS could do. - -If you need more than what this libary provides, we encourage you to -check out the existing alternatives. - +Moved to http://svn.apache.org/repos/asf/ant/sandbox/antlibs/svn/trunk/ diff --git a/proposal/sandbox/svn/build.xml b/proposal/sandbox/svn/build.xml deleted file mode 100644 index a867d9815..000000000 --- a/proposal/sandbox/svn/build.xml +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - At least one test has failed. - - \ No newline at end of file diff --git a/proposal/sandbox/svn/docs/changelog.html b/proposal/sandbox/svn/docs/changelog.html deleted file mode 100644 index d13788f14..000000000 --- a/proposal/sandbox/svn/docs/changelog.html +++ /dev/null @@ -1,217 +0,0 @@ - - - - -ChangeLog Task - - - - -

ChangeLog

-

Description

- -

Generates an XML-formatted report file of the change logs recorded -in a Subversion repository.

- -

Important: This task needs "svn" on the path. If it isn't, -you will get an error (such as error 2 on windows). If -<svn> doesn't work, try to execute svn.exe from the -command line in the target directory in which you are working.

- -

Parameters

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AttributeDescriptionRequired
Attributes from parent svn - task which are meaningful here
-
svnURLthe URL the subcommand should apply to.No
destthe directory where the checked out files are.No, default is project's basedir.
failonerrorStop the build process if the command exits with a - return code other than 0. Defaults to falseNo
Specific attributes
dirThe directory from which to run the CVS log - command.No; defaults to ${basedir}.
destfileThe file in which to write the change log report.Yes
usersfileProperty file that contains name-value pairs mapping - user IDs and names that should be used in the report in place of - the user ID.No
daysinpastSets the number of days into the past for which the - change log information should be retrieved.No
startThe earliest revision/date from which change logs - are to be included in the report.No
endThe latest revision/date to which change logs are to be - included in the report.No
- -

Parameters specified as nested elements

-

user

- -

The nested <user> element allows you to specify -a mapping between a user ID as it appears on the Subversion server and -a name to include in the formatted report. Anytime the specified user -ID has made a change in the repository, the -<author> tag in the report file will include the -name specified in displayname rather than the user -ID.

- - - - - - - - - - - - - - - - - -
AttributeDescriptionRequired
displaynameThe name to be used in the Subversion change log - report.Yes
useridThe userid of the person as it exists on the - Subversion server. - Yes
- - -

Examples

-
  <changelog dir="dve/network"
-                destfile="changelog.xml"
-  />
- -

Generates a change log report for all the changes that have been made -under the dve/network directory. -It writes these changes into the file changelog.xml.

- -
  <changelog dir="dve/network"
-                destfile="changelog.xml"
-                daysinpast="10"
-  />
- -

Generates a change log report for any changes that were made -under the dve/network directory in the past 10 days. -It writes these changes into the file changelog.xml.

- -
  <changelog dir="dve/network"
-                destfile="changelog.xml"
-                start="{2002-02-20}"
-                end="{2002-03-20}"
-  />
- -

Generates a change log report for any changes that were made -between February 20, 2002 and March 20, 2002 -under the dve/network directory. -It writes these changes into the file changelog.xml.

- -
  <changelog dir="dve/network"
-                destfile="changelog.xml"
-                start="{2002-02-20}"
-  />
- -

Generates a change log report for any changes that were made -after February 20, 2002 under the dve/network directory. -It writes these changes into the file changelog.xml.

- -
  <changelog dir="dve/network"
-                destfile="changelog.xml"
-                start="1000"
-                end="1500"
-  />
- -

Generates a change log report for any changes that were made -between Subversion revisions 1000 and 1500 under the -dve/network directory. It writes these changes into the -file changelog.xml.

- -
  <changelog dir="dve/network"
-                destfile="changelog.xml">
-       <user displayname="Esmerelda Weatherwax" userid="granny"/>
-  </changelog>
- -

Generates a change log report for all the changes that were made -under the dve/network directory, substituting the name -"Esmerelda Weatherwax" in the <author> tags -anytime it encounters a change made by the user ID "granny". -It writes these changes into the file changelog.xml.

- -

Generate Report

-

This antlib includes a basic XSLT stylesheet that you can use to -generate a HTML report based on the xml output. The following example -illustrates how to generate a HTML report from the XML report.

- -
-        <style in="changelog.xml" 
-               out="changelog.html" 
-               style="your-path-to/etc/changelog.xsl">
-          <param name="title" expression="Jakarta BCEL ChangeLog"/>
-          <param name="repo" expression="http://svn.apache.org/repos/asf"/>
-        </style>
-
- -

Sample Output

-
-  <entry>
-    <date>2005-02-14</date>
-    <time>01:55</time>
-    <author><![CDATA[dbrosius]]></author>
-    <revision>153687</revision>
-    <path>
-      <name><![CDATA[/jakarta/bcel/trunk/src/java/org/apache/bcel/util/BCELifier.java]]></name>
-      <action>modified</action>
-    </path>
-    <message><![CDATA[Update BCELifier to handle the new method access flags (ACC_BRIDGE, ACC_VARARGS)]]></message>
-  </entry>
-
- -

Copyright © 2005 The Apache Software Foundation. All rights -Reserved.

- - - - diff --git a/proposal/sandbox/svn/docs/revisiondiff.html b/proposal/sandbox/svn/docs/revisiondiff.html deleted file mode 100644 index 9d282ee90..000000000 --- a/proposal/sandbox/svn/docs/revisiondiff.html +++ /dev/null @@ -1,129 +0,0 @@ - - - -RevisionDiff Task - - -

RevisionDiff

-

Description

- -

Generates an XML-formatted report file of the changes between two -revisions recorded in a Subversion repository.

- -

Important: This task needs "svn" on the path. If it isn't, -you will get an error (such as error 2 on windows). If -<svn> doesn't work, try to execute -svn.exe from the command line in the target directory in -which you are working.

- -

Parameters

- - - - - - - - - - - - - - - - - - - - - -
AttributeDescriptionRequired
startThe earliest revision from which diffs are to be - included in the report.Yes.
endThe latest revision from which diffs are to be - included in the report.Yes.
destfileThe file in which to write the diff report.Yes
- -

Parameters inherited from the svn task

- - - - - - - - - - - - - - - - -
AttributeDescriptionRequired
svnURLthe svn URL to diff.No
failonerrorStop the buildprocess if the command exits with a - returncode other than 0. Defaults to falseNo
- -

Examples

-
  <revisiondiff
-                svnURL="http://svn.apache.org/repos/asf/jakarta/bcel/trunk"
-                destfile="diff.xml"
-                start="152904"
-                end="153682"
-  />
- -

Generates a revisiondiff report for all the changes that have been -made in the Apache BCEL module between the revisions -152904 and 153682. It writes these changes -into the file diff.xml.

- -
  <revisiondiff
-                destfile="diff.xml"
-                package="ant"
-                start="{2002-01-01}"
-                end="{2002-02-01}"
-                dest="my-working-copy-of-BCEL"
-  />
- -

Generates a diff report for all the changes that have been made in -the Apache BCEL module in january 2002. In this example -svnURL has not been set, it is assumed that -my-working-copy-of-BCEL contains a checked out copy of -the BCEL module. It writes these changes into the file -diff.xml.

- -

Generate Report

- -

This antlib includes a basic XSLT stylesheet that you can use to -generate a HTML report based on the xml output. The following example -illustrates how to generate a HTML report from the XML report.

- -
-        <style in="diff.xml" 
-               out="diff.html" 
-               style="your-path-to/etc/diff.xsl">
-          <param name="title" expression="Jakarta BCEL diff"/>
-          <param name="repo" expression="http://svn.apache.org/repos/asf/jakarta/bcel/trunk"/>
-        </style>
-
- -

(Shortened) Example Output

-
-<?xml version="1.0" encoding="UTF-8"?>
-<revisiondiff start="153872" end="152873" svnurl="http://svn.apache.org/repos/asf/jakarta/bcel/trunk" >
-  <path>
-    <name><![CDATA[LICENSE.txt]]></name>
-    <action>modified</action>
-  </path>
-  <path>
-    <name><![CDATA[NOTICE.txt]]></name>
-    <action>deleted</action>
-  </path>
-</revisiondiff>
-
- -

Copyright © 2005 The Apache Software Foundation. All rights -Reserved.

- - - - diff --git a/proposal/sandbox/svn/docs/svn.html b/proposal/sandbox/svn/docs/svn.html deleted file mode 100644 index 73eefbbb7..000000000 --- a/proposal/sandbox/svn/docs/svn.html +++ /dev/null @@ -1,157 +0,0 @@ - - - - -Subversion Task - - - - - -

SVN

-

Description

-

Handles packages/modules retrieved from a -Subversion repository.

-

Important: This task needs "svn" on the path. If it isn't, you will get -an error (such as error 2 on windows). If <svn> doesn't work, try to execute svn.exe -from the command line in the target directory in which you are working. -

Parameters

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AttributeDescriptionRequired
subcommandthe SVN subcommand to execute.No, default "checkout".
svnURLthe URL the subcommand should apply to.No
destthe directory where the checked out files should - be placed. Note that this is different from SVN's -d command line - switch as Ant will never shorten pathnames to avoid empty - directories.No, default is project's basedir.
revisionthe revision or date of the subcommand should apply toNo
quietsuppress informational messages. This is the same as --quiet on the command line.No, default "false"
verboseBe verbose. This is the same as --verbose on the command line.No, default "false"
dryrunreport only, don't change any files.No, default to "false"
fileUses the contents of the file passed as an - argument to this switch for the specified subcommand.No.
forceForces a particular command or operation to run.No, defaults to false.
recursiveMakes a subcommand recurse into - subdirectories. Most subcommands recurse by default.No.
targetsTells Subversion to get the list of files that you wish to - operate on from the filename you provide instead of listing all - the files on the command line.No.
outputthe file to direct standard output from the command.No, default output to ANT Log as MSG_INFO.
errorthe file to direct standard error from the command.No, default error to ANT Log as MSG_WARN.
appendwhether to append output/error when redirecting to a file.No, default to "false".
failonerrorStop the build process if the command exits with a - return code other than 0. Defaults to "false"No
-

Examples

-
  <svn svnURL="http://svn.apache.org/repos/asf/httpd/httpd/trunk/"
-       dest="${ws.dir}"
-  />
-

checks out the URL -"http://svn.apache.org/repos/asf/httpd/httpd/trunk/" and -stores the files in "${ws.dir}".

-
  <svn dest="${ws.dir}" command="update"/>
-

updates the working copy that has previously been checked out into -"${ws.dir}".

- -
  <svn command="-q diff" output="patch.txt"/>
- -

silently (-q) creates a file called patch.txt which contains a unified diff which can be used as input to patch. -The equivalent, using <commandline> elements, is: -

-
-<svn output="patch">
-    <commandline>
-        <argument value="-q"/>
-        <argument value="diff"/>
-    </commandline>
-</svn>
-
-or: -
-<svn output="patch">
-    <commandline>
-        <argument line="-q diff -u -N"/>
-    </commandline>
-</svn>
-
-

-You may include as many <commandline> elements as you like. -Each will inherit the failonerror and other "global" parameters -from the <svn> element. -

- -
  <svn command="update"/>
-

Updates from the head of repository creating any new directories as necessary.

-

See Version Control with Subversion for details, -specifically the The Subversion Command Line Client: svn

-
-

Copyright © 2005 The Apache Software -Foundation. All rights Reserved.

- - - - diff --git a/proposal/sandbox/svn/docs/tagdiff.html b/proposal/sandbox/svn/docs/tagdiff.html deleted file mode 100644 index 72178e34f..000000000 --- a/proposal/sandbox/svn/docs/tagdiff.html +++ /dev/null @@ -1,158 +0,0 @@ - - - -RevisionDiff Task - - -

TagDiff

-

Description

- -

Generates an XML-formatted report file of the changes between two -tags recorded in a Subversion repository.

- -

Important: This task needs "svn" on the path. If it isn't, -you will get an error (such as error 2 on windows). If -<svn> doesn't work, try to execute -svn.exe from the command line in the target directory in -which you are working.

- -

This task assumes that your repository follows the best-practice -layout of

-
-BASEURL
-  |
-  |
-  -----> trunk
-  -----> tags
-           |
-           |
-           ----------> tag1
-           ----------> tag2
-
- -

Parameters

- - - - - - - - - - - - - - - - - - - - - - - - - - -
AttributeDescriptionRequired
tag1The first tag.Yes.
tag2The second tag.No, defaults to "trunk/"
destfileThe file in which to write the diff report.Yes
baseURLThe baseURL of the repository, used to calculate - the two URLs to compare.Yes
- -

Parameters inherited from the svn task

- - - - - - - - - - - -
AttributeDescriptionRequired
failonerrorStop the buildprocess if the command exits with a - returncode other than 0. Defaults to falseNo
- -

Examples

-
-  <tagdiff failonerror="true"
-      baseURL="http://svn.apache.org/repos/asf/jakarta/bcel/"
-      destfile="diff.xml"
-      tag1="initial"
-      tag2="BCEL_5_0"
-  />
-
- -

Generates a tagdiff report for all the changes that have been -made in the Apache BCEL module between the tags -initial and BCEL_5_0. It writes these changes -into the file diff.xml.

- -
-  <tagdiff failonerror="true"
-      baseURL="http://svn.apache.org/repos/asf/jakarta/bcel/"
-      destfile="diff.xml"
-      tag1="BCEL_5_0"
-      tag2="trunk"
-  />
-
- -

Generates a tagdiff report for all the changes that have been made -in the Apache BCEL module between the tag -BCEL_5_0 and the trunk. It writes these -changes into the file diff.xml.

- -
-  <tagdiff failonerror="true"
-      baseURL="http://svn.apache.org/repos/asf/jakarta/bcel/"
-      destfile="diff.xml"
-      tag1="BCEL_5_0"
-  />
-
- -

Does the same, using trunk as tag2 -implicitly.

- -

Generate Report

- -

This antlib includes a basic XSLT stylesheet that you can use to -generate a HTML report based on the xml output. The following example -illustrates how to generate a HTML report from the XML report.

- -
-        <style in="diff.xml" 
-               out="diff.html" 
-               style="your-path-to/etc/diff.xsl">
-          <param name="title" expression="Jakarta BCEL diff"/>
-          <param name="repo" expression="http://svn.apache.org/repos/asf/jakarta/bcel/trunk"/>
-        </style>
-
- -

(Shortened) Example Output

-
-<?xml version="1.0" encoding="UTF-8"?>
-<tagdiff tag1="BCEL_5_0" svnurl="http://svn.apache.org/repos/asf/jakarta/bcel/" >
-  <path>
-    <name><![CDATA[default.properties]]></name>
-    <action>added</action>
-  </path>
-  <path>
-    <name><![CDATA[xdocs/images/classloader.gif]]></name>
-    <action>modified</action>
-  </path>
-  <path>
-    <name><![CDATA[README]]></name>
-    <action>deleted</action>
-  </path>
-</tagdiff>
-
- -

Copyright © 2005 The Apache Software Foundation. All rights -Reserved.

- - - - diff --git a/proposal/sandbox/svn/src/etc/changelog.xsl b/proposal/sandbox/svn/src/etc/changelog.xsl deleted file mode 100644 index 0622bbefb..000000000 --- a/proposal/sandbox/svn/src/etc/changelog.xsl +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - <xsl:value-of select="$title"/> - - - -

- -

-

Designed for use with Apache Ant.

-
- - - - - - - -
- - - -
- - - - - - - - - -
-
-
    - -
- - -
- - - - - - - - - - - - - - - - -
  • - - - () -
  • -
    - - - - - - -
    diff --git a/proposal/sandbox/svn/src/etc/diff.xsl b/proposal/sandbox/svn/src/etc/diff.xsl deleted file mode 100644 index 467ffb997..000000000 --- a/proposal/sandbox/svn/src/etc/diff.xsl +++ /dev/null @@ -1,140 +0,0 @@ - - - - - - - - - - - - - - - - - - - <xsl:value-of select="$title"/> - - - -

    - -

    - diff between and -

    Designed for use with Apache Ant.

    -
    - - - - - -
    - New Files | - Modified Files | - Removed Files -
    - - - New Files - New - - - - - Modified Files - Modified - - - - - Removed Files - Removed - - -
    - - - -
    - - - - - - - - - - - entries - - (back to top) - - - - - - - -
      - -
    - - - - - -
  • - - / - - -
  • -
    - - - - - - -
    diff --git a/proposal/sandbox/svn/src/etc/testcases/abstractsvntask.xml b/proposal/sandbox/svn/src/etc/testcases/abstractsvntask.xml deleted file mode 100644 index cc349f9c4..000000000 --- a/proposal/sandbox/svn/src/etc/testcases/abstractsvntask.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/proposal/sandbox/svn/src/etc/testcases/changelog.xml b/proposal/sandbox/svn/src/etc/testcases/changelog.xml deleted file mode 100644 index 266bed179..000000000 --- a/proposal/sandbox/svn/src/etc/testcases/changelog.xml +++ /dev/null @@ -1,69 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/proposal/sandbox/svn/src/etc/testcases/revisiondiff.xml b/proposal/sandbox/svn/src/etc/testcases/revisiondiff.xml deleted file mode 100644 index 771bc87dc..000000000 --- a/proposal/sandbox/svn/src/etc/testcases/revisiondiff.xml +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/proposal/sandbox/svn/src/etc/testcases/tagdiff.xml b/proposal/sandbox/svn/src/etc/testcases/tagdiff.xml deleted file mode 100644 index 4854dab79..000000000 --- a/proposal/sandbox/svn/src/etc/testcases/tagdiff.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/proposal/sandbox/svn/src/main/org/apache/tools/ant/taskdefs/svn/AbstractSvnTask.java b/proposal/sandbox/svn/src/main/org/apache/tools/ant/taskdefs/svn/AbstractSvnTask.java deleted file mode 100644 index 0d77e8ada..000000000 --- a/proposal/sandbox/svn/src/main/org/apache/tools/ant/taskdefs/svn/AbstractSvnTask.java +++ /dev/null @@ -1,699 +0,0 @@ -/* - * 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.svn; - -import java.io.BufferedOutputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.io.PrintStream; -import java.util.Vector; -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.Project; -import org.apache.tools.ant.Task; -import org.apache.tools.ant.taskdefs.Execute; -import org.apache.tools.ant.taskdefs.ExecuteStreamHandler; -import org.apache.tools.ant.taskdefs.LogOutputStream; -import org.apache.tools.ant.taskdefs.PumpStreamHandler; -import org.apache.tools.ant.types.Commandline; -import org.apache.tools.ant.types.Environment; -import org.apache.tools.ant.util.StringUtils; - -/** - * Just like Ant's built-in CVS task, the main loginc lives in this - * abstract task. - */ -public abstract class AbstractSvnTask extends Task { - - private Commandline cmd = new Commandline(); - - /** list of Commandline children */ - private Vector vecCommandlines = new Vector(); - - /** - * the URL the subcommand should apply to. - */ - private String svnURL; - - /** - * the revision - */ - private String revision; - /** - * the default command. - */ - private static final String DEFAULT_SUBCOMMAND = "checkout"; - /** - * the SVN command to execute. - */ - private String subCommand = null; - - /** - * suppress information messages. - */ - private boolean quiet = false; - - /** - * be verbose - */ - private boolean verbose = false; - - /** - * report only, don't change any files. - */ - private boolean dryrun = false; - - /** - * the directory where the checked out files should be placed. - */ - private File dest; - - /** whether or not to append stdout/stderr to existing files */ - private boolean append = false; - - /** - * the file to direct standard output from the command. - */ - private File output; - - /** - * the file to direct standard error from the command. - */ - private File error; - - /** - * If true it will stop the build if svn exits with error. - * Default is false. (Iulian) - */ - private boolean failOnError = false; - - /** - * Uses the contents of the file passed as an argument to this - * switch for the specified subcommand. - */ - private File file; - - /** - * Forces a particular command or operation to run. - */ - private boolean force; - - /** - * Makes a subcommand recurse into subdirectories. - */ - private Boolean recursive = null; - - /** - * Tells Subversion to get the list of files that you wish to - * operate on from the filename you provide instead of listing all - * the files on the command line. - */ - private File targets; - - /** - * Create accessors for the following, to allow different handling of - * the output. - */ - private ExecuteStreamHandler executeStreamHandler; - private OutputStream outputStream; - private OutputStream errorStream; - - /** empty no-arg constructor*/ - public AbstractSvnTask() { - super(); - } - - /** - * sets the handler - * @param handler a handler able of processing the output and error streams from the svn exe - */ - public void setExecuteStreamHandler(ExecuteStreamHandler handler) { - this.executeStreamHandler = handler; - } - - /** - * find the handler and instantiate it if it does not exist yet - * @return handler for output and error streams - */ - protected ExecuteStreamHandler getExecuteStreamHandler() { - - if (this.executeStreamHandler == null) { - setExecuteStreamHandler(new PumpStreamHandler(getOutputStream(), - getErrorStream())); - } - - return this.executeStreamHandler; - } - - /** - * sets a stream to which the output from the svn executable should be sent - * @param outputStream stream to which the stdout from svn should go - */ - protected void setOutputStream(OutputStream outputStream) { - - this.outputStream = outputStream; - } - - /** - * access the stream to which the stdout from svn should go - * if this stream has already been set, it will be returned - * if the stream has not yet been set, if the attribute output - * has been set, the output stream will go to the output file - * otherwise the output will go to ant's logging system - * @return output stream to which svn' stdout should go to - */ - protected OutputStream getOutputStream() { - - if (this.outputStream == null) { - - if (output != null) { - try { - setOutputStream(new PrintStream( - new BufferedOutputStream( - new FileOutputStream(output - .getPath(), - append)))); - } catch (IOException e) { - throw new BuildException(e, getLocation()); - } - } else { - setOutputStream(new LogOutputStream(this, Project.MSG_INFO)); - } - } - - return this.outputStream; - } - - /** - * sets a stream to which the stderr from the svn exe should go - * @param errorStream an output stream willing to process stderr - */ - protected void setErrorStream(OutputStream errorStream) { - - this.errorStream = errorStream; - } - - /** - * access the stream to which the stderr from svn should go - * if this stream has already been set, it will be returned - * if the stream has not yet been set, if the attribute error - * has been set, the output stream will go to the file denoted by the error attribute - * otherwise the stderr output will go to ant's logging system - * @return output stream to which svn' stderr should go to - */ - protected OutputStream getErrorStream() { - - if (this.errorStream == null) { - - if (error != null) { - - try { - setErrorStream(new PrintStream( - new BufferedOutputStream( - new FileOutputStream(error.getPath(), - append)))); - } catch (IOException e) { - throw new BuildException(e, getLocation()); - } - } else { - setErrorStream(new LogOutputStream(this, Project.MSG_WARN)); - } - } - - return this.errorStream; - } - - /** - * Sets up the environment for toExecute and then runs it. - * @param toExecute the command line to execute - * @throws BuildException if failonError is set to true and the svn command fails - */ - protected void runCommand(Commandline toExecute) throws BuildException { - Environment env = new Environment(); - - // - // Just call the getExecuteStreamHandler() and let it handle - // the semantics of instantiation or retrieval. - // - Execute exe = new Execute(getExecuteStreamHandler(), null); - - exe.setAntRun(getProject()); - if (dest == null) { - dest = getProject().getBaseDir(); - } - - if (!dest.exists()) { - dest.mkdirs(); - } - - exe.setWorkingDirectory(dest); - exe.setCommandline(toExecute.getCommandline()); - exe.setEnvironment(env.getVariables()); - - try { - String actualCommandLine = executeToString(exe); - log(actualCommandLine, Project.MSG_VERBOSE); - int retCode = exe.execute(); - log("retCode=" + retCode, Project.MSG_DEBUG); - /*Throw an exception if svn exited with error. (Iulian)*/ - if (failOnError && Execute.isFailure(retCode)) { - throw new BuildException("svn exited with error code " - + retCode - + StringUtils.LINE_SEP - + "Command line was [" - + actualCommandLine + "]", getLocation()); - } - } catch (IOException e) { - if (failOnError) { - throw new BuildException(e, getLocation()); - } else { - log("Caught exception: " + e.getMessage(), Project.MSG_WARN); - } - } catch (BuildException e) { - if (failOnError) { - throw(e); - } else { - Throwable t = e.getException(); - if (t == null) { - t = e; - } - log("Caught exception: " + t.getMessage(), Project.MSG_WARN); - } - } catch (Exception e) { - if (failOnError) { - throw new BuildException(e, getLocation()); - } else { - log("Caught exception: " + e.getMessage(), Project.MSG_WARN); - } - } - } - - /** - * do the work - * @throws BuildException if failonerror is set to true and the svn command fails. - */ - public void execute() throws BuildException { - - String savedCommand = getSubCommand(); - - if (this.getSubCommand() == null && vecCommandlines.size() == 0) { - // re-implement legacy behaviour: - this.setSubCommand(AbstractSvnTask.DEFAULT_SUBCOMMAND); - } - - String c = this.getSubCommand(); - Commandline cloned = null; - if (c != null) { - cloned = (Commandline) cmd.clone(); - cloned.createArgument(true).setLine(c); - if (svnURL != null) { - cloned.createArgument().setValue(svnURL); - } - this.addConfiguredCommandline(cloned, true); - } - - try { - for (int i = 0; i < vecCommandlines.size(); i++) { - this.runCommand((Commandline) vecCommandlines.elementAt(i)); - } - } finally { - if (cloned != null) { - removeCommandline(cloned); - } - setSubCommand(savedCommand); - - if (outputStream != null) { - try { - outputStream.close(); - } catch (IOException e) { - //ignore - } - } - if (errorStream != null) { - try { - errorStream.close(); - } catch (IOException e) { - //ignore - } - } - } - } - - private String executeToString(Execute execute) { - - StringBuffer stringBuffer = - new StringBuffer(Commandline.describeCommand(execute - .getCommandline())); - - String newLine = StringUtils.LINE_SEP; - String[] variableArray = execute.getEnvironment(); - - if (variableArray != null) { - stringBuffer.append(newLine); - stringBuffer.append(newLine); - stringBuffer.append("environment:"); - stringBuffer.append(newLine); - for (int z = 0; z < variableArray.length; z++) { - stringBuffer.append(newLine); - stringBuffer.append("\t"); - stringBuffer.append(variableArray[z]); - } - } - - return stringBuffer.toString(); - } - - /** - * The URL the subcommand should apply to. - * - * @param url the URL the subcommand should apply to. - */ - public void setSvnURL(String url) { - - // Check if not real svnroot => set it to null - if (url != null) { - if (url.trim().equals("")) { - url = null; - } - } - - this.svnURL = url; - } - - /** - * access the svnURL variable - * @return svnURL - */ - public String getSvnURL() { - - return this.svnURL; - } - - /** - * The directory where the checked out files should be placed. - * - *

    Note that this is different from SVN's -d command line - * switch as Ant will never shorten pathnames to avoid empty - * directories.

    - * - * @param dest directory where the checked out files should be placed - */ - public void setDest(File dest) { - this.dest = dest; - } - - /** - * get the file where the checked out files should be placed - * - * @return directory where the checked out files should be placed - */ - public File getDest() { - - return this.dest; - } - - /** - * revision - * @return revision - */ - public String getRevision() { - return revision; - } - - /** - * The revision to operate upon. - * @param p revision - */ - public void setRevision(String p) { - // Check if not real revision => set it to null - if (p != null && p.trim().length() > 0) { - revision = p; - addSubCommandArgument("--revision"); - addSubCommandArgument(p); - } - } - - /** - * Uses the contents of the file passed as an argument to this - * switch for the specified subcommand. - */ - public void setFile(File file) { - this.file = file; - } - - /** - * Uses the contents of the file passed as an argument to this - * switch for the specified subcommand. - */ - public File getFile() { - return file; - } - - /** - * Forces a particular command or operation to run. - */ - public void setForce(boolean force) { - this.force = force; - } - - /** - * Forces a particular command or operation to run. - */ - public boolean getForce() { - return force; - } - - /** - * Makes a subcommand recurse into subdirectories. Most - * subcommands recurse by default. - */ - public void setRecursive(Boolean recursive) { - this.recursive = recursive; - } - - /** - * Makes a subcommand recurse into subdirectories. Most - * subcommands recurse by default. - */ - public Boolean getRecursive() { - return recursive; - } - - /** - * Tells Subversion to get the list of files that you wish to - * operate on from the filename you provide instead of listing all - * the files on the command line. - */ - public void setTargets(File targets) { - this.targets = targets; - } - - /** - * Tells Subversion to get the list of files that you wish to - * operate on from the filename you provide instead of listing all - * the files on the command line. - */ - public File getTargets() { - return targets; - } - - /** - * This needs to be public to allow configuration - * of commands externally. - * @param arg command argument - */ - public void addSubCommandArgument(String arg) { - this.addSubCommandArgument(cmd, arg); - } - - /** - * This method adds a command line argument to an external subcommand. - * - * @param c command line to which one argument should be added - * @param arg argument to add - */ - protected void addSubCommandArgument(Commandline c, String arg) { - c.createArgument().setValue(arg); - } - - - /** - * The SVN command to execute. - * - * @param c a command as string - */ - public void setSubCommand(String c) { - this.subCommand = c; - } - /** - * accessor to a command line as string - * - * @return command line as string - */ - public String getSubCommand() { - return this.subCommand; - } - - /** - * If true, suppress informational messages. - * @param q if true, suppress informational messages - */ - public void setQuiet(boolean q) { - quiet = q; - } - - /** - * If true, be verbose. - * @param q if true, be verbose. - */ - public void setVerbose(boolean v) { - verbose = v; - } - - /** - * If true, report only and don't change any files. - * - * @param ne if true, report only and do not change any files. - */ - public void setDryrun(boolean ne) { - dryrun = ne; - } - - /** - * The file to direct standard output from the command. - * @param output a file to which stdout should go - */ - public void setOutput(File output) { - this.output = output; - } - - /** - * The file to direct standard error from the command. - * - * @param error a file to which stderr should go - */ - public void setError(File error) { - this.error = error; - } - - /** - * Whether to append output/error when redirecting to a file. - * @param value true indicated you want to append - */ - public void setAppend(boolean value) { - this.append = value; - } - - /** - * Stop the build process if the command exits with - * a return code other than 0. - * Defaults to false. - * @param failOnError stop the build process if the command exits with - * a return code other than 0 - */ - public void setFailOnError(boolean failOnError) { - this.failOnError = failOnError; - } - - /** - * Configure a commandline element for things like quiet, etc. - * @param c the command line which will be configured - * if the commandline is initially null, the function is a noop - * otherwise the function append to the commandline arguments concerning - *
      - *
    • - * svn - *
    • - *
    • - * quiet - *
    • - *
    • verbose
    • - *
    • dryrun
    • - *
    - */ - protected void configureCommandline(Commandline c) { - if (c == null) { - return; - } - c.setExecutable("svn"); - if (quiet) { - c.createArgument(true).setValue("--quiet"); - } - if (verbose) { - c.createArgument(true).setValue("--verbose"); - } - if (dryrun) { - c.createArgument(true).setValue("--dry-run"); - } - if (file != null) { - c.createArgument(true).setValue("--file"); - c.createArgument(true).setFile(file); - } - if (force) { - c.createArgument(true).setValue("--force"); - } - if (recursive != null) { - if (recursive.booleanValue()) { - c.createArgument(true).setValue("--recursive"); - } else { - c.createArgument(true).setValue("--non-recursive"); - } - } - if (targets != null) { - c.createArgument(true).setValue("--targets"); - c.createArgument(true).setFile(targets); - } - } - - /** - * remove a particular command from a vector of command lines - * @param c command line which should be removed - */ - protected void removeCommandline(Commandline c) { - vecCommandlines.removeElement(c); - } - - /** - * Adds direct command-line to execute. - * @param c command line to execute - */ - public void addConfiguredCommandline(Commandline c) { - this.addConfiguredCommandline(c, false); - } - - /** - * Configures and adds the given Commandline. - * @param c commandline to insert - * @param insertAtStart If true, c is - * inserted at the beginning of the vector of command lines - */ - public void addConfiguredCommandline(Commandline c, - boolean insertAtStart) { - if (c == null) { - return; - } - this.configureCommandline(c); - if (insertAtStart) { - vecCommandlines.insertElementAt(c, 0); - } else { - vecCommandlines.addElement(c); - } - } - -} diff --git a/proposal/sandbox/svn/src/main/org/apache/tools/ant/taskdefs/svn/LineOrientedOutputStream.java b/proposal/sandbox/svn/src/main/org/apache/tools/ant/taskdefs/svn/LineOrientedOutputStream.java deleted file mode 100644 index e15d9db53..000000000 --- a/proposal/sandbox/svn/src/main/org/apache/tools/ant/taskdefs/svn/LineOrientedOutputStream.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * 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.svn; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.OutputStream; - -/** - * Invokes {@link #processLine processLine} whenever a full line has - * been written to this stream. - * - *

    Tries to be smart about line separators.

    - */ -public abstract class LineOrientedOutputStream extends OutputStream { - - /** Initial buffer size. */ - private static final int INTIAL_SIZE = 132; - - /** Carriage return */ - private static final int CR = 0x0d; - - /** Linefeed */ - private static final int LF = 0x0a; - - private ByteArrayOutputStream buffer - = new ByteArrayOutputStream(INTIAL_SIZE); - private boolean skip = false; - - /** - * Write the data to the buffer and flush the buffer, if a line - * separator is detected. - * - * @param cc data to log (byte). - */ - public final void write(int cc) throws IOException { - final byte c = (byte) cc; - if ((c == '\n') || (c == '\r')) { - if (!skip) { - processBuffer(); - } - } else { - buffer.write(cc); - } - skip = (c == '\r'); - } - - /** - * Flush this log stream - */ - public final void flush() throws IOException { - if (buffer.size() > 0) { - processBuffer(); - } - } - - /** - * Converts the buffer to a string and sends it to - * processLine - */ - private void processBuffer() throws IOException { - try { - processLine(buffer.toString()); - } finally { - buffer.reset(); - } - } - - /** - * Processes a line. - * - * @param line the line to log. - */ - protected abstract void processLine(String line) throws IOException; - - /** - * Writes all remaining - */ - public final void close() throws IOException { - if (buffer.size() > 0) { - processBuffer(); - } - super.close(); - } - - /** - * Write a block of characters to the output stream - * - * @param b the array containing the data - * @param off the offset into the array where data starts - * @param len the length of block - * - * @throws IOException if the data cannot be written into the stream. - */ - public final void write(byte[] b, int off, int len) throws IOException { - // find the line breaks and pass other chars through in blocks - int offset = off; - int blockStartOffset = offset; - int remaining = len; - while (remaining > 0) { - while (remaining > 0 && b[offset] != LF && b[offset] != CR) { - offset++; - remaining--; - } - // either end of buffer or a line separator char - int blockLength = offset - blockStartOffset; - if (blockLength > 0) { - buffer.write(b, blockStartOffset, blockLength); - } - while (remaining > 0 && (b[offset] == LF || b[offset] == CR)) { - write(b[offset]); - offset++; - remaining--; - } - blockStartOffset = offset; - } - } - -} diff --git a/proposal/sandbox/svn/src/main/org/apache/tools/ant/taskdefs/svn/Svn.java b/proposal/sandbox/svn/src/main/org/apache/tools/ant/taskdefs/svn/Svn.java deleted file mode 100644 index a8bf0a56e..000000000 --- a/proposal/sandbox/svn/src/main/org/apache/tools/ant/taskdefs/svn/Svn.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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.svn; - -/** - * Performs operations on a SVN repository. - * - * @ant.task category="scm" - */ -public class Svn extends AbstractSvnTask { - - /** - * SVN Task - now implemented by the Abstract SVN Task base class - */ - public Svn() { - } -} diff --git a/proposal/sandbox/svn/src/main/org/apache/tools/ant/taskdefs/svn/SvnChangeLogParser.java b/proposal/sandbox/svn/src/main/org/apache/tools/ant/taskdefs/svn/SvnChangeLogParser.java deleted file mode 100644 index bb27abb0b..000000000 --- a/proposal/sandbox/svn/src/main/org/apache/tools/ant/taskdefs/svn/SvnChangeLogParser.java +++ /dev/null @@ -1,188 +0,0 @@ -/* - * 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.svn; - -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.ArrayList; - -/** - * A class used to parse the output of the svn log command. - * - */ -class SvnChangeLogParser extends LineOrientedOutputStream { - - private final static int GET_ENTRY_LINE = 0; - private final static int GET_REVISION_LINE = 1; - private final static int GET_PATHS = 2; - private final static int GET_MESSAGE = 3; - - private String message = ""; - private Date date = null; - private String author = null; - private String revision = null; - private ArrayList paths = new ArrayList(); - - /** input format for dates read in from cvs log */ - private static final String PATTERN = "yyyy-MM-dd HH:mm:ss"; - private static final SimpleDateFormat INPUT_DATE - = new SimpleDateFormat(PATTERN); - - private final ArrayList entries = new ArrayList(); - private int status = GET_ENTRY_LINE; - - /** - * Get a list of rcs entries as an array. - * - * @return a list of rcs entries as an array - */ - public SvnEntry[] getEntrySetAsArray() { - return (SvnEntry[]) entries.toArray(new SvnEntry[entries.size()]); - } - - /** - * Receive notification about the process writing - * to standard output. - * @param line the line to process - */ - public void processLine(final String line) { - switch(status) { - case GET_ENTRY_LINE: - // make sure attributes are reset when - // working on a 'new' file. - reset(); - processEntryStart(line); - break; - case GET_REVISION_LINE: - processRevision(line); - break; - - case GET_MESSAGE: - processMessage(line); - break; - - case GET_PATHS: - processPath(line); - break; - - default: - // Do nothing - break; - } - } - - /** - * Process a line while in "GET_MESSAGE" state. - * - * @param line the line - */ - private void processMessage(final String line) { - final String lineSeparator = System.getProperty("line.separator"); - if (line.equals("------------------------------------------------------------------------")) { - //We have ended changelog for that particular revision - //so we can save it - final int end - = message.length() - lineSeparator.length(); - message = message.substring(0, end); - saveEntry(); - status = GET_REVISION_LINE; - } else { - message += line + lineSeparator; - } - } - - /** - * Process a line while in "GET_ENTRY_LINE" state. - * - * @param line the line to process - */ - private void processEntryStart(final String line) { - if (line.equals("------------------------------------------------------------------------")) { - status = GET_REVISION_LINE; - } - } - - /** - * Process a line while in "REVISION" state. - * - * @param line the line to process - */ - private void processRevision(final String line) { - int index = line.indexOf(" |"); - if (line.startsWith("r") - && (line.endsWith("lines") || line.endsWith("line")) - && index > -1) { - revision = line.substring(1, index); - int end = line.indexOf(" |", index + 1); - author = line.substring(index + 3, end); - String d = line.substring(end + 3, end + 3 + PATTERN.length()); - date = parseDate(d); - status = GET_PATHS; - } - } - - /** - * Process a line while in "GET_PATHS" state. - * - * @param line the line to process - */ - private void processPath(final String line) { - if (line.startsWith("Changed paths:")) { - // ignore - } else if (line.equals("")) { - status = GET_MESSAGE; - } else if (line.length() > 5) { - paths.add(new SvnEntry.Path(line.substring(5), line.charAt(3))); - } - } - - /** - * Utility method that saves the current entry. - */ - private void saveEntry() { - SvnEntry entry = new SvnEntry(date, revision, author, message, - paths); - entries.add(entry); - reset(); - } - - /** - * Parse date out from expected format. - * - * @param date the string holding date - * @return the date object or null if unknown date format - */ - private Date parseDate(final String date) { - try { - return INPUT_DATE.parse(date); - } catch (ParseException e) { - return null; - } - } - - /** - * Reset all internal attributes except status. - */ - public void reset() { - this.date = null; - this.author = null; - this.message = ""; - this.revision = null; - this.paths.clear(); - } -} diff --git a/proposal/sandbox/svn/src/main/org/apache/tools/ant/taskdefs/svn/SvnChangeLogTask.java b/proposal/sandbox/svn/src/main/org/apache/tools/ant/taskdefs/svn/SvnChangeLogTask.java deleted file mode 100644 index 718416135..000000000 --- a/proposal/sandbox/svn/src/main/org/apache/tools/ant/taskdefs/svn/SvnChangeLogTask.java +++ /dev/null @@ -1,399 +0,0 @@ -/* - * 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.svn; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStreamWriter; -import java.io.PrintWriter; -import java.io.UnsupportedEncodingException; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.Enumeration; -import java.util.Properties; -import java.util.Vector; -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.DirectoryScanner; -import org.apache.tools.ant.Project; -import org.apache.tools.ant.taskdefs.LogOutputStream; -import org.apache.tools.ant.taskdefs.PumpStreamHandler; -import org.apache.tools.ant.taskdefs.cvslib.CvsUser; -import org.apache.tools.ant.types.FileSet; -import org.apache.tools.ant.util.FileUtils; - -/** - * Examines the output of svn log and group related changes together. - * - * It produces an XML output representing the list of changes. - *
    - * <!-- Root element -->
    - * <!ELEMENT changelog (entry+)>
    - * <!-- SVN Entry -->
    - * <!ELEMENT entry (date,time,revision,author,path+,msg,msg)>
    - * <!-- Date of svn entry -->
    - * <!ELEMENT date (#PCDATA)>
    - * <!-- Time of svn entry -->
    - * <!ELEMENT time (#PCDATA)>
    - * <!-- Author of change -->
    - * <!ELEMENT author (#PCDATA)>
    - * <!-- commit message -->
    - * <!ELEMENT msg (#PCDATA)>
    - * <!-- List of paths affected -->
    - * <!ELEMENT path (name,action))>
    - * <!-- Name of the path -->
    - * <!ELEMENT name (#PCDATA)>
    - * <!ELEMENT action (added|modified|deleted)>
    - * <!-- Revision number -->
    - * <!ELEMENT revision (#PCDATA)>
    - * 
    - * - * @ant.task name="svnchangelog" category="scm" - */ -public class SvnChangeLogTask extends AbstractSvnTask { - /** User list */ - private File usersFile; - - /** User list */ - private Vector svnUsers = new Vector(); - - /** Input dir */ - private File inputDir; - - /** Output file */ - private File destFile; - - /** The earliest revision at which to start processing entries. */ - private String startRevision; - - /** The latest revision at which to stop processing entries. */ - private String endRevision; - - /** - * Filesets containing list of files against which the svn log will be - * performed. If empty then all files in the working directory will - * be checked. - */ - private final Vector filesets = new Vector(); - - - /** - * Set the base dir for svn. - * - * @param inputDir The new dir value - */ - public void setDir(final File inputDir) { - this.inputDir = inputDir; - } - - - /** - * Set the output file for the log. - * - * @param destFile The new destfile value - */ - public void setDestfile(final File destFile) { - this.destFile = destFile; - } - - - /** - * Set a lookup list of user names & addresses - * - * @param usersFile The file containing the users info. - */ - public void setUsersfile(final File usersFile) { - this.usersFile = usersFile; - } - - - /** - * Add a user to list changelog knows about. - * - * @param user the user - */ - public void addUser(final CvsUser user) { - svnUsers.addElement(user); - } - - - /** - * Set the revision at which the changelog should start. - * - * @param start The revision at which the changelog should start. - */ - public void setStart(final String start) { - this.startRevision = start; - } - - - /** - * Set the revision at which the changelog should stop. - * - * @param endRevision The revision at which the changelog should stop. - */ - public void setEnd(final String endRevision) { - this.endRevision = endRevision; - } - - - /** - * Set the number of days worth of log entries to process. - * - * @param days the number of days of log to process. - */ - public void setDaysinpast(final int days) { - final long time = System.currentTimeMillis() - - (long) days * 24 * 60 * 60 * 1000; - - final SimpleDateFormat outputDate = - new SimpleDateFormat("{yyyy-MM-dd}"); - setStart(outputDate.format(new Date(time))); - } - - - /** - * Adds a set of files about which svn logs will be generated. - * - * @param fileSet a set of files about which svn logs will be generated. - */ - public void addFileset(final FileSet fileSet) { - filesets.addElement(fileSet); - } - - - /** - * Execute task - * - * @exception BuildException if something goes wrong executing the - * svn command - */ - public void execute() throws BuildException { - File savedDir = inputDir; // may be altered in validate - - try { - - validate(); - final Properties userList = new Properties(); - - loadUserlist(userList); - - for (int i = 0, size = svnUsers.size(); i < size; i++) { - final CvsUser user = (CvsUser) svnUsers.get(i); - user.validate(); - userList.put(user.getUserID(), user.getDisplayname()); - } - - setSubCommand("log"); - setVerbose(true); - - if (null != startRevision) { - if (null != endRevision) { - setRevision(startRevision + ":" + endRevision); - } else { - setRevision(startRevision + ":HEAD"); - } - } - - // Check if list of files to check has been specified - if (!filesets.isEmpty()) { - final Enumeration e = filesets.elements(); - - while (e.hasMoreElements()) { - final FileSet fileSet = (FileSet) e.nextElement(); - final DirectoryScanner scanner = - fileSet.getDirectoryScanner(getProject()); - final String[] files = scanner.getIncludedFiles(); - - for (int i = 0; i < files.length; i++) { - addSubCommandArgument(files[i]); - } - } - } - - final SvnChangeLogParser parser = new SvnChangeLogParser(); - final PumpStreamHandler handler = - new PumpStreamHandler(parser, - new LogOutputStream(this, - Project.MSG_ERR)); - - log(getSubCommand(), Project.MSG_VERBOSE); - - setDest(inputDir); - setExecuteStreamHandler(handler); - super.execute(); - - final SvnEntry[] entrySet = parser.getEntrySetAsArray(); - final SvnEntry[] filteredEntrySet = filterEntrySet(entrySet); - - replaceAuthorIdWithName(userList, filteredEntrySet); - - writeChangeLog(filteredEntrySet); - - } finally { - inputDir = savedDir; - } - } - - /** - * Validate the parameters specified for task. - * - * @throws BuildException if fails validation checks - */ - private void validate() - throws BuildException { - if (null == inputDir) { - inputDir = getDest(); - } - if (null == destFile) { - final String message = "Destfile must be set."; - - throw new BuildException(message); - } - if (!inputDir.exists()) { - final String message = "Cannot find base dir " - + inputDir.getAbsolutePath(); - - throw new BuildException(message); - } - if (null != usersFile && !usersFile.exists()) { - final String message = "Cannot find user lookup list " - + usersFile.getAbsolutePath(); - - throw new BuildException(message); - } - } - - /** - * Load the userlist from the userList file (if specified) and add to - * list of users. - * - * @param userList the file of users - * @throws BuildException if file can not be loaded for some reason - */ - private void loadUserlist(final Properties userList) - throws BuildException { - if (null != usersFile) { - try { - userList.load(new FileInputStream(usersFile)); - } catch (final IOException ioe) { - throw new BuildException(ioe.toString(), ioe); - } - } - } - - /** - * Filter the specified entries according to an appropriate rule. - * - * @param entrySet the entry set to filter - * @return the filtered entry set - */ - private SvnEntry[] filterEntrySet(final SvnEntry[] entrySet) { - final Vector results = new Vector(); - - for (int i = 0; i < entrySet.length; i++) { - final SvnEntry svnEntry = entrySet[i]; - - if (null != endRevision && !isBeforeEndRevision(svnEntry)) { - //Skip revisions that are too late - continue; - } - results.addElement(svnEntry); - } - - final SvnEntry[] resultArray = new SvnEntry[results.size()]; - - results.copyInto(resultArray); - return resultArray; - } - - /** - * replace all known author's id's with their maven specified names - */ - private void replaceAuthorIdWithName(final Properties userList, - final SvnEntry[] entrySet) { - for (int i = 0; i < entrySet.length; i++) { - - final SvnEntry entry = entrySet[ i ]; - if (userList.containsKey(entry.getAuthor())) { - entry.setAuthor(userList.getProperty(entry.getAuthor())); - } - } - } - - /** - * Print changelog to file specified in task. - * - * @param entrySet the entry set to write. - * @throws BuildException if there is an error writing changelog. - */ - private void writeChangeLog(final SvnEntry[] entrySet) - throws BuildException { - FileOutputStream output = null; - - try { - output = new FileOutputStream(destFile); - - final PrintWriter writer = - new PrintWriter(new OutputStreamWriter(output, "UTF-8")); - - final SvnChangeLogWriter serializer = new SvnChangeLogWriter(); - - serializer.printChangeLog(writer, entrySet); - } catch (final UnsupportedEncodingException uee) { - getProject().log(uee.toString(), Project.MSG_ERR); - } catch (final IOException ioe) { - throw new BuildException(ioe.toString(), ioe); - } finally { - FileUtils.close(output); - } - } - - private static final String PATTERN = "yyyy-MM-dd"; - private static final SimpleDateFormat INPUT_DATE - = new SimpleDateFormat(PATTERN); - - /** - * Checks whether a given entry is before the given end revision, - * using revision numbers or date information as appropriate. - */ - private boolean isBeforeEndRevision(SvnEntry entry) { - if (endRevision.startsWith("{") - && endRevision.length() >= 2 + PATTERN.length() ) { - try { - Date endDate = - INPUT_DATE.parse(endRevision.substring(1, - PATTERN.length() - + 1)); - return entry.getDate().before(endDate); - } catch (ParseException e) { - } - } else { - try { - int endRev = Integer.parseInt(endRevision); - int entryRev = Integer.parseInt(entry.getRevision()); - return endRev >= entryRev; - } catch (NumberFormatException e) { - } // end of try-catch - } - // failed to parse revision, use a save fallback - return true; - } -} - diff --git a/proposal/sandbox/svn/src/main/org/apache/tools/ant/taskdefs/svn/SvnChangeLogWriter.java b/proposal/sandbox/svn/src/main/org/apache/tools/ant/taskdefs/svn/SvnChangeLogWriter.java deleted file mode 100644 index 380bd22a6..000000000 --- a/proposal/sandbox/svn/src/main/org/apache/tools/ant/taskdefs/svn/SvnChangeLogWriter.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * 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.svn; - -import java.io.IOException; -import java.io.PrintWriter; -import java.text.SimpleDateFormat; -import javax.xml.parsers.DocumentBuilder; - -import org.apache.tools.ant.util.DOMElementWriter; -import org.apache.tools.ant.util.DOMUtils; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -/** - * Class used to generate an XML changelog. - */ -public class SvnChangeLogWriter { - /** output format for dates written to xml file */ - private static final SimpleDateFormat OUTPUT_DATE - = new SimpleDateFormat("yyyy-MM-dd"); - /** output format for times written to xml file */ - private static final SimpleDateFormat OUTPUT_TIME - = new SimpleDateFormat("HH:mm"); - /** stateless helper for writing the XML document */ - private static final DOMElementWriter DOM_WRITER = new DOMElementWriter(); - - /** - * Print out the specified entries. - * - * @param output writer to which to send output. - * @param entries the entries to be written. - */ - public void printChangeLog(final PrintWriter output, - final SvnEntry[] entries) throws IOException { - output.println(""); - Document doc = DOMUtils.newDocument(); - Element root = doc.createElement("changelog"); - DOM_WRITER.openElement(root, output, 0, "\t"); - output.println(); - for (int i = 0; i < entries.length; i++) { - final SvnEntry entry = entries[i]; - - printEntry(output, entry, root); - } - DOM_WRITER.closeElement(root, output, 0, "\t", entries.length > 0); - output.flush(); - output.close(); - } - - - /** - * Print out an individual entry in changelog. - * - * @param entry the entry to print - * @param output writer to which to send output. - */ - private void printEntry(final PrintWriter output, final SvnEntry entry, - final Element element) throws IOException { - Document doc = element.getOwnerDocument(); - - Element ent = doc.createElement("entry"); - DOMUtils.appendTextElement(ent, "date", - OUTPUT_DATE.format(entry.getDate())); - DOMUtils.appendTextElement(ent, "time", - OUTPUT_TIME.format(entry.getDate())); - DOMUtils.appendCDATAElement(ent, "author", entry.getAuthor()); - DOMUtils.appendTextElement(ent, "revision", entry.getRevision()); - - SvnEntry.Path[] paths = entry.getPaths(); - for (int i = 0; i < paths.length; i++) { - Element path = DOMUtils.createChildElement(ent, "path"); - DOMUtils.appendCDATAElement(path, "name", paths[i].getName()); - DOMUtils.appendTextElement(path, "action", - paths[i].getActionDescription()); - } - DOMUtils.appendCDATAElement(ent, "message", entry.getMessage()); - DOM_WRITER.write(ent, output, 1, "\t"); - } -} - diff --git a/proposal/sandbox/svn/src/main/org/apache/tools/ant/taskdefs/svn/SvnDiffHandler.java b/proposal/sandbox/svn/src/main/org/apache/tools/ant/taskdefs/svn/SvnDiffHandler.java deleted file mode 100644 index 354735453..000000000 --- a/proposal/sandbox/svn/src/main/org/apache/tools/ant/taskdefs/svn/SvnDiffHandler.java +++ /dev/null @@ -1,207 +0,0 @@ -/* - * 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.svn; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileOutputStream; -import java.io.FileReader; -import java.io.IOException; -import java.io.OutputStreamWriter; -import java.io.PrintWriter; -import java.io.UnsupportedEncodingException; -import java.util.ArrayList; -import java.util.StringTokenizer; - -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.Project; -import org.apache.tools.ant.util.DOMElementWriter; -import org.apache.tools.ant.util.DOMUtils; -import org.apache.tools.ant.util.FileUtils; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -/** - * Parses the output of a svn diff command and/or writes an XML report - * based on such a diff output. - * - * It produces an XML output representing the list of changes. - */ -final class SvnDiffHandler { - - /** - * Token to identify the word file in the rdiff log - */ - private static final String INDEX = "Index: "; - /** - * Token to identify a deleted file based on the Index line. - */ - private static final String DELETED = " (deleted)"; - - /** - * Token to identify added files based on the diff line. - */ - private static final String IS_NEW = "\t(revision 0)"; - - /** - * Token that starts diff line of old revision. - */ - private static final String DASHES = "--- "; - - /** stateless helper for writing the XML document */ - private static final DOMElementWriter DOM_WRITER = new DOMElementWriter(); - - /** - * Parse the tmpFile and return and array of entries to be written - * in the output. - * - * @param tmpFile the File containing the output of the svn rdiff command - * @return the entries in the output - * @exception BuildException if an error occurs - */ - static SvnEntry.Path[] parseDiff(File tmpFile) throws BuildException { - // parse the output of the command - BufferedReader reader = null; - - try { - reader = new BufferedReader(new FileReader(tmpFile)); - ArrayList entries = new ArrayList(); - - String line = reader.readLine(); - String name = null; - String currDiffLine = null; - boolean deleted = false; - boolean added = false; - - while (null != line) { - if (line.length() > INDEX.length()) { - if (line.startsWith(INDEX)) { - if (name != null) { - SvnEntry.Path p = - new SvnEntry.Path(name, - deleted - ? SvnEntry.Path.DELETED - : (added - ? SvnEntry.Path.ADDED - : SvnEntry.Path.MODIFIED) - ); - entries.add(p); - deleted = added = false; - } - - name = line.substring(INDEX.length()); - if (line.endsWith(DELETED)) { - name = name.substring(0, name.length() - - DELETED.length()); - deleted = true; - } - - currDiffLine = DASHES + name; - } else if (currDiffLine != null - && line.startsWith(currDiffLine) - && line.endsWith(IS_NEW)) { - added = true; - } - } - line = reader.readLine(); - } - if (name != null) { - SvnEntry.Path p = new SvnEntry.Path(name, - deleted - ? SvnEntry.Path.DELETED - : (added - ? SvnEntry.Path.ADDED - : SvnEntry.Path.MODIFIED) - ); - entries.add(p); - } - - SvnEntry.Path[] array = (SvnEntry.Path[]) - entries.toArray(new SvnEntry.Path[entries.size()]); - return array; - } catch (IOException e) { - throw new BuildException("Error in parsing", e); - } finally { - FileUtils.close(reader); - } - } - - /** - * Write the diff log. - * - * @param entries a SvnRevisionEntry[] value - * @exception BuildException if an error occurs - */ - static void writeDiff(File destFile, SvnEntry.Path[] entries, - String rootElementName, - String tag1Name, String tag1Value, - String tag2Name, String tag2Value, - String svnURL) throws BuildException { - FileOutputStream output = null; - try { - output = new FileOutputStream(destFile); - PrintWriter writer = new PrintWriter( - new OutputStreamWriter(output, "UTF-8")); - writer.println(""); - Document doc = DOMUtils.newDocument(); - Element root = doc.createElement(rootElementName); - if (tag1Name != null && tag1Value != null) { - root.setAttribute(tag1Name, tag1Value); - } - if (tag2Name != null && tag2Value != null) { - root.setAttribute(tag2Name, tag2Value); - } - - if (svnURL != null) { - root.setAttribute("svnurl", svnURL); - } - DOM_WRITER.openElement(root, writer, 0, "\t"); - writer.println(); - for (int i = 0, c = entries.length; i < c; i++) { - writeRevisionEntry(doc, writer, entries[i]); - } - DOM_WRITER.closeElement(root, writer, 0, "\t", true); - writer.flush(); - writer.close(); - } catch (UnsupportedEncodingException uee) { - throw new BuildException(uee); - } catch (IOException ioe) { - throw new BuildException(ioe.toString(), ioe); - } finally { - FileUtils.close(output); - } - } - - /** - * Write a single entry to the given writer. - * - * @param doc Document used to create elements. - * @param writer a PrintWriter value - * @param entry a SvnRevisionEntry value - */ - private static void writeRevisionEntry(Document doc, - PrintWriter writer, - SvnEntry.Path entry) - throws IOException { - Element e = doc.createElement("path"); - DOMUtils.appendCDATAElement(e, "name", entry.getName()); - DOMUtils.appendTextElement(e, "action", entry.getActionDescription()); - DOM_WRITER.write(e, writer, 1, "\t"); - } - -} diff --git a/proposal/sandbox/svn/src/main/org/apache/tools/ant/taskdefs/svn/SvnEntry.java b/proposal/sandbox/svn/src/main/org/apache/tools/ant/taskdefs/svn/SvnEntry.java deleted file mode 100644 index 7da4f3fa8..000000000 --- a/proposal/sandbox/svn/src/main/org/apache/tools/ant/taskdefs/svn/SvnEntry.java +++ /dev/null @@ -1,171 +0,0 @@ -/* - * 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.svn; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.Date; - -public class SvnEntry { - private final Date date; - private final String revision; - private String author; - private final String message; - private final ArrayList paths = new ArrayList(); - - /** - * Creates a new instance of a SvnEntry - * @param date the date - * @param author the author - * @param message a message to be added to the revision - */ - public SvnEntry(final Date date, final String revision, - final String author, final String message) { - this(date, revision, author, message, Collections.EMPTY_LIST); - } - - /** - * Creates a new instance of a SvnEntry - * @param date the date - * @param author the author - * @param message a message to be added to the revision - */ - public SvnEntry(final Date date, final String revision, - final String author, final String message, - final Collection paths) { - this.date = date; - this.revision = revision; - this.author = author; - this.message = message; - this.paths.addAll(paths); - } - - /** - * Adds a path to the SvnEntry - * @param path the path to add - * @param revision the revision - */ - public void addPath(final String name, final char action) { - paths.add(new Path(name, action)); - } - - /** - * Gets the date of the SvnEntry - * @return the date - */ - public Date getDate() { - return date; - } - - /** - * Gets the revision of the SvnEntry - * @return the date - */ - public String getRevision() { - return revision; - } - - /** - * Sets the author of the SvnEntry - * @param author the author - */ - public void setAuthor(final String author) { - this.author = author; - } - - /** - * Gets the author of the SvnEntry - * @return the author - */ - public String getAuthor() { - return author; - } - - /** - * Gets the message for the SvnEntry - * @return the message - */ - public String getMessage() { - return message; - } - - /** - * Gets the paths in this SvnEntry - * @return the files - */ - public Path[] getPaths() { - return (Path[]) paths.toArray(new Path[paths.size()]); - } - - public static class Path { - - private static final char ADDED_MARKER = 'A'; - private static final char MODIFIED_MARKER = 'M'; - private static final char DELETED_MARKER = 'D'; - - public static final int ADDED = 0; - public static final int MODIFIED = 1; - public static final int DELETED = 2; - - private static final String[] ACTIONS = { - "added", "modified", "deleted", - }; - - private final String name; - private final int action; - - public Path(final String name, final char actionChar) { - this.name = name; - switch (actionChar) { - case ADDED_MARKER: - action = ADDED; - break; - case MODIFIED_MARKER: - action = MODIFIED; - break; - case DELETED_MARKER: - action = DELETED; - break; - default: - throw new IllegalArgumentException("Unkown action; " - + actionChar); - } - } - - public Path(final String name, final int action) { - this.name = name; - if (action != ADDED && action != DELETED && action != MODIFIED) { - throw new IllegalArgumentException("Unkown action; " + action); - } - this.action = action; - } - - public String getName() { - return name; - } - - public int getAction() { - return action; - } - - public String getActionDescription() { - return ACTIONS[action]; - } - } - -} diff --git a/proposal/sandbox/svn/src/main/org/apache/tools/ant/taskdefs/svn/SvnRevisionDiff.java b/proposal/sandbox/svn/src/main/org/apache/tools/ant/taskdefs/svn/SvnRevisionDiff.java deleted file mode 100644 index cf45aeade..000000000 --- a/proposal/sandbox/svn/src/main/org/apache/tools/ant/taskdefs/svn/SvnRevisionDiff.java +++ /dev/null @@ -1,162 +0,0 @@ -/* - * 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.svn; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileOutputStream; -import java.io.FileReader; -import java.io.IOException; -import java.io.OutputStreamWriter; -import java.io.PrintWriter; -import java.io.UnsupportedEncodingException; -import java.util.ArrayList; -import java.util.StringTokenizer; - -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.Project; -import org.apache.tools.ant.util.FileUtils; - -/** - * Examines the output of svn diff between two revisions. - * - * It produces an XML output representing the list of changes. - *
    - * <!-- Root element -->
    - * <!ELEMENT revisiondiff ( paths? ) >
    - * <!-- Start revision of the report -->
    - * <!ATTLIST revisiondiff start NMTOKEN #IMPLIED >
    - * <!-- End revision of the report -->
    - * <!ATTLIST revisiondiff end NMTOKEN #IMPLIED >
    - * <!-- Subversion URL if known  -->
    - * <!ATTLIST revisiondiff svnurl NMTOKEN #IMPLIED >
    - *
    - * <!-- Path added, changed or removed -->
    - * <!ELEMENT path ( name,action ) >
    - * <!-- Name of the file -->
    - * <!ELEMENT name ( #PCDATA ) >
    - * <!ELEMENT action (added|modified|deleted)>
    - * 
    - * - * @ant.task name="svnrevisiondiff" - */ -public class SvnRevisionDiff extends AbstractSvnTask { - - /** - * Used to create the temp file for svn log - */ - private static final FileUtils FILE_UTILS = FileUtils.getFileUtils(); - - /** - * The earliest revision from which diffs are to be included in the report. - */ - private String mystartRevision; - - /** - * The latest revision from which diffs are to be included in the report. - */ - private String myendRevision; - - /** - * The file in which to write the diff report. - */ - private File mydestfile; - - /** - * Set the start revision. - * - * @param s the start revision. - */ - public void setStart(String s) { - mystartRevision = s; - } - - /** - * Set the end revision. - * - * @param s the end revision. - */ - public void setEnd(String s) { - myendRevision = s; - } - - /** - * Set the output file for the diff. - * - * @param f the output file for the diff. - */ - public void setDestFile(File f) { - mydestfile = f; - } - - /** - * Execute task. - * - * @exception BuildException if an error occurs - */ - public void execute() throws BuildException { - // validate the input parameters - validate(); - - // build the rdiff command - setSubCommand("diff"); - setRevision(mystartRevision + ":" + myendRevision); - addSubCommandArgument("--no-diff-deleted"); - - File tmpFile = null; - try { - tmpFile = - FILE_UTILS.createTempFile("svnrevisiondiff", ".log", null); - tmpFile.deleteOnExit(); - setOutput(tmpFile); - - // run the svn command - super.execute(); - - // parse the diff - SvnEntry.Path[] entries = SvnDiffHandler.parseDiff(tmpFile); - - // write the revision diff - SvnDiffHandler.writeDiff(mydestfile, entries, "revisiondiff", - "start", mystartRevision, - "end", myendRevision, getSvnURL()); - } finally { - if (tmpFile != null) { - tmpFile.delete(); - } - } - } - - /** - * Validate the parameters specified for task. - * - * @exception BuildException if a parameter is not correctly set - */ - private void validate() throws BuildException { - if (null == mydestfile) { - throw new BuildException("Destfile must be set."); - } - - if (null == mystartRevision) { - throw new BuildException("Start revision or start date must be set."); - } - - if (null == myendRevision) { - throw new BuildException("End revision or end date must be set."); - } - } -} diff --git a/proposal/sandbox/svn/src/main/org/apache/tools/ant/taskdefs/svn/SvnTagDiff.java b/proposal/sandbox/svn/src/main/org/apache/tools/ant/taskdefs/svn/SvnTagDiff.java deleted file mode 100644 index 42db960cd..000000000 --- a/proposal/sandbox/svn/src/main/org/apache/tools/ant/taskdefs/svn/SvnTagDiff.java +++ /dev/null @@ -1,210 +0,0 @@ -/* - * 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.svn; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileOutputStream; -import java.io.FileReader; -import java.io.IOException; -import java.io.OutputStreamWriter; -import java.io.PrintWriter; -import java.io.UnsupportedEncodingException; -import java.util.ArrayList; -import java.util.StringTokenizer; - -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.Project; -import org.apache.tools.ant.util.FileUtils; - -/** - * Examines the output of svn diff between two tags or a tag and trunk. - * - *

    This task only works if you follow the best-practice structure of - *

    - * BASEURL
    - *   |
    - *   |
    - *   -----> trunk
    - *   -----> tags
    - *            |
    - *            |
    - *            ----------> tag1
    - *            ----------> tag2
    - * 
    - * - * It produces an XML output representing the list of changes. - *
    - * <!-- Root element -->
    - * <!ELEMENT tagdiff ( paths? ) >
    - * <!-- First tag -->
    - * <!ATTLIST tagdiff tag1 NMTOKEN #IMPLIED >
    - * <!-- Second tag -->
    - * <!ATTLIST tagdiff tag2 NMTOKEN #IMPLIED >
    - * <!-- Subversion BaseURL -->
    - * <!ATTLIST tagdiff svnurl NMTOKEN #IMPLIED >
    - *
    - * <!-- Path added, changed or removed -->
    - * <!ELEMENT path ( name,action ) >
    - * <!-- Name of the file -->
    - * <!ELEMENT name ( #PCDATA ) >
    - * <!ELEMENT action (added|modified|deleted)>
    - * 
    - * - * @ant.task name="svntagdiff" - */ -public class SvnTagDiff extends AbstractSvnTask { - - /** - * Used to create the temp file for svn log - */ - private static final FileUtils FILE_UTILS = FileUtils.getFileUtils(); - - /** - * The earliest revision from which diffs are to be included in the report. - */ - private String tag1; - - /** - * The latest revision from which diffs are to be included in the report. - */ - private String tag2; - - /** - * The file in which to write the diff report. - */ - private File mydestfile; - - /** - * Base URL. - */ - private String baseURL; - - /** - * Set the first tag. - * - * @param s the first tag. - */ - public void setTag1(String s) { - tag1 = s; - } - - /** - * Set the second tag. - * - * @param s the second tag. - */ - public void setTag2(String s) { - tag2 = s; - } - - /** - * Set the output file for the diff. - * - * @param f the output file for the diff. - */ - public void setDestFile(File f) { - mydestfile = f; - } - - /** - * Set the base URL from which to calculate tag URLs. - * - * @param u the base URL from which to calculate tag URLs. - */ - public void setBaseURL(String u) { - baseURL = u; - if (!u.endsWith("/")) { - baseURL += "/"; - } - } - - /** - * Execute task. - * - * @exception BuildException if an error occurs - */ - public void execute() throws BuildException { - // validate the input parameters - validate(); - - // build the rdiff command - setSubCommand("diff"); - addSubCommandArgument("--no-diff-deleted"); - if (tag1.equals("trunk") || tag1.equals("trunk/")) { - addSubCommandArgument(baseURL + "trunk/"); - } else { - if (tag1.endsWith("/")) { - addSubCommandArgument(baseURL + "tags/" + tag1); - } else { - addSubCommandArgument(baseURL + "tags/" + tag1 + "/"); - } - } - if (tag2 == null || tag2.equals("trunk") || tag2.equals("trunk/")) { - addSubCommandArgument(baseURL + "trunk/"); - } else { - if (tag2.endsWith("/")) { - addSubCommandArgument(baseURL + "tags/" + tag2); - } else { - addSubCommandArgument(baseURL + "tags/" + tag2 + "/"); - } - } - - File tmpFile = null; - try { - tmpFile = - FILE_UTILS.createTempFile("svntagdiff", ".log", null); - tmpFile.deleteOnExit(); - setOutput(tmpFile); - - // run the svn command - super.execute(); - - // parse the diff - SvnEntry.Path[] entries = SvnDiffHandler.parseDiff(tmpFile); - - // write the revision diff - SvnDiffHandler.writeDiff(mydestfile, entries, "tagdiff", - "tag1", tag1, "tag2", - tag2 == null ? "trunk" : tag2, - baseURL); - } finally { - if (tmpFile != null) { - tmpFile.delete(); - } - } - } - - /** - * Validate the parameters specified for task. - * - * @exception BuildException if a parameter is not correctly set - */ - private void validate() throws BuildException { - if (null == mydestfile) { - throw new BuildException("Destfile must be set."); - } - - if (null == tag1) { - throw new BuildException("tag1 must be set."); - } - - if (null == baseURL) { - throw new BuildException("baseURL must be set."); - } - } -} diff --git a/proposal/sandbox/svn/src/main/org/apache/tools/ant/taskdefs/svn/antlib.xml b/proposal/sandbox/svn/src/main/org/apache/tools/ant/taskdefs/svn/antlib.xml deleted file mode 100644 index 94bc54c98..000000000 --- a/proposal/sandbox/svn/src/main/org/apache/tools/ant/taskdefs/svn/antlib.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - diff --git a/proposal/sandbox/svn/src/testcases/org/apache/tools/ant/taskdefs/svn/AbstractSvnTaskTest.java b/proposal/sandbox/svn/src/testcases/org/apache/tools/ant/taskdefs/svn/AbstractSvnTaskTest.java deleted file mode 100644 index a191475d3..000000000 --- a/proposal/sandbox/svn/src/testcases/org/apache/tools/ant/taskdefs/svn/AbstractSvnTaskTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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.svn; - -import java.io.File; - -import org.apache.tools.ant.BuildFileTest; - -/** - */ -public class AbstractSvnTaskTest extends BuildFileTest { - - public AbstractSvnTaskTest() { - this( "AbstractSvnTaskTest" ); - } - - public AbstractSvnTaskTest(String name) { - super(name); - } - - public void setUp() { - configureProject("src/etc/testcases/abstractsvntask.xml"); - } - - public void tearDown() { - executeTarget("cleanup"); - } - - public void testAbstractSvnTask() { - executeTarget("all"); - } - - public void testRevisionAttribute() { - File f = getProject().resolveFile("tmpdir/tpf/ebcdic.h"); - assertTrue("starting empty", !f.exists()); - expectLogContaining("revision-attribute", "A tpf/ebcdic.h"); - assertTrue("now it is there", f.exists()); - } -} diff --git a/proposal/sandbox/svn/src/testcases/org/apache/tools/ant/taskdefs/svn/SvnChangeLogTaskTest.java b/proposal/sandbox/svn/src/testcases/org/apache/tools/ant/taskdefs/svn/SvnChangeLogTaskTest.java deleted file mode 100644 index f855cc5d3..000000000 --- a/proposal/sandbox/svn/src/testcases/org/apache/tools/ant/taskdefs/svn/SvnChangeLogTaskTest.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * 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.svn; - -import java.io.IOException; -import java.io.FileReader; - -import org.apache.tools.ant.BuildFileTest; -import org.apache.tools.ant.util.FileUtils; - -import junit.framework.Assert; - -/** - */ -public class SvnChangeLogTaskTest extends BuildFileTest { - - public SvnChangeLogTaskTest(String name) { - super(name); - } - - public void setUp() { - configureProject("src/etc/testcases/changelog.xml"); - } - - public void tearDown() { - executeTarget("cleanup"); - } - - public void testLog() throws IOException { - String log = executeTargetAndReadLogFully("log"); - assertRev153687(log); - assertRev152685(log); - } - - public void testStart() throws IOException { - String log = executeTargetAndReadLogFully("start"); - assertRev153687(log); - assertNoRev152685(log); - } - - public void testStartDate() throws IOException { - String log = executeTargetAndReadLogFully("startDate"); - assertRev153687(log); - assertNoRev152685(log); - } - - public void testEnd() throws IOException { - String log = executeTargetAndReadLogFully("end"); - assertNoRev153687(log); - assertRev152685(log); - } - - public void testEndDate() throws IOException { - String log = executeTargetAndReadLogFully("endDate"); - assertNoRev153687(log); - assertRev152685(log); - } - - private String executeTargetAndReadLogFully(String target) - throws IOException { - executeTarget(target); - FileReader r = new FileReader(getProject() - .resolveFile("tmpdir/log.xml")); - try { - return FileUtils.readFully(r); - } finally { - r.close(); - } - } - - private static final void assertRev153687(String log) { - int rev = log.indexOf("153687"); - Assert.assertTrue(rev > -1); - int entryBeforeRev = log.lastIndexOf("", rev); - int entryAfterRev = log.indexOf("", rev); - - Assert.assertTrue(entryBeforeRev > -1); - Assert.assertTrue(entryAfterRev > -1); - - Assert - .assertTrue(log.lastIndexOf("", - rev) > entryBeforeRev); - Assert - .assertTrue(log.indexOf("", rev) < entryAfterRev); - Assert - .assertTrue(log.indexOf("modified", rev) - < entryAfterRev); - Assert - .assertTrue(log.indexOf("", - rev) - < entryAfterRev); - } - - private static final void assertRev152685(String log) { - int rev = log.indexOf("152685"); - Assert.assertTrue(rev > -1); - int entryBeforeRev = log.lastIndexOf("", rev); - int entryAfterRev = log.indexOf("", rev); - - Assert.assertTrue(entryBeforeRev > -1); - Assert.assertTrue(entryAfterRev > -1); - - Assert - .assertTrue(log.lastIndexOf("", rev) - > entryBeforeRev); - Assert - .assertTrue(log.indexOf("" - + "", rev) < entryAfterRev); - Assert - .assertTrue(log.indexOf("added", rev) - < entryAfterRev); - Assert - .assertTrue(log.indexOf("", - rev) - < entryAfterRev); - } - - private static final void assertNoRev153687(String log) { - int rev = log.indexOf("153687"); - Assert.assertEquals(-1, rev); - } - - private static final void assertNoRev152685(String log) { - int rev = log.indexOf("152685"); - Assert.assertEquals(-1, rev); - } -} diff --git a/proposal/sandbox/svn/src/testcases/org/apache/tools/ant/taskdefs/svn/SvnRevisionDiffTest.java b/proposal/sandbox/svn/src/testcases/org/apache/tools/ant/taskdefs/svn/SvnRevisionDiffTest.java deleted file mode 100644 index 69c063ed7..000000000 --- a/proposal/sandbox/svn/src/testcases/org/apache/tools/ant/taskdefs/svn/SvnRevisionDiffTest.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * 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.svn; - -import java.io.IOException; -import java.io.FileReader; - -import org.apache.tools.ant.BuildFileTest; -import org.apache.tools.ant.util.FileUtils; - -import junit.framework.Assert; - -/** - */ -public class SvnRevisionDiffTest extends BuildFileTest { - - public SvnRevisionDiffTest(String name) { - super(name); - } - - public void setUp() { - configureProject("src/etc/testcases/revisiondiff.xml"); - } - - public void tearDown() { - executeTarget("cleanup"); - } - - public void testDiff() throws IOException { - String log = executeTargetAndReadLogFully("diff"); - assertAttributesNoURL(log); - assertAdded(log); - assertModified(log); - assertDeleted(log); - } - - public void testDiffUrl() throws IOException { - String log = executeTargetAndReadLogFully("diff-using-url"); - assertAttributesWithURL(log); - assertAdded(log); - assertModified(log); - assertDeleted(log); - } - - private String executeTargetAndReadLogFully(String target) - throws IOException { - executeTarget(target); - FileReader r = new FileReader(getProject() - .resolveFile("tmpdir/diff.xml")); - try { - return FileUtils.readFully(r); - } finally { - r.close(); - } - } - - private static final void assertAttributes(String log) { - int start = log.indexOf(" -1); - int end = log.indexOf(">", start); - Assert.assertTrue(end > -1); - Assert.assertTrue(log.indexOf("start=\"152904\"", start) > -1); - Assert.assertTrue(log.indexOf("start=\"152904\"", start) < end); - Assert.assertTrue(log.indexOf("end=\"153682\"", start) > -1); - Assert.assertTrue(log.indexOf("end=\"153682\"", start) < end); - } - - private static final void assertAttributesNoURL(String log) { - assertAttributes(log); - Assert.assertEquals(-1, log.indexOf("svnurl=")); - } - - private static final void assertAttributesWithURL(String log) { - assertAttributes(log); - int start = log.indexOf("", start); - Assert.assertTrue(log.indexOf("svnurl=\"http://svn.apache.org/repos/" - + "asf/jakarta/bcel/trunk\"", start) - > -1); - Assert.assertTrue(log.indexOf("svnurl=\"http://svn.apache.org/repos/" - + "asf/jakarta/bcel/trunk\"", start) - < end); - } - - private static final void assertAdded(String log) { - int name = log.indexOf(""); - Assert.assertTrue(name > -1); - - int pathAfterName = log.indexOf("", name); - Assert.assertTrue(pathAfterName > -1); - - Assert.assertTrue(log.indexOf("added", name) > -1); - Assert.assertTrue(log.indexOf("added", name) - < pathAfterName); - } - - private static final void assertModified(String log) { - int name = log.indexOf(""); - Assert.assertTrue(name > -1); - - int pathAfterName = log.indexOf("", name); - Assert.assertTrue(pathAfterName > -1); - - Assert.assertTrue(log.indexOf("modified", name) > -1); - Assert.assertTrue(log.indexOf("modified", name) - < pathAfterName); - } - - private static final void assertDeleted(String log) { - int name = log.indexOf(""); - Assert.assertTrue(name > -1); - - int pathAfterName = log.indexOf("", name); - Assert.assertTrue(pathAfterName > -1); - - Assert.assertTrue(log.indexOf("deleted", name) > -1); - Assert.assertTrue(log.indexOf("deleted", name) - < pathAfterName); - } -} diff --git a/proposal/sandbox/svn/src/testcases/org/apache/tools/ant/taskdefs/svn/SvnTagDiffTest.java b/proposal/sandbox/svn/src/testcases/org/apache/tools/ant/taskdefs/svn/SvnTagDiffTest.java deleted file mode 100644 index d2fb13e34..000000000 --- a/proposal/sandbox/svn/src/testcases/org/apache/tools/ant/taskdefs/svn/SvnTagDiffTest.java +++ /dev/null @@ -1,144 +0,0 @@ -/* - * 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.svn; - -import java.io.IOException; -import java.io.FileReader; - -import org.apache.tools.ant.BuildFileTest; -import org.apache.tools.ant.util.FileUtils; - -import junit.framework.Assert; - -/** - */ -public class SvnTagDiffTest extends BuildFileTest { - - public SvnTagDiffTest(String name) { - super(name); - } - - public void setUp() { - configureProject("src/etc/testcases/tagdiff.xml"); - } - - public void tearDown() { - executeTarget("cleanup"); - } - - public void testDiffWithTwoTags() throws IOException { - String log = executeTargetAndReadLogFully("diff-with-two-tags"); - assertAttributes(log, "initial", "BCEL_5_0"); - assertAdded1(log); - } - - public void testDiffWithExplicitTrunk() throws IOException { - String log = executeTargetAndReadLogFully("diff-with-explicit-trunk"); - assertDiffWithTrunk(log); - } - - public void testDiffWithImplicitTrunk() throws IOException { - String log = executeTargetAndReadLogFully("diff-with-implicit-trunk"); - assertDiffWithTrunk(log); - } - - private static void assertDiffWithTrunk(String log) { - assertAttributes(log, "BCEL_5_0", "trunk"); - assertAdded(log); - assertModified(log); - assertDeleted(log); - } - - private String executeTargetAndReadLogFully(String target) - throws IOException { - executeTarget(target); - FileReader r = new FileReader(getProject() - .resolveFile("tmpdir/diff.xml")); - try { - return FileUtils.readFully(r); - } finally { - r.close(); - } - } - - private static final void assertAttributes(String log, String tag1, - String tag2) { - int start = log.indexOf(" -1); - int end = log.indexOf(">", start); - Assert.assertTrue(end > -1); - Assert.assertTrue(log.indexOf("tag1=\"" + tag1 + "\"", start) > -1); - Assert.assertTrue(log.indexOf("tag1=\"" + tag1 + "\"", start) < end); - Assert.assertTrue(log.indexOf("tag2=\"" + tag2 + "\"", start) > -1); - Assert.assertTrue(log.indexOf("tag2=\"" + tag2 + "\"", start) < end); - Assert.assertTrue(log.indexOf("svnurl=\"http://svn.apache.org/repos/" - + "asf/jakarta/bcel/\"", start) > -1); - Assert.assertTrue(log.indexOf("svnurl=\"http://svn.apache.org/repos/" - + "asf/jakarta/bcel/\"", start) < end); - } - - private static final void assertAdded(String log) { - int name = log.indexOf(""); - Assert.assertTrue(name > -1); - - int pathAfterName = log.indexOf("", name); - Assert.assertTrue(pathAfterName > -1); - - Assert.assertTrue(log.indexOf("added", name) > -1); - Assert.assertTrue(log.indexOf("added", name) - < pathAfterName); - } - - private static final void assertModified(String log) { - int name = log.indexOf(""); - Assert.assertTrue(name > -1); - - int pathAfterName = log.indexOf("", name); - Assert.assertTrue(pathAfterName > -1); - - Assert.assertTrue(log.indexOf("modified", name) > -1); - Assert.assertTrue(log.indexOf("modified", name) - < pathAfterName); - } - - private static final void assertDeleted(String log) { - int name = log.indexOf(""); - Assert.assertTrue(name > -1); - - int pathAfterName = log.indexOf("", name); - Assert.assertTrue(pathAfterName > -1); - - Assert.assertTrue(log.indexOf("deleted", name) > -1); - Assert.assertTrue(log.indexOf("deleted", name) - < pathAfterName); - } - - private static final void assertAdded1(String log) { - int name = log.indexOf(""); - Assert.assertTrue(name > -1); - - int pathAfterName = log.indexOf("", name); - Assert.assertTrue(pathAfterName > -1); - - Assert.assertTrue(log.indexOf("added", name) > -1); - Assert.assertTrue(log.indexOf("added", name) - < pathAfterName); - } - -}