What is the acceptance process of a new task? I would like to put this task in the ant repository for anybody else who needs it. I have attached the task, tests and doc for it. I have put in the apache licenses and stuff also.
thanks,
dean
/* * The Apache Software License, Version 1.1 * * Copyright (c) 2000-2002 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Ant" and "Apache Software * Foundation" must not be used to endorse or promote products derived * from this software without prior written permission. For written * permission, please contact [EMAIL PROTECTED] * * 5. Products derived from this software may not be called "Apache" * nor may "Apache" appear in their names without prior written * permission of the Apache Group. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. */ package org.apache.tools.ant.taskdefs.optional.walls;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
/*
* Created on Aug 24, 2003
*
* To change the template for this generated file go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
/**
* FILL IN JAVADOC HERE
*
* @author $Author: deanhiller $
* @version $ProductVersion:$ $FileVersion:$ $Revision: $ $Date: $
* @since $ProductVersionCreated:$ Aug 24, 2003
*/
public class Walls {
private List packages = new LinkedList();
private Map nameToPackage = new HashMap();
public void addConfiguredPackage(Package p) {
String pack = p.getPackage();
if(!pack.endsWith(".*") && !pack.endsWith(".**"))
p.setFaultReason("The package='"+pack+"' must end with "
+".* or .** such as
biz.xsoftware.* or "
+"biz.xsoftware.**");
String[] depends = p.getDepends();
if(depends == null) {
nameToPackage.put(p.getName(), p);
packages.add(p);
return;
}
//make sure all depends are in Map first
//circular references then are not a problem because they must
//put the stuff in order
for(int i = 0; i < depends.length; i++) {
Package dependsPackage =
(Package)nameToPackage.get(depends[i]);
if(dependsPackage == null) {
p.setFaultReason("package name="+p.getName()+"
did not have "
+depends[i]+" listed before it
and cannot compile without it");
} else
p.addExcludesElement(dependsPackage.getPackage());
}
nameToPackage.put(p.getName(), p);
packages.add(p);
}
public Iterator getPackagesToCompile() {
return packages.iterator();
}
}/* * The Apache Software License, Version 1.1 * * Copyright (c) 2000-2002 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Ant" and "Apache Software * Foundation" must not be used to endorse or promote products derived * from this software without prior written permission. For written * permission, please contact [EMAIL PROTECTED] * * 5. Products derived from this software may not be called "Apache" * nor may "Apache" appear in their names without prior written * permission of the Apache Group. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. */ package org.apache.tools.ant.taskdefs.optional.walls; import java.io.File; import java.util.Iterator; import org.apache.tools.ant.BuildException; import org.apache.tools.ant.Task; import org.apache.tools.ant.taskdefs.Javac; import org.apache.tools.ant.taskdefs.Move; import org.apache.tools.ant.types.FileSet; import org.apache.tools.ant.types.Mapper; import org.apache.tools.ant.types.Mapper.MapperType; /* * Created on Aug 24, 2003 * * To change the template for this generated file go to * Window>Preferences>Java>Code Generation>Code and Comments */ /** * FILL IN JAVADOC HERE * * @author $Author: deanhiller $ * @version $ProductVersion:$ $FileVersion:$ $Revision: $ $Date: $ * @since $ProductVersionCreated:$ Aug 24, 2003 */ public class CompileWithWalls extends Task { private boolean setWallsTwice = false; private boolean setJavacTwice = false; private Walls walls; private Javac javac; public Walls createWalls() { if(walls != null) setWallsTwice = true; walls = new Walls(); return walls; } public Javac createJavac() { if(javac != null) setJavacTwice = true; javac = new Javac(); return javac; } public void execute() throws BuildException { if(javac == null) throw new BuildException("There must be a nested javac element", getLocation()); else if(walls == null) throw new BuildException("There must be a nested walls element", getLocation()); else if(setWallsTwice) throw new BuildException("compilewithwalls task only supports one nested walls element or one walls attribute", getLocation()); else if(setJavacTwice) throw new BuildException("compilewithwalls task only supports one nested javac element", getLocation()); project.addTaskDefinition("SilentMove", SilentMove.class); Iterator iter = walls.getPackagesToCompile(); while(iter.hasNext()) { Package toCompile = (Package)iter.next(); log("Compiling package "+toCompile.getPackage()); File destDir = javac.getDestdir(); String[] list = javac.getSrcdir().list(); if(list.length != 1) throw new BuildException("srcdir in javac task must contain one and only one " +"source directory with the compilewithwalls task\n" +"Your javac srcdir contains "+list.length+" source directories", getLocation()); File srcDir = getProject().resolveFile(list[0]); if (!srcDir.exists()) { throw new BuildException("srcdir \"" + srcDir.getPath() + "\" does not exist!", getLocation()); } FileSet excludes = toCompile.getExcludesFileSet(project, getLocation()); moveFiles(srcDir, excludes, true, true); moveFiles(destDir, excludes, true, false); try { javac.perform(); } finally { FileSet includes = new FileSet(); //move temp files back to java files. moveFiles(srcDir, includes, false, true); moveFiles(destDir, includes, false, false); } } } /** * Move java or class files to temp files or moves the temp files * back to java or class files. This must be done because javac * is too nice and sticks already compiled classes and ones depended * on in the classpath destroying the compile time wall. This way, * we can keep the wall up. * * @param srcDir Directory to copy files from/to(Usually the java files dir or the class files dir) * @param fileset The fileset of files to include in the move. * @param moveToTempFile true if moving src files to temp files, false if moving temp files * back to src files. * @param isJavaFiles true if we are moving .java files, false if we are moving .class files. */ private void moveFiles(File srcDir, FileSet fileset, boolean moveToTempFile, boolean isJavaFiles) { fileset.setDir(srcDir); //before we do this, we have to move all files not //in the above fileset to xxx.java.ant-tempfile //so that they don't get dragged into the compile //This way we don't miss anything and all the dependencies //are listed or the compile will break. Move move = (Move) project.createTask("SilentMove"); move.setProject(project); move.setOwningTarget(target); move.setTaskName(getTaskName()); move.setLocation(getLocation()); move.setTodir(srcDir); move.setOverwrite(true); move.addFileset(fileset); MapperType globType = new Mapper.MapperType(); globType.setValue("glob"); Mapper mapper = move.createMapper(); mapper.setType(globType); String pattern; if(isJavaFiles) pattern = "*.java"; else pattern = "*.class"; if(moveToTempFile) { //debug("moving "+pattern+" files to temp files"); mapper.setFrom(pattern); mapper.setTo("*.ant-tempfile"); } else { //debug("moving temp files back to "+pattern+" files"); mapper.setFrom("*.ant-tempfile"); mapper.setTo(pattern); } move.perform(); } }
/* * The Apache Software License, Version 1.1 * * Copyright (c) 2000-2002 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Ant" and "Apache Software * Foundation" must not be used to endorse or promote products derived * from this software without prior written permission. For written * permission, please contact [EMAIL PROTECTED] * * 5. Products derived from this software may not be called "Apache" * nor may "Apache" appear in their names without prior written * permission of the Apache Group. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. */ package org.apache.tools.ant.taskdefs.optional.walls; import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer; import org.apache.tools.ant.BuildException; import org.apache.tools.ant.Location; import org.apache.tools.ant.Project; import org.apache.tools.ant.ProjectHelper; import org.apache.tools.ant.types.FileSet; /* * Created on Aug 24, 2003 * * To change the template for this generated file go to * Window>Preferences>Java>Code Generation>Code and Comments */ /** * FILL IN JAVADOC HERE * * @author $Author: deanhiller $ * @version $ProductVersion:$ $FileVersion:$ $Revision: $ $Date: $ * @since $ProductVersionCreated:$ Aug 24, 2003 */ public class Package { private String name; private String pack; //signifies the package did not end with .* or .** private boolean badPackage = false; private String failureReason = null; //holds the name attribute of the package element of each //package this package depends on. private String[] depends; //holds the package attribute of the package element for each //package this package depends on. private List dependsPack = new ArrayList(); private FileSet set = new FileSet(); public void setName(String name) { this.name = name; } public void setPackage(String pack) { this.pack = pack; } public void setDepends(String d) { //parse this first. StringTokenizer tok = new StringTokenizer(d, ", \t"); depends = new String[tok.countTokens()]; int i = 0; while(tok.hasMoreTokens()) { depends[i] = tok.nextToken(); i++; } } public String getName() { return name; } public String[] getDepends() { return depends; } /** * FILL IN JAVADOC HERE * */ public FileSet getExcludesFileSet(Project p, Location l) throws BuildException { if(failureReason != null) throw new BuildException(failureReason, l); else if(pack.indexOf("/") != -1 || pack.indexOf("\\") != -1) throw new BuildException("A package name cannot contain '\\' or '/' like package="+pack +"\nIt must look like biz.xsoftware.* for example", l); String propertiesResolved = ProjectHelper.replaceProperties(p, pack); //first exclude the compilation module, then exclude all it's //dependencies too. set.setExcludes(propertiesResolved); for(int i = 0; i < dependsPack.size(); i++) { String s = (String)dependsPack.get(i); s = ProjectHelper.replaceProperties(p, s); //must be a good package here because we would have already //compiled it. set.setExcludes(s); } set.setIncludes("**/*.java"); set.setIncludes("**/*.class"); return set; } /** * FILL IN JAVADOC HERE * @param dependsPackage */ public void addExcludesElement(String dependsPackage) { dependsPack.add(dependsPackage); } /** * FILL IN JAVADOC HERE * @return */ public String getPackage() { return pack; } /** * FILL IN JAVADOC HERE * @param string */ public void setFaultReason(String r) { failureReason = r; } }
/* * The Apache Software License, Version 1.1 * * Copyright (c) 2000-2002 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Ant" and "Apache Software * Foundation" must not be used to endorse or promote products derived * from this software without prior written permission. For written * permission, please contact [EMAIL PROTECTED] * * 5. Products derived from this software may not be called "Apache" * nor may "Apache" appear in their names without prior written * permission of the Apache Group. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. */ package org.apache.tools.ant.taskdefs.optional.walls; import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.Move; /* * Created on Aug 25, 2003 * * To change the template for this generated file go to * Window>Preferences>Java>Code Generation>Code and Comments */ /** * FILL IN JAVADOC HERE * * @author $Author: deanhiller $ * @version $ProductVersion:$ $FileVersion:$ $Revision: $ $Date: $ * @since $ProductVersionCreated:$ Aug 25, 2003 */ public class SilentMove extends Move { public void log(String msg) { log(msg, Project.MSG_INFO); } public void log(String msg, int level) { if(level == Project.MSG_INFO) super.log(msg, Project.MSG_VERBOSE); else if(level == Project.MSG_VERBOSE) super.log(msg, Project.MSG_DEBUG); } }
/*
Copyright (c) 2002, Dean Hiller
All rights reserved.
*****************************************************************
IF YOU MAKE CHANGES TO THIS CODE AND DO NOT POST THEM, YOU
WILL BE IN VIOLATION OF THE LICENSE I HAVE GIVEN YOU. Contact
me at [EMAIL PROTECTED] if you need a different
license.
*****************************************************************
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Also, just to clarify a point in the GNU license, this software
can only be bundled with your software if your software is free.
*/
package org.apache.tools.ant.taskdefs.optional.walls;
import java.io.File;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.taskdefs.Javac;
import org.apache.tools.ant.types.DirSet;
import org.apache.tools.ant.types.Path;
import junit.framework.TestCase;
/*
* Created on Aug 25, 2003
*
* To change the template for this generated file go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
/**
* FILL IN JAVADOC HERE
*
* @author $Author: deanhiller $
* @version $ProductVersion:$ $FileVersion:$ $Revision: $ $Date: $
* @since $ProductVersionCreated:$ Aug 25, 2003
*/
public class TestCompileWithWalls extends TestCase {
/**
* FILL IN JAVADOC HERE
* @param arg0
*/
public TestCompileWithWalls(String testName) {
super(testName);
}
public void testTooManyNestedWallElements() {
CompileWithWalls walls = new CompileWithWalls();
walls.createWalls();
walls.createWalls();
try {
walls.execute();
fail("A BuildException should have been thrown and
wasn't");
} catch(BuildException e) {
}
}
public void testTooManyNestedJavacElements() {
CompileWithWalls walls = new CompileWithWalls();
walls.createJavac();
walls.createJavac();
try {
walls.execute();
fail("A BuildException should have been thrown and
wasn't");
} catch(BuildException e) {
}
}
public void testNoWallElement() {
CompileWithWalls walls = new CompileWithWalls();
walls.createJavac();
try {
walls.execute();
fail("A BuildException should have been thrown and
wasn't");
} catch(BuildException e) {
}
}
public void testNoJavacElement() {
CompileWithWalls walls = new CompileWithWalls();
walls.createWalls();
try {
walls.execute();
fail("A BuildException should have been thrown and
wasn't");
} catch(BuildException e) {
}
}
public void testMoreThanOneSrcDirInJavac() {
File f1 = null;
File f2 = null;
try {
Project proj = new Project();
CompileWithWalls compileWithWalls = new
CompileWithWalls();
compileWithWalls.setProject(proj);
Walls walls = compileWithWalls.createWalls();
Javac javac = compileWithWalls.createJavac();
//have to have walls to compile.
Package p = new Package();
p.setName("modA");
p.setPackage("biz.xsoftware");
walls.addConfiguredPackage(p);
String nameDir1 = "dir1";
String nameDir2 = "dir2";
f1 = new File(nameDir1);
f2 = new File(nameDir2);
f1.mkdir();
f2.mkdir();
Path dir2 = new Path(proj, nameDir2);
Path srcDir = new Path(proj, nameDir1);
srcDir.addExisting(dir2);
javac.setSrcdir(srcDir);
try {
compileWithWalls.execute();
fail("A BuildException should have been thrown
and wasn't");
} catch(BuildException e) {
}
} finally {
if(f1 != null) f1.delete();
if(f2 != null) f2.delete();
}
}
public void testPackageDoesntEndWithStar() {
File f1 = null;
try {
Project proj = new Project();
CompileWithWalls compileWithWalls = new
CompileWithWalls();
compileWithWalls.setProject(proj);
Walls walls = compileWithWalls.createWalls();
Javac javac = compileWithWalls.createJavac();
//have to have walls to compile.
Package p = new Package();
p.setName("modA");
p.setPackage("biz.xsoftware");
walls.addConfiguredPackage(p);
String nameDir1 = "dir1";
f1 = new File(nameDir1);
f1.mkdir();
Path srcDir = new Path(proj, nameDir1);
javac.setSrcdir(srcDir);
try {
compileWithWalls.execute();
fail("A BuildException should have been thrown
and wasn't");
} catch(BuildException e) {
}
} finally {
if(f1 != null) f1.delete();
}
}
public void testPackageDoesntHaveSlash() {
File f1 = null;
try {
Project proj = new Project();
CompileWithWalls compileWithWalls = new
CompileWithWalls();
compileWithWalls.setProject(proj);
Walls walls = compileWithWalls.createWalls();
Javac javac = compileWithWalls.createJavac();
//have to have walls to compile.
Package p = new Package();
p.setName("modA");
p.setPackage("biz/xsoftware.*");
walls.addConfiguredPackage(p);
String nameDir1 = "dir1";
f1 = new File(nameDir1);
f1.mkdir();
Path srcDir = new Path(proj, nameDir1);
javac.setSrcdir(srcDir);
try {
compileWithWalls.execute();
fail("A BuildException should have been thrown
and wasn't");
} catch(BuildException e) {
}
} finally {
if(f1 != null) f1.delete();
}
}
public void testDependsOnNonExistPackage() {
File f1 = null;
try {
Project proj = new Project();
CompileWithWalls compileWithWalls = new
CompileWithWalls();
compileWithWalls.setProject(proj);
Walls walls = compileWithWalls.createWalls();
Javac javac = compileWithWalls.createJavac();
//have to have walls to compile.
Package modA = new Package();
modA.setName("modA");
modA.setPackage("biz.xsoftware.*");
modA.setDepends("modB");
walls.addConfiguredPackage(modA);
String nameDir1 = "dir1";
f1 = new File(nameDir1);
f1.mkdir();
Path srcDir = new Path(proj, nameDir1);
javac.setSrcdir(srcDir);
try {
compileWithWalls.execute();
fail("A BuildException should have been thrown
and wasn't");
} catch(BuildException e) {
}
} finally {
if(f1 != null) f1.delete();
}
}
public void testDependsOnPackageAfter() {
File f1 = null;
try {
Project proj = new Project();
CompileWithWalls compileWithWalls = new
CompileWithWalls();
compileWithWalls.setProject(proj);
Walls walls = compileWithWalls.createWalls();
Javac javac = compileWithWalls.createJavac();
//have to have walls to compile.
Package modA = new Package();
modA.setName("modA");
modA.setPackage("biz.xsoftware.*");
modA.setDepends("modB");
Package modB = new Package();
modB.setName("modB");
modB.setPackage("biz.xsoftware.something.*");
walls.addConfiguredPackage(modA);
walls.addConfiguredPackage(modB);
String nameDir1 = "dir1";
f1 = new File(nameDir1);
f1.mkdir();
Path srcDir = new Path(proj, nameDir1);
javac.setSrcdir(srcDir);
try {
compileWithWalls.execute();
fail("A BuildException should have been thrown
and wasn't");
} catch(BuildException e) {
}
} finally {
if(f1 != null) f1.delete();
}
}
}
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
