Initial commit of Sigil contribution. (FELIX-1142)
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@793581 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/sigil/bld-ivy/test/multi-project/build.xml b/sigil/bld-ivy/test/multi-project/build.xml
new file mode 100644
index 0000000..fd2d774
--- /dev/null
+++ b/sigil/bld-ivy/test/multi-project/build.xml
@@ -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>
diff --git a/sigil/bld-ivy/test/multi-project/common/build.properties b/sigil/bld-ivy/test/multi-project/common/build.properties
new file mode 100644
index 0000000..9552b4a
--- /dev/null
+++ b/sigil/bld-ivy/test/multi-project/common/build.properties
@@ -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
diff --git a/sigil/bld-ivy/test/multi-project/common/common.xml b/sigil/bld-ivy/test/multi-project/common/common.xml
new file mode 100644
index 0000000..4e54d1d
--- /dev/null
+++ b/sigil/bld-ivy/test/multi-project/common/common.xml
@@ -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>
diff --git a/sigil/bld-ivy/test/multi-project/common/ivysettings.xml b/sigil/bld-ivy/test/multi-project/common/ivysettings.xml
new file mode 100644
index 0000000..03440c4
--- /dev/null
+++ b/sigil/bld-ivy/test/multi-project/common/ivysettings.xml
@@ -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>
diff --git a/sigil/bld-ivy/test/multi-project/common/sigil-gen.sh b/sigil/bld-ivy/test/multi-project/common/sigil-gen.sh
new file mode 100755
index 0000000..2f7e184
--- /dev/null
+++ b/sigil/bld-ivy/test/multi-project/common/sigil-gen.sh
@@ -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
diff --git a/sigil/bld-ivy/test/multi-project/common/sigil-repos.properties b/sigil/bld-ivy/test/multi-project/common/sigil-repos.properties
new file mode 100644
index 0000000..d98b618
--- /dev/null
+++ b/sigil/bld-ivy/test/multi-project/common/sigil-repos.properties
@@ -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
diff --git a/sigil/bld-ivy/test/multi-project/projects/console/build.properties b/sigil/bld-ivy/test/multi-project/projects/console/build.properties
new file mode 100644
index 0000000..1b54925
--- /dev/null
+++ b/sigil/bld-ivy/test/multi-project/projects/console/build.properties
@@ -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
diff --git a/sigil/bld-ivy/test/multi-project/projects/console/build.xml b/sigil/bld-ivy/test/multi-project/projects/console/build.xml
new file mode 100644
index 0000000..5c02cba
--- /dev/null
+++ b/sigil/bld-ivy/test/multi-project/projects/console/build.xml
@@ -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>
diff --git a/sigil/bld-ivy/test/multi-project/projects/console/ivy.xml b/sigil/bld-ivy/test/multi-project/projects/console/ivy.xml
new file mode 100644
index 0000000..93b5ee5
--- /dev/null
+++ b/sigil/bld-ivy/test/multi-project/projects/console/ivy.xml
@@ -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>
diff --git a/sigil/bld-ivy/test/multi-project/projects/console/sigil.properties b/sigil/bld-ivy/test/multi-project/projects/console/sigil.properties
new file mode 100644
index 0000000..1d4bb13
--- /dev/null
+++ b/sigil/bld-ivy/test/multi-project/projects/console/sigil.properties
@@ -0,0 +1,6 @@
+
+-bundles: console
+
+-exports: console
+
+-requires: org.example.list
diff --git a/sigil/bld-ivy/test/multi-project/projects/console/src/console/Main.java b/sigil/bld-ivy/test/multi-project/projects/console/src/console/Main.java
new file mode 100644
index 0000000..678f3ca
--- /dev/null
+++ b/sigil/bld-ivy/test/multi-project/projects/console/src/console/Main.java
@@ -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");
+ }
+
+}
diff --git a/sigil/bld-ivy/test/multi-project/projects/find/build.properties b/sigil/bld-ivy/test/multi-project/projects/find/build.properties
new file mode 100644
index 0000000..1b54925
--- /dev/null
+++ b/sigil/bld-ivy/test/multi-project/projects/find/build.properties
@@ -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
diff --git a/sigil/bld-ivy/test/multi-project/projects/find/build.xml b/sigil/bld-ivy/test/multi-project/projects/find/build.xml
new file mode 100644
index 0000000..4d23bf5
--- /dev/null
+++ b/sigil/bld-ivy/test/multi-project/projects/find/build.xml
@@ -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>
diff --git a/sigil/bld-ivy/test/multi-project/projects/find/ivy.xml b/sigil/bld-ivy/test/multi-project/projects/find/ivy.xml
new file mode 100644
index 0000000..8026113
--- /dev/null
+++ b/sigil/bld-ivy/test/multi-project/projects/find/ivy.xml
@@ -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>
diff --git a/sigil/bld-ivy/test/multi-project/projects/find/sigil.properties b/sigil/bld-ivy/test/multi-project/projects/find/sigil.properties
new file mode 100644
index 0000000..30c10a7
--- /dev/null
+++ b/sigil/bld-ivy/test/multi-project/projects/find/sigil.properties
@@ -0,0 +1,10 @@
+
+-bundles: find
+
+-exports: find
+
+-imports:\
+ version, \
+ list, \
+ org.apache.commons.collections, \
+ org.apache.commons.cli
diff --git a/sigil/bld-ivy/test/multi-project/projects/find/src/find/FindFile.java b/sigil/bld-ivy/test/multi-project/projects/find/src/find/FindFile.java
new file mode 100644
index 0000000..25fa1af
--- /dev/null
+++ b/sigil/bld-ivy/test/multi-project/projects/find/src/find/FindFile.java
@@ -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;
+ }
+ });
+ }
+}
diff --git a/sigil/bld-ivy/test/multi-project/projects/find/src/find/Main.java b/sigil/bld-ivy/test/multi-project/projects/find/src/find/Main.java
new file mode 100644
index 0000000..a41c136
--- /dev/null
+++ b/sigil/bld-ivy/test/multi-project/projects/find/src/find/Main.java
@@ -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);
+ }
+ }
+
+}
diff --git a/sigil/bld-ivy/test/multi-project/projects/list/build.properties b/sigil/bld-ivy/test/multi-project/projects/list/build.properties
new file mode 100644
index 0000000..1b54925
--- /dev/null
+++ b/sigil/bld-ivy/test/multi-project/projects/list/build.properties
@@ -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
diff --git a/sigil/bld-ivy/test/multi-project/projects/list/build.xml b/sigil/bld-ivy/test/multi-project/projects/list/build.xml
new file mode 100644
index 0000000..3926148
--- /dev/null
+++ b/sigil/bld-ivy/test/multi-project/projects/list/build.xml
@@ -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>
diff --git a/sigil/bld-ivy/test/multi-project/projects/list/ivy.xml b/sigil/bld-ivy/test/multi-project/projects/list/ivy.xml
new file mode 100644
index 0000000..7fca587
--- /dev/null
+++ b/sigil/bld-ivy/test/multi-project/projects/list/ivy.xml
@@ -0,0 +1,38 @@
+<?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="list"
+ status="integration"/>
+ <configurations>
+ <conf name="core"/>
+ <conf name="standalone" extends="core"/>
+ </configurations>
+ <publications>
+ <artifact name="list" type="jar" conf="core" />
+ </publications>
+ <dependencies>
+ <!--
+ <dependency name="version" rev="latest.integration" conf="core->default" />
+ <dependency org="commons-cli" name="commons-cli" rev="1.0" conf="standalone->default" />
+ -->
+ </dependencies>
+</ivy-module>
diff --git a/sigil/bld-ivy/test/multi-project/projects/list/sigil.properties b/sigil/bld-ivy/test/multi-project/projects/list/sigil.properties
new file mode 100644
index 0000000..302cba7
--- /dev/null
+++ b/sigil/bld-ivy/test/multi-project/projects/list/sigil.properties
@@ -0,0 +1,14 @@
+
+# requirements
+
+-imports:\
+ version, \
+ org.apache.commons.cli
+
+# exports
+
+-bundles: list
+
+list;name: org.example.list
+list;-exports: list.*
+
diff --git a/sigil/bld-ivy/test/multi-project/projects/list/src/list/ListFile.java b/sigil/bld-ivy/test/multi-project/projects/list/src/list/ListFile.java
new file mode 100644
index 0000000..7467152
--- /dev/null
+++ b/sigil/bld-ivy/test/multi-project/projects/list/src/list/ListFile.java
@@ -0,0 +1,49 @@
+/*
+ * 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 list;
+
+import version.Version;
+import java.util.Collection;
+import java.util.ArrayList;
+import java.io.File;
+
+public class ListFile {
+ static {
+ Version.register("list");
+ }
+
+ public static Collection list(File dir) {
+ Collection files = new ArrayList();
+
+ return list(dir, files);
+ }
+
+ private static Collection list(File file, Collection files) {
+ if (file.isDirectory()) {
+ File[] f = file.listFiles();
+ for (int i=0; i<f.length; i++) {
+ list(f[i], files);
+ }
+ } else {
+ files.add(file);
+ }
+ return files;
+ }
+}
diff --git a/sigil/bld-ivy/test/multi-project/projects/list/src/list/Main.java b/sigil/bld-ivy/test/multi-project/projects/list/src/list/Main.java
new file mode 100644
index 0000000..0f8cb14
--- /dev/null
+++ b/sigil/bld-ivy/test/multi-project/projects/list/src/list/Main.java
@@ -0,0 +1,70 @@
+/*
+ * 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 list;
+
+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" );
+ Options options = new Options();
+
+ options.addOption(dir);
+
+ 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", "."));
+ Collection files = ListFile.list(dir);
+ System.out.println("listing files in "+dir);
+ 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( "list", options );
+ }
+ }
+
+}
diff --git a/sigil/bld-ivy/test/multi-project/projects/sigil-defaults.properties b/sigil/bld-ivy/test/multi-project/projects/sigil-defaults.properties
new file mode 100644
index 0000000..0000617
--- /dev/null
+++ b/sigil/bld-ivy/test/multi-project/projects/sigil-defaults.properties
@@ -0,0 +1,6 @@
+
+header;Bundle-Vendor: Paremus Limited
+
+package;org.osgi.framework: 1.7.1
+
+bad-key: wibble
diff --git a/sigil/bld-ivy/test/multi-project/projects/size/build.properties b/sigil/bld-ivy/test/multi-project/projects/size/build.properties
new file mode 100644
index 0000000..1b54925
--- /dev/null
+++ b/sigil/bld-ivy/test/multi-project/projects/size/build.properties
@@ -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
diff --git a/sigil/bld-ivy/test/multi-project/projects/size/build.xml b/sigil/bld-ivy/test/multi-project/projects/size/build.xml
new file mode 100644
index 0000000..2a75fe5
--- /dev/null
+++ b/sigil/bld-ivy/test/multi-project/projects/size/build.xml
@@ -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="size" default="compile">
+ <property file="build.properties"/>
+
+ <import file="${common.dir}/common.xml"/>
+</project>
diff --git a/sigil/bld-ivy/test/multi-project/projects/size/ivy.xml b/sigil/bld-ivy/test/multi-project/projects/size/ivy.xml
new file mode 100644
index 0000000..33e9995
--- /dev/null
+++ b/sigil/bld-ivy/test/multi-project/projects/size/ivy.xml
@@ -0,0 +1,31 @@
+<?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="size"
+ status="integration"/>
+ <dependencies>
+ <!--
+ <dependency name="version" rev="latest.integration" conf="default" />
+ <dependency name="list" rev="latest.integration" conf="default->core" />
+ -->
+ </dependencies>
+</ivy-module>
diff --git a/sigil/bld-ivy/test/multi-project/projects/size/sigil.properties b/sigil/bld-ivy/test/multi-project/projects/size/sigil.properties
new file mode 100644
index 0000000..cf239af
--- /dev/null
+++ b/sigil/bld-ivy/test/multi-project/projects/size/sigil.properties
@@ -0,0 +1,8 @@
+
+-bundles: size
+
+-exports: size
+
+-imports:\
+ list, \
+ version
diff --git a/sigil/bld-ivy/test/multi-project/projects/size/src/size/FileSize.java b/sigil/bld-ivy/test/multi-project/projects/size/src/size/FileSize.java
new file mode 100644
index 0000000..dcd4a1c
--- /dev/null
+++ b/sigil/bld-ivy/test/multi-project/projects/size/src/size/FileSize.java
@@ -0,0 +1,44 @@
+/*
+ * 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 size;
+
+import version.Version;
+import java.util.Collection;
+import java.util.Iterator;
+import java.io.File;
+
+public class FileSize {
+ static {
+ Version.register("size");
+ }
+
+ public static long totalSize(File dir) {
+ return totalSize(list.ListFile.list(dir));
+ }
+
+ public static long totalSize(Collection files) {
+ long total = 0;
+ for (Iterator it = files.iterator(); it.hasNext(); ) {
+ File f = (File)it.next();
+ total += f.length();
+ }
+ return total;
+ }
+}
diff --git a/sigil/bld-ivy/test/multi-project/projects/sizewhere/build.properties b/sigil/bld-ivy/test/multi-project/projects/sizewhere/build.properties
new file mode 100644
index 0000000..1b54925
--- /dev/null
+++ b/sigil/bld-ivy/test/multi-project/projects/sizewhere/build.properties
@@ -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
diff --git a/sigil/bld-ivy/test/multi-project/projects/sizewhere/build.xml b/sigil/bld-ivy/test/multi-project/projects/sizewhere/build.xml
new file mode 100644
index 0000000..0b8ab4c
--- /dev/null
+++ b/sigil/bld-ivy/test/multi-project/projects/sizewhere/build.xml
@@ -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="sizewhere" default="compile">
+ <property file="build.properties"/>
+
+ <import file="${common.dir}/common.xml"/>
+</project>
diff --git a/sigil/bld-ivy/test/multi-project/projects/sizewhere/ivy.xml b/sigil/bld-ivy/test/multi-project/projects/sizewhere/ivy.xml
new file mode 100644
index 0000000..6b86af0
--- /dev/null
+++ b/sigil/bld-ivy/test/multi-project/projects/sizewhere/ivy.xml
@@ -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="sizewhere"
+ status="integration"/>
+ <configurations>
+ <conf name="core"/>
+ <conf name="standalone" extends="core"/>
+ </configurations>
+ <publications>
+ <artifact name="sizewhere" type="jar" conf="core" />
+ </publications>
+ <dependencies>
+ <!--
+ <dependency name="version" rev="latest.integration" conf="core->default" />
+ <dependency name="size" rev="latest.integration" conf="core->default" />
+ <dependency name="find" rev="latest.integration" conf="core" />
+ <dependency org="commons-cli" name="commons-cli" rev="1.0" conf="standalone->default" />
+ -->
+ </dependencies>
+</ivy-module>
diff --git a/sigil/bld-ivy/test/multi-project/projects/sizewhere/sigil.properties b/sigil/bld-ivy/test/multi-project/projects/sizewhere/sigil.properties
new file mode 100644
index 0000000..c272f9b
--- /dev/null
+++ b/sigil/bld-ivy/test/multi-project/projects/sizewhere/sigil.properties
@@ -0,0 +1,10 @@
+
+-bundles: sizewhere
+
+-exports: sizewhere
+
+-imports:\
+ find, \
+ size, \
+ version, \
+ org.apache.commons.cli
diff --git a/sigil/bld-ivy/test/multi-project/projects/sizewhere/src/sizewhere/Main.java b/sigil/bld-ivy/test/multi-project/projects/sizewhere/src/sizewhere/Main.java
new file mode 100644
index 0000000..131af66
--- /dev/null
+++ b/sigil/bld-ivy/test/multi-project/projects/sizewhere/src/sizewhere/Main.java
@@ -0,0 +1,70 @@
+/*
+ * 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 sizewhere;
+
+import java.io.File;
+
+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( "give total size of files in given dir" )
+ .create( "dir" );
+ Option name = OptionBuilder.withArgName( "name" )
+ .hasArg()
+ .withDescription( "give total size of 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");
+ System.out.println("total size of files in "+dir+" containing "+name+": "+SizeWhere.totalSize(dir, name));
+ } catch( ParseException exp ) {
+ // oops, something went wrong
+ System.err.println( "Parsing failed. Reason: " + exp.getMessage() );
+
+ HelpFormatter formatter = new HelpFormatter();
+ formatter.printHelp( "sizewhere", options );
+ }
+ }
+
+}
diff --git a/sigil/bld-ivy/test/multi-project/projects/sizewhere/src/sizewhere/SizeWhere.java b/sigil/bld-ivy/test/multi-project/projects/sizewhere/src/sizewhere/SizeWhere.java
new file mode 100644
index 0000000..3594bd9
--- /dev/null
+++ b/sigil/bld-ivy/test/multi-project/projects/sizewhere/src/sizewhere/SizeWhere.java
@@ -0,0 +1,38 @@
+/*
+ * 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 sizewhere;
+
+import version.Version;
+import size.FileSize;
+import find.FindFile;
+
+import java.util.Collection;
+import java.util.ArrayList;
+import java.io.File;
+
+public class SizeWhere {
+ static {
+ Version.register("sizewhere");
+ }
+
+ public static long totalSize(File dir, String name) {
+ return FileSize.totalSize(FindFile.find(dir, name));
+ }
+}
diff --git a/sigil/bld-ivy/test/multi-project/projects/version/build.properties b/sigil/bld-ivy/test/multi-project/projects/version/build.properties
new file mode 100644
index 0000000..1b54925
--- /dev/null
+++ b/sigil/bld-ivy/test/multi-project/projects/version/build.properties
@@ -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
diff --git a/sigil/bld-ivy/test/multi-project/projects/version/build.xml b/sigil/bld-ivy/test/multi-project/projects/version/build.xml
new file mode 100644
index 0000000..375db20
--- /dev/null
+++ b/sigil/bld-ivy/test/multi-project/projects/version/build.xml
@@ -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="version" default="compile">
+ <property file="build.properties"/>
+
+ <import file="${common.dir}/common.xml"/>
+</project>
diff --git a/sigil/bld-ivy/test/multi-project/projects/version/ivy.xml b/sigil/bld-ivy/test/multi-project/projects/version/ivy.xml
new file mode 100644
index 0000000..16e08f3
--- /dev/null
+++ b/sigil/bld-ivy/test/multi-project/projects/version/ivy.xml
@@ -0,0 +1,25 @@
+<?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="version"
+ status="integration"/>
+</ivy-module>
diff --git a/sigil/bld-ivy/test/multi-project/projects/version/sigil.properties b/sigil/bld-ivy/test/multi-project/projects/version/sigil.properties
new file mode 100644
index 0000000..a940ffd
--- /dev/null
+++ b/sigil/bld-ivy/test/multi-project/projects/version/sigil.properties
@@ -0,0 +1,4 @@
+
+-bundles: version
+
+-exports: version
diff --git a/sigil/bld-ivy/test/multi-project/projects/version/src/version/Version.java b/sigil/bld-ivy/test/multi-project/projects/version/src/version/Version.java
new file mode 100644
index 0000000..0c69bc5
--- /dev/null
+++ b/sigil/bld-ivy/test/multi-project/projects/version/src/version/Version.java
@@ -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 version;
+
+import java.io.InputStream;
+import java.util.Properties;
+import java.util.Map;
+import java.util.HashMap;
+
+public class Version {
+ static {
+ versions = new HashMap();
+ register("version");
+ }
+
+ private static Map versions;
+
+ public static void register(String module) {
+ try {
+ InputStream moduleVersion = Version.class.getResourceAsStream("/"+module+".properties");
+ Properties props = new Properties();
+ props.load(moduleVersion);
+ String version = (String)props.get("version");
+ versions.put(module, version);
+ System.out.println("--- using "+module+" v"+version);
+ } catch (Exception ex) {
+ System.err.println("an error occured while registering "+module+": "+ex.getMessage());
+ ex.printStackTrace();
+ }
+ }
+}