Index: src/java/org/objectstyle/woproject/ant/AppFormat.java
===================================================================
RCS file: /cvsroot/woproject/woproject/src/java/org/objectstyle/woproject/ant/AppFormat.java,v
retrieving revision 1.14
diff -c -2 -r1.14 AppFormat.java
*** src/java/org/objectstyle/woproject/ant/AppFormat.java	4 Aug 2002 13:59:58 -0000	1.14
--- src/java/org/objectstyle/woproject/ant/AppFormat.java	8 Aug 2002 11:59:00 -0000
***************
*** 60,63 ****
--- 60,65 ----
  
  import org.apache.tools.ant.*;
+ import org.apache.tools.ant.types.FileSet;
+ import org.apache.tools.ant.types.PatternSet;
  import org.apache.tools.ant.types.FilterSet;
  import org.apache.tools.ant.types.FilterSetCollection;
***************
*** 72,76 ****
  	protected HashMap templateMap = new HashMap();
  	protected HashMap filterMap = new HashMap();
! 	protected String appPath;
  	protected String frameworkPaths;
  
--- 74,78 ----
  	protected HashMap templateMap = new HashMap();
  	protected HashMap filterMap = new HashMap();
! 	protected String appPaths;
  	protected String frameworkPaths;
  
***************
*** 107,111 ****
  	 */
  	private void preparePaths() {
! 		appPath = buildAppPath();
  		frameworkPaths = buildFrameworkPaths();
  	}
--- 109,113 ----
  	 */
  	private void preparePaths() {
! 		appPaths = buildAppPaths();
  		frameworkPaths = buildFrameworkPaths();
  	}
***************
*** 117,129 ****
  	 * platforms.
  	 */
! 	protected String buildAppPath() {
! 		String name = getApplicatonTask().getName().toLowerCase() + ".jar";
! 		return "APPROOT"
! 			+ File.separator
! 			+ "Resources"
! 			+ File.separator
! 			+ "Java"
! 			+ File.separator
! 			+ name;
  	}
  
--- 119,136 ----
  	 * platforms.
  	 */
! 	protected String buildAppPaths() {
! 		FileSet fs = new FileSet();
! 		fs.setDir(getApplicatonTask().contentsDir());
! 		PatternSet.NameEntry include = fs.createInclude();
! 		include.setName("**/Resources/Java/*.jar");
! 
! 		DirectoryScanner ds = fs.getDirectoryScanner(task.getProject());
! 		String[] files = ds.getIncludedFiles();
! 		StringBuffer buf = new StringBuffer();
! 
! 		for (int i = 0; i < files.length; i++) {
! 		  buf.append("APPROOT").append(File.separatorChar).append(files[i]).append("\r\n");
! 		}
! 		return buf.toString();
  	}
  
***************
*** 147,150 ****
--- 154,163 ----
  
  			FrameworkSet fs = (FrameworkSet) frameworkSets.get(i);
