Browse Source

Add initial task

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@277635 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 20 years ago
parent
commit
dba3d96c01
8 changed files with 970 additions and 0 deletions
  1. +1
    -0
      proposal/sandbox/svn/.cvsignore
  2. +91
    -0
      proposal/sandbox/svn/build.xml
  3. +128
    -0
      proposal/sandbox/svn/docs/svn.html
  4. +64
    -0
      proposal/sandbox/svn/src/etc/testcases/abstractsvntask.xml
  5. +578
    -0
      proposal/sandbox/svn/src/main/org/apache/tools/ant/taskdefs/svn/AbstractSvnTask.java
  6. +32
    -0
      proposal/sandbox/svn/src/main/org/apache/tools/ant/taskdefs/svn/Svn.java
  7. +22
    -0
      proposal/sandbox/svn/src/main/org/apache/tools/ant/taskdefs/svn/antlib.xml
  8. +54
    -0
      proposal/sandbox/svn/src/testcases/org/apache/tools/ant/taskdefs/svn/AbstractSvnTaskTest.java

+ 1
- 0
proposal/sandbox/svn/.cvsignore View File

@@ -0,0 +1 @@
build

+ 91
- 0
proposal/sandbox/svn/build.xml View File

@@ -0,0 +1,91 @@
<?xml version="1.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.
-->
<project default="compile">

<target name="setup">
<property name="build" value="build"/>
<property name="build.classes" value="${build}/classes"/>
<property name="build.testclasses" value="${build}/test-classes"/>
<property name="build.lib" value="${build}/lib"/>
<property name="jarname" value="${build.lib}/ant-svn.jar"/>
<mkdir dir="${build.classes}"/>
<mkdir dir="${build.testclasses}"/>
<mkdir dir="${build.lib}"/>
</target>

<target name="compile" depends="setup">
<javac
srcdir="src/main"
destdir="${build.classes}"
debug="true"
/>
</target>

<target name="antlib" depends="compile">
<copy todir="${build.classes}">
<fileset dir="src/main" includes="**/antlib.xml"/>
</copy>
<jar
destfile="${jarname}"
basedir="${build.classes}"
/>
</target>

<target name="setup-for-tests" depends="setup">
<ant
antfile="../../../build.xml"
target="test-jar"
inheritall="false"
/>
</target>

<target name="compile-tests" depends="setup-for-tests, antlib">
<javac
srcdir="src/testcases"
destdir="${build.testclasses}"
debug="true"
>
<classpath>
<pathelement location="${jarname}"/>
<pathelement location="../../../build/lib/ant-testutil.jar"/>
</classpath>
</javac>
</target>

<target name="test" depends="compile-tests">
<junit
printsummary="false"
haltonfailure="false"
failureproperty="tests.failed"
filtertrace="false"
>
<classpath>
<pathelement location="${jarname}"/>
<pathelement location="../../../build/lib/ant-testutil.jar"/>
<pathelement location="${build.testclasses}"/>
</classpath>

<batchtest>
<fileset dir="src/testcases"/>
</batchtest>

<formatter type="plain" usefile="false"/>
</junit>

<fail if="tests.failed">At least one test has failed.</fail>
</target>
</project>

+ 128
- 0
proposal/sandbox/svn/docs/svn.html View File

@@ -0,0 +1,128 @@
<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<title>Subversion Task</title>
<link rel="stylesheet" type="text/css" href="../stylesheets/antmanual.css">
</head>

<body>

