You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by ri...@apache.org on 2009/07/13 15:26:06 UTC

svn commit: r793581 [4/23] - in /felix/trunk/sigil: ./ bld-ivy/ bld-ivy/example/ bld-ivy/example/dependence/ bld-ivy/example/dependence/dependee/ bld-ivy/example/dependence/dependee/src/ bld-ivy/example/dependence/dependee/src/standalone/ bld-ivy/examp...

Added: felix/trunk/sigil/bld-ivy/src/org/cauldron/bld/ivy/SigilResolver.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bld-ivy/src/org/cauldron/bld/ivy/SigilResolver.java?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bld-ivy/src/org/cauldron/bld/ivy/SigilResolver.java (added)
+++ felix/trunk/sigil/bld-ivy/src/org/cauldron/bld/ivy/SigilResolver.java Mon Jul 13 13:25:46 2009
@@ -0,0 +1,383 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.cauldron.bld.ivy;
+
+import static java.lang.String.format;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URL;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+import java.util.jar.JarInputStream;
+import java.util.jar.Manifest;
+
+import org.apache.ivy.core.module.descriptor.Artifact;
+import org.apache.ivy.core.module.descriptor.DependencyDescriptor;
+import org.apache.ivy.core.module.id.ModuleRevisionId;
+import org.apache.ivy.core.resolve.ResolveData;
+import org.apache.ivy.plugins.repository.Resource;
+import org.apache.ivy.plugins.repository.url.URLResource;
+import org.apache.ivy.plugins.resolver.BasicResolver;
+import org.apache.ivy.plugins.resolver.util.ResolvedResource;
+import org.apache.ivy.util.FileUtil;
+import org.cauldron.bld.config.BldFactory;
+import org.cauldron.bld.core.internal.model.osgi.RequiredBundle;
+import org.cauldron.sigil.model.IModelElement;
+import org.cauldron.sigil.model.common.VersionRange;
+import org.cauldron.sigil.model.eclipse.ISigilBundle;
+import org.cauldron.sigil.model.osgi.IBundleModelElement;
+import org.cauldron.sigil.repository.IResolution;
+import org.cauldron.sigil.repository.ResolutionException;
+
+/**
+ * This resolver is able to work with Sigil repositories.
+ * It does not allow publishing.
+ */
+public class SigilResolver extends BasicResolver implements IBldResolver {
+	/** the sigil-injected dependency organisation name */
+	static final String ORG_SIGIL = "sigil";
+	
+	private IBldResolver resolver;
+	private String config;
+	private boolean extractBCP = false;
+	private Map<String, Resource> resourcesCache = new HashMap<String, Resource>();
+	
+	/**
+	 * no-args constructor required by Ivy.
+	 * 
+	 * XXX: It doesn't currently seem to matter that Ivy instantiates this many times,
+	 * since SigilParser caches it, and the ProjectRepositoryProvider static cache
+	 * prevents it being re-loaded unnecessarily.
+	 * 
+	 * If this should become a problem, then we will need to delegate to a singleton instance,
+	 * as we have done in SigilParser.
+	 */
+	public SigilResolver() {
+	}
+	
+	public void setConfig(String config) {
+		this.config = config;
+	}
+	
+	/**
+	 * if true, resolver extracts any jars embedded in Bundle-ClassPath.
+	 */
+	public void setExtractBCP(String extract) {
+		this.extractBCP = Boolean.parseBoolean(extract);
+	}
+
+	private IBldResolver getResolver() {
+		if (resolver == null) {
+			if (config == null) {
+				throw new Error("SigilResolver: not configured. Specify config=\"PATH\" in ivysettings.xml.");
+			}
+			try {
+				URI uri;
+				File file = new File(config);
+				
+				if (file.isAbsolute()) {
+					uri = file.toURI();
+				} else {
+    				URI cwd = new File(".").toURI();
+    				uri = cwd.resolve(config);
+				}
+				
+				Map<String, Properties> repositories = BldFactory.getConfig(uri).getRepositoryConfig();
+				resolver = new BldResolver(repositories);
+			} catch (IOException e) {
+				throw new Error("SigilResolver: failed to configure: " + e);
+			}
+		}
+		return resolver;
+	}
+
+	public IResolution resolveOrFail(IModelElement element, boolean transitive) throws ResolutionException {
+		return getResolver().resolveOrFail(element, transitive);
+	}
+
+	public IResolution resolve(IModelElement element, boolean transitive) {
+		return getResolver().resolve(element, transitive);
+	}
+
+	public String getTypeName() {
+		return "sigil";
+	}
+
+	/*
+	 * synthesize an ivy descriptor for a Sigil dependency. called after Sigil
+	 * resolution, so descriptor already contains resolved version.
+	 */
+	public ResolvedResource findIvyFileRef(DependencyDescriptor dd, ResolveData data) {
+		ResolvedResource ref = null;
+
+		ModuleRevisionId id = dd.getDependencyRevisionId();
+
+		if (!id.getOrganisation().equals(ORG_SIGIL)) {
+			return null;
+		}
+
+		ISigilBundle bundle = resolve(id);
+		if (bundle == null) {
+			return null;
+		}
+
+		String symbolicName = id.getName();
+		String version = bundle.getVersion().toString();
+
+		Resource res = new SigilIvy(extractBCP ? bundle : null, symbolicName, version);
+		ref = new ResolvedResource(res, version);
+
+		Log.debug(format("findIvyFileRef: dd=%s => ref=%s", dd, ref));
+		return ref;
+	}
+
+	@Override
+	protected ResolvedResource findArtifactRef(Artifact artifact, Date date) {
+		String name = artifact.getName();
+		ModuleRevisionId id = artifact.getModuleRevisionId();
+
+		if (!id.getOrganisation().equals(ORG_SIGIL)) {
+			return null;
+		}
+		
+		ISigilBundle bundle = resolve(id);
+		if (bundle == null) {
+			return null;
+		}
+
+		IBundleModelElement info = bundle.getBundleInfo();
+		URI uri = info.getUpdateLocation();
+		Resource res = null;
+
+		try {
+			URL url =  (uri != null) ? uri.toURL() : bundle.getLocation().toFile().toURL();
+    		if (name.contains("!")) {
+    			String[] split = name.split("!");
+    			url = new URL("jar:" + url + "!/" + split[1] + "." + artifact.getExt());
+    		}
+			res = new URLResource(url);
+		} catch (MalformedURLException e) {
+			System.out.println("Oops! " + e);
+		}
+
+		String version = bundle.getVersion().toString();
+		ResolvedResource ref = new ResolvedResource(res, version);
+
+		Log.debug(format("findArtifactRef: artifact=%s, date=%s => ref=%s", artifact, date, ref));
+		return ref;
+	}
+
+	private ISigilBundle resolve(ModuleRevisionId id) {
+		String revision = id.getRevision();
+		String range = revision;
+
+		if (revision.indexOf(',') < 0) {
+			// SigilParser has already resolved the revision from the import
+			// version range.
+			// We now need to locate the same bundle to get its download URL.
+			// We must use an OSGi version range to specify the exact version,
+			// otherwise it will resolve to "specified version or above".
+			range = "[" + revision + "," + revision + "]";
+		}
+
+		RequiredBundle bundle = new RequiredBundle();
+		bundle.setSymbolicName(id.getName());
+		bundle.setVersions(VersionRange.parseVersionRange(range));
+
+		try {
+			IResolution resolution = resolveOrFail(bundle, false);
+			ISigilBundle[] bundles = resolution.getBundles().toArray(new ISigilBundle[0]);
+			if (bundles.length == 1) {
+				return bundles[0];
+			}
+		} catch (ResolutionException e) {
+			return null;
+		}
+		return null;
+	}
+
+	/*
+	 * Implement BasicResolver abstract methods
+	 */
+
+	@Override
+	protected long get(Resource res, File dest) throws IOException {
+		FileUtil.copy(res.openStream(), dest, null);
+		long len = res.getContentLength();
+		Log.debug(format("get(%s, %s) = %d", res, dest, len));
+		return len;
+	}
+
+
+	@Override
+	public Resource getResource(String source) throws IOException {
+		source = encode(source);
+		Resource res = resourcesCache.get(source);
+		if (res == null) {
+			res = new URLResource(new URL(source));
+			resourcesCache.put(source, res);
+		}
+		Log.debug(format("SIGIL: getResource(%s) = %d", source, res));
+		return res;
+	}
+
+	private static String encode(String source) {
+		return source.trim().replaceAll(" ", "%20");
+	}
+
+	@SuppressWarnings("unchecked")
+	@Override
+	protected Collection findNames(Map tokenValues, String token) {
+		throw new Error("SigilResolver: findNames not supported.");
+	}
+
+	public void publish(Artifact artifact, File src, boolean overwrite) throws IOException {
+		throw new Error("SigilResolver: publish not supported.");
+	}
+
+	public void beginPublishTransaction(ModuleRevisionId module, boolean overwrite) throws IOException {
+		// stop publish attempts being silently ignored.
+		throw new Error("SigilResolver: publish not supported.");
+	}
+
+	/*
+	 * Synthesize a virtual ivy file for a Sigil dependency.
+	 */
+	static class SigilIvy implements Resource {
+		private StringBuilder content = new StringBuilder();
+		private String name;
+		private boolean exists = true;
+
+		private SigilIvy() {
+		}
+
+		public SigilIvy(ISigilBundle bundle, String module, String rev) {
+			this.name = "sigil!" + module + "#" + rev;
+
+			String org = ORG_SIGIL;
+			// FIXME: make status and pub configurable
+			String status = "release";
+			String pub = "20080912162859";
+
+			content.append("<ivy-module version=\"1.0\">\n");
+
+			content.append(format(
+					"<info organisation=\"%s\" module=\"%s\" revision=\"%s\" status=\"%s\" publication=\"%s\"/>\n",
+					org, module, rev, status, pub));
+			
+			String bcp = readBundleClassPath(bundle);
+			if (bcp != null) {
+    			content.append("<publications>\n");
+    			for (String j : bcp.split(",\\s*")) {
+    				if (j.equals(".")) {
+            			content.append("<artifact/>\n");
+    				} else if (!j.endsWith("component-activator.jar")) {
+    					if (j.endsWith(".jar"))
+    						j = j.substring(0, j.length() - 4);
+            			content.append(format("<artifact name=\"%s!%s\"/>\n", module, j));
+        			}
+    			}
+    			content.append("</publications>\n");
+			}
+
+			// TODO: add dependencies?
+			// <dependencies>
+			// <dependency org="org.apache" name="log4j" rev="1.2.12"
+			// revConstraint="[1.2,1.3)"/>
+			// </dependencies>
+
+			content.append("</ivy-module>\n");
+		}
+		
+        private String readBundleClassPath(ISigilBundle bundle) {
+        	if (bundle == null)
+        		return null;
+        	
+        	URI uri = bundle.getBundleInfo().getUpdateLocation();
+            InputStream is = null;
+			try {
+    			URL url =  (uri != null) ? uri.toURL() : bundle.getLocation().toFile().toURL();
+				is = url.openStream();
+            	JarInputStream js = new JarInputStream(is, false);
+                Manifest m = js.getManifest();
+                if (m != null)
+                    return (String) m.getMainAttributes().getValue("Bundle-ClassPath");
+			} catch (IOException e) {
+			} finally {
+				if (is != null) {
+					try {
+						is.close();
+					} catch (IOException e2) {
+					}
+				}
+			}
+			
+            return null;
+        }
+
+		public String toString() {
+			return "SigilIvy[" + name + "]";
+		}
+
+		// clone is used to read checksum files
+		// so clone(getName() + ".sha1").exists() should be false
+		public Resource clone(String cloneName) {
+			Log.debug("SigilIvy: clone: " + cloneName);
+			SigilIvy clone = new SigilIvy();
+			clone.name = cloneName;
+			clone.exists = false;
+			return clone;
+		}
+
+		public boolean exists() {
+			return exists;
+		}
+
+		public long getContentLength() {
+			return content.length();
+		}
+
+		public long getLastModified() {
+			// TODO Auto-generated method stub
+			Log.debug("NOT IMPLEMENTED: getLastModified");
+			return 0;
+		}
+
+		public String getName() {
+			return name;
+		}
+
+		public boolean isLocal() {
+			return false;
+		}
+
+		@SuppressWarnings("deprecation")
+		public InputStream openStream() throws IOException {
+			return new java.io.StringBufferInputStream(content.toString());
+		}
+	}
+}