+ 
+ 			// Don't bother checking if it's embedded.
+ 			if ( fs.getEmbed() ) {
+ 			    continue;
+ 			}
+ 
  			String root = fs.getRootPrefix();
  			try {
***************
*** 264,273 ****
  
  		if (pathSeparator == File.separatorChar) {
! 			filter.addFilter("APP_JAR", appPath);
  			filter.addFilter("FRAMEWORK_JAR", frameworkPaths);
  		} else {
  			filter.addFilter(
  				"APP_JAR",
! 				appPath.replace(File.separatorChar, pathSeparator));
  			filter.addFilter(
  				"FRAMEWORK_JAR",
--- 277,286 ----
  
  		if (pathSeparator == File.separatorChar) {
! 			filter.addFilter("APP_JAR", appPaths);
  			filter.addFilter("FRAMEWORK_JAR", frameworkPaths);
  		} else {
  			filter.addFilter(
  				"APP_JAR",
! 				appPaths.replace(File.separatorChar, pathSeparator));
  			filter.addFilter(
  				"FRAMEWORK_JAR",
***************
*** 328,330 ****
  		return (FilterSetCollection) filterMap.get(targetName);
  	}
! }
\ No newline at end of file
--- 341,343 ----
  		return (FilterSetCollection) filterMap.get(targetName);
  	}
! }
Index: src/java/org/objectstyle/woproject/ant/FrameworkSet.java
===================================================================
RCS file: /cvsroot/woproject/woproject/src/java/org/objectstyle/woproject/ant/FrameworkSet.java,v
retrieving revision 1.8
diff -c -2 -r1.8 FrameworkSet.java
*** src/java/org/objectstyle/woproject/ant/FrameworkSet.java	4 Aug 2002 13:59:58 -0000	1.8
--- src/java/org/objectstyle/woproject/ant/FrameworkSet.java	8 Aug 2002 11:59:00 -0000
***************
*** 63,66 ****
--- 63,67 ----
  import org.apache.tools.ant.Project;
  import org.apache.tools.ant.types.FileSet;
+ import org.apache.tools.ant.util.StringUtils;
  
  /**
***************
*** 71,74 ****
--- 72,76 ----
  public class FrameworkSet extends FileSet {
  	protected String root;
+ 	protected boolean embed = false;
  
  	/** 
***************
*** 89,97 ****
  	public String getRootPrefix() throws BuildException {
  		if (isWORoot()) {
! 			return "WOROOT";
  		} else if (isHomeRoot()) {
! 			return "HOMEROOT";
  		} else if (isLocalRoot()) {
! 			return "LOCALROOT";
  		} else if (isAbsoluteRoot()) {
  			return getRoot();
--- 91,99 ----
  	public String getRootPrefix() throws BuildException {
  		if (isWORoot()) {
! 			return StringUtils.replace(root, WOPropertiesHandler.WO_ROOT, "WOROOT");
  		} else if (isHomeRoot()) {
! 			return StringUtils.replace(root, WOPropertiesHandler.HOME_ROOT, "HOMEROOT");
  		} else if (isLocalRoot()) {
! 			return StringUtils.replace(root, WOPropertiesHandler.LOCAL_ROOT, "LOCALROOT");
  		} else if (isAbsoluteRoot()) {
  			return getRoot();
***************
*** 102,114 ****
  
  	public boolean isWORoot() {
! 		return WOPropertiesHandler.WO_ROOT.equals(root);
  	}
  
  	public boolean isHomeRoot() {
! 		return WOPropertiesHandler.HOME_ROOT.equals(root);
  	}
  
  	public boolean isLocalRoot() {
! 		return WOPropertiesHandler.LOCAL_ROOT.equals(root);
  	}
  
--- 104,116 ----
  
  	public boolean isWORoot() {
! 		return root.startsWith(WOPropertiesHandler.WO_ROOT);
  	}
  
  	public boolean isHomeRoot() {
! 		return root.startsWith(WOPropertiesHandler.HOME_ROOT);
  	}
  
  	public boolean isLocalRoot() {
! 		return root.startsWith(WOPropertiesHandler.LOCAL_ROOT);
  	}
  
***************
*** 140,148 ****
  
  		if (isWORoot()) {
! 			super.setDir(new File(propsHandler.getWORoot()));
  		} else if (isLocalRoot()) {
! 			super.setDir(new File(propsHandler.getLocalRoot()));
  		} else if (isHomeRoot()) {
! 			super.setDir(new File(propsHandler.getHomeRoot()));
  		} else if (isAbsoluteRoot()) {
  			super.setDir(new File(root));
--- 142,152 ----
  
  		if (isWORoot()) {
! 			String newRoot = StringUtils.replace(root, WOPropertiesHandler.WO_ROOT, propsHandler.getWORoot());
! 			super.setDir(new File(newRoot));
  		} else if (isLocalRoot()) {
! 			String newRoot = StringUtils.replace(root, WOPropertiesHandler.LOCAL_ROOT, propsHandler.getLocalRoot());
! 			super.setDir(new File(newRoot));
  		} else if (isHomeRoot()) {
! 			String newRoot = StringUtils.replace(root, WOPropertiesHandler.HOME_ROOT, propsHandler.getHomeRoot());
  		} else if (isAbsoluteRoot()) {
  			super.setDir(new File(root));
***************
*** 152,155 ****
--- 156,167 ----
  	}
  
+ 	public void setEmbed(boolean flag) {
+ 		this.embed = flag;
+ 	}
+ 
+ 	public boolean getEmbed() {
+ 		return this.embed;
+ 	}
+ 
  	public String[] findJars(Project project, String frameworkDir) {
  		String jarDirName =
***************
*** 182,184 ****
  		}
  	}
! }
\ No newline at end of file
--- 194,196 ----
  		}
  	}
! }
Index: src/java/org/objectstyle/woproject/ant/WOApplication.java
===================================================================
RCS file: /cvsroot/woproject/woproject/src/java/org/objectstyle/woproject/ant/WOApplication.java,v
retrieving revision 1.19
diff -c -2 -r1.19 WOApplication.java
*** src/java/org/objectstyle/woproject/ant/WOApplication.java	1 Aug 2002 14:55:55 -0000	1.19
--- src/java/org/objectstyle/woproject/ant/WOApplication.java	8 Aug 2002 11:59:00 -0000
***************
*** 57,65 ****
  
  import java.io.File;
! import java.util.ArrayList;
! import java.util.List;
  
  import org.apache.tools.ant.BuildException;
  import org.apache.tools.ant.types.PatternSet;
  
  /**
--- 57,67 ----
  
  import java.io.File;
! import java.util.*;
  
  import org.apache.tools.ant.BuildException;
  import org.apache.tools.ant.types.PatternSet;
+ import org.apache.tools.ant.taskdefs.Copy;
+ import org.apache.tools.ant.types.FileSet;
+ import org.apache.tools.ant.DirectoryScanner;
  
  /**
***************
*** 85,89 ****
--- 87,97 ----
  
  	protected ArrayList frameworkSets = new ArrayList();
+ 	private Vector lib = new Vector();
  	protected boolean stdFrameworks = true;
+ 	protected boolean embedStdFrameworks = false;
+ 
+ 	public void addLib(FileSet set) {
+ 	    lib.addElement(set);
+ 	}
  
      public String getPrincipalClass() {
***************
*** 107,110 ****
--- 115,121 ----
  			jarClasses();
  		}
+ 		if (hasLib()) {
+ 		    copyLibs();
+ 		}
  		if (hasResources()) {
  			copyResources();
***************
*** 113,116 ****
--- 124,130 ----
  			copyWsresources();
  		}
+ 		if (hasEmbeddedFrameworks()) {
+ 		    copyEmbeddedFrameworks();
+ 		}
  
  		// create all needed scripts
***************
*** 118,121 ****
--- 132,196 ----
  	}
  
+ 	protected void copyEmbeddedFrameworks() throws BuildException {
+ //	    Copy cp = subtaskFactory.getResourceCopy();
+ 	    Copy cp = new Copy();
+ 	    cp.setOwningTarget(getOwningTarget());
+             cp.setProject(getProject()); 
+             cp.setTaskName(getTaskName());   
+             cp.setLocation(getLocation()); 
+ 
+ 	    cp.setTodir(embeddedFrameworksDir());
+  
+ 	    // The purpose of this is to create filesets that actually
+ 	    // allow the framework directory to be copied into the
+ 	    // WOApplication directory.  If we didn't do this, we'd
+ 	    // have to append '/' or '/**' to the end of the includes
+ 	    // in the <frameworks> tag.
+ 	    List frameworkSets = getFrameworkSets();
+ 	    int size = frameworkSets.size();
+ 	    for (int i = 0; i < size; i++) {
+ 		FrameworkSet fs = (FrameworkSet)frameworkSets.get(i);
+ 
+ 		if ( fs.getEmbed() == false ) {
+ 		    continue;
+ 		}
+ 
+ 		File root = fs.getDir(getProject());
+ 		DirectoryScanner ds = fs.getDirectoryScanner(getProject());
+ 		String[] dirs = ds.getIncludedDirectories();
+ 
+ 		for (int j = 0; j < dirs.length; j++) {
+ 		    String includeName = dirs[j];
+ 
+ 		    if ( includeName.endsWith(".framework") == false ) {
+ 			throw new BuildException("'name' attribute must end with '.framework'");
+ 		    }
+ 
+ 		    FileSet newFs = new FileSet();
+ 		    PatternSet.NameEntry include;
+ 
+ 		    newFs.setDir(root);
+ 		    include = newFs.createInclude();
+ 		    include.setName(includeName + "/Resources/");
+ 		    include = newFs.createInclude();
+ 		    include.setName(includeName + "/WebServerResources/");
+ 		    
+ 		    cp.addFileset(newFs);
+ 		}
+ 	    }
+ 	    cp.execute();
+ 	}
+ 
+ 	protected void copyLibs() throws BuildException {
+ 	    Copy cp = subtaskFactory.getResourceCopy();
+ 	    cp.setTodir(new File(resourcesDir(), "Java"));
+  
+ 	    Enumeration en = lib.elements();
+ 	    while (en.hasMoreElements()) {
+ 		cp.addFileset((FileSet) en.nextElement());
+ 	    }
+ 	    cp.execute();
+ 	}
+ 
  	/**
  	 * Returns a list of standard frameworks as a FrameworkSet. */
***************
*** 123,135 ****
  		FrameworkSet set = new FrameworkSet();
  		set.setProject(this.getProject());
! 		set.setRoot(WOPropertiesHandler.WO_ROOT);
  
  		for (int i = 0; i < stdFrameworkNames.length; i++) {
  			String path =
! 				"Library/Frameworks/" + stdFrameworkNames[i] + ".framework";
  			PatternSet.NameEntry include = set.createInclude();
  			include.setName(path);
  		}
  
  		return set;
  	}