<h2><a name="svn">SVN</a></h2>
<h3>Description</h3>
<p>Handles packages/modules retrieved from a
<a href="http://subversion.tigris.org/" target="_top">Subversion</a> repository.</p>
<p><b>Important:</b> This task needs &quot;<code>svn</code>&quot; on the path. If it isn't, you will get
an error (such as error <code>2</code> on windows). If <code>&lt;svn&gt;</code> doesn't work, try to execute <code>svn.exe</code>
from the command line in the target directory in which you are working.
<h3>Parameters</h3>
<table border="1" cellpadding="2" cellspacing="0">
<tr>
<td valign="top"><b>Attribute</b></td>
<td valign="top"><b>Description</b></td>
<td align="center" valign="top"><b>Required</b></td>
</tr>
<tr>
<td valign="top">subcommand</td>
<td valign="top">the SVN subcommand to execute.</td>
<td align="center" valign="top">No, default &quot;checkout&quot;.</td>
</tr>
<tr>
<td valign="top">svnURL</td>
<td valign="top">the URL the subcommand should apply to.</td>
<td align="center" valign="top">No</td>
</tr>
<tr>
<td valign="top">dest</td>
<td valign="top">the directory where the checked out files should
be placed. Note that this is different from SVN's <code>-d</code> command line
switch as Ant will never shorten pathnames to avoid empty
directories.</td>
<td align="center" valign="top">No, default is project's basedir.</td>
</tr>
<tr>
<td valign="top">revision</td>
<td valign="top">the revision or date of the subcommand should apply to</td>
<td align="center" valign="top">No</td>
</tr>
<tr>
<td valign="top">quiet</td>
<td valign="top">suppress informational messages. This is the same as <code>--quiet</code> on the command line.</td>
<td align="center" valign="top">No, default &quot;false&quot;</td>
</tr>
<tr>
<td valign="top">dryrun</td>
<td valign="top">report only, don't change any files.</td>
<td align="center" valign="top">No, default to &quot;false&quot;</td>
</tr>
<tr>
<td valign="top">output</td>
<td valign="top">the file to direct standard output from the command.</td>
<td align="center" valign="top">No, default output to ANT Log as <code>MSG_INFO</code>.</td>
</tr>
<tr>
<td valign="top">error</td>
<td valign="top">the file to direct standard error from the command.</td>
<td align="center" valign="top">No, default error to ANT Log as <code>MSG_WARN</code>.</td>
</tr>
<tr>
<td valign="top">append</td>
<td valign="top">whether to append output/error when redirecting to a file.</td>
<td align="center" valign="top">No, default to &quot;false&quot;.</td>
</tr>
<tr>
<td valign="top">failonerror</td>
<td valign="top">Stop the build process if the command exits with a
return code other than <code>0</code>. Defaults to &quot;false&quot;</td>
<td align="center" valign="top">No</td>
</tr>
</table>
<h3>Examples</h3>
<pre> &lt;svn svnURL=&quot;http://svn.apache.org/repos/asf/httpd/httpd/trunk/&quot;
dest=&quot;${ws.dir}&quot;
/&gt;</pre>
<p>checks out the URL
&quot;http://svn.apache.org/repos/asf/httpd/httpd/trunk/&quot; and
stores the files in &quot;<code>${ws.dir}</code>&quot;.</p>
<pre> &lt;svn dest=&quot;${ws.dir}&quot; command=&quot;update&quot;/&gt;</pre>
<p>updates the working copy that has previously been checked out into
&quot;<code>${ws.dir}</code>&quot;.</p>

<pre> &lt;svn command=&quot;-q diff&quot; output=&quot;patch.txt&quot;/&gt;</pre>

<p>silently (<code>-q</code>) creates a file called <code>patch.txt</code> which contains a unified diff which can be used as input to patch.
The equivalent, using <code>&lt;commandline&gt;</code> elements, is:
</p>
<pre>
&lt;svn output=&quot;patch&quot;&gt;
&lt;commandline&gt;
&lt;argument value=&quot;-q&quot;/&gt;
&lt;argument value=&quot;diff&quot;/&gt;
&lt;/commandline&gt;
&lt;/svn&gt;
</pre>
or:
<pre>
&lt;svn output=&quot;patch&quot;&gt;
&lt;commandline&gt;
&lt;argument line=&quot;-q diff -u -N&quot;/&gt;
&lt;/commandline&gt;
&lt;/svn&gt;
</pre>
<p>
You may include as many <code>&lt;commandline&gt;</code> elements as you like.
Each will inherit the <code>failonerror</code> and other &quot;global&quot; parameters
from the <code>&lt;svn&gt;</code> element.
</p>

<pre> &lt;svn command=&quot;update&quot;/&gt;</pre>
<p>Updates from the head of repository creating any new directories as necessary.</p>
<p>See <a href="http://svnbook.red-bean.com/en/1.1/ch09.html#svn-ch-9-sect-1" target="_top">Version Control with Subversion</a> for details,
specifically the <a href="http://svnbook.red-bean.com/en/1.1/ch09.html#svn-ch-9-sect-1" target="_top">The Subversion Command Line Client: svn</a></p>
<hr>
<p align="center">Copyright &copy; 2005 The Apache Software
Foundation. All rights Reserved.</p>

</body>
</html>


+ 64
- 0
proposal/sandbox/svn/src/etc/testcases/abstractsvntask.xml View File

