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 [5/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/test/multi-project/projects/list/ivy.xml
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bld-ivy/test/multi-project/projects/list/ivy.xml?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bld-ivy/test/multi-project/projects/list/ivy.xml (added)
+++ felix/trunk/sigil/bld-ivy/test/multi-project/projects/list/ivy.xml Mon Jul 13 13:25:46 2009
@@ -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>
Added: felix/trunk/sigil/bld-ivy/test/multi-project/projects/list/sigil.properties
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bld-ivy/test/multi-project/projects/list/sigil.properties?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bld-ivy/test/multi-project/projects/list/sigil.properties (added)
+++ felix/trunk/sigil/bld-ivy/test/multi-project/projects/list/sigil.properties Mon Jul 13 13:25:46 2009
@@ -0,0 +1,14 @@
+
+# requirements
+
+-imports:\
+ version, \
+ org.apache.commons.cli
+
+# exports
+
+-bundles: list
+
+list;name: org.example.list
+list;-exports: list.*
+
Added: felix/trunk/sigil/bld-ivy/test/multi-project/projects/list/src/list/ListFile.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bld-ivy/test/multi-project/projects/list/src/list/ListFile.java?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bld-ivy/test/multi-project/projects/list/src/list/ListFile.java (added)
+++ felix/trunk/sigil/bld-ivy/test/multi-project/projects/list/src/list/ListFile.java Mon Jul 13 13:25:46 2009
@@ -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;
+ }
+}
Added: felix/trunk/sigil/bld-ivy/test/multi-project/projects/list/src/list/Main.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bld-ivy/test/multi-project/projects/list/src/list/Main.java?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bld-ivy/test/multi-project/projects/list/src/list/Main.java (added)
+++ felix/trunk/sigil/bld-ivy/test/multi-project/projects/list/src/list/Main.java Mon Jul 13 13:25:46 2009
@@ -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 );
+ }
+ }
+
+}
Added: felix/trunk/sigil/bld-ivy/test/multi-project/projects/sigil-defaults.properties
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bld-ivy/test/multi-project/projects/sigil-defaults.properties?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bld-ivy/test/multi-project/projects/sigil-defaults.properties (added)
+++ felix/trunk/sigil/bld-ivy/test/multi-project/projects/sigil-defaults.properties Mon Jul 13 13:25:46 2009
@@ -0,0 +1,6 @@
+
+header;Bundle-Vendor: Paremus Limited
+
+package;org.osgi.framework: 1.7.1
+
+bad-key: wibble
Added: felix/trunk/sigil/bld-ivy/test/multi-project/projects/size/build.properties
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bld-ivy/test/multi-project/projects/size/build.properties?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bld-ivy/test/multi-project/projects/size/build.properties (added)
+++ felix/trunk/sigil/bld-ivy/test/multi-project/projects/size/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/size/build.xml
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bld-ivy/test/multi-project/projects/size/build.xml?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bld-ivy/test/multi-project/projects/size/build.xml (added)
+++ felix/trunk/sigil/bld-ivy/test/multi-project/projects/size/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="size" default="compile">
+ <property file="build.properties"/>
+
+ <import file="${common.dir}/common.xml"/>
+</project>
Added: felix/trunk/sigil/bld-ivy/test/multi-project/projects/size/ivy.xml
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bld-ivy/test/multi-project/projects/size/ivy.xml?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bld-ivy/test/multi-project/projects/size/ivy.xml (added)
+++ felix/trunk/sigil/bld-ivy/test/multi-project/projects/size/ivy.xml Mon Jul 13 13:25:46 2009
@@ -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>
Added: felix/trunk/sigil/bld-ivy/test/multi-project/projects/size/sigil.properties
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bld-ivy/test/multi-project/projects/size/sigil.properties?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bld-ivy/test/multi-project/projects/size/sigil.properties (added)
+++ felix/trunk/sigil/bld-ivy/test/multi-project/projects/size/sigil.properties Mon Jul 13 13:25:46 2009
@@ -0,0 +1,8 @@
+
+-bundles: size
+
+-exports: size
+
+-imports:\
+ list, \
+ version
Added: felix/trunk/sigil/bld-ivy/test/multi-project/projects/size/src/size/FileSize.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bld-ivy/test/multi-project/projects/size/src/size/FileSize.java?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bld-ivy/test/multi-project/projects/size/src/size/FileSize.java (added)
+++ felix/trunk/sigil/bld-ivy/test/multi-project/projects/size/src/size/FileSize.java Mon Jul 13 13:25:46 2009
@@ -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;
+ }
+}
Added: felix/trunk/sigil/bld-ivy/test/multi-project/projects/sizewhere/build.properties
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bld-ivy/test/multi-project/projects/sizewhere/build.properties?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bld-ivy/test/multi-project/projects/sizewhere/build.properties (added)
+++ felix/trunk/sigil/bld-ivy/test/multi-project/projects/sizewhere/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/sizewhere/build.xml
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bld-ivy/test/multi-project/projects/sizewhere/build.xml?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bld-ivy/test/multi-project/projects/sizewhere/build.xml (added)
+++ felix/trunk/sigil/bld-ivy/test/multi-project/projects/sizewhere/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="sizewhere" default="compile">
+ <property file="build.properties"/>
+
+ <import file="${common.dir}/common.xml"/>
+</project>
Added: felix/trunk/sigil/bld-ivy/test/multi-project/projects/sizewhere/ivy.xml
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bld-ivy/test/multi-project/projects/sizewhere/ivy.xml?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bld-ivy/test/multi-project/projects/sizewhere/ivy.xml (added)
+++ felix/trunk/sigil/bld-ivy/test/multi-project/projects/sizewhere/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="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>
Added: felix/trunk/sigil/bld-ivy/test/multi-project/projects/sizewhere/sigil.properties
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bld-ivy/test/multi-project/projects/sizewhere/sigil.properties?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bld-ivy/test/multi-project/projects/sizewhere/sigil.properties (added)
+++ felix/trunk/sigil/bld-ivy/test/multi-project/projects/sizewhere/sigil.properties Mon Jul 13 13:25:46 2009
@@ -0,0 +1,10 @@
+
+-bundles: sizewhere
+
+-exports: sizewhere
+
+-imports:\
+ find, \
+ size, \
+ version, \
+ org.apache.commons.cli
Added: felix/trunk/sigil/bld-ivy/test/multi-project/projects/sizewhere/src/sizewhere/Main.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bld-ivy/test/multi-project/projects/sizewhere/src/sizewhere/Main.java?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bld-ivy/test/multi-project/projects/sizewhere/src/sizewhere/Main.java (added)
+++ felix/trunk/sigil/bld-ivy/test/multi-project/projects/sizewhere/src/sizewhere/Main.java Mon Jul 13 13:25:46 2009
@@ -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 );
+ }
+ }
+
+}
Added: felix/trunk/sigil/bld-ivy/test/multi-project/projects/sizewhere/src/sizewhere/SizeWhere.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bld-ivy/test/multi-project/projects/sizewhere/src/sizewhere/SizeWhere.java?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bld-ivy/test/multi-project/projects/sizewhere/src/sizewhere/SizeWhere.java (added)
+++ felix/trunk/sigil/bld-ivy/test/multi-project/projects/sizewhere/src/sizewhere/SizeWhere.java Mon Jul 13 13:25:46 2009
@@ -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));
+ }
+}
Added: felix/trunk/sigil/bld-ivy/test/multi-project/projects/version/build.properties
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bld-ivy/test/multi-project/projects/version/build.properties?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bld-ivy/test/multi-project/projects/version/build.properties (added)
+++ felix/trunk/sigil/bld-ivy/test/multi-project/projects/version/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/version/build.xml
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bld-ivy/test/multi-project/projects/version/build.xml?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bld-ivy/test/multi-project/projects/version/build.xml (added)
+++ felix/trunk/sigil/bld-ivy/test/multi-project/projects/version/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="version" default="compile">
+ <property file="build.properties"/>
+
+ <import file="${common.dir}/common.xml"/>
+</project>
Added: felix/trunk/sigil/bld-ivy/test/multi-project/projects/version/ivy.xml
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bld-ivy/test/multi-project/projects/version/ivy.xml?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bld-ivy/test/multi-project/projects/version/ivy.xml (added)
+++ felix/trunk/sigil/bld-ivy/test/multi-project/projects/version/ivy.xml Mon Jul 13 13:25:46 2009
@@ -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>
Added: felix/trunk/sigil/bld-ivy/test/multi-project/projects/version/sigil.properties
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bld-ivy/test/multi-project/projects/version/sigil.properties?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bld-ivy/test/multi-project/projects/version/sigil.properties (added)
+++ felix/trunk/sigil/bld-ivy/test/multi-project/projects/version/sigil.properties Mon Jul 13 13:25:46 2009
@@ -0,0 +1,4 @@
+
+-bundles: version
+
+-exports: version
Added: felix/trunk/sigil/bld-ivy/test/multi-project/projects/version/src/version/Version.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bld-ivy/test/multi-project/projects/version/src/version/Version.java?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bld-ivy/test/multi-project/projects/version/src/version/Version.java (added)
+++ felix/trunk/sigil/bld-ivy/test/multi-project/projects/version/src/version/Version.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 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();
+ }
+ }
+}
Added: felix/trunk/sigil/bld-junit/.classpath
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bld-junit/.classpath?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bld-junit/.classpath (added)
+++ felix/trunk/sigil/bld-junit/.classpath Mon Jul 13 13:25:46 2009
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.cauldron.sigil.core.classpathContainer"/>
+ <classpathentry kind="output" path="build/classes"/>
+</classpath>
Added: felix/trunk/sigil/bld-junit/.project
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bld-junit/.project?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bld-junit/.project (added)
+++ felix/trunk/sigil/bld-junit/.project Mon Jul 13 13:25:46 2009
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>bld-junit</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.cauldron.sigil.core.newtonBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.cauldron.sigil.core.newtonnature</nature>
+ </natures>
+</projectDescription>
Added: felix/trunk/sigil/bld-junit/.settings/org.eclipse.jdt.core.prefs
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bld-junit/.settings/org.eclipse.jdt.core.prefs?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bld-junit/.settings/org.eclipse.jdt.core.prefs (added)
+++ felix/trunk/sigil/bld-junit/.settings/org.eclipse.jdt.core.prefs Mon Jul 13 13:25:46 2009
@@ -0,0 +1,7 @@
+#Thu Feb 19 09:53:36 GMT 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Added: felix/trunk/sigil/bld-junit/build.xml
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bld-junit/build.xml?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bld-junit/build.xml (added)
+++ felix/trunk/sigil/bld-junit/build.xml Mon Jul 13 13:25:46 2009
@@ -0,0 +1,23 @@
+<?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="bld-junit" default="bundle" basedir=".">
+ <import file="../bldcommon/common.xml"/>
+</project>
Added: felix/trunk/sigil/bld-junit/ivy.xml
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bld-junit/ivy.xml?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bld-junit/ivy.xml (added)
+++ felix/trunk/sigil/bld-junit/ivy.xml Mon Jul 13 13:25:46 2009
@@ -0,0 +1,28 @@
+<?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.cauldron"
+ module="bld.junit"
+ status="integration"/>
+ <publications>
+ <artifact name="org.cauldron.sigil.junit" />
+ </publications>
+</ivy-module>
Added: felix/trunk/sigil/bld-junit/sigil.properties
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bld-junit/sigil.properties?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bld-junit/sigil.properties (added)
+++ felix/trunk/sigil/bld-junit/sigil.properties Mon Jul 13 13:25:46 2009
@@ -0,0 +1,22 @@
+
+# sigil project file, saved by plugin.
+
+-activator: org.cauldron.sigil.junit.activator.Activator
+
+version: 0.8.0
+
+-bundles: \
+ org.cauldron.sigil.junit, \
+
+-sourcedirs: \
+ src, \
+
+-exports: \
+ org.cauldron.sigil.junit.server, \
+
+-imports: \
+ junit.framework;version=4.5.0, \
+ org.osgi.framework;version=1.4.0, \
+ org.osgi.util.tracker;version=1.3.3, \
+
+# end
Added: felix/trunk/sigil/bld-junit/src/org/cauldron/sigil/junit/AbstractSigilTestCase.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bld-junit/src/org/cauldron/sigil/junit/AbstractSigilTestCase.java?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bld-junit/src/org/cauldron/sigil/junit/AbstractSigilTestCase.java (added)
+++ felix/trunk/sigil/bld-junit/src/org/cauldron/sigil/junit/AbstractSigilTestCase.java Mon Jul 13 13:25:46 2009
@@ -0,0 +1,100 @@
+/*
+ * 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.sigil.junit;
+
+import java.lang.reflect.Method;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.util.tracker.ServiceTracker;
+import org.osgi.util.tracker.ServiceTrackerCustomizer;
+
+import junit.framework.TestCase;
+
+public abstract class AbstractSigilTestCase extends TestCase {
+
+ private final static List<ServiceTracker> trackers = new LinkedList<ServiceTracker>();
+
+ private BundleContext ctx;
+
+ public void setBundleContext(BundleContext ctx) {
+ this.ctx = ctx;
+ }
+
+ protected BundleContext getBundleContext() {
+ return ctx;
+ }
+
+ @Override
+ protected void setUp() {
+ for ( Class<?> c : getReferences() ) {
+ ServiceTracker t = createBindTracker(c);
+ t.open();
+ trackers.add( t );
+ }
+ }
+
+ @Override
+ protected void tearDown() {
+ for ( ServiceTracker t : trackers ) {
+ t.close();
+ }
+ trackers.clear();
+ }
+
+
+ private ServiceTracker createBindTracker(final Class<?> c) {
+ return new ServiceTracker(ctx, c.getName(), new ServiceTrackerCustomizer() {
+ public Object addingService(ServiceReference reference) {
+ Object o = ctx.getService(reference);
+ Method m = getBindMethod(c);
+ if ( m != null ) invoke( m, o );
+ return o;
+ }
+
+ public void modifiedService(ServiceReference reference,
+ Object service) {
+ }
+
+ public void removedService(ServiceReference reference,
+ Object service) {
+ Method m = getUnbindMethod(c);
+ if ( m != null ) invoke( m, service );
+ ctx.ungetService(reference);
+ }
+ });
+ }
+
+ private void invoke(Method m, Object o) {
+ try {
+ m.invoke( this, new Object[] { o } );
+ } catch (Exception e) {
+ throw new IllegalStateException( "Failed to invoke binding method " + m, e);
+ }
+ }
+
+ protected abstract Class<?>[] getReferences();
+
+ protected abstract Method getBindMethod(Class<?> clazz);
+
+ protected abstract Method getUnbindMethod(Class<?> clazz);
+}
Added: felix/trunk/sigil/bld-junit/src/org/cauldron/sigil/junit/ReflectiveSigilTestCase.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bld-junit/src/org/cauldron/sigil/junit/ReflectiveSigilTestCase.java?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bld-junit/src/org/cauldron/sigil/junit/ReflectiveSigilTestCase.java (added)
+++ felix/trunk/sigil/bld-junit/src/org/cauldron/sigil/junit/ReflectiveSigilTestCase.java Mon Jul 13 13:25:46 2009
@@ -0,0 +1,98 @@
+/*
+ * 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.sigil.junit;
+
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+
+public abstract class ReflectiveSigilTestCase extends AbstractSigilTestCase {
+
+ private Class<?>[] references;
+ private Map<Class<?>, Method> bindMethods;
+ private Map<Class<?>, Method> unbindMethods;
+
+ @Override
+ protected Class<?>[] getReferences() {
+ introspect();
+ return references;
+ }
+
+ @Override
+ protected Method getBindMethod(Class<?> clazz) {
+ return bindMethods.get(clazz);
+ }
+
+ @Override
+ protected Method getUnbindMethod(Class<?> clazz) {
+ return unbindMethods.get(clazz);
+ }
+
+ private void introspect() {
+ if ( references == null ) {
+ bindMethods = findBindMethods(getClass(), "set", "add");
+ unbindMethods = findBindMethods(getClass(), "set", "remove");
+
+ HashSet<Class<?>> refs = new HashSet<Class<?>>();
+ refs.addAll( bindMethods.keySet() );
+ refs.addAll( unbindMethods.keySet() );
+ references = refs.toArray( new Class<?>[refs.size()] );
+ }
+ }
+
+ private static Map<Class<?>, Method> findBindMethods(Class<?> clazz, String... prefix) {
+ HashMap<Class<?>, Method> found = new HashMap<Class<?>, Method>();
+
+ checkDeclaredMethods(clazz, found, prefix);
+
+ return found;
+ }
+
+ private static void checkDeclaredMethods(Class<?> clazz, Map<Class<?>, Method> found, String...prefix) {
+ for ( Method m : clazz.getDeclaredMethods() ) {
+ if ( isMethodPrefixed(m, prefix) && isBindSignature(m) ) {
+ found.put( m.getParameterTypes()[0], m );
+ }
+ }
+
+ Class<?> sup = clazz.getSuperclass();
+ if ( sup != null && sup != Object.class ) {
+ checkDeclaredMethods(sup, found, prefix);
+ }
+
+ for ( Class<?> i : clazz.getInterfaces() ) {
+ checkDeclaredMethods(i, found, prefix);
+ }
+ }
+
+ private static boolean isMethodPrefixed(Method m, String...prefix) {
+ String n = m.getName();
+ for ( String p : prefix ) {
+ if ( n.startsWith( p ) && n.length() > p.length() ) {
+ return true;
+ }
+ }
+ return false;
+ }
+ private static boolean isBindSignature(Method m) {
+ return m.getReturnType() == Void.TYPE && m.getParameterTypes().length == 1;
+ }
+}
Added: felix/trunk/sigil/bld-junit/src/org/cauldron/sigil/junit/activator/Activator.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bld-junit/src/org/cauldron/sigil/junit/activator/Activator.java?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bld-junit/src/org/cauldron/sigil/junit/activator/Activator.java (added)
+++ felix/trunk/sigil/bld-junit/src/org/cauldron/sigil/junit/activator/Activator.java Mon Jul 13 13:25:46 2009
@@ -0,0 +1,47 @@
+/*
+ * 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.sigil.junit.activator;
+
+import org.cauldron.sigil.junit.server.JUnitService;
+import org.cauldron.sigil.junit.server.impl.JUnitServiceFactory;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+
+/**
+ * @author dave
+ */
+public class Activator implements BundleActivator {
+ private ServiceRegistration reg;
+ private JUnitServiceFactory service;
+
+ public void start(final BundleContext ctx) {
+ service = new JUnitServiceFactory();
+ service.start(ctx);
+ reg = ctx.registerService(JUnitService.class.getName(), service, null);
+ }
+
+ public void stop(BundleContext ctx) {
+ reg.unregister();
+ reg = null;
+ service.stop(ctx);
+ service = null;
+ }
+}
Added: felix/trunk/sigil/bld-junit/src/org/cauldron/sigil/junit/server/JUnitService.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bld-junit/src/org/cauldron/sigil/junit/server/JUnitService.java?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bld-junit/src/org/cauldron/sigil/junit/server/JUnitService.java (added)
+++ felix/trunk/sigil/bld-junit/src/org/cauldron/sigil/junit/server/JUnitService.java Mon Jul 13 13:25:46 2009
@@ -0,0 +1,34 @@
+/*
+ * 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.sigil.junit.server;
+
+import java.util.Set;
+
+import org.osgi.framework.BundleContext;
+
+import junit.framework.TestSuite;
+
+public interface JUnitService {
+ Set<String> getTests();
+
+ TestSuite createTest(String test);
+
+ TestSuite createTest(String test, BundleContext ctx);
+}
\ No newline at end of file
Added: felix/trunk/sigil/bld-junit/src/org/cauldron/sigil/junit/server/impl/JUnitServiceFactory.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bld-junit/src/org/cauldron/sigil/junit/server/impl/JUnitServiceFactory.java?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bld-junit/src/org/cauldron/sigil/junit/server/impl/JUnitServiceFactory.java (added)
+++ felix/trunk/sigil/bld-junit/src/org/cauldron/sigil/junit/server/impl/JUnitServiceFactory.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 org.cauldron.sigil.junit.server.impl;
+
+import java.util.HashMap;
+import java.util.Set;
+import java.util.TreeSet;
+
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceFactory;
+import org.osgi.framework.ServiceRegistration;
+
+public class JUnitServiceFactory implements ServiceFactory {
+
+ private HashMap<String, Class<? extends TestCase>> tests = new HashMap<String, Class<? extends TestCase>>();
+ private TestClassListener listener;
+
+ public void start(BundleContext ctx) {
+ listener = new TestClassListener(this);
+ ctx.addBundleListener(listener);
+ //listener.index(ctx.getBundle());
+ for ( Bundle b : ctx.getBundles() ) {
+ if ( b.getState() == Bundle.RESOLVED ) {
+ listener.index(b);
+ }
+ }
+ }
+
+ public void stop(BundleContext ctx) {
+ ctx.removeBundleListener(listener);
+ listener = null;
+ }
+
+ public Object getService(Bundle bundle, ServiceRegistration reg) {
+ return new JUnitServiceImpl(this, bundle.getBundleContext());
+ }
+
+ public void ungetService(Bundle bundle, ServiceRegistration reg, Object service) {
+ }
+
+ public void registerTest(Class<? extends TestCase> clazz) {
+ tests.put( clazz.getName(), clazz );
+ }
+
+ public void unregister(Class<? extends TestCase> clazz) {
+ tests.remove(clazz.getName());
+ }
+
+ public Set<String> getTests() {
+ return new TreeSet<String>(tests.keySet());
+ }
+
+ public TestSuite getTest(String test) {
+ Class<? extends TestCase> tc = tests.get(test);
+ return tc == null ? null : new TestSuite(tc);
+ }
+
+}
Added: felix/trunk/sigil/bld-junit/src/org/cauldron/sigil/junit/server/impl/JUnitServiceImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bld-junit/src/org/cauldron/sigil/junit/server/impl/JUnitServiceImpl.java?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bld-junit/src/org/cauldron/sigil/junit/server/impl/JUnitServiceImpl.java (added)
+++ felix/trunk/sigil/bld-junit/src/org/cauldron/sigil/junit/server/impl/JUnitServiceImpl.java Mon Jul 13 13:25:46 2009
@@ -0,0 +1,152 @@
+/*
+ * 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.sigil.junit.server.impl;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.Enumeration;
+import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import junit.framework.Test;
+import junit.framework.TestResult;
+import junit.framework.TestSuite;
+
+import org.cauldron.sigil.junit.server.JUnitService;
+import org.osgi.framework.BundleContext;
+
+public class JUnitServiceImpl implements JUnitService {
+
+ private static final Logger log = Logger.getLogger(JUnitServiceImpl.class.getName());
+
+ private static final Class<?>[] BUNDLE_CONTEXT_PARAMS = new Class[] { BundleContext.class };
+
+ private final JUnitServiceFactory junitServiceFactory;
+ private final BundleContext bundleContext;
+
+ public JUnitServiceImpl(JUnitServiceFactory junitServiceFactory, BundleContext bundleContext) {
+ this.junitServiceFactory = junitServiceFactory;
+ this.bundleContext = bundleContext;
+ }
+
+ public Set<String> getTests() {
+ return junitServiceFactory.getTests();
+ }
+
+ public TestSuite createTest(String test) {
+ return createTest(test, null);
+ }
+
+ public TestSuite createTest(String test, BundleContext ctx) {
+ try {
+ TestSuite ts = junitServiceFactory.getTest(test);
+
+ if ( ts == null ) return null;
+
+ TestSuite ret = new TestSuite(ts.getName());
+
+ Enumeration<Test> e = ts.tests();
+
+ while ( e.hasMoreElements() ) {
+ Test t = e.nextElement();
+ setContext(t, ctx);
+ ret.addTest(t);
+ }
+
+ return ret;
+ }
+ catch (final NoClassDefFoundError e) {
+ TestSuite s = new TestSuite(test);
+ s.addTest( new Test() {
+ public int countTestCases() {
+ return 1;
+ }
+
+ public void run(TestResult result) {
+ result.addError(this, e);
+ }
+ });
+ return s;
+ }
+ catch (final RuntimeException e) {
+ TestSuite s = new TestSuite(test);
+ s.addTest( new Test() {
+ public int countTestCases() {
+ return 1;
+ }
+
+ public void run(TestResult result) {
+ result.addError(this, e);
+ }
+
+ });
+ return s;
+ }
+ }
+
+ private void setContext(Test t, BundleContext ctx) {
+ try {
+ Method m = findMethod( t.getClass(), "setBundleContext", BUNDLE_CONTEXT_PARAMS );
+ if ( m != null )
+ m.invoke(t, ctx == null ? bundleContext : ctx );
+ } catch (SecurityException e) {
+ log.log( Level.WARNING, "Failed to set bundle context on " + t, e);
+ } catch (IllegalArgumentException e) {
+ log.log( Level.WARNING, "Failed to set bundle context on " + t, e);
+ } catch (IllegalAccessException e) {
+ log.log( Level.WARNING, "Failed to set bundle context on " + t, e);
+ } catch (InvocationTargetException e) {
+ log.log( Level.WARNING, "Failed to set bundle context on " + t, e);
+ }
+ }
+
+ private Method findMethod(Class<?> clazz, String name,
+ Class<?>[] params) {
+ Method found = null;
+
+ for ( Method m : clazz.getDeclaredMethods() ) {
+ if ( m.getName().equals(name) && Arrays.deepEquals(m.getParameterTypes(), params) ) {
+ found = m;
+ break;
+ }
+ }
+
+ if ( found == null ) {
+ Class<?> c = clazz.getSuperclass();
+
+ if ( c != null && c != Object.class ) {
+ found = findMethod(c, name, params);
+ }
+ }
+
+ if ( found == null ) {
+ for ( Class<?> c : clazz.getInterfaces() ) {
+ found = findMethod(c, name, params);
+ if ( found != null ) {
+ break;
+ }
+ }
+ }
+
+ return found;
+ }
+}
Added: felix/trunk/sigil/bld-junit/src/org/cauldron/sigil/junit/server/impl/TestClassListener.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bld-junit/src/org/cauldron/sigil/junit/server/impl/TestClassListener.java?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bld-junit/src/org/cauldron/sigil/junit/server/impl/TestClassListener.java (added)
+++ felix/trunk/sigil/bld-junit/src/org/cauldron/sigil/junit/server/impl/TestClassListener.java Mon Jul 13 13:25:46 2009
@@ -0,0 +1,134 @@
+/*
+ * 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.sigil.junit.server.impl;
+
+import java.lang.reflect.Modifier;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import junit.framework.TestCase;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleEvent;
+import org.osgi.framework.SynchronousBundleListener;
+
+public class TestClassListener implements SynchronousBundleListener {
+ private static final Logger log = Logger.getLogger(TestClassListener.class.getName());
+
+ private final JUnitServiceFactory service;
+
+ private HashMap<Long, Class<TestCase>[]> registrations = new HashMap<Long, Class<TestCase>[]>();
+
+ public TestClassListener(JUnitServiceFactory service) {
+ this.service = service;
+ }
+
+ public void bundleChanged(BundleEvent event) {
+ switch( event.getType() ) {
+ case BundleEvent.RESOLVED:
+ index( event.getBundle() );
+ break;
+ case BundleEvent.UNRESOLVED:
+ unindex( event.getBundle() );
+ break;
+ }
+ }
+
+ void index(Bundle bundle) {
+ if ( isTestBundle( bundle ) ) {
+ List<String> tests = findTests( bundle );
+
+ if ( !tests.isEmpty() ) {
+ LinkedList<Class<? extends TestCase>> regs = new LinkedList<Class<? extends TestCase>>();
+
+ for ( String jc : tests ) {
+ try {
+ Class<?> clazz = bundle.loadClass(jc);
+ if ( isTestCase(clazz) ) {
+ Class<? extends TestCase> tc = clazz.asSubclass(TestCase.class);
+ regs.add( tc );
+ service.registerTest(tc);
+ }
+ } catch (ClassNotFoundException e) {
+ log.log( Level.WARNING, "Failed to load class " + jc, e );
+ } catch (NoClassDefFoundError e) {
+ log.log( Level.WARNING, "Failed to load class " + jc, e );
+ }
+ }
+
+ registrations.put( bundle.getBundleId(), toArray(regs) );
+ }
+ }
+ }
+
+ private boolean isTestBundle(Bundle bundle) {
+ try {
+ bundle.loadClass(TestCase.class.getName());
+ return true;
+ } catch (ClassNotFoundException e) {
+ return false;
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private Class<TestCase>[] toArray(LinkedList<Class<? extends TestCase>> regs) {
+ return regs.toArray( new Class[regs.size()] );
+ }
+
+ private boolean isTestCase(Class<?> clazz) {
+ return
+ TestCase.class.isAssignableFrom(clazz) &&
+ !Modifier.isAbstract(clazz.getModifiers()) &&
+ !clazz.getPackage().getName().startsWith( "junit" );
+ }
+
+ void unindex(Bundle bundle) {
+ Class<TestCase>[] classes = registrations.remove(bundle.getBundleId());
+ if ( classes != null ) {
+ for ( Class<TestCase> tc : classes ) {
+ service.unregister(tc);
+ }
+ }
+ }
+
+ private List<String> findTests(Bundle bundle) {
+ @SuppressWarnings("unchecked") Enumeration<URL> urls = bundle.findEntries("", "*.class", true);
+
+ LinkedList<String> tests = new LinkedList<String>();
+ while( urls.hasMoreElements() ) {
+ URL url = urls.nextElement();
+ tests.add( toClassName( url ) );
+ }
+
+ return tests;
+ }
+
+ private String toClassName(URL url) {
+ String f = url.getFile();
+ String cn = f.substring(1, f.length() - 6 );
+ return cn.replace('/', '.');
+ }
+
+}
Added: felix/trunk/sigil/bldcommon/build.properties
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bldcommon/build.properties?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bldcommon/build.properties (added)
+++ felix/trunk/sigil/bldcommon/build.properties Mon Jul 13 13:25:46 2009
@@ -0,0 +1,40 @@
+# common properties
+# easier to set here than in xml file
+
+# set common.dir when used without ant (e.g. IvyDE)
+common.dir = ${ivy.settings.dir}
+
+ivy.jar = ${common.dir}/../bld-ivy/lib/compile/ivy-2.0.0-rc1.jar
+sigil-ivy-plugin.jar = ${common.dir}/../bld-ivy/target/sigil-ivy-plugin.jar
+
+build.dir = ${basedir}/build
+build_xml = build.xml
+classes.dir = ${build.dir}/classes
+deps.dir = ${build.dir}/deps
+composite.dir = ${basedir}/xml
+src.dir = ${basedir}/src
+ivy.file = ${basedir}/ivy.xml
+
+_build.dir = ${build.dir}
+build.lib.dir = ${_build.dir}/lib
+build.etc.dir = ${_build.dir}/etc
+
+top-build.dir = ${common.dir}/../build
+dist.dir = ${top-build.dir}/dist
+install.dir = ${top-build.dir}/install
+cache.dir = ${top-build.dir}/ivy-cache
+repository.dir = ${top-build.dir}/repository
+# note: clean-local task assumes repository.pattern starts with ${ivy.module}
+repository.pattern = [module]/[revision]/[type]s/[artifact].[ext]
+
+community.version = 1.4.0.SNAPSHOT
+jini.version = 2.1
+paremus.version = ${default.version}
+bundle.version = ${paremus.version}
+resolve.log = download-only
+
+# over-ridden by hudson
+buildVersion = 0.8.0-dev
+
+# end
+
Added: felix/trunk/sigil/bldcommon/common.xml
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bldcommon/common.xml?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bldcommon/common.xml (added)
+++ felix/trunk/sigil/bldcommon/common.xml Mon Jul 13 13:25:46 2009
@@ -0,0 +1,466 @@
+<?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">
+
+ <dirname property="common.dir" file="${ant.file.common}"/>
+ <property file="${common.dir}/sigil-defaults.properties" prefix="default."/>
+ <property file="${common.dir}/build.properties"/>
+
+ <!-- =====================================================
+ stuff intended to be over-ridden is prefixed with my.
+ =====================================================-->
+
+ <fileset id="my.projects" dir="${basedir}">
+ <include name="**/${build_xml}"/>
+ </fileset>
+
+ <path id="my.classpath">
+ <fileset dir="${basedir}" includes="lib/*.jar"/>
+ </path>
+
+ <path id="javac.classpath">
+ <path refid="my.classpath"/>
+ <fileset dir="${deps.dir}" />
+ </path>
+
+ <path id="sigil.classpath">
+ <path refid="javac.classpath" />
+ <path location="${classes.dir}" />
+ </path>
+
+ <!-- =================================
+ target: load-ivy
+ ================================= -->
+ <target name="load-ivy" depends="ident,ivy-taskdefs">
+ <ivy:settings file="${common.dir}/ivysettings.xml" />
+ </target>
+
+ <!-- =================================
+ target: ivy-taskdefs
+ ================================= -->
+ <target name="ivy-taskdefs" unless="ivy.loaded">
+ <property name="ivy.loaded" value="true"/>
+ <echo message="Loading Ivy ... common.dir=${common.dir}"/>
+
+ <taskdef resource="org/apache/ivy/ant/antlib.xml"
+ uri="antlib:org.apache.ivy.ant"
+ classpath="${ivy.jar}:${sigil-ivy-plugin.jar}"/>
+
+ <taskdef name="sigil.bundle"
+ classname="org.cauldron.bld.ant.BundleTask"
+ classpath="${sigil-ivy-plugin.jar}"/>
+
+ <taskdef name="sigil.bundle.info"
+ classname="org.cauldron.bld.ant.BundleInfoTask"
+ classpath="${sigil-ivy-plugin.jar}"/>
+ </target>
+
+
+ <!-- =================================
+ target: build (default target)
+ ================================= -->
+ <target name="build" depends="publish-local, composites" />
+
+ <target name="ident">
+ <echo message="${ant.project.name}"/>
+ </target>
+
+ <!-- =================================
+ target: resolve
+ ================================= -->
+ <target name="resolve" depends="load-ivy"
+ description="--> resolve and retrieve dependencies with ivy">
+ <mkdir dir="${deps.dir}"/>
+ <ivy:resolve file="${ivy.file}" log="${resolve.log}"/>
+ <ivy:retrieve pattern="${deps.dir}/[artifact].[ext]"
+ symlink="true" sync="true"/>
+ <!-- sync=true removes empty deps dir, so re-create it -->
+ <mkdir dir="${deps.dir}"/>
+ </target>
+
+ <!-- =================================
+ target: publish-local
+ ================================= -->
+
+ <target name="publish-check" unless="bundle.modified">
+ <ivy:info file="${ivy.file}"/>
+ <condition property="bundle.modified">
+ <not>
+ <available file="${repository.dir}/local/${ivy.module}" type="dir"/>
+ </not>
+ </condition>
+ </target>
+
+ <target name="publish-local" depends="bundle, publish-check" if="bundle.modified"
+ description="--> publish project in the local repository">
+
+ <tstamp>
+ <format property="now" pattern="yyyyMMddHHmmss"/>
+ </tstamp>
+ <property name="local-version" value="${now}"/>
+
+ <antcall target="clean-local"/>
+ <ivy:publish artifactspattern="${build.lib.dir}/[artifact].[ext]"
+ resolver="local"
+ pubrevision="${local-version}"
+ pubdate="${now}"
+ forcedeliver="true"
+ status="integration"/>
+ <echo message="project ${ant.project.name} published locally with version ${local-version}" />
+ </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">
+ <!-- uncomment the following to debug classpath -->
+ <!--pathconvert property="cp" refid="javac.classpath"/>
+ <echo>Classpath - ${cp}</echo-->
+ <mkdir dir="${classes.dir}" />
+ <javac srcdir="${src.dir}"
+ destdir="${classes.dir}"
+ classpathref="javac.classpath"
+ target="1.5"
+ debug="true" />
+ </target>
+
+ <!-- =================================
+ target: bundle
+ ================================= -->
+ <target name="bundle" depends="compile"
+ description="--> build OSGi bundle(s) for this project">
+ <mkdir dir="${build.lib.dir}"/>
+ <sigil.bundle
+ classpathref="sigil.classpath"
+ destpattern="${build.lib.dir}/[name].[ext]"
+ force="${bundle.force}"
+ property="bundle.modified" />
+ </target>
+
+ <!-- =================================
+ target: composites
+ ================================= -->
+ <available file="${composite.dir}" type="dir"
+ property="composite.dir.present"/>
+
+ <target name="composites" if="composite.dir.present"
+ description="--> filter xml composites replacing ${VERSION} etc.">
+ <mkdir dir="${build.etc.dir}"/>
+ <copy todir="${build.etc.dir}">
+ <fileset dir="${composite.dir}">
+ <exclude name="*-template.composite"/>
+ <include name="*.composite"/>
+ <include name="*.system"/>
+ </fileset>
+ <filterset begintoken="@" endtoken="@">
+ <filter token="VERSION" value="${bundle.version}"/>
+ <filter token="COMMUNITY_VERSION" value="${community.version}"/>
+ <filter token="JINI_VERSION" value="${jini.version}"/>
+ <filter token="PAREMUS_VERSION" value="${paremus.version}"/>
+ </filterset>
+ </copy>
+ </target>
+
+ <!-- =================================
+ target: install
+ install-bin, install-etc deprecated in favour of single
+ assemble/bin, assemble/etc dirs
+ ================================= -->
+ <target name="install"
+ depends="install-lib, install-composites"/>
+
+ <available file="bin" type="dir"
+ property="bin.dir.present"/>
+ <available file="etc" type="dir"
+ property="etc.dir.present"/>
+
+ <target name="install-bin" if="bin.dir.present">
+ <mkdir dir="${install.dir}/bin"/>
+ <copy todir="${install.dir}/bin">
+ <fileset dir="bin" />
+ </copy>
+ <chmod dir="${install.dir}/bin" perm="755" excludes="*.bat"/>
+ </target>
+
+ <target name="install-etc" if="etc.dir.present">
+ <mkdir dir="${install.dir}/etc"/>
+ <copy todir="${install.dir}/etc">
+ <fileset dir="etc" />
+ </copy>
+ </target>
+
+ <target name="composites-available">
+ <available file="${build.etc.dir}" type="dir"
+ property="build.etc.dir.present"/>
+ </target>
+
+ <target name="install-composites"
+ depends="composites, composites-available"
+ if="build.etc.dir.present">
+ <copy todir="${install.dir}/etc">
+ <fileset dir="${build.etc.dir}" />
+ </copy>
+ </target>
+
+ <target name="libs-available">
+ <available file="${build.lib.dir}" type="dir"
+ property="build.lib.dir.present"/>
+ </target>
+
+ <target name="install-lib"
+ depends="publish-local, libs-available"
+ if="build.lib.dir.present">
+ <copy todir="${install.dir}/lib">
+ <fileset dir="${build.lib.dir}" />
+ <mapper type="glob" from="*.jar" to="*-${buildVersion}.jar"/>
+ </copy>
+ </target>
+
+ <!-- =================================
+ target: clean-local
+ ================================= -->
+ <target name="clean-local" depends="load-ivy"
+ description="--> cleans the local repository for the current module">
+ <ivy:info file="${ivy.file}"/>
+ <delete dir="${repository.dir}/local/${ivy.module}"/>
+ </target>
+
+ <!-- =================================
+ target: clean-deps
+ ================================= -->
+ <target name="clean-deps"
+ description="--> clean the project dependencies directory">
+ <delete includeemptydirs="true" dir="${deps.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="ident, clean-build, clean-deps"
+ description="--> clean the project" />
+
+
+ <!-- =================================
+ target: buildlist
+ ================================= -->
+ <target name="buildlist" depends="load-ivy">
+ <ivy:buildlist reference="ordered-list"
+ onMissingDescriptor="skip">
+ <fileset refid="my.projects"/>
+ </ivy:buildlist>
+ </target>
+
+ <!-- =================================
+ target: build-list
+ ================================= -->
+ <target name="build-list" depends="buildlist"
+ description="--> build all projects in the right order">
+ <property name="target" value="build"/>
+ <subant target="${target}" buildpathref="ordered-list">
+ <propertyset>
+ <propertyref name="ivy.loaded" />
+ </propertyset>
+ </subant>
+ </target>
+
+ <!-- =================================
+ target: install-list
+ ================================= -->
+ <target name="install-list"
+ description="--> install all projects">
+ <antcall target="build-list">
+ <param name="target" value="install"/>
+ </antcall>
+ </target>
+
+ <!-- =================================
+ target: ident-list
+ ================================= -->
+ <target name="ident-list"
+ description="--> identify projects">
+ <antcall target="build-list">
+ <param name="target" value="ident"/>
+ </antcall>
+ </target>
+
+ <!-- =================================
+ target: clean-list
+ ================================= -->
+ <target name="clean-list"
+ description="--> clean all projects">
+ <antcall target="build-list">
+ <param name="target" value="clean"/>
+ </antcall>
+ </target>
+
+ <!-- =================================
+ target: clean-all
+ ================================= -->
+ <target name="clean-all" depends="clean-list, clean"
+ description="--> clean repository, cache, and all projects">
+ <delete dir="${repository.dir}"/>
+ <delete dir="${cache.dir}"/>
+ <delete dir="${install.dir}"/>
+ <delete dir="${dist.dir}"/>
+ </target>
+
+ <target name="sigil.test" depends="ivy-taskdefs">
+ <mkdir dir="${dist.dir}/lib/sigil" />
+ <copy todir="${dist.dir}/lib/sigil" overwrite="true">
+ <fileset dir="${common.dir}/test/lib">
+ <include name="*.jar" />
+ </fileset>
+ </copy>
+
+ <mkdir dir="${dist.dir}/etc/sigil/boot" />
+
+ <copy todir="${dist.dir}/etc/sigil/boot" overwrite="true">
+ <fileset dir="${common.dir}/test/etc/boot">
+ <include name="*" />
+ </fileset>
+ </copy>
+
+ <property name="install.script" value="${dist.dir}/etc/sigil/boot/2-install-tests" />
+ <delete file="${install.script}" />
+
+ <for param="project">
+ <fileset refid="my.projects" />
+ <sequential>
+ <antcall target="sigil.test.setup">
+ <param name="project" value="@{project}"/>
+ </antcall>
+ </sequential>
+ </for>
+
+ <for param="project">
+ <fileset refid="my.projects" />
+ <sequential>
+ <antcall target="sigil.test.install">
+ <param name="project" value="@{project}"/>
+ </antcall>
+ </sequential>
+ </for>
+
+ <delete dir="${dist.dir}/../test-results" />
+
+ <exec executable="sh" osfamily="unix">
+ <arg line="${dist.dir}/bin/container equinox -verbose=true" />
+ <arg line="-bootScript=etc/sigil/boot" />
+ </exec>
+ </target>
+
+ <target name="sigil.test.setup">
+ <property name="dir" location="${project}/../" />
+ <path id="test.resources">
+ <fileset dir="${dir}">
+ <include name="build/lib/*.jar" />
+ <exclude name="**/*-dl.jar" />
+ </fileset>
+ <fileset dir="${dir}">
+ <include name="build/deps/*.jar" />
+ <exclude name="**/*!*.jar" />
+ </fileset>
+ </path>
+ <for param="jar">
+ <path refid="test.resources"/>
+ <sequential>
+ <antcall target="sigil.test.load">
+ <param name="jar" value="@{jar}" />
+ </antcall>
+ </sequential>
+ </for>
+ </target>
+
+ <target name="sigil.test.install">
+ <property name="dir" location="${project}/../" />
+ <path id="test.bundles">
+ <fileset dir="${dir}">
+ <include name="build/lib/*test.jar" />
+ </fileset>
+ </path>
+ <for param="jar">
+ <path refid="test.bundles"/>
+ <sequential>
+ <antcall target="sigil.test.start">
+ <param name="jar" value="@{jar}" />
+ </antcall>
+ </sequential>
+ </for>
+ </target>
+
+ <target name="sigil.test.load">
+ <sigil.bundle.info bundle="${jar}" header="Bundle-SymbolicName" property="test.bundle.symbolic.name"/>
+ <if>
+ <isset property="test.bundle.symbolic.name"/>
+ <then>
+ <echo file="${install.script}" append="true">cds load boot ${test.bundle.symbolic.name}.jar ${jar}
+</echo>
+ </then>
+ </if>
+ </target>
+
+ <target name="sigil.test.start">
+ <sigil.bundle.info bundle="${jar}" header="Bundle-SymbolicName" property="test.bundle.symbolic.name"/>
+ <if>
+ <isset property="test.bundle.symbolic.name"/>
+ <then>
+ <sigil.bundle.info bundle="${jar}" header="Bundle-Version" property="test.bundle.version" defaultvalue="0"/>
+ <sigil.bundle.info bundle="${jar}" header="Fragment-Host" property="test.bundle.fragment"/>
+ <if>
+ <isset property="test.bundle.fragment" />
+ <then>
+ <propertyregex property="test.bundle.fragment.name"
+ input="${test.bundle.fragment}"
+ regexp="([^;]*).*"
+ select="\1"
+ casesensitive="false" />
+
+ <echo file="${install.script}" append="true">nim policy -a osgi.installed.bundle/${test.bundle.fragment.name} osgi.fragment.bundle/${test.bundle.symbolic.name}:${test.bundle.version}
+</echo>
+ <echo file="${install.script}" append="true">nim add ${test.bundle.symbolic.name}:${test.bundle.version}@fragment
+</echo>
+ </then>
+ <else>
+ <echo file="${install.script}" append="true">nim add ${test.bundle.symbolic.name}:${test.bundle.version}@installed
+</echo>
+ </else>
+ </if>
+ </then>
+ </if>
+ </target>
+</project>
Added: felix/trunk/sigil/bldcommon/ivysettings.xml
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bldcommon/ivysettings.xml?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bldcommon/ivysettings.xml (added)
+++ felix/trunk/sigil/bldcommon/ivysettings.xml Mon Jul 13 13:25:46 2009
@@ -0,0 +1,64 @@
+<?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="${cache.dir}" />
+
+ <settings defaultResolver="local" circularDependencyStrategy="error" />
+
+ <!--
+ <classpath file="${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!
+ Loading sigil-ivy-plugin.jar in load-ivy task, uses the same ClassLoader
+ and thus avoids re-initialising ProjectRepositiory.
+ Search for Derek Baum in the October 2008 ant-dev archives for my attempt
+ at getting the Ivy communiuty to fix this.
+ http://mail-archives.apache.org/mod_mbox/ant-dev/200810.mbox/browser
+ -->
+ <typedef name="sigil-parser" classname="org.cauldron.bld.ivy.SigilParser" />
+ <typedef name="sigil" classname="org.cauldron.bld.ivy.SigilResolver" />
+
+ <parsers>
+ <sigil-parser config="${ivy.settings.dir}/sigil-repos.properties"
+ quiet="true"/>
+ </parsers>
+
+ <resolvers>
+ <sigil name="sigil"
+ config="${ivy.settings.dir}/sigil-repos.properties"
+ extractBCP="true"/>
+
+ <filesystem name="local">
+ <ivy pattern="${repository.dir}/local/${repository.pattern}" />
+ <artifact pattern="${repository.dir}/local/${repository.pattern}" />
+ </filesystem>
+
+ <filesystem name="shared">
+ <ivy pattern="${repository.dir}/shared/${repository.pattern}" />
+ <artifact pattern="${repository.dir}/shared/${repository.pattern}" />
+ </filesystem>
+ </resolvers>
+
+ <modules>
+ <module organisation="sigil" resolver="sigil"/>
+ </modules>
+</ivysettings>
Added: felix/trunk/sigil/bldcommon/sigil-repos.properties
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/bldcommon/sigil-repos.properties?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/bldcommon/sigil-repos.properties (added)
+++ felix/trunk/sigil/bldcommon/sigil-repos.properties Mon Jul 13 13:25:46 2009
@@ -0,0 +1,24 @@
+# sigil repository config
+
+# repository config
+
+-repositories: system, project, bld-common
+
+system;provider: system
+system;level: -1
+
+project;provider: project
+project;level: 0
+project;pattern: ${..}/**/[sigilproject]
+
+bld-common;provider: filesystem
+bld-common;level: 1
+bld-common;recurse: true
+bld-common;dir: ${.}/lib
+
+spring;provider: obr
+spring;level: 2
+spring;url: http://sigil.codecauldron.org/spring-repository.obr
+spring;index: ../build/spring-repository.obr
+
+# end
Added: felix/trunk/sigil/build.xml
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/build.xml?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/build.xml (added)
+++ felix/trunk/sigil/build.xml Mon Jul 13 13:25:46 2009
@@ -0,0 +1,51 @@
+<?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="Sigil" default="build">
+
+ <target name="build-eclipse">
+ <subant buildpath="sigil-builder" target="build"/>
+ </target>
+
+ <target name="build-ivy">
+ <subant buildpath="bld-ivy" target="dist"/>
+ </target>
+
+ <target name="build-junit">
+ <subant buildpath="bld-junit" target="install"/>
+ <subant buildpath="bld-junit-cli" target="install"/>
+ </target>
+
+ <target name="clean">
+ <delete dir="build" />
+ <subant buildpath="sigil-builder" target="clean"/>
+ <subant buildpath="bld-ivy" target="clean"/>
+ <subant buildpath="bld-junit" target="clean"/>
+ <subant buildpath="bld-junit-cli" target="clean"/>
+ </target>
+
+ <target name="build" depends="build-eclipse, build-ivy, build-junit" />
+
+ <target name="ci-commit" depends="clean, build"/>
+
+ <target name="ci-daily" depends="clean, build">
+ <subant buildpath="sigil-builder" target="new.updateSite"/>
+ </target>
+
+</project>
Added: felix/trunk/sigil/misc/do_notice
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/misc/do_notice?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/misc/do_notice (added)
+++ felix/trunk/sigil/misc/do_notice Mon Jul 13 13:25:46 2009
@@ -0,0 +1,30 @@
+#!/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.
+
+here=$(dirname $0)
+
+find . \
+ ! \( -type d \( -name .svn -o -name build \) -prune \) \
+ ! -name '*.jar' ! -name .classpath ! -name .project \
+ ! -name '*.gif' ! -name '*.ico' ! -name '*.png' \
+ ! -name '*.config' ! -name '*.policy' \
+ ! -name '*.swp' ! -name '*.txt' ! -name '*.properties' \
+ -type f |
+xargs $here/notice.pl $*
+