Added: felix/trunk/sigil/bld-ivy/test/config/proj1/newton-project.xml
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bld-ivy/test/config/proj1/newton-project.xml?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bld-ivy/test/config/proj1/newton-project.xml (added)
+++ felix/trunk/sigil/bld-ivy/test/config/proj1/newton-project.xml Mon Jul 13 13:25:46 2009
@@ -0,0 +1,35 @@
+<?xml version='1.0' encoding='utf-8'?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you 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.
+-->
+<sigil:bundle xmlns:sigil="http://sigil.codecauldron.org/xml/sigil-namespace">
+<classpathEntry>&lt;classpathentry kind="lib" path="lib/dependee.jar"/&gt;</classpathEntry>
+<classpathEntry>&lt;classpathentry kind="src" path="src"/&gt;</classpathEntry>
+<bundle>
+<bundle-version>0.0.0</bundle-version>
+<bundle-vendor>Paremus Limited</bundle-vendor>
+<bundle-symbolicName>org.example.helloworld</bundle-symbolicName>
+<fragment-host bundle="com.springsource.org.apache.commons.lang" version="[2.0.0,2.4.0)"/>
+<export-package package="org.example.helloworld.api" version="0.0.0"/><import-package package="org.cauldron.newton.command" version="1.2.0"/><import-package package="org.apache.log4j" version="[1.2.14,1.3)"/><import-package package="org.example.helloworld.api" version="0"/><import-package package="org.cauldron.newton.command.console" version="1.2.0"/></bundle>
+<sigil:composite xmlns:sigil="http://sigil.codecauldron.org/xml/sigil-namespace">
+<location>sca/org.example.helloworld.service.composite</location>
+</sigil:composite>
+<sigil:composite xmlns:sigil="http://sigil.codecauldron.org/xml/sigil-namespace">
+<location>sca/org.example.helloworld.cli.composite</location>
+</sigil:composite>
+</sigil:bundle>

Added: felix/trunk/sigil/bld-ivy/test/config/proj1/sigil.properties
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bld-ivy/test/config/proj1/sigil.properties?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bld-ivy/test/config/proj1/sigil.properties (added)
+++ felix/trunk/sigil/bld-ivy/test/config/proj1/sigil.properties Mon Jul 13 13:25:46 2009
@@ -0,0 +1,33 @@
+# proj1 sigil.properties
+
+version: 1.2.3.beta1
+
+-bundles: main
+
+-exports: standalone
+
+-imports: \
+  javax.swing, \
+  javax.servlet, \
+  org.apache.commons.logging, \
+  org.apache.commons.lang, \
+  org.apache.log4j, \
+
+ximports: \
+  !org.cauldron.newton.framework, \
+  !org.osgi.*, \
+  org.apache.log4j;version="1.2.3", \
+
+-fragment: \
+  com.springsource.org.apache.commons.lang;version="[2.0.0,2.4.0)"
+
+-composites: \
+  ivy.xml
+
+-resources: \
+  version.properties
+
+header;Bundle-Vendor: Paremus Limited
+header;Random-Heading: this header is a bit like random
+
+# end

Added: felix/trunk/sigil/bld-ivy/test/config/sigil-defaults.properties
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bld-ivy/test/config/sigil-defaults.properties?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bld-ivy/test/config/sigil-defaults.properties (added)
+++ felix/trunk/sigil/bld-ivy/test/config/sigil-defaults.properties Mon Jul 13 13:25:46 2009
@@ -0,0 +1,6 @@
+# sigil defaults
+
+package;javax.servlet:			(2.4,3.0]
+package;org.apache.log4j:		[1.2.14,1.3)
+package;org.apache.commons.lang:	[2.0.0,2.4.0)
+