@@ -0,0 +1,64 @@
<?xml version="1.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.
-->

<project name="abstractsvntask-test" basedir="../../../"
default="all" xmlns:svn="antlib:org.apache.tools.ant.taskdefs.svn">

<property name="tmpdir" value="tmpdir"/>
<property name="tpfdir" value="${tmpdir}/tpf"/>
<property name="file" value="ebcdic.h"/>

<target name="setup">
<mkdir dir="${tmpdir}"/>
<svn:svn
svnURL="http://svn.apache.org/repos/asf/httpd/httpd/trunk/os/tpf/"
dest="${tmpdir}"/>
</target>

<target name="all" depends="setup">
<svn:svn failonerror="true" subcommand="status ${file}" dest="${tpfdir}"/>
<svn:svn failonerror="true" dest="${tpfdir}">
<commandline>
<argument value="up"/>
<argument value="-r"/>
<argument value="83750"/>
<argument value="${file}"/>
</commandline>
</svn:svn>
<svn:svn failonerror="true" subcommand="status ${file}" dest="${tpfdir}"/>
<svn:svn failonerror="true" dest="${tpfdir}">
<commandline>
<argument line="up -r HEAD ${file}" />
</commandline>
</svn:svn>
<svn:svn failonerror="true" subcommand="status ${file}" dest="${tpfdir}"/>
</target>

<target name="revision-attribute">
<mkdir dir="${tmpdir}" />
<svn:svn
svnURL="http://svn.apache.org/repos/asf/httpd/httpd/trunk/os/tpf"
dest="${tmpdir}"
quiet="false"
revision="83750"/>
</target>

<target name="cleanup">
<delete dir="${tmpdir}" />
</target>
</project>

+ 578
- 0
proposal/sandbox/svn/src/main/org/apache/tools/ant/taskdefs/svn/AbstractSvnTask.java View File

