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 @@
-
-
-
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 @@ - - -
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 @@ - - - -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.
- -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.
- -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.
- -Right now direct any feedback either directly to me or the Ant - developer list. - -
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:
- -- <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. -
- <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. -
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
.
- 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 @@ - - - -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.
- -Attribute | -Description | -Required | -
buildfile | -External build file to invoke MSBuild on. | -No. | -
vm | -Same as dotnetexec's vm attribute. - Specify the framework to use. | -No. | -
target
has a single required attribute name -
- specifies a target to be run.
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.
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.
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 @@ - - - -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.
- -Attribute | -Description | -Required | -
buildfile | -External build file to invoke NAnt on. | -No. | -
vm | -Same as dotnetexec's vm attribute. - Specify the framework to use. | -No. | -
target
has a single required attribute name -
- specifies a target to be run.
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.
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.
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 @@ - - - -Runs the NUnit console - test runner.
- -Attribute | -Description | -Required | -
vm | -Same as dotnetexec's vm attribute. - Specify the framework to use. | -No. | -
config | -Config file to use | -No. | -
output | -Where test output should go. | -No. | -
error | -Where test error output should go. | -No. | -
xmlout | -Where NUnit's XML output should go. | -No. | -
transform | -The transformation to apply. | -No. | -
thread | -Causes a separate thread to be created for - running the tests - see the NUnit documentation for - details. | -No - defaults to false. | -
noshadow | -Disables shadow copying of the assembly in - order to provide improved performance.. | -No - defaults to false. | -
fixture | -Test fixture to run. | -No. | -
labels | -Causes an identifying label to be displayed - at the start of each test case. | -No - defaults to false. | -
failOnError | -Stops the build if NUnit returns with a code - indicating an error or failure. | -No - defaults to false. | -
testassembly
has a single required attribute name -
- specifies an assembly or a project file holding tests.
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.
- -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.
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.
- <nunit> - <testassembly name="nunit.tests.dll"/> - </nunit> -- -
or
- -- <nunit> - <testassembly name="nunit.tests.csproj"/> - </nunit> -- -
- <nunit fixture="NUnit.Tests.AssertionTests"> - <testassembly name="nunit.tests.dll"/> - </nunit> -- -
- <nunit> - <testassembly name="nunit.tests.dll"/> - <include name="Baseline"/> - </nunit> -- -
- <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.
- -- <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 @@ - - - -Runs the candle, light or both from the Wix toolset.
- -Attribute | -Description | -Required | -
source | -The single source file to process. | -Either this or at least one nested - <sources> set. | -
target | -The expected target file. | -Yes, unless you run candle without light. | -
mode | -Which part of the toolset to run, one of - "candle", "light" or - "both". | -No, default is "both". | -
vm | -Same as dotnetexec's vm attribute. - Specify the framework to use. | -No. | -
Specify source files that shall be passed on the command line. - This is a fileset.
- -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.
- - -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 @@ - - - -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; - -/** - * SpecializedDefaults 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
If we have exactly one
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.
candle
may include more files than this one,
- * the main source is the one passed on the command line.
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 @@ - - -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.
Attribute | -Description | -Required | -
Attributes from parent svn
- task which are meaningful here - | ||
svnURL | -the URL the subcommand should apply to. | -No | -
dest | -the directory where the checked out files are. | -No, default is project's basedir. | -
failonerror | -Stop the build process if the command exits with a
- return code other than 0 . Defaults to false |
- No | -
Specific attributes | -||
dir | -The directory from which to run the CVS log - command. | -No; defaults to ${basedir}. | -
destfile | -The file in which to write the change log report. | -Yes | -
usersfile | -Property 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 | -
daysinpast | -Sets the number of days into the past for which the - change log information should be retrieved. | -No | -
start | -The earliest revision/date from which change logs - are to be included in the report. | -No | -
end | -The latest revision/date to which change logs are to be - included in the report. | -No | -
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.
Attribute | -Description | -Required | -
displayname | -The name to be used in the Subversion change log - report. | -Yes | -
userid | -The userid of the person as it exists on the - Subversion server. - | -Yes | -
<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
.
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> -- -
- <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 @@ - - - -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.
Attribute | -Description | -Required | -
start | -The earliest revision from which diffs are to be - included in the report. | -Yes. | -
end | -The latest revision from which diffs are to be - included in the report. | -Yes. | -
destfile | -The file in which to write the diff report. | -Yes | -
svn
taskAttribute | -Description | -Required | -
svnURL | -the svn URL to diff. | -No | -
failonerror | -Stop the buildprocess if the command exits with a - returncode other than 0. Defaults to false | -No | -
<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
.
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> -- -
-<?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 @@ - - - - -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.
-
Attribute | -Description | -Required | -
subcommand | -the SVN subcommand to execute. | -No, default "checkout". | -
svnURL | -the URL the subcommand should apply to. | -No | -
dest | -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. |
- No, default is project's basedir. | -
revision | -the revision or date of the subcommand should apply to | -No | -
quiet | -suppress informational messages. This is the same as --quiet on the command line. |
- No, default "false" | -
verbose | -Be verbose. This is the same as --verbose on the command line. |
- No, default "false" | -
dryrun | -report only, don't change any files. | -No, default to "false" | -
file | -Uses the contents of the file passed as an - argument to this switch for the specified subcommand. | -No. | -
force | -Forces a particular command or operation to run. | -No, defaults to false. | -
recursive | -Makes a subcommand recurse into - subdirectories. Most subcommands recurse by default. | -No. | -
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. | -No. | -
output | -the file to direct standard output from the command. | -No, default output to ANT Log as MSG_INFO . |
-
error | -the file to direct standard error from the command. | -No, default error to ANT Log as MSG_WARN . |
-
append | -whether to append output/error when redirecting to a file. | -No, default to "false". | -
failonerror | -Stop the build process if the command exits with a
- return code other than 0 . Defaults to "false" |
- No | -
<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 @@ - - - -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 -- -
Attribute | -Description | -Required | -
tag1 | -The first tag. | -Yes. | -
tag2 | -The second tag. | -No, defaults to "trunk/" | -
destfile | -The file in which to write the diff report. | -Yes | -
baseURL | -The baseURL of the repository, used to calculate - the two URLs to compare. | -Yes | -
svn
taskAttribute | -Description | -Required | -
failonerror | -Stop the buildprocess if the command exits with a - returncode other than 0. Defaults to false | -No | -
- <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.
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> -- -
-<?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 @@ - - -Designed for use with Apache Ant.
---
Designed for use with Apache Ant.
-- New Files | - Modified Files | - Removed Files - | -
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 - *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 @@ - - -