Added: felix/trunk/sigil/bld-ivy/test/dependence/build.xml
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bld-ivy/test/dependence/build.xml?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bld-ivy/test/dependence/build.xml (added)
+++ felix/trunk/sigil/bld-ivy/test/dependence/build.xml Mon Jul 13 13:25:46 2009
@@ -0,0 +1,43 @@
+<?xml version="1.0">
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you 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="dependence" default="clean">
+    
+    <!-- ================================= 
+          target: clean              
+         ================================= -->
+    <target name="clean" description="--> clean directories">
+        <delete includeemptydirs="true"> 
+            <fileset dir="settings" excludes="ivysettings.*, sigil*.properties" />
+		</delete>
+        <ant dir="dependee" antfile="build.xml" target="clean" inheritall="false" inheritrefs="false" />
+        <ant dir="depender" antfile="build.xml" target="clean" inheritall="false" inheritrefs="false" />
+    </target>
+
+    <!-- ================================= 
+          target: all              
+         ================================= -->
+    <target name="all" depends="clean" description="--> make the whole example of dependency">
+        <ant dir="dependee" antfile="build.xml" target="publish" inheritall="false" inheritrefs="false" />
+        <ant dir="depender" antfile="build.xml" inheritall="false" inheritrefs="false" />
+        <ant dir="dependee" antfile="build.xml" target="publish" inheritall="false" inheritrefs="false" />
+        <ant dir="depender" antfile="build.xml" inheritall="false" inheritrefs="false" />
+    </target>
+    
+</project>

Added: felix/trunk/sigil/bld-ivy/test/dependence/dependee/build.xml
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bld-ivy/test/dependence/dependee/build.xml?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bld-ivy/test/dependence/dependee/build.xml (added)
+++ felix/trunk/sigil/bld-ivy/test/dependence/dependee/build.xml Mon Jul 13 13:25:46 2009
@@ -0,0 +1,135 @@
+<?xml version="1.0">
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you 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="dependee" default="run" xmlns:ivy="antlib:org.apache.ivy.ant">
+    <!-- some variables used -->
+    <property name="lib.dir" value="${basedir}/lib" />
+    <property name="build.dir" value="${basedir}/build" />
+    <property name="classes.dir" value="${build.dir}/classes" />
+    <property name="src.dir" value="${basedir}/src" />
+
+    <!-- ivy properties used -->
+    <property name="ivy.settings.dir" value="../settings" />
+    <property file="${ivy.settings.dir}/ivysettings.properties" />
+
+    <!-- paths used for compilation and run -->
+    <path id="lib.path.id">
+	<fileset dir="${lib.dir}" />
+    </path>
+    <path id="run.path.id">
+	<path refid="lib.path.id" />
+	<path location="${classes.dir}" />
+    </path>
+    
+    <property name="ivy.jar.file"
+	     value="/opt/apache-ivy-2.0.0/ivy-2.0.0.jar"/>
+
+    <!-- ================================= 
+          target: init
+         ================================= -->
+    <target name="init">
+      <taskdef resource="org/apache/ivy/ant/antlib.xml"
+		    uri="antlib:org.apache.ivy.ant"
+		    classpath="${ivy.jar.file}"/>
+      <ivy:settings file="${ivy.settings.dir}/ivysettings.xml" />
+
+	<taskdef name="sigil.bundle"
+	  classname="org.cauldron.bld.ant.BundleTask"
+	  classpath="${basedir}/../../../target/sigil-ivy-plugin.jar"/>
+    </target>
+
+    <!-- ================================= 
+          target: resolve              
+         ================================= -->
+    <target name="resolve" depends="init"
+    	description="--> resolve and retrieve dependencies with ivy">
+        <ivy:retrieve />
+    </target>
+
+    <!-- ================================= 
+          target: report              
+         ================================= -->
+    <target name="report" depends="resolve" description="--> generates a report of dependencies">
+        <ivy:report todir="${build.dir}"/>
+    </target>
+	
+    <!-- ================================= 
+          target: compile              
+         ================================= -->
+    <target name="compile" depends="resolve" description="--> description">
+        <mkdir dir="${classes.dir}" />
+        <javac srcdir="${src.dir}" destdir="${classes.dir}" classpathref="lib.path.id" />
+    </target>
+    
+    <!-- ================================= 
+          target: run
+         ================================= -->
+    <target name="run" depends="compile" description="--> compile and run the project">
+        <java classpathref="run.path.id" classname="standalone.Main"/>
+    </target>
+    
+    <!-- ================================= 
+          target: jar              
+         ================================= -->
+    <target name="jar" depends="compile" description="--> make a jar file for this project">
+        <propertyfile file="${classes.dir}/version.properties">
+	        <entry  key="version" type="int" operation="+" default="0" />
+		</propertyfile>
+        <property file="${classes.dir}/version.properties" />
+
+	<!--
+        <jar destfile="${build.dir}/${ant.project.name}.jar">
+            <fileset dir="${classes.dir}" />
+        </jar>
+	-->
+
+        <sigil.bundle destpattern="${build.dir}/[id].[ext]"
+		classpathref="run.path.id" />
+
+    </target>
+
+    <!-- ================================= 
+          target: publish              
+         ================================= -->
+    <target name="publish" depends="jar" description="--> publish this project in the ivy repository">
+        <property name="revision" value="${version}"/>
+        <delete file="${build.dir}/ivy.xml"/>
+		<ivy:publish artifactspattern="${build.dir}/[artifact].[ext]" 
+			resolver="projects"
+			pubrevision="${revision}" 
+			status="release"
+		/>
+        <echo message="project ${ant.project.name} released with version ${revision}" />
+    </target>
+
+
+    <!-- ================================= 
+          target: clean              
+         ================================= -->
+    <target name="clean" description="--> clean the project">
+        <delete includeemptydirs="true">
+            <fileset dir="${basedir}">
+            	<exclude name="src/**" />
+            	<exclude name="build.xml" />
+		    	<exclude name="ivy.xml" />
+		    	<exclude name="sigil.properties" />
+        	</fileset>
+    	</delete>
+    </target>
+</project>

Added: felix/trunk/sigil/bld-ivy/test/dependence/dependee/ivy.xml
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bld-ivy/test/dependence/dependee/ivy.xml?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bld-ivy/test/dependence/dependee/ivy.xml (added)
+++ felix/trunk/sigil/bld-ivy/test/dependence/dependee/ivy.xml Mon Jul 13 13:25:46 2009
@@ -0,0 +1,27 @@
+<?xml version="1.0"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you 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.
+-->
+<ivy-module version="1.0">
+    <info organisation="org.apache" module="dependee"/>
+    <dependencies>
+	<!--
+        <dependency org="sigil" name="com.springsource.org.apache.log4j" rev="[1.2,1.3)"/>
+	-->
+    </dependencies>
+</ivy-module>

Added: felix/trunk/sigil/bld-ivy/test/dependence/dependee/sigil.properties
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bld-ivy/test/dependence/dependee/sigil.properties?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bld-ivy/test/dependence/dependee/sigil.properties (added)
+++ felix/trunk/sigil/bld-ivy/test/dependence/dependee/sigil.properties Mon Jul 13 13:25:46 2009
@@ -0,0 +1,25 @@
+# dependee sigil.properties
+# all initial comments are retained.
+
+version: 1.2.3.beta1
+
+-bundles: dependee
+
+-exports: standalone
+
+-imports: \
+  org.apache.commons.lang;version="[2.0.0,2.4.0)";resolve=compile;resolution=optional, \
+  org.apache.commons.logging, \
+  javax.servlet;version="(2.4,3.0]", \
+  org.apache.log4j;version="[1.2.14,1.3)", \
+  javax.swing, \
+
+-resources: \
+  version.properties
+
+header;Hello: World
+
+X-requires: \
+  com.springsource.org.apache.commons.lang;version="[2.0.0,2.4.0)", \
+
+# end