@@ -0,0 +1,578 @@
/*
* Copyright 2005 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package org.apache.tools.ant.taskdefs.svn;

import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
import java.util.Vector;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.taskdefs.Execute;
import org.apache.tools.ant.taskdefs.ExecuteStreamHandler;
import org.apache.tools.ant.taskdefs.LogOutputStream;
import org.apache.tools.ant.taskdefs.PumpStreamHandler;
import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.Environment;
import org.apache.tools.ant.util.StringUtils;

/**
* Just like Ant's built-in CVS task, the main loginc lives in this
* abstract task.
*/
public abstract class AbstractSvnTask extends Task {

private Commandline cmd = new Commandline();

/** list of Commandline children */
private Vector vecCommandlines = new Vector();

/**
* the URL the subcommand should apply to.
*/
private String svnURL;

/**
* the revision
*/
private String revision;
/**
* the default command.
*/
private static final String DEFAULT_SUBCOMMAND = "checkout";
/**
* the SVN command to execute.
*/
private String subCommand = null;

/**
* suppress information messages.
*/
private boolean quiet = false;

/**
* report only, don't change any files.
*/
private boolean dryrun = false;

/**
* the directory where the checked out files should be placed.
*/
private File dest;

/** whether or not to append stdout/stderr to existing files */
private boolean append = false;

/**
* the file to direct standard output from the command.
*/
private File output;

/**
* the file to direct standard error from the command.
*/
private File error;

/**
* If true it will stop the build if svn exits with error.
* Default is false. (Iulian)
*/
private boolean failOnError = false;

/**
* Create accessors for the following, to allow different handling of
* the output.
*/
private ExecuteStreamHandler executeStreamHandler;
private OutputStream outputStream;
private OutputStream errorStream;

/** empty no-arg constructor*/
public AbstractSvnTask() {
super();
}

/**
* sets the handler
* @param handler a handler able of processing the output and error streams from the svn exe
*/
public void setExecuteStreamHandler(ExecuteStreamHandler handler) {
this.executeStreamHandler = handler;
}

/**
* find the handler and instantiate it if it does not exist yet
* @return handler for output and error streams
*/
protected ExecuteStreamHandler getExecuteStreamHandler() {

if (this.executeStreamHandler == null) {
setExecuteStreamHandler(new PumpStreamHandler(getOutputStream(),
getErrorStream()));
}

return this.executeStreamHandler;
}

/**
* sets a stream to which the output from the svn executable should be sent
* @param outputStream stream to which the stdout from svn should go
*/
protected void setOutputStream(OutputStream outputStream) {

this.outputStream = outputStream;
}

/**
* access the stream to which the stdout from svn should go
* if this stream has already been set, it will be returned
* if the stream has not yet been set, if the attribute output
* has been set, the output stream will go to the output file
* otherwise the output will go to ant's logging system
* @return output stream to which svn' stdout should go to
*/
protected OutputStream getOutputStream() {

if (this.outputStream == null) {

if (output != null) {
try {
setOutputStream(new PrintStream(
new BufferedOutputStream(
new FileOutputStream(output
.getPath(),
append))));
} catch (IOException e) {
throw new BuildException(e, getLocation());
}
} else {
setOutputStream(new LogOutputStream(this, Project.MSG_INFO));
}
}

return this.outputStream;
}

/**
* sets a stream to which the stderr from the svn exe should go
* @param errorStream an output stream willing to process stderr
*/
protected void setErrorStream(OutputStream errorStream) {

this.errorStream = errorStream;
}

/**
* access the stream to which the stderr from svn should go
* if this stream has already been set, it will be returned
* if the stream has not yet been set, if the attribute error
* has been set, the output stream will go to the file denoted by the error attribute
* otherwise the stderr output will go to ant's logging system
* @return output stream to which svn' stderr should go to
*/
protected OutputStream getErrorStream() {

if (this.errorStream == null) {

if (error != null) {

try {
setErrorStream(new PrintStream(
new BufferedOutputStream(
new FileOutputStream(error.getPath(),
append))));
} catch (IOException e) {
throw new BuildException(e, getLocation());
}
} else {
setErrorStream(new LogOutputStream(this, Project.MSG_WARN));
}
}

return this.errorStream;
}

/**
* Sets up the environment for toExecute and then runs it.
* @param toExecute the command line to execute
* @throws BuildException if failonError is set to true and the svn command fails
*/
protected void runCommand(Commandline toExecute) throws BuildException {
Environment env = new Environment();

//
// Just call the getExecuteStreamHandler() and let it handle
// the semantics of instantiation or retrieval.
//
Execute exe = new Execute(getExecuteStreamHandler(), null);

exe.setAntRun(getProject());
if (dest == null) {
dest = getProject().getBaseDir();
}

if (!dest.exists()) {
dest.mkdirs();
}

exe.setWorkingDirectory(dest);
exe.setCommandline(toExecute.getCommandline());
exe.setEnvironment(env.getVariables());

try {
String actualCommandLine = executeToString(exe);
log(actualCommandLine, Project.MSG_VERBOSE);
int retCode = exe.execute();
log("retCode=" + retCode, Project.MSG_DEBUG);
/*Throw an exception if svn exited with error. (Iulian)*/
if (failOnError && Execute.isFailure(retCode)) {
throw new BuildException("svn exited with error code "
+ retCode
+ StringUtils.LINE_SEP
+ "Command line was ["
+ actualCommandLine + "]", getLocation());
}
} catch (IOException e) {
if (failOnError) {
throw new BuildException(e, getLocation());
} else {
log("Caught exception: " + e.getMessage(), Project.MSG_WARN);
}
} catch (BuildException e) {
if (failOnError) {
throw(e);
} else {
Throwable t = e.getException();
if (t == null) {
t = e;
}
log("Caught exception: " + t.getMessage(), Project.MSG_WARN);
}
} catch (Exception e) {
if (failOnError) {
throw new BuildException(e, getLocation());
} else {
log("Caught exception: " + e.getMessage(), Project.MSG_WARN);
}
}
}

/**
* do the work
* @throws BuildException if failonerror is set to true and the svn command fails.
*/
public void execute() throws BuildException {

String savedCommand = getSubCommand();

if (this.getSubCommand() == null && vecCommandlines.size() == 0) {
// re-implement legacy behaviour:
this.setSubCommand(AbstractSvnTask.DEFAULT_SUBCOMMAND);
}

String c = this.getSubCommand();
Commandline cloned = null;
if (c != null) {
cloned = (Commandline) cmd.clone();
cloned.createArgument(true).setLine(c);
if (svnURL != null) {
cloned.createArgument().setValue(svnURL);
}
this.addConfiguredCommandline(cloned, true);
}

try {
for (int i = 0; i < vecCommandlines.size(); i++) {
this.runCommand((Commandline) vecCommandlines.elementAt(i));
}
} finally {
if (cloned != null) {
removeCommandline(cloned);
}
setSubCommand(savedCommand);

if (outputStream != null) {
try {
outputStream.close();
} catch (IOException e) {
//ignore
}
}
if (errorStream != null) {
try {
errorStream.close();
} catch (IOException e) {
//ignore
}
}
}
}

private String executeToString(Execute execute) {

StringBuffer stringBuffer =
new StringBuffer(Commandline.describeCommand(execute
.getCommandline()));

String newLine = StringUtils.LINE_SEP;
String[] variableArray = execute.getEnvironment();

if (variableArray != null) {
stringBuffer.append(newLine);
stringBuffer.append(newLine);
stringBuffer.append("environment:");
stringBuffer.append(newLine);
for (int z = 0; z < variableArray.length; z++) {
stringBuffer.append(newLine);
stringBuffer.append("\t");
stringBuffer.append(variableArray[z]);
}
}

return stringBuffer.toString();
}

/**
* The URL the subcommand should apply to.
*
* @param url the URL the subcommand should apply to.
*/
public void setSvnURL(String url) {

// Check if not real svnroot => set it to null
if (url != null) {
if (url.trim().equals("")) {
url = null;
}
}

this.svnURL = url;
}

/**
* access the svnURL variable
* @return svnURL
*/
public String getSvnURL() {

return this.svnURL;
}

/**
* The directory where the checked out files should be placed.
*
* <p>Note that this is different from SVN's -d command line
* switch as Ant will never shorten pathnames to avoid empty
* directories.</p>
*
* @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);
}
}

/**
* 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, 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
* <ul>
* <li>
* svn
* </li>
* <li>
* quiet
* </li>
* <li>svnroot</li>
* <li>dryrun</li>
* </ul>
*/
protected void configureCommandline(Commandline c) {
if (c == null) {
return;
}
c.setExecutable("svn");
if (quiet) {
c.createArgument(true).setValue("--quiet");
}
if (dryrun) {
c.createArgument(true).setValue("--dry-run");
}
}

/**
* remove a particular command from a vector of command lines
* @param c command line which should be removed
*/
protected void removeCommandline(Commandline c) {
vecCommandlines.removeElement(c);
}

/**
* Adds direct command-line to execute.
* @param c command line to execute
*/
public void addConfiguredCommandline(Commandline c) {
this.addConfiguredCommandline(c, false);
}

/**
* Configures and adds the given Commandline.
* @param c commandline to insert
* @param insertAtStart If true, c is
* inserted at the beginning of the vector of command lines
*/
public void addConfiguredCommandline(Commandline c,
boolean insertAtStart) {
if (c == null) {
return;
}
this.configureCommandline(c);
if (insertAtStart) {
vecCommandlines.insertElementAt(c, 0);
} else {
vecCommandlines.addElement(c);
}
}

}