--- 198,214 ----
  		FrameworkSet set = new FrameworkSet();
  		set.setProject(this.getProject());
! 		set.setRoot(WOPropertiesHandler.WO_ROOT + "/Library/Frameworks");
! //		set.setRoot(WOPropertiesHandler.WO_ROOT);
  
  		for (int i = 0; i < stdFrameworkNames.length; i++) {
  			String path =
! //				"Library/Frameworks/" + stdFrameworkNames[i] + ".framework";
! 				stdFrameworkNames[i] + ".framework";
  			PatternSet.NameEntry include = set.createInclude();
  			include.setName(path);
  		}
  
+ 		// Force embedding of the standard frameworks.
+ 		set.setEmbed(embedStdFrameworks);
  		return set;
  	}
***************
*** 145,148 ****
--- 224,237 ----
  	}
  
+ 	public void setEmbedStdFrameworks(boolean flag) {
+ 		embedStdFrameworks = flag;
+ 		// If we request embedding for the standard
+ 		// frameworks, we certainly want to reference
+ 		// them.
+ 		if ( flag ) {
+ 		  stdFrameworks = true;
+ 		}
+ 	}
+ 
  	/**
  	 * Returns location where WOApplication is being built up. 
***************
*** 158,161 ****
--- 247,254 ----
  	}
  
+ 	protected File embeddedFrameworksDir() {
+ 		return new File(contentsDir(), "Frameworks");
+ 	}
+ 
  	protected File resourcesDir() {
  		return new File(contentsDir(), "Resources");
***************
*** 166,169 ****
--- 259,282 ----
  	}
  
+ 	protected boolean hasLib() {
+ 	    return lib.size() > 0;
+ 	}
+ 
+ 	protected boolean hasEmbeddedFrameworks() {
+ 	    List frameworkSets = getFrameworkSets();
+ 	    int size = frameworkSets.size();
+ 
+ 	    for (int i = 0; i < size; i++) {
+ 		FrameworkSet fs = (FrameworkSet)frameworkSets.get(i);
+ 
+ 		if ( fs.getEmbed() ) {
+ 		    return true;
+ 		}
+ 	    }
+ 
+ 	    return false;
+ 	}
+ 
+ 	/**
  	/**
  	 * Create a nested FrameworkSet.
***************
*** 185,187 ****
  		}
  	}
! }
\ No newline at end of file
--- 298,300 ----
  		}
  	}
! }
Index: src/java/org/objectstyle/woproject/ant/WOPropertiesHandler.java
===================================================================
RCS file: /cvsroot/woproject/woproject/src/java/org/objectstyle/woproject/ant/WOPropertiesHandler.java,v
retrieving revision 1.4
diff -c -2 -r1.4 WOPropertiesHandler.java
*** src/java/org/objectstyle/woproject/ant/WOPropertiesHandler.java	4 Aug 2002 13:59:58 -0000	1.4
--- src/java/org/objectstyle/woproject/ant/WOPropertiesHandler.java	8 Aug 2002 11:59:00 -0000
***************
*** 125,129 ****
  
  			if (localRoot == null) {
! 				localRoot = getWORoot() + "/Local";
  			}
  		}
--- 125,136 ----
  
  			if (localRoot == null) {
! 				String osName = System.getProperty("os.name");
! 
! 				// This should really be "Darwin"
! 				if ( osName.equals("Mac OS X") ) {
! 				    localRoot = "";
! 				} else {
! 				    localRoot = getWORoot() + "/Local";
! 				}
  			}
  		}
***************
*** 186,188 ****
  		env = props;
  	}
! }
\ No newline at end of file
--- 193,195 ----
  		env = props;
  	}
! }