Added: felix/trunk/sigil/bld-ivy/test/dependence/dependee/src/standalone/Main.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bld-ivy/test/dependence/dependee/src/standalone/Main.java?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bld-ivy/test/dependence/dependee/src/standalone/Main.java (added)
+++ felix/trunk/sigil/bld-ivy/test/dependence/dependee/src/standalone/Main.java Mon Jul 13 13:25:46 2009
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 standalone;
+
+import java.util.Properties;
+
+import org.apache.commons.lang.WordUtils;
+
+/**
+ * TODO write javadoc
+ */
+public class Main {
+    /**
+     * Returns the version of the project
+     * @return a string representation of the version, null if the version could not be retreived
+     */
+    public static String getVersion() {
+        Properties p = new Properties();
+        try {
+            p.load(Main.class.getResourceAsStream("/version.properties"));
+            String version = p.getProperty("version");
+            if (version != null) {
+                return String.valueOf(Integer.parseInt(version));
+            } 
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+    
+    /**
+     * Return the same string with all words capitalized.
+     * @param str the string conatining the words to capitalize
+     * @return null if the string was null, the string with all words capitalized otherwise
+     */
+    public static String capitalizeWords(String str) {
+        System.out.println("    [" + Main.class.getName() + "] capitalizing string \"" + str + "\" using " + WordUtils.class.getName());
+        return WordUtils.capitalizeFully(str);
+    }
+    public static void main(String[] args) {
+        String message="sentence to capitalize";
+        System.out.println("standard message : " + message);
+        System.out.println("capitalized message : " + capitalizeWords(message));
+    }
+}

Added: felix/trunk/sigil/bld-ivy/test/dependence/depender/build.xml
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bld-ivy/test/dependence/depender/build.xml?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bld-ivy/test/dependence/depender/build.xml (added)
+++ felix/trunk/sigil/bld-ivy/test/dependence/depender/build.xml Mon Jul 13 13:25:46 2009
@@ -0,0 +1,107 @@
+<?xml version="1.0">
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you 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="depender" default="run" xmlns:ivy="antlib:org.apache.ivy.ant">
+    <!-- some variables used -->
+    <property name="lib.dir" value="${basedir}/lib" />
+    <property name="build.dir" value="${basedir}/build" />
+    <property name="classes.dir" value="${build.dir}/classes" />
+    <property name="src.dir" value="${basedir}/src" />
+
+    <!-- ivy properties used -->
+    <property name="ivy.settings.dir" value="../settings" />
+    <property file="${ivy.settings.dir}/ivysettings.properties" />
+    
+    <!-- paths used for compilation and run  -->
+    <path id="lib.path.id">
+        <fileset dir="${lib.dir}" />
+	</path>
+    <path id="run.path.id">
+        <path refid="lib.path.id" />
+        <path location="${classes.dir}" />
+    </path>
+
+    <property name="ivy.jar.file"
+	     value="/opt/apache-ivy-2.0.0/ivy-2.0.0.jar"/>
+
+    <!-- ================================= 
+          target: init
+         ================================= -->
+    <target name="init">
+      <taskdef resource="org/apache/ivy/ant/antlib.xml"
+		    uri="antlib:org.apache.ivy.ant"
+		    classpath="${ivy.jar.file}"/>
+      <ivy:settings file="${ivy.settings.dir}/ivysettings.xml" />
+    </target>
+
+    <!-- ================================= 
+          target: resolve              
+         ================================= -->
+    <target name="resolve" depends="init"
+    	description="--> resolve and retrieve dependencies with ivy">
+        <ivy:retrieve />
+    </target>
+    
+    <!-- ================================= 
+          target: report              
+         ================================= -->
+    <target name="report" depends="resolve" description="--> generates a report of dependencies">
+        <ivy:report todir="${build.dir}" dot="true"/>
+    </target>
+    
+    <!-- ================================= 
+          target: gen-graph
+         ================================= -->
+    <target name="gen-graph" depends="report" description="--> generates a graph of dependencies (requires dot in your path - see http://www.graphviz.org/)">
+    	<property name="dot.file" value="${build.dir}/apache-depending-default.dot" />
+    	<property name="ivygraph.output.file" value="${build.dir}/graph.png" />
+    	<exec executable="dot">
+    	    <arg line="-T png -o ${ivygraph.output.file} ${dot.file}" />
+    	</exec>
+    </target>
+    
+    <!-- ================================= 
+          target: compile              
+         ================================= -->
+    <target name="compile" depends="resolve" description="--> description">
+        <mkdir dir="${classes.dir}" />
+        <javac srcdir="${src.dir}" destdir="${classes.dir}" classpathref="lib.path.id" />
+    </target>
+    
+    <!-- ================================= 
+          target: run
+         ================================= -->
+    <target name="run" depends="clean, compile" description="--> compile and run the project">
+        <java classpathref="run.path.id" classname="depending.Main"/>
+    </target>
+    
+    <!-- ================================= 
+          target: clean              
+         ================================= -->
+    <target name="clean" description="--> clean the project">
+        <delete includeemptydirs="true">
+            <fileset dir="${basedir}">
+            	<exclude name="src/**" />
+            	<exclude name="build.xml" />
+		    	<exclude name="ivy.xml" />
+		    	<exclude name="sigil.properties" />
+        	</fileset>
+    	</delete>
+    </target>
+</project>

Added: felix/trunk/sigil/bld-ivy/test/dependence/depender/ivy.xml
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bld-ivy/test/dependence/depender/ivy.xml?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bld-ivy/test/dependence/depender/ivy.xml (added)
+++ felix/trunk/sigil/bld-ivy/test/dependence/depender/ivy.xml Mon Jul 13 13:25:46 2009
@@ -0,0 +1,30 @@
+<?xml version="1.0"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you 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.
+-->
+<ivy-module version="1.0">
+    <info organisation="org.apache" module="depender"/>
+    <dependencies>
+	<!--
+        <dependency name="dependee" rev="latest.integration" />
+	-->
+    </dependencies>
+    <conflicts>
+        <manager name="latest-compatible"/>
+    </conflicts>
+</ivy-module>

Added: felix/trunk/sigil/bld-ivy/test/dependence/depender/sigil.properties
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bld-ivy/test/dependence/depender/sigil.properties?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bld-ivy/test/dependence/depender/sigil.properties (added)
+++ felix/trunk/sigil/bld-ivy/test/dependence/depender/sigil.properties Mon Jul 13 13:25:46 2009
@@ -0,0 +1,7 @@
+# depender sigil.properties
+
+-bundles: depender
+
+-imports: standalone
+
+# end

Added: felix/trunk/sigil/bld-ivy/test/dependence/depender/src/depending/Main.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bld-ivy/test/dependence/depender/src/depending/Main.java?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bld-ivy/test/dependence/depender/src/depending/Main.java (added)
+++ felix/trunk/sigil/bld-ivy/test/dependence/depender/src/depending/Main.java Mon Jul 13 13:25:46 2009
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 depending;
+
+/**
+ * TODO write javadoc
+ */
+public class Main {
+    public static void main(String[] args) {
+        String standaloneVersion = standalone.Main.getVersion();
+        if (standaloneVersion!=null) {
+            System.out.println("you are using version " + standaloneVersion + " of class " + standalone.Main.class.getName());
+        } else {
+            System.err.println("failed to get version of " + standalone.Main.class.getName());
+        }
+        String message = "i am " + Main.class.getName() + " and " + standalone.Main.class.getName() + " will do the job for me";
+        System.out.println("standard message : " + message);
+        System.out.println("capitalized message : " + standalone.Main.capitalizeWords(message));
+    }
+}

Added: felix/trunk/sigil/bld-ivy/test/dependence/settings/ivysettings.properties
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bld-ivy/test/dependence/settings/ivysettings.properties?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bld-ivy/test/dependence/settings/ivysettings.properties (added)
+++ felix/trunk/sigil/bld-ivy/test/dependence/settings/ivysettings.properties Mon Jul 13 13:25:46 2009
@@ -0,0 +1,19 @@
+#	 ***************************************************************
+#	 * Licensed to the Apache Software Foundation (ASF) under one
+#	 * or more contributor license agreements.  See the NOTICE file
+#	 * distributed with this work for additional information
+#	 * regarding copyright ownership.  The ASF licenses this file
+#	 * to you 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.
+#	 ***************************************************************
+repository.dir=${ivy.settings.dir}/repository

Added: felix/trunk/sigil/bld-ivy/test/dependence/settings/ivysettings.xml
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bld-ivy/test/dependence/settings/ivysettings.xml?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bld-ivy/test/dependence/settings/ivysettings.xml (added)
+++ felix/trunk/sigil/bld-ivy/test/dependence/settings/ivysettings.xml Mon Jul 13 13:25:46 2009
@@ -0,0 +1,48 @@
+<?xml version="1.0">
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you 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.
+-->
+<ivysettings>
+  <properties file="${ivy.settings.dir}/ivysettings.properties"/>
+  <settings defaultResolver="sigil-libs"/>
+
+  <!--<caches defaultCacheDir="${ivy.settings.dir}/ivy-cache" />
+  -->
+  <caches default="mycache" checkUpToDate="false">
+    <cache name="mycache" basedir="${ivy.settings.dir}/ivy-cache" useOrigin="true"/>
+  </caches>
+
+  <classpath file="${ivy.settings.dir}/../../../target/sigil-ivy-plugin.jar" />
+  <typedef name="sigil-parser" classname="org.cauldron.bld.ivy.SigilParser" />
+  <typedef name="sigil" classname="org.cauldron.bld.ivy.SigilResolver" />
+
+  <parsers>
+    <sigil-parser/>
+  </parsers>
+
+  <resolvers>
+    <sigil name="sigil-libs" config="${ivy.settings.dir}/sigil-repos.properties" />
+    <filesystem name="projects">
+      <ivy pattern="${repository.dir}/[module]-[revision].xml" />
+      <artifact pattern="${repository.dir}/[artifact]-[revision].[ext]" />
+    </filesystem>
+</resolvers>
+<modules>
+  <module organisation="org.apache" name="dependee" resolver="projects"/>
+</modules>
+</ivysettings>

Added: felix/trunk/sigil/bld-ivy/test/dependence/settings/sigil-repos.properties
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bld-ivy/test/dependence/settings/sigil-repos.properties?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bld-ivy/test/dependence/settings/sigil-repos.properties (added)
+++ felix/trunk/sigil/bld-ivy/test/dependence/settings/sigil-repos.properties Mon Jul 13 13:25:46 2009
@@ -0,0 +1,17 @@
+# repository config
+
+-repositories:	system, project, spring
+
+system;provider:	system
+system;level:		-1
+
+project;provider:	project
+project;level:		0
+project;pattern:	${..}/*/[sigilproject]
+
+spring;provider:	obr
+spring;level:		2
+spring;url:		http://sigil.codecauldron.org/spring-external.obr
+spring;index:		${..}/settings/spring-external.obr
+
+# end

Added: felix/trunk/sigil/bld-ivy/test/dependence/sigil-defaults.properties
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bld-ivy/test/dependence/sigil-defaults.properties?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bld-ivy/test/dependence/sigil-defaults.properties (added)
+++ felix/trunk/sigil/bld-ivy/test/dependence/sigil-defaults.properties Mon Jul 13 13:25:46 2009
@@ -0,0 +1,2 @@
+header;Bundle-Vendor: Paremus Limited
+version: 1.2.3.parent

Added: felix/trunk/sigil/bld-ivy/test/multi-project/build.xml
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bld-ivy/test/multi-project/build.xml?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bld-ivy/test/multi-project/build.xml (added)
+++ felix/trunk/sigil/bld-ivy/test/multi-project/build.xml Mon Jul 13 13:25:46 2009
@@ -0,0 +1,59 @@
+<?xml version="1.0">
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you 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="all" default="order" xmlns:ivy="antlib:org.apache.ivy.ant">
+  <property name="common.dir" value="${basedir}/common" />
+  <import file="${common.dir}/common.xml"/>
+
+  <fileset id="projects" dir="projects" includes="**/build.xml"/>
+
+  <path id="unordered-list">
+    <fileset refid="projects"/>
+  </path>
+
+  <target name="buildlist" depends="load-ivy"> 
+    <ivy:buildlist reference="ordered-list">
+      <fileset refid="projects"/>
+    </ivy:buildlist>
+  </target>
+  
+  <target name="publish" depends="buildlist" 
+	description="compile, jar and publish all projects in the right order">
+    <subant target="publish" buildpathref="ordered-list">
+      <propertyset>
+	<propertyref name="ivy.loaded" />
+      </propertyset>
+    </subant>
+  </target>
+
+  <target name="clean" description="clean all projects">
+    <subant target="clean" buildpathref="unordered-list" />
+  </target>
+  
+  <target name="fullclean" depends="clean, load-ivy" 
+  description="clean tutorial: delete repository, ivy cache, and all projects">
+    <delete dir="repository"/>
+  	<ivy:cleancache />
+  </target>
+
+  <target name="order" depends="buildlist">
+    <subant target="hello" buildpathref="ordered-list" />
+  </target>
+
+</project>

Added: felix/trunk/sigil/bld-ivy/test/multi-project/common/build.properties
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bld-ivy/test/multi-project/common/build.properties?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bld-ivy/test/multi-project/common/build.properties (added)
+++ felix/trunk/sigil/bld-ivy/test/multi-project/common/build.properties Mon Jul 13 13:25:46 2009
@@ -0,0 +1,30 @@
+#	 ***************************************************************
+#	 * Licensed to the Apache Software Foundation (ASF) under one
+#	 * or more contributor license agreements.  See the NOTICE file
+#	 * distributed with this work for additional information
+#	 * regarding copyright ownership.  The ASF licenses this file
+#	 * to you 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.
+#	 ***************************************************************
+lib.dir = ${basedir}/lib
+build.dir = ${basedir}/build
+classes.dir = ${build.dir}/classes
+src.dir = ${basedir}/src
+repository.dir=${common.dir}/../repository
+
+ivy.file = ${basedir}/ivy.xml
+
+jar.file = ${build.dir}/${ant.project.name}.jar
+main.class.name = ${ant.project.name}.Main
+
+module.version.target = 1.0

Added: felix/trunk/sigil/bld-ivy/test/multi-project/common/common.xml
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bld-ivy/test/multi-project/common/common.xml?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bld-ivy/test/multi-project/common/common.xml (added)
+++ felix/trunk/sigil/bld-ivy/test/multi-project/common/common.xml Mon Jul 13 13:25:46 2009
@@ -0,0 +1,232 @@
+<?xml version="1.0">
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you 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="common" 
+         xmlns:ivy="antlib:org.apache.ivy.ant">
+	<!-- a sample common ant build file, used for ivy multi-project tutorial
+	     feel free to copy and adapt it to your own needs
+	     Note that the only targets specific to ivy are:
+	        load-ivy
+	     	resolve
+	     	report
+	     	ivy-new-version
+	     	publish
+	     	publish-local
+	     	
+	     All other targets are usual ant based targets, which could have been written
+	     in a build not depending at all on ivy: 
+	     resolve constructs a lib directory based upon ivy dependencies, and then the lib dir 
+	     is used as in any classical ant build
+	     -->
+	
+	<property file="${common.dir}/build.properties"/>
+	
+	<property name="ivy.jar.dir" value="/opt/apache-ivy-2.0.0-rc2" />
+	<property name="ivy.jar.file" value="${ivy.jar.dir}/ivy-2.0.0-rc2.jar" />
+        <property name="sigil-ivy-plugin.jar" value="${common.dir}/../../../target/sigil-ivy-plugin.jar"/>
+
+	<target name="hello">
+	    <echo message="${ant.project.name}"/>
+	</target>
+
+	<!-- ================================= 
+          target: load-ivy         
+            this target is not necessary if you put ivy.jar in your ant lib directory
+            if you already have ivy 2.0 in your ant lib, you can simply remove this
+            target
+         ================================= -->
+    <path id="ivy.lib.path">
+	<path location="${ivy.jar.file}"/>
+	<path location="${sigil-ivy-plugin.jar}"/>
+	<!--
+	<path location="${user.home}/src/tmp/ivy/build/ivy.jar"/>
+	-->
+    </path>
+
+    <target name="load-ivy" depends="ivy-taskdefs">
+	<ivy:settings file="${common.dir}/ivysettings.xml" />
+    </target>
+
+    <target name="ivy-taskdefs" unless="ivy.loaded">
+    	<property name="ivy.loaded" value="true"/>
+	<echo message="Loading Ivy ..."/>
+	<!--
+    	<taskdef resource="org/apache/ivy/ant/antlib.xml"
+    	         uri="antlib:org.apache.ivy.ant" classpath="${ivy.jar.file}"/>
+	-->
+    	<taskdef resource="org/apache/ivy/ant/antlib.xml"
+    	         uri="antlib:org.apache.ivy.ant"
+		 loaderRef="ivyLoader"
+		 classpath="${ivy.jar.file}"/>
+
+	<taskdef name="sigil.bundle"
+		 classname="org.cauldron.bld.ant.BundleTask"
+		 classpath="${sigil-ivy-plugin.jar}:${bndlib.jar}"/>
+    </target>    
+
+    <path id="lib.path.id">
+        <fileset dir="${lib.dir}" />
+    </path>
+
+    <path id="run.path.id">
+        <path refid="lib.path.id" />
+        <path location="${classes.dir}" />
+    </path>
+
+    
+	<!-- setup ivy default configuration with some custom info -->
+	<property name="ivy.local.default.root" value="${repository.dir}/local"/>
+	<property name="ivy.shared.default.root" value="${repository.dir}/shared"/>
+
+   	<!-- here is how we would have configured ivy if we had our own ivysettings file
+    <ivy:settings file="${common.dir}/ivysettings.xml" />
+    -->
+
+	
+    <!-- ================================= 
+          target: resolve              
+         ================================= -->
+    <target name="resolve" depends="clean-lib, load-ivy" description="--> resolve and retrieve dependencies with ivy">
+        <mkdir dir="${lib.dir}"/> <!-- not usually necessary, ivy creates the directory IF there are dependencies -->
+    	
+    	<!-- the call to resolve is not mandatory, retrieve makes an implicit call if we don't -->
+    	<ivy:resolve file="${ivy.file}"/>
+    	<ivy:retrieve pattern="${lib.dir}/[artifact].[ext]" />
+    </target>
+    
+    <!-- ================================= 
+          target: report              
+         ================================= -->
+    <target name="report" depends="resolve" description="--> generates a report of dependencies">
+        <ivy:report todir="${build.dir}"/>
+    </target>
+    
+    <!-- ================================= 
+          target: compile              
+         ================================= -->
+    <target name="compile" depends="resolve" description="--> compile the project">
+        <mkdir dir="${classes.dir}" />
+        <javac srcdir="${src.dir}" destdir="${classes.dir}" classpathref="lib.path.id" debug="true" />
+    </target>
+    
+    <!-- ================================= 
+          target: run
+         ================================= -->
+    <target name="run" depends="version, compile" description="--> compile and run the project">
+        <java classpathref="run.path.id" classname="${main.class.name}"/>
+    </target>
+
+	<target name="ivy-new-version" depends="load-ivy" unless="ivy.new.revision">
+    	<!-- default module version prefix value -->
+		<property name="module.version.prefix" value="${module.version.target}-dev-b" />
+		
+    	<!-- asks to ivy an available version number -->
+		<ivy:info file="${ivy.file}" />
+    	<ivy:buildnumber 
+    		organisation="${ivy.organisation}" module="${ivy.module}" 
+    		revision="${module.version.prefix}" defaultBuildNumber="1" revSep=""/>
+	</target>
+
+    <target name="local-version">
+		<tstamp>
+			<format property="now" pattern="yyyyMMddHHmmss"/>
+		</tstamp>
+        <property name="ivy.new.revision" value="${module.version.target}-local-${now}"/>
+    </target>
+	
+	<target name="version" depends="ivy-new-version">
+    	<!-- create version file in classpath for later inclusion in jar -->
+        <mkdir dir="${classes.dir}"/>
+		<echo message="version=${ivy.new.revision}" file="${classes.dir}/${ant.project.name}.properties" append="false" />
+
+		<!-- load generated version properties file -->
+        <property file="${classes.dir}/${ant.project.name}.properties" />
+    </target>
+
+    <!-- ================================= 
+          target: jar              
+         ================================= -->
+    <target name="jar" depends="version, compile" description="--> make a jar file for this project">
+
+	<!--
+        <jar destfile="${jar.file}">
+            <fileset dir="${classes.dir}" />
+            <manifest>
+                <attribute name="Built-By" value="${user.name}"/>
+                <attribute name="Build-Version" value="${version}" />
+            </manifest>
+        </jar>
+	-->
+
+        <sigil.bundle destpattern="${build.dir}/[id].[ext]"
+                classpathref="run.path.id"/>
+    </target>
+
+    <!-- ================================= 
+          target: publish              
+         ================================= -->
+    <target name="publish" depends="clean-build, jar" description="--> publish this project in the ivy repository">
+    	<ivy:publish artifactspattern="${build.dir}/[artifact].[ext]" 
+    			           resolver="shared"
+    			           pubrevision="${version}" 
+    			           status="release"
+    	/>
+        <echo message="project ${ant.project.name} released with version ${version}" />
+    </target>
+
+    <!-- ================================= 
+          target: publish-local              
+         ================================= -->
+    <target name="publish-local" depends="local-version, jar" description="--> publish this project in the local ivy repository">
+    	<ivy:publish artifactspattern="${build.dir}/[artifact].[ext]" 
+    			        resolver="local"
+    			        pubrevision="${version}"
+				        pubdate="${now}"
+    			        status="integration"
+    					forcedeliver="true"
+    	/>
+        <echo message="project ${ant.project.name} published locally with version ${version}" />
+    </target>
+
+	<!-- ================================= 
+          target: clean-local              
+         ================================= -->
+	<target name="clean-local" description="--> cleans the local repository for the current module">
+	   <delete dir="${ivy.local.default.root}/${ant.project.name}"/>
+	</target>
+
+	<!-- ================================= 
+          target: clean-lib              
+         ================================= -->
+    <target name="clean-lib" description="--> clean the project libraries directory (dependencies)">
+        <delete includeemptydirs="true" dir="${lib.dir}"/>
+    </target>
+
+    <!-- ================================= 
+          target: clean-build              
+         ================================= -->
+    <target name="clean-build" description="--> clean the project built files">
+        <delete includeemptydirs="true" dir="${build.dir}"/>
+    </target>
+
+    <!-- ================================= 
+          target: clean              
+         ================================= -->
+    <target name="clean" depends="clean-build, clean-lib" description="--> clean the project" />
+</project>

Added: felix/trunk/sigil/bld-ivy/test/multi-project/common/ivysettings.xml
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bld-ivy/test/multi-project/common/ivysettings.xml?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bld-ivy/test/multi-project/common/ivysettings.xml (added)
+++ felix/trunk/sigil/bld-ivy/test/multi-project/common/ivysettings.xml Mon Jul 13 13:25:46 2009
@@ -0,0 +1,62 @@
+<?xml version="1.0">
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you 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.
+-->
+<ivysettings>
+  <properties file="${ivy.settings.dir}/build.properties"/>
+  <caches defaultCacheDir="${ivy.settings.dir}/../ivy-cache" />
+
+  <settings defaultResolver="shared"
+     circularDependencyStrategy="error" />
+
+  <classpath file="${ivy.settings.dir}/../../../target/sigil-ivy-plugin.jar" />
+  <!--
+  Ant tasks "subant" and "ant" cause IvySettings to be re-loaded, 
+  which then re-loads SigilParser in a new URLClassLoader,
+  which causes ProjectRepository to be re-initialised. Outch!
+
+  Better if Ivy classpath cached its classloader, or provided a
+  loaderRef attribute, like ant does.
+
+  Loading sigil-ivy-plugin.jar in ivy-taskdefs, uses the same ClassLoader
+  to load sigil-ivy-plugin, and thus avoids re-initialising ProjectRepositiory.
+  -->
+  <typedef name="sigil-parser" classname="org.cauldron.bld.ivy.SigilParser" />
+  <typedef name="sigil" classname="org.cauldron.bld.ivy.SigilResolver" />
+
+  <parsers>
+    <sigil-parser quiet="true"/>
+  </parsers>
+
+  <resolvers>
+    <sigil name="sigil" config="${ivy.settings.dir}/sigil-repos.properties" />
+    <filesystem name="local">
+      <ivy pattern="${repository.dir}/local/[module]-[revision].xml" />
+      <artifact pattern="${repository.dir}/local/[artifact]-[revision].[ext]" />
+    </filesystem>
+    <filesystem name="shared">
+      <ivy pattern="${repository.dir}/shared/[module]-[revision].xml" />
+      <artifact pattern="${repository.dir}/shared/[module]/[artifact]-[revision].[ext]" />
+    </filesystem>
+  </resolvers>
+  <modules>
+    <!--<module organisation="org.apache.ivy.example" name=".*" resolver="shared"/>
+    -->
+    <module organisation="sigil" resolver="sigil"/>
+  </modules>
+</ivysettings>

Added: felix/trunk/sigil/bld-ivy/test/multi-project/common/sigil-gen.sh
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bld-ivy/test/multi-project/common/sigil-gen.sh?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bld-ivy/test/multi-project/common/sigil-gen.sh (added)
+++ felix/trunk/sigil/bld-ivy/test/multi-project/common/sigil-gen.sh Mon Jul 13 13:25:46 2009
@@ -0,0 +1,107 @@
+#!/bin/sh
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you 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.
+
+# sigilgen build.xml ..
+
+function a2s() {
+  find ${1:?} -name '*.java' -o -name '*.spring' -o -name '*.sca' |
+  perl -e '
+    use strict;
+    use FileHandle;
+
+    my %imports;
+    my %exports;
+
+    while (<>) {
+	chomp($_);
+	my $path = $_;
+	my $fh = new FileHandle($path);
+
+	my $testFile = ($path =~ m!Test[^/]+$!);
+
+	while (my $line = <$fh>) {
+	  chomp($line);
+
+	  if ($line =~ /^\s*package\s+([\w.]+)\s*;\s*$/) {
+	    my $exp = $1;
+	    if (!($testFile && ($exp !~ /^test[.]/))) {
+	      $exports{$exp} = 1;
+	    }
+	  } 
+	  elsif ($line =~ /^\s*import\s+([a-z_0-9.]+)([.][A-Z][^.]+)+;\s*$/) {
+	    my $imp = $1;
+	    $imports{$imp} = 1 unless ($imp =~ /^java[.]/);
+	  }
+	  elsif (($line !~ m!^\s*(//|\*|\@)!) &&
+		($line =~ /(\W)((([a-z0-9]{2,})[.]){3,})[A-Z]/)) {
+	    my $quot = $1;
+	    my $imp = $2;
+	    $imp =~ s/.$//;
+
+	    if (($imp !~ /^java[.]/) &&
+	    	($quot ne "\"" || ($path !~ /[.]java$/))) {
+	      $imports{$imp} = 1;
+	    }
+	  }
+	}
+	$fh->close();
+    }
+
+    if (keys(%exports) == () && keys(%imports) == ()) {
+      exit(1);
+    }
+
+    print "-exports: \\\n";
+    foreach my $key (sort keys(%exports)) {
+	print "\t$key, \\\n";
+    }
+    print "\n";
+
+    print "-imports: \\\n";
+    foreach my $key (sort keys(%imports)) {
+	print "\t$key, \\\n";
+    }
+    print "\n";
+
+    exit(0);
+  '
+  return $?
+}
+
+for file in $*; do
+  echo "converting $file"
+  name=$(perl -ne 'print $1 if (/project name="([^"]*)"/);' $file)
+  dir=$(dirname $file)
+
+  if [ -f $dir/sigil.properties ]; then
+    rm -f $dir/sigil.properties.old
+    mv $dir/sigil.properties $dir/sigil.properties.old
+  fi
+
+  (
+    echo "# generated by sigilgen on $(date)"
+    echo
+    echo "-bundles: $name"
+    echo
+    a2s $dir && mv $dir/sigil.properties-part $dir/sigil.properties
+  ) > $dir/sigil.properties-part
+
+  rm -f $dir/sigil.properties-part
+
+done

Propchange: felix/trunk/sigil/bld-ivy/test/multi-project/common/sigil-gen.sh
------------------------------------------------------------------------------
    svn:executable = *

Added: felix/trunk/sigil/bld-ivy/test/multi-project/common/sigil-repos.properties
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bld-ivy/test/multi-project/common/sigil-repos.properties?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bld-ivy/test/multi-project/common/sigil-repos.properties (added)
+++ felix/trunk/sigil/bld-ivy/test/multi-project/common/sigil-repos.properties Mon Jul 13 13:25:46 2009
@@ -0,0 +1,26 @@
+
+# repository config
+
+-repositories:	system, project, newton, spring
+
+system;provider:	system
+system;level:		-1
+#system;framework:	osgi.core.jar
+#system;profile:	J2SE-1.5
+
+project;provider:	project
+project;level:	0
+project;pattern:	../projects/**/[sigilproject]
+
+newton;provider:	filesystem
+newton;level:		1
+newton;recurse:		true
+#newton;dir:		/opt/newton-1.2.5/lib
+newton;dir:		/Users/derek/devl/Newton/src/target/newton-dist.dir/lib
+
+spring;provider:	obr
+spring;level:		2
+spring;url:		http://sigil.codecauldron.org/spring-external.obr
+spring;index:		../settings/spring-external.obr
+
+# end

Added: felix/trunk/sigil/bld-ivy/test/multi-project/projects/console/build.properties
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bld-ivy/test/multi-project/projects/console/build.properties?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bld-ivy/test/multi-project/projects/console/build.properties (added)
+++ felix/trunk/sigil/bld-ivy/test/multi-project/projects/console/build.properties Mon Jul 13 13:25:46 2009
@@ -0,0 +1,21 @@
+#	 ***************************************************************
+#	 * Licensed to the Apache Software Foundation (ASF) under one
+#	 * or more contributor license agreements.  See the NOTICE file
+#	 * distributed with this work for additional information
+#	 * regarding copyright ownership.  The ASF licenses this file
+#	 * to you 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.
+#	 ***************************************************************
+projects.dir = ${basedir}/..
+wkspace.dir = ${projects.dir}/..
+common.dir = ${wkspace.dir}/common

Added: felix/trunk/sigil/bld-ivy/test/multi-project/projects/console/build.xml
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bld-ivy/test/multi-project/projects/console/build.xml?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bld-ivy/test/multi-project/projects/console/build.xml (added)
+++ felix/trunk/sigil/bld-ivy/test/multi-project/projects/console/build.xml Mon Jul 13 13:25:46 2009
@@ -0,0 +1,24 @@
+<?xml version="1.0">
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you 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="console" default="compile">
+	<property file="build.properties"/>
+	
+	<import file="${common.dir}/common.xml"/>
+</project>

Added: felix/trunk/sigil/bld-ivy/test/multi-project/projects/console/ivy.xml
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bld-ivy/test/multi-project/projects/console/ivy.xml?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bld-ivy/test/multi-project/projects/console/ivy.xml (added)
+++ felix/trunk/sigil/bld-ivy/test/multi-project/projects/console/ivy.xml Mon Jul 13 13:25:46 2009
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you 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.
+-->
+<ivy-module version="1.0">
+    <info 
+        organisation="org.apache.ivy.example"
+        module="console"
+        status="integration"/>
+    <dependencies>
+      <!--
+      <dependency name="version" rev="latest.integration" conf="default" />
+      <dependency name="list" rev="latest.integration" conf="default->standalone" />
+      <dependency name="find" rev="latest.integration" conf="default->standalone" />
+      <dependency name="sizewhere" rev="latest.integration" conf="default->standalone" />
+      -->
+    </dependencies>
+</ivy-module>

Added: felix/trunk/sigil/bld-ivy/test/multi-project/projects/console/sigil.properties
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bld-ivy/test/multi-project/projects/console/sigil.properties?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bld-ivy/test/multi-project/projects/console/sigil.properties (added)
+++ felix/trunk/sigil/bld-ivy/test/multi-project/projects/console/sigil.properties Mon Jul 13 13:25:46 2009
@@ -0,0 +1,6 @@
+
+-bundles: console
+
+-exports: console
+
+-requires: org.example.list

Added: felix/trunk/sigil/bld-ivy/test/multi-project/projects/console/src/console/Main.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bld-ivy/test/multi-project/projects/console/src/console/Main.java?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bld-ivy/test/multi-project/projects/console/src/console/Main.java (added)
+++ felix/trunk/sigil/bld-ivy/test/multi-project/projects/console/src/console/Main.java Mon Jul 13 13:25:46 2009
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 console;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.util.Collection;
+import java.util.Arrays;
+import java.lang.reflect.Method;
+
+
+public class Main {
+    private static Collection QUIT_COMMANDS = Arrays.asList(new String[] {"quit", "q", "exit"});
+    private static Collection HELP_COMMANDS = Arrays.asList(new String[] {"help", "h", "?"});
+
+    public static void main(String[] a) throws Exception {
+      BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
+      while (true) {
+        System.out.print("> ");
+        String command = in.readLine().trim();
+        if (QUIT_COMMANDS.contains(command)) {
+          return;
+        }
+        if (HELP_COMMANDS.contains(command)) {
+          help();
+          continue;
+        }
+        String[] split = command.split(" ");
+        if (split.length == 0) {
+          error(command);
+          continue;
+        }
+        
+        try {
+          String[] args = new String[split.length - 1];
+          System.arraycopy(split, 1, args, 0, args.length);
+          Class cl = Class.forName(split[0]+".Main");
+          Method m = cl.getMethod("main", new Class[] {String[].class});
+          m.invoke(null, new Object[] {args});
+        } catch (Exception ex) {
+          error(command);
+          continue;
+        }
+      }
+    }
+    
+    private static void help() {
+      System.out.println("available commands:");
+      System.out.println("\tquit: quit the console");
+      System.out.println("\thelp: displays this message");
+      System.out.println("\tlist -dir <dir>: list files in given directory");
+      System.out.println("\tfind -dir <dir> -name <name>: list files with given name in given dir");
+      System.out.println("\tsizewhere -dir <dir> -name <name>: compute total size of files with given name in given dir");
+      System.out.println("\thelp: displays this message");
+    }
+            
+    private static void error(String command) {
+      System.out.println("unknown command "+command);
+      System.out.println("type ? for help");
+    }
+            
+}

Added: felix/trunk/sigil/bld-ivy/test/multi-project/projects/find/build.properties
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bld-ivy/test/multi-project/projects/find/build.properties?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bld-ivy/test/multi-project/projects/find/build.properties (added)
+++ felix/trunk/sigil/bld-ivy/test/multi-project/projects/find/build.properties Mon Jul 13 13:25:46 2009
@@ -0,0 +1,21 @@
+#	 ***************************************************************
+#	 * Licensed to the Apache Software Foundation (ASF) under one
+#	 * or more contributor license agreements.  See the NOTICE file
+#	 * distributed with this work for additional information
+#	 * regarding copyright ownership.  The ASF licenses this file
+#	 * to you 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.
+#	 ***************************************************************
+projects.dir = ${basedir}/..
+wkspace.dir = ${projects.dir}/..
+common.dir = ${wkspace.dir}/common

Added: felix/trunk/sigil/bld-ivy/test/multi-project/projects/find/build.xml
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bld-ivy/test/multi-project/projects/find/build.xml?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bld-ivy/test/multi-project/projects/find/build.xml (added)
+++ felix/trunk/sigil/bld-ivy/test/multi-project/projects/find/build.xml Mon Jul 13 13:25:46 2009
@@ -0,0 +1,24 @@
+<?xml version="1.0">
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you 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="find" default="compile">
+	<property file="build.properties"/>
+	
+	<import file="${common.dir}/common.xml"/>
+</project>

Added: felix/trunk/sigil/bld-ivy/test/multi-project/projects/find/ivy.xml
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bld-ivy/test/multi-project/projects/find/ivy.xml?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bld-ivy/test/multi-project/projects/find/ivy.xml (added)
+++ felix/trunk/sigil/bld-ivy/test/multi-project/projects/find/ivy.xml Mon Jul 13 13:25:46 2009
@@ -0,0 +1,40 @@
+<?xml version="1.0"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you 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.
+-->
+<ivy-module version="1.0">
+    <info 
+        organisation="org.apache.ivy.example"
+        module="find"
+        status="integration"/>
+    <configurations>
+      <conf name="core"/>
+      <conf name="standalone" extends="core"/>
+    </configurations>
+    <publications>
+      <artifact name="find" type="jar" conf="core" />
+    </publications>
+    <dependencies>
+      <!--
+      <dependency name="version" rev="latest.integration" conf="core->default" />
+      <dependency name="list" rev="latest.integration" conf="core" />
+      <dependency org="commons-collections" name="commons-collections" rev="3.1" conf="core->default" />
+      <dependency org="commons-cli" name="commons-cli" rev="1.0" conf="standalone->default" />
+      -->
+    </dependencies>
+</ivy-module>

Added: felix/trunk/sigil/bld-ivy/test/multi-project/projects/find/sigil.properties
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bld-ivy/test/multi-project/projects/find/sigil.properties?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bld-ivy/test/multi-project/projects/find/sigil.properties (added)
+++ felix/trunk/sigil/bld-ivy/test/multi-project/projects/find/sigil.properties Mon Jul 13 13:25:46 2009
@@ -0,0 +1,10 @@
+
+-bundles: find
+
+-exports: find
+
+-imports:\
+  version, \
+  list, \
+  org.apache.commons.collections, \
+  org.apache.commons.cli

Added: felix/trunk/sigil/bld-ivy/test/multi-project/projects/find/src/find/FindFile.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bld-ivy/test/multi-project/projects/find/src/find/FindFile.java?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bld-ivy/test/multi-project/projects/find/src/find/FindFile.java (added)
+++ felix/trunk/sigil/bld-ivy/test/multi-project/projects/find/src/find/FindFile.java Mon Jul 13 13:25:46 2009
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 find;
+
+import version.Version;
+import list.ListFile;
+
+import java.util.Collection;
+import java.util.ArrayList;
+import java.io.File;
+
+import  org.apache.commons.collections.CollectionUtils;
+import  org.apache.commons.collections.Predicate;
+
+public class FindFile {
+  static {
+    Version.register("find");
+  }
+  
+  public static Collection find(File dir, String name) {
+    return find(ListFile.list(dir), name);
+  }
+  
+  private static Collection find(Collection files, final String name) {    
+    return CollectionUtils.select(files, new Predicate() {
+      public boolean evaluate(Object o) {
+        return ((File)o).getName().indexOf(name) != -1;
+      }
+    });
+  }
+}

Added: felix/trunk/sigil/bld-ivy/test/multi-project/projects/find/src/find/Main.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bld-ivy/test/multi-project/projects/find/src/find/Main.java?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bld-ivy/test/multi-project/projects/find/src/find/Main.java (added)
+++ felix/trunk/sigil/bld-ivy/test/multi-project/projects/find/src/find/Main.java Mon Jul 13 13:25:46 2009
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 find;
+
+import java.io.File;
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.CommandLineParser;
+import org.apache.commons.cli.GnuParser;
+import org.apache.commons.cli.HelpFormatter;
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.OptionBuilder;
+import org.apache.commons.cli.Options;
+import org.apache.commons.cli.ParseException;
+
+public class Main {
+    private static Options getOptions() {
+        Option dir = OptionBuilder.withArgName("dir")
+            .hasArg()
+            .withDescription("list files in given dir")
+            .create("dir");
+        Option name = OptionBuilder.withArgName("name")
+            .hasArg()
+            .withDescription("list files with given name")
+            .create("name");
+        Options options = new Options();
+
+        options.addOption(dir);
+        options.addOption(name);
+        
+        return options;
+    }
+    
+    public static void main(String[] args) throws Exception {
+        Options options = getOptions();
+        try {
+        
+            CommandLineParser parser = new GnuParser();
+    
+            CommandLine line = parser.parse(options, args);
+            File dir = new File(line.getOptionValue("dir", "."));
+            String name = line.getOptionValue("name", "jar");
+            Collection files = FindFile.find(dir, name);
+            System.out.println("listing files in " + dir + " containing " + name);
+            for (Iterator it = files.iterator(); it.hasNext();) {
+                System.out.println("\t" + it.next() + "\n");
+            }
+        } catch(ParseException exp) {
+            // oops, something went wrong
+            System.err.println("Parsing failed.  Reason: " + exp.getMessage());
+              
+            HelpFormatter formatter = new HelpFormatter();
+            formatter.printHelp("find", options);
+        }        
+    }
+            
+}

Added: felix/trunk/sigil/bld-ivy/test/multi-project/projects/list/build.properties
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bld-ivy/test/multi-project/projects/list/build.properties?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bld-ivy/test/multi-project/projects/list/build.properties (added)
+++ felix/trunk/sigil/bld-ivy/test/multi-project/projects/list/build.properties Mon Jul 13 13:25:46 2009
@@ -0,0 +1,21 @@
+#	 ***************************************************************
+#	 * Licensed to the Apache Software Foundation (ASF) under one
+#	 * or more contributor license agreements.  See the NOTICE file
+#	 * distributed with this work for additional information
+#	 * regarding copyright ownership.  The ASF licenses this file
+#	 * to you 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.
+#	 ***************************************************************
+projects.dir = ${basedir}/..
+wkspace.dir = ${projects.dir}/..
+common.dir = ${wkspace.dir}/common

Added: felix/trunk/sigil/bld-ivy/test/multi-project/projects/list/build.xml
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bld-ivy/test/multi-project/projects/list/build.xml?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bld-ivy/test/multi-project/projects/list/build.xml (added)
+++ felix/trunk/sigil/bld-ivy/test/multi-project/projects/list/build.xml Mon Jul 13 13:25:46 2009
@@ -0,0 +1,24 @@
+<?xml version="1.0">
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you 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="list" default="compile">
+	<property file="build.properties"/>
+	
+	<import file="${common.dir}/common.xml"/>
+</project>