+ 32
- 0
proposal/sandbox/svn/src/main/org/apache/tools/ant/taskdefs/svn/Svn.java View File

@@ -0,0 +1,32 @@
/*
* 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() {
}
}

+ 22
- 0
proposal/sandbox/svn/src/main/org/apache/tools/ant/taskdefs/svn/antlib.xml View File

@@ -0,0 +1,22 @@
<?xml version="1.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.
-->
<antlib>
<taskdef
name="svn"
classname="org.apache.tools.ant.taskdefs.svn.Svn"
/>
</antlib>

+ 54
- 0
proposal/sandbox/svn/src/testcases/org/apache/tools/ant/taskdefs/svn/AbstractSvnTaskTest.java View File

@@ -0,0 +1,54 @@
/*
* Copyright 2005 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.tools.ant.taskdefs.svn;

import java.io.File;

import org.apache.tools.ant.BuildFileTest;

/**
* @version $Revision$
*/
public class AbstractSvnTaskTest extends BuildFileTest {

public AbstractSvnTaskTest() {
this( "AbstractCvsTaskTest" );
}

public AbstractSvnTaskTest(String name) {
super(name);
}

public void setUp() {
configureProject("src/etc/testcases/abstractsvntask.xml");
}

public void tearDown() {
executeTarget("cleanup");
}

public void testAbstractCvsTask() {
executeTarget("all");
}

public void testRevisionAttribute() {
File f = getProject().resolveFile("tmpdir/tpf/ebcdic.h");
assertTrue("starting empty", !f.exists());
expectLogContaining("revision-attribute", "A tpf/ebcdic.h");
assertTrue("now it is there", f.exists());
}
}

Loading…
Cancel
Save