woproject/projects/woproject/src/java/org/objectstyle/woproject/ant ResourcesSet.java,NONE,1.1 WOPBXBuild.java,1.2,1.3 WOTask.java,1.5,1.6
[email protected] Mon, 27 Mar 2006 09:43:06 -0800 (PST)
| Newsgroups | gmane.comp.web.webobjects.woproject.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/woproject/woproject/projects/woproject/src/java/org/objectstyle/woproject/ant In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22971/projects/woproject/src/java/org/objectstyle/woproject/ant Modified Files: WOPBXBuild.java WOTask.java Added Files: ResourcesSet.java Log Message: Applied patch from Bod Schwarzmann for http://objectstyle.org/jira/browse/WOL-220 Resource filesets should be allowed to be conditionally run --- NEW FILE: ResourcesSet.java --- /* ==================================================================== * * The ObjectStyle Group Software License, Version 1.0 * * Copyright (c) 2002 - 2005 The ObjectStyle Group * and individual authors of the software. 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 * ObjectStyle Group (http://objectstyle.org/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "ObjectStyle Group" and "Cayenne" * 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 "ObjectStyle" * nor may "ObjectStyle" appear in their names without prior written * permission of the ObjectStyle 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 OBJECTSTYLE GROUP 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 ObjectStyle Group. For more * information on the ObjectStyle Group, please see * <http://objectstyle.org/>. * */ package org.objectstyle.woproject.ant; import org.apache.tools.ant.ProjectHelper; import org.apache.tools.ant.types.FileSet; /** * A subclass of FileSet with special support for building a destination Resources directory. * * @author Bob Schwarzmann */ public class ResourcesSet extends FileSet { protected String ifCondition = ""; /** * Creates new ResourcesSet. */ public ResourcesSet() { super(); } public void setIf(String string) { ifCondition = string == null ? "" : string; } protected boolean testIfCondition() { if ("".equals(ifCondition)) { return true; } String string = ProjectHelper.replaceProperties(getProject(), ifCondition, getProject().getProperties()); return getProject().getProperty(string) != null; } } Index: WOPBXBuild.java =================================================================== RCS file: /cvsroot/woproject/woproject/projects/woproject/src/java/org/objectstyle/woproject/ant/WOPBXBuild.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- WOPBXBuild.java 11 Dec 2004 10:26:06 -0000 1.2 +++ WOPBXBuild.java 27 Mar 2006 17:42:40 -0000 1.3 @@ -210,7 +210,7 @@ */ i = resourcesFiles.iterator(); while (i.hasNext()) { - FileSet set = new FileSet(); + ResourcesSet set = new ResourcesSet(); File tempFile = new File(this.getProject().getBaseDir(), ((PBXBuildFile) i.next()).getPath()); set.setProject(this.getProject()); @@ -226,7 +226,7 @@ */ i = webResourcesFiles.iterator(); while (i.hasNext()) { - FileSet set = new FileSet(); + ResourcesSet set = new ResourcesSet(); File tempFile = new File(this.getProject().getBaseDir(), ((PBXBuildFile) i.next()).getPath()); set.setProject(this.getProject()); Index: WOTask.java =================================================================== RCS file: /cvsroot/woproject/woproject/projects/woproject/src/java/org/objectstyle/woproject/ant/WOTask.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- WOTask.java 13 Apr 2005 17:49:45 -0000 1.5 +++ WOTask.java 27 Mar 2006 17:42:40 -0000 1.6 @@ -204,7 +204,7 @@ } /** - * Method addResources. + * Method addSources. * * @param set */ @@ -217,7 +217,7 @@ * * @param set */ - public void addResources(FileSet set) { + public void addResources(ResourcesSet set) { resources.addElement(set); } @@ -235,7 +235,7 @@ * * @param set */ - public void addWsresources(FileSet set) { + public void addWsresources(ResourcesSet set) { wsresources.addElement(set); } @@ -431,11 +431,20 @@ Copy cp = this.getSubtaskFactory().getResourceCopy(); cp.setTodir(resourcesDir()); + int count = 0; Enumeration en = resources.elements(); while (en.hasMoreElements()) { - cp.addFileset((FileSet) en.nextElement()); + ResourcesSet rs = (ResourcesSet) en.nextElement(); + if( rs.testIfCondition() ){ + cp.addFileset( (FileSet) rs ); + count++; + } + } + + // if no filesets were added, then don't run copy + if( count > 0){ + cp.execute(); } - cp.execute(); } /** @@ -448,19 +457,28 @@ Copy cp = this.getSubtaskFactory().getResourceCopy(); cp.setTodir(wsresourcesDir()); + int count = 0; Enumeration en = wsresources.elements(); while (en.hasMoreElements()) { - cp.addFileset((FileSet) en.nextElement()); - } - cp.execute(); + ResourcesSet rs = (ResourcesSet) en.nextElement(); + if( rs.testIfCondition() ){ + cp.addFileset( (FileSet) rs ); + count++; + } + } + + // if no filesets were added, then don't run copy + if( count > 0){ + cp.execute(); - // do split install - if (doingSplitInstall()) { - log("Split install WebServerResources of " + name + " in " - + wsDestDir); - cp.setTodir(wsresourcesDestDir()); - cp.execute(); - } + // do split install + if (doingSplitInstall()) { + log("Split install WebServerResources of " + name + " in " + + wsDestDir); + cp.setTodir(wsresourcesDestDir()); + cp.execute(); + } + } } /** ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642