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 [6/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/misc/notice.pl
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/misc/notice.pl?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/misc/notice.pl (added)
+++ felix/trunk/sigil/misc/notice.pl Mon Jul 13 13:25:46 2009
@@ -0,0 +1,295 @@
+#!/usr/bin/env perl
+
+# 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.
+
+use FileHandle;
+
+my $dryrun = 0;
+my $quiet = 0;
+
+#
+# Usage: notice.pl [-n] [-q] files...
+#
+
+my $NOTICE = <<'EOT';
+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.
+EOT
+
+# Note: source code notices must not be changed by code formatter
+
+my $NOTICE_java = $NOTICE;
+$NOTICE_java =~ s/^/ * /gm;
+$NOTICE_java = "/*\n" . $NOTICE_java . " */\n\n";
+
+my $NOTICE_xml = $NOTICE;
+$NOTICE_xml =~ s/^/  /gm;
+$NOTICE_xml = "<!--\n" . $NOTICE_xml . "-->\n";
+
+my $NOTICE_sh = $NOTICE;
+$NOTICE_sh =~ s/^/# /gm;
+
+my $NOTICE_bat = $NOTICE;
+$NOTICE_bat =~ s/^/:: /gm;
+
+sub addNotice {
+    my ($fh, $file, $notice) = @_;
+    print "$file\n";
+
+    return if ($dryrun);
+
+    my $tmp = "$file.tmp";
+    my $fh2 = new FileHandle(">$tmp");
+
+    print $fh2 $notice;
+    while (<$fh>) {
+	print $fh2 $_;
+    }
+
+    unlink($file);
+    rename($tmp, $file);
+}
+
+#
+# locate existing copyright & license
+#	starts at top of file
+#	ends at "package" statement
+#
+sub notice_java {
+    my $file = shift;
+    my $fh = new FileHandle($file);
+    my $header;
+    my $package = undef;
+
+    while (<$fh>) {
+        if (/^package\s+[\w.]+\s*;/) {
+	    $package = $_;
+	    last;
+	}
+	last if ($. > 200);
+	$header .= $_;
+    }
+
+    if (! $package) {
+        print STDERR "$file: ERROR: no package statement.\n";
+	return;
+    }
+
+    return if ($header eq $NOTICE_java);
+
+    # completely replace all before package statement
+    # so DON'T change below, without changing above
+    # to stop at end-of-first-comment.
+    $header = '';
+    #$header = '' if ($header =~ /copyright/im);
+    #$header = "\n" . $header unless ($header =~ /^\n/);
+
+    addNotice($fh, $file, $NOTICE_java . $header . $package);
+}
+
+sub notice_xml {
+    my $file = shift;
+    my $fh = new FileHandle($file);
+    my $header = undef;
+    my $decl = qq(<?xml version="1.0"?>\n);
+    my $end = 0;
+    my $start = 0;
+
+    while (<$fh>) {
+    	if ($. == 1 && /^\<\?/) {
+	    $decl = $_;
+	    next;
+	}
+
+	$header .= $_;
+
+    	if (!$start) {
+	  last unless (/^<!--/);
+	  $start = 1;
+	}
+
+        if (/-->/) {
+	    $end = 1;
+	    last;
+	}
+    }
+
+    return if ($header eq $NOTICE_xml);
+
+    $header = '' if ($header =~ /copyright/im);
+
+    if ($start && !$end) {
+        print STDERR "$file: ERROR: initial comment not terminated.\n";
+	return;
+    }
+
+    addNotice($fh, $file, $decl . $NOTICE_xml . $header);
+}
+
+sub notice_sh {
+    my $file = shift;
+    my $fh = new FileHandle($file);
+    my $header = undef;
+    my $hashbang = undef;
+    my $end = '';
+    my $start = '';
+
+    while (<$fh>) {
+    	if ($. == 1 && /^#!/) {
+	    $hashbang = $_;
+	    next;
+	}
+
+    	if (!$start) {
+	  unless (/^(#|\s*$)/) {
+	    $header = $_;
+	    last;
+	  }
+	  $start = 1;
+	  next if (/^\s*$/);
+	}
+
+        if (!/^#/) {
+	    $end = $_;
+	    last;
+	}
+
+	$header .= $_;
+    }
+
+    return if ($header eq $NOTICE_sh);
+
+    $hashbang .= "\n" if ($hashbang);
+
+    $header = '' if ($header =~ /copyright/im);
+    $header .= $end;
+    $header = "\n" . $header unless ($header =~ /^\n/);
+
+    if ($start && !$end) {
+        print STDERR "$file: ERROR: initial comment not terminated.\n";
+	return;
+    }
+
+    addNotice($fh, $file, $hashbang . $NOTICE_sh . $header);
+}
+
+sub notice_bat {
+    my $file = shift;
+    my $fh = new FileHandle($file);
+    my $header = undef;
+    my $atecho = undef;
+    my $end = '';
+    my $start = '';
+
+    while (<$fh>) {
+	s/\r\n$/\n/;
+    	if ($. == 1 && /^\@echo/) {
+	    $atecho = $_;
+	    next;
+	}
+
+    	if (!$start) {
+	  unless (/^(::|\s*$)/) {
+	    $header = $_;
+	    last;
+	  }
+	  $start = 1;
+	  next if (/^\s*$/);
+	}
+
+        if (!/^::/) {
+	    $end = $_;
+	    last;
+	}
+
+	$header .= $_;
+    }
+
+    return if ($header eq $NOTICE_bat);
+
+    $atecho .= "\n" if ($atecho);
+
+    $header = '' if ($header =~ /copyright/im);
+    $header .= $end;
+    $header = "\n" . $header unless ($header =~ /^\n/);
+
+    if ($start && !$end) {
+        print STDERR "$file: ERROR: initial comment not terminated.\n";
+	return;
+    }
+
+    $header = $atecho . $NOTICE_bat . $header;
+    $header =~ s/\n/\r\n/mg;
+    addNotice($fh, $file, $header);
+}
+
+sub notice_unknown {
+    my $file = shift;
+    my $fh = new FileHandle($file);
+
+    my $line = <$fh>;
+
+    if ($line =~ /^#!/) {
+        notice_sh($file);
+    }
+    elsif ($line =~ /^\<\?xml/) {
+        notice_xml($file);
+    }
+    elsif (! $quiet) {
+	print STDERR "$file: unknown file type.\n";
+    }
+}
+
+foreach my $f (@ARGV) {
+    if ($f eq '-n') {
+	$dryrun++;
+    }
+    elsif ($f eq '-q') {
+	$quiet++;
+    }
+    elsif ($f =~ /\.java$/) {
+	notice_java($f);
+    }
+    elsif ($f =~ /\.(xml|xsd|system|composite)$/) {
+	notice_xml($f);
+    }
+    elsif ($f =~ /\.(sh|app|ini|xargs)$/) {
+	notice_sh($f);
+    }
+    elsif ($f =~ /\.(bat)$/) {
+	notice_bat($f);
+    }
+    else {
+	notice_unknown($f);
+    }
+}
+

Propchange: felix/trunk/sigil/misc/notice.pl
------------------------------------------------------------------------------
    svn:executable = *

Added: felix/trunk/sigil/org.cauldron.bld.core.tests/.classpath
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/org.cauldron.bld.core.tests/.classpath?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/org.cauldron.bld.core.tests/.classpath (added)
+++ felix/trunk/sigil/org.cauldron.bld.core.tests/.classpath Mon Jul 13 13:25:46 2009
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/>
+	<classpathentry combineaccessrules="false" kind="src" path="/org.cauldron.bld.core"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>

Added: felix/trunk/sigil/org.cauldron.bld.core.tests/.project
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/org.cauldron.bld.core.tests/.project?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/org.cauldron.bld.core.tests/.project (added)
+++ felix/trunk/sigil/org.cauldron.bld.core.tests/.project Mon Jul 13 13:25:46 2009
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>org.cauldron.bld.core.tests</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>

Added: felix/trunk/sigil/org.cauldron.bld.core.tests/src/org/cauldron/bld/core/BundleModelElementTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/org.cauldron.bld.core.tests/src/org/cauldron/bld/core/BundleModelElementTest.java?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/org.cauldron.bld.core.tests/src/org/cauldron/bld/core/BundleModelElementTest.java (added)
+++ felix/trunk/sigil/org.cauldron.bld.core.tests/src/org/cauldron/bld/core/BundleModelElementTest.java Mon Jul 13 13:25:46 2009
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.cauldron.bld.core;
+
+import java.util.Arrays;
+
+import org.cauldron.bld.core.internal.model.osgi.BundleModelElement;
+import org.cauldron.bld.core.internal.model.osgi.PackageImport;
+import org.cauldron.bld.core.internal.model.osgi.RequiredBundle;
+import org.cauldron.sigil.model.common.VersionRange;
+
+import junit.framework.TestCase;
+
+public class BundleModelElementTest extends TestCase {
+
+	public BundleModelElementTest(String name) {
+		super(name);
+	}
+	
+	public void testAddRequires() {
+		BundleModelElement element = new BundleModelElement();
+		checkRequires(element);
+	}
+	
+	public void testAddImports() {
+		BundleModelElement element = new BundleModelElement();
+		checkImports(element);
+	}
+	
+	public void testAddImportsAndRequires() {
+		BundleModelElement element = new BundleModelElement();
+		checkImports(element);
+		checkRequires(element);
+		
+		element = new BundleModelElement();
+		checkRequires(element);
+		checkImports(element);
+	}
+	
+	private void checkImports(BundleModelElement element) {
+		PackageImport foo = new PackageImport();
+		foo.setPackageName("foo");
+		foo.setVersions( VersionRange.parseVersionRange("1.0.0") );
+		PackageImport bar = new PackageImport();
+		bar.setPackageName( "bar" );
+		bar.setVersions( VersionRange.parseVersionRange("[2.2.2, 3.3.3]") );
+		PackageImport baz = new PackageImport();
+		baz.setPackageName( "baz" );
+		baz.setVersions( VersionRange.parseVersionRange("[3.0.0, 4.0.0)") );
+		
+		element.addChild(foo.clone());
+		element.addChild(bar.clone());
+		element.addChild(baz.clone());
+		
+		assertTrue( Arrays.asList(element.children()).contains(foo) );
+		assertTrue( Arrays.asList(element.children()).contains(bar) );
+		assertTrue( Arrays.asList(element.children()).contains(baz) );
+	}
+
+	private void checkRequires(BundleModelElement element) {
+		RequiredBundle foo = new RequiredBundle();
+		foo.setSymbolicName( "foo" );
+		foo.setVersions( VersionRange.parseVersionRange("1.0.0") );
+		RequiredBundle bar = new RequiredBundle();
+		bar.setSymbolicName( "bar" );
+		bar.setVersions( VersionRange.parseVersionRange("[2.2.2, 3.3.3]") );
+		RequiredBundle baz = new RequiredBundle();
+		baz.setSymbolicName( "baz" );
+		baz.setVersions( VersionRange.parseVersionRange("[3.0.0, 4.0.0)") );
+		
+		element.addChild(foo.clone());
+		element.addChild(bar.clone());
+		element.addChild(baz.clone());
+		
+		assertTrue( Arrays.asList(element.children()).contains(foo) );
+		assertTrue( Arrays.asList(element.children()).contains(bar) );
+		assertTrue( Arrays.asList(element.children()).contains(baz) );
+	}
+}

Added: felix/trunk/sigil/org.cauldron.bld.core.tests/src/org/cauldron/bld/core/ConfigTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/org.cauldron.bld.core.tests/src/org/cauldron/bld/core/ConfigTest.java?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/org.cauldron.bld.core.tests/src/org/cauldron/bld/core/ConfigTest.java (added)
+++ felix/trunk/sigil/org.cauldron.bld.core.tests/src/org/cauldron/bld/core/ConfigTest.java Mon Jul 13 13:25:46 2009
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.cauldron.bld.core;
+
+import java.io.IOException;
+import java.net.URI;
+import java.util.Set;
+
+import junit.framework.TestCase;
+
+import org.cauldron.bld.config.BldFactory;
+import org.cauldron.bld.config.IBldProject;
+import org.cauldron.bld.core.internal.model.osgi.PackageImport;
+import org.cauldron.sigil.model.common.VersionRange;
+import org.cauldron.sigil.model.eclipse.ISigilBundle;
+import org.cauldron.sigil.model.osgi.IBundleModelElement;
+import org.cauldron.sigil.model.osgi.IPackageImport;
+
+public class ConfigTest extends TestCase {
+	
+	static final URI base = URI.create("test/ConfigTest/sigil.properties");
+
+	public ConfigTest(String name) {
+		super(name);
+	}
+	
+	public void testSimple() throws IOException {
+		IBldProject project = BldFactory.getProject(base.resolve("test1.properties"));
+		
+		ISigilBundle bundle = project.getDefaultBundle();
+		IBundleModelElement info = bundle.getBundleInfo();
+		
+		checkImports(info.getImports());
+		
+		//IBundleModelElement requirements = project.getRequirements();
+	}
+	
+	private void checkImports(Set<IPackageImport> imports) {
+		PackageImport foo = new PackageImport();
+		foo.setPackageName("foo");
+		foo.setVersions(VersionRange.parseVersionRange("1.0.0"));
+		PackageImport bar = new PackageImport();
+		bar.setPackageName( "bar" );
+		bar.setVersions(VersionRange.parseVersionRange("[2.2.2, 3.3.3]"));
+		PackageImport baz = new PackageImport();
+		baz.setPackageName( "baz" );
+		baz.setVersions(VersionRange.parseVersionRange("[3.0.0, 4.0.0)"));
+		
+		assertTrue(foo.toString(), imports.contains(foo));
+		assertTrue(bar.toString(), imports.contains(bar));
+		assertTrue(baz.toString(), imports.contains(baz));
+	}
+
+}

Added: felix/trunk/sigil/org.cauldron.bld.core.tests/test/ConfigTest/test1.properties
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/org.cauldron.bld.core.tests/test/ConfigTest/test1.properties?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/org.cauldron.bld.core.tests/test/ConfigTest/test1.properties (added)
+++ felix/trunk/sigil/org.cauldron.bld.core.tests/test/ConfigTest/test1.properties Mon Jul 13 13:25:46 2009
@@ -0,0 +1,10 @@
+
+# test1
+
+-bundles: default
+
+-imports: \
+  foo;version=1.0, \
+  bar;version="[2.2.2,3.3.3]", \
+  baz;version="[3.0.0,4.0.0)", \
+

Added: felix/trunk/sigil/org.cauldron.bld.core/.classpath
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/org.cauldron.bld.core/.classpath?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/org.cauldron.bld.core/.classpath (added)
+++ felix/trunk/sigil/org.cauldron.bld.core/.classpath Mon Jul 13 13:25:46 2009
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry exported="true" kind="lib" path="lib/bndlib.jar" sourcepath="/bld-ivy/lib/ant/bnd-0.0.312.jar"/>
+	<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.eclipse.pde.core.requiredPlugins"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>

Added: felix/trunk/sigil/org.cauldron.bld.core/.project
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/org.cauldron.bld.core/.project?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/org.cauldron.bld.core/.project (added)
+++ felix/trunk/sigil/org.cauldron.bld.core/.project Mon Jul 13 13:25:46 2009
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>org.cauldron.bld.core</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.ManifestBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.SchemaBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.pde.PluginNature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>

Added: felix/trunk/sigil/org.cauldron.bld.core/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/org.cauldron.bld.core/META-INF/MANIFEST.MF?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/org.cauldron.bld.core/META-INF/MANIFEST.MF (added)
+++ felix/trunk/sigil/org.cauldron.bld.core/META-INF/MANIFEST.MF Mon Jul 13 13:25:46 2009
@@ -0,0 +1,22 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Sigil_bld Plug-in
+Bundle-SymbolicName: org.cauldron.bld.core;singleton:=true
+Bundle-Version: 0.8.0.qualifier
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-Activator: org.cauldron.bld.core.BldCore
+Bundle-ActivationPolicy: lazy
+Export-Package: org.cauldron.bld.bnd,
+ org.cauldron.bld.config,
+ org.cauldron.bld.core,
+ org.cauldron.bld.core.licence,
+ org.cauldron.bld.core.repository,
+ org.cauldron.sigil.model,
+ org.cauldron.sigil.model.common,
+ org.cauldron.sigil.model.eclipse,
+ org.cauldron.sigil.model.osgi,
+ org.cauldron.sigil.repository
+Import-Package: org.osgi.framework
+Require-Bundle: org.eclipse.equinox.common;bundle-version="3.4.0"
+Bundle-ClassPath: lib/bndlib.jar,
+ .

Added: felix/trunk/sigil/org.cauldron.bld.core/build.properties
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/org.cauldron.bld.core/build.properties?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/org.cauldron.bld.core/build.properties (added)
+++ felix/trunk/sigil/org.cauldron.bld.core/build.properties Mon Jul 13 13:25:46 2009
@@ -0,0 +1,6 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+               .,\
+               profiles/,\
+               lib/bndlib.jar

Added: felix/trunk/sigil/org.cauldron.bld.core/profiles/CDC-1.0_Foundation-1.0.profile
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/org.cauldron.bld.core/profiles/CDC-1.0_Foundation-1.0.profile?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/org.cauldron.bld.core/profiles/CDC-1.0_Foundation-1.0.profile (added)
+++ felix/trunk/sigil/org.cauldron.bld.core/profiles/CDC-1.0_Foundation-1.0.profile Mon Jul 13 13:25:46 2009
@@ -0,0 +1,19 @@
+###############################################################################
+# Copyright (c) 2005 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+# 
+# Contributors:
+#     IBM Corporation - initial API and implementation
+###############################################################################
+org.osgi.framework.system.packages = \
+ javax.microedition.io
+org.osgi.framework.bootdelegation = \
+ javax.microedition.io
+org.osgi.framework.executionenvironment = \
+ OSGi/Minimum-1.0,\
+ OSGi/Minimum-1.1,\
+ CDC-1.0/Foundation-1.0
+osgi.java.profile.name = CDC-1.0/Foundation-1.0

Added: felix/trunk/sigil/org.cauldron.bld.core/profiles/CDC-1.1_Foundation-1.1.profile
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/org.cauldron.bld.core/profiles/CDC-1.1_Foundation-1.1.profile?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/org.cauldron.bld.core/profiles/CDC-1.1_Foundation-1.1.profile (added)
+++ felix/trunk/sigil/org.cauldron.bld.core/profiles/CDC-1.1_Foundation-1.1.profile Mon Jul 13 13:25:46 2009
@@ -0,0 +1,24 @@
+###############################################################################
+# Copyright (c) 2005 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+# 
+# Contributors:
+#     IBM Corporation - initial API and implementation
+###############################################################################
+org.osgi.framework.system.packages = \
+ javax.microedition.io,\
+ javax.microedition.pki,\
+ javax.security.auth.x500
+org.osgi.framework.bootdelegation = \
+ javax.microedition.io,\
+ javax.microedition.pki,\
+ javax.security.auth.x500
+org.osgi.framework.executionenvironment = \
+ OSGi/Minimum-1.0,\
+ OSGi/Minimum-1.1,\
+ CDC-1.0/Foundation-1.0,\
+ CDC-1.1/Foundation-1.1
+osgi.java.profile.name = CDC-1.1/Foundation-1.1

Added: felix/trunk/sigil/org.cauldron.bld.core/profiles/J2SE-1.2.profile
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/org.cauldron.bld.core/profiles/J2SE-1.2.profile?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/org.cauldron.bld.core/profiles/J2SE-1.2.profile (added)
+++ felix/trunk/sigil/org.cauldron.bld.core/profiles/J2SE-1.2.profile Mon Jul 13 13:25:46 2009
@@ -0,0 +1,42 @@
+###############################################################################
+# Copyright (c) 2003, 2005 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+# 
+# Contributors:
+#     IBM Corporation - initial API and implementation
+###############################################################################
+org.osgi.framework.system.packages = \
+ javax.accessibility,\
+ javax.swing,\
+ javax.swing.border,\
+ javax.swing.colorchooser,\
+ javax.swing.event,\
+ javax.swing.filechooser,\
+ javax.swing.plaf,\
+ javax.swing.plaf.basic,\
+ javax.swing.plaf.metal,\
+ javax.swing.plaf.multi,\
+ javax.swing.table,\
+ javax.swing.text,\
+ javax.swing.text.html,\
+ javax.swing.text.html.parser,\
+ javax.swing.text.rtf,\
+ javax.swing.tree,\
+ javax.swing.undo,\
+ org.omg.CORBA,\
+ org.omg.CORBA.DynAnyPackage,\
+ org.omg.CORBA.ORBPackage,\
+ org.omg.CORBA.portable,\
+ org.omg.CORBA.TypeCodePackage,\
+ org.omg.CosNaming,\
+ org.omg.CosNaming.NamingContextPackage
+org.osgi.framework.bootdelegation = \
+ sun.*,\
+ com.sun.*
+org.osgi.framework.executionenvironment = \
+ JRE-1.1,\
+ J2SE-1.2
+osgi.java.profile.name = J2SE-1.2

Added: felix/trunk/sigil/org.cauldron.bld.core/profiles/J2SE-1.3.profile
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/org.cauldron.bld.core/profiles/J2SE-1.3.profile?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/org.cauldron.bld.core/profiles/J2SE-1.3.profile (added)
+++ felix/trunk/sigil/org.cauldron.bld.core/profiles/J2SE-1.3.profile Mon Jul 13 13:25:46 2009
@@ -0,0 +1,63 @@
+###############################################################################
+# Copyright (c) 2003, 2005 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+# 
+# Contributors:
+#     IBM Corporation - initial API and implementation
+###############################################################################
+org.osgi.framework.system.packages = \
+ javax.accessibility,\
+ javax.naming,\
+ javax.naming.directory,\
+ javax.naming.event,\
+ javax.naming.ldap,\
+ javax.naming.spi,\
+ javax.rmi,\
+ javax.rmi.CORBA,\
+ javax.sound.midi,\
+ javax.sound.midi.spi,\
+ javax.sound.sampled,\
+ javax.sound.sampled.spi,\
+ javax.swing,\
+ javax.swing.border,\
+ javax.swing.colorchooser,\
+ javax.swing.event,\
+ javax.swing.filechooser,\
+ javax.swing.plaf,\
+ javax.swing.plaf.basic,\
+ javax.swing.plaf.metal,\
+ javax.swing.plaf.multi,\
+ javax.swing.table,\
+ javax.swing.text,\
+ javax.swing.text.html,\
+ javax.swing.text.html.parser,\
+ javax.swing.text.rtf,\
+ javax.swing.tree,\
+ javax.swing.undo,\
+ javax.transaction,\
+ org.omg.CORBA,\
+ org.omg.CORBA_2_3,\
+ org.omg.CORBA_2_3.portable,\
+ org.omg.CORBA.DynAnyPackage,\
+ org.omg.CORBA.ORBPackage,\
+ org.omg.CORBA.portable,\
+ org.omg.CORBA.TypeCodePackage,\
+ org.omg.CosNaming,\
+ org.omg.CosNaming.NamingContextPackage,\
+ org.omg.SendingContext,\
+ org.omg.stub.java.rmi
+org.osgi.framework.bootdelegation = \
+ javax.*,\
+ org.omg.*,\
+ sun.*,\
+ com.sun.*
+org.osgi.framework.executionenvironment = \
+ OSGi/Minimum-1.0,\
+ OSGi/Minimum-1.1,\
+ JRE-1.1,\
+ J2SE-1.2,\
+ J2SE-1.3
+osgi.java.profile.name = J2SE-1.3

Added: felix/trunk/sigil/org.cauldron.bld.core/profiles/J2SE-1.4.profile
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/org.cauldron.bld.core/profiles/J2SE-1.4.profile?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/org.cauldron.bld.core/profiles/J2SE-1.4.profile (added)
+++ felix/trunk/sigil/org.cauldron.bld.core/profiles/J2SE-1.4.profile Mon Jul 13 13:25:46 2009
@@ -0,0 +1,123 @@
+###############################################################################
+# Copyright (c) 2003, 2005 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+# 
+# Contributors:
+#     IBM Corporation - initial API and implementation
+###############################################################################
+org.osgi.framework.system.packages = \
+ javax.accessibility,\
+ javax.crypto,\
+ javax.crypto.interfaces,\
+ javax.crypto.spec,\
+ javax.imageio,\
+ javax.imageio.event,\
+ javax.imageio.metadata,\
+ javax.imageio.plugins.jpeg,\
+ javax.imageio.spi,\
+ javax.imageio.stream,\
+ javax.naming,\
+ javax.naming.directory,\
+ javax.naming.event,\
+ javax.naming.ldap,\
+ javax.naming.spi,\
+ javax.net,\
+ javax.net.ssl,\
+ javax.print,\
+ javax.print.attribute,\
+ javax.print.attribute.standard,\
+ javax.print.event,\
+ javax.rmi,\
+ javax.rmi.CORBA,\
+ javax.security.auth,\
+ javax.security.auth.callback,\
+ javax.security.auth.kerberos,\
+ javax.security.auth.login,\
+ javax.security.auth.spi,\
+ javax.security.auth.x500,\
+ javax.security.cert,\
+ javax.sound.midi,\
+ javax.sound.midi.spi,\
+ javax.sound.sampled,\
+ javax.sound.sampled.spi,\
+ javax.sql,\
+ javax.swing,\
+ javax.swing.border,\
+ javax.swing.colorchooser,\
+ javax.swing.event,\
+ javax.swing.filechooser,\
+ javax.swing.plaf,\
+ javax.swing.plaf.basic,\
+ javax.swing.plaf.metal,\
+ javax.swing.plaf.multi,\
+ javax.swing.table,\
+ javax.swing.text,\
+ javax.swing.text.html,\
+ javax.swing.text.html.parser,\
+ javax.swing.text.rtf,\
+ javax.swing.tree,\
+ javax.swing.undo,\
+ javax.transaction,\
+ javax.transaction.xa,\
+ javax.xml.parsers,\
+ javax.xml.transform,\
+ javax.xml.transform.dom,\
+ javax.xml.transform.sax,\
+ javax.xml.transform.stream,\
+ org.ietf.jgss,\
+ org.omg.CORBA,\
+ org.omg.CORBA_2_3,\
+ org.omg.CORBA_2_3.portable,\
+ org.omg.CORBA.DynAnyPackage,\
+ org.omg.CORBA.ORBPackage,\
+ org.omg.CORBA.portable,\
+ org.omg.CORBA.TypeCodePackage,\
+ org.omg.CosNaming,\
+ org.omg.CosNaming.NamingContextExtPackage,\
+ org.omg.CosNaming.NamingContextPackage,\
+ org.omg.Dynamic,\
+ org.omg.DynamicAny,\
+ org.omg.DynamicAny.DynAnyFactoryPackage,\
+ org.omg.DynamicAny.DynAnyPackage,\
+ org.omg.IOP,\
+ org.omg.IOP.CodecFactoryPackage,\
+ org.omg.IOP.CodecPackage,\
+ org.omg.Messaging,\
+ org.omg.PortableInterceptor,\
+ org.omg.PortableInterceptor.ORBInitInfoPackage,\
+ org.omg.PortableServer,\
+ org.omg.PortableServer.CurrentPackage,\
+ org.omg.PortableServer.POAManagerPackage,\
+ org.omg.PortableServer.POAPackage,\
+ org.omg.PortableServer.portable,\
+ org.omg.PortableServer.ServantLocatorPackage,\
+ org.omg.SendingContext,\
+ org.omg.stub.java.rmi,\
+ org.w3c.dom,\
+ org.w3c.dom.css,\
+ org.w3c.dom.events,\
+ org.w3c.dom.html,\
+ org.w3c.dom.stylesheets,\
+ org.w3c.dom.views ,\
+ org.xml.sax,\
+ org.xml.sax.ext,\
+ org.xml.sax.helpers
+org.osgi.framework.bootdelegation = \
+ javax.*,\
+ org.ietf.jgss,\
+ org.omg.*,\
+ org.w3c.*,\
+ org.xml.*,\
+ sun.*,\
+ com.sun.*
+org.osgi.framework.executionenvironment = \
+ OSGi/Minimum-1.0,\
+ OSGi/Minimum-1.1,\
+ JRE-1.1,\
+ J2SE-1.2,\
+ J2SE-1.3,\
+ J2SE-1.4
+osgi.java.profile.name = J2SE-1.4

Added: felix/trunk/sigil/org.cauldron.bld.core/profiles/J2SE-1.5.profile
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/org.cauldron.bld.core/profiles/J2SE-1.5.profile?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/org.cauldron.bld.core/profiles/J2SE-1.5.profile (added)
+++ felix/trunk/sigil/org.cauldron.bld.core/profiles/J2SE-1.5.profile Mon Jul 13 13:25:46 2009
@@ -0,0 +1,150 @@
+###############################################################################
+# Copyright (c) 2003, 2005 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+# 
+# Contributors:
+#     IBM Corporation - initial API and implementation
+###############################################################################
+org.osgi.framework.system.packages = \
+ javax.accessibility,\
+ javax.activity,\
+ javax.crypto,\
+ javax.crypto.interfaces,\
+ javax.crypto.spec,\
+ javax.imageio,\
+ javax.imageio.event,\
+ javax.imageio.metadata,\
+ javax.imageio.plugins.bmp,\
+ javax.imageio.plugins.jpeg,\
+ javax.imageio.spi,\
+ javax.imageio.stream,\
+ javax.management,\
+ javax.management.loading,\
+ javax.management.modelmbean,\
+ javax.management.monitor,\
+ javax.management.openmbean,\
+ javax.management.relation,\
+ javax.management.remote,\
+ javax.management.remote.rmi,\
+ javax.management.timer,\
+ javax.naming,\
+ javax.naming.directory,\
+ javax.naming.event,\
+ javax.naming.ldap,\
+ javax.naming.spi,\
+ javax.net,\
+ javax.net.ssl,\
+ javax.print,\
+ javax.print.attribute,\
+ javax.print.attribute.standard,\
+ javax.print.event,\
+ javax.rmi,\
+ javax.rmi.CORBA,\
+ javax.rmi.ssl,\
+ javax.security.auth,\
+ javax.security.auth.callback,\
+ javax.security.auth.kerberos,\
+ javax.security.auth.login,\
+ javax.security.auth.spi,\
+ javax.security.auth.x500,\
+ javax.security.cert,\
+ javax.security.sasl,\
+ javax.sound.midi,\
+ javax.sound.midi.spi,\
+ javax.sound.sampled,\
+ javax.sound.sampled.spi,\
+ javax.sql,\
+ javax.sql.rowset,\
+ javax.sql.rowset.serial,\
+ javax.sql.rowset.spi,\
+ javax.swing,\
+ javax.swing.border,\
+ javax.swing.colorchooser,\
+ javax.swing.event,\
+ javax.swing.filechooser,\
+ javax.swing.plaf,\
+ javax.swing.plaf.basic,\
+ javax.swing.plaf.metal,\
+ javax.swing.plaf.multi,\
+ javax.swing.plaf.synth,\
+ javax.swing.table,\
+ javax.swing.text,\
+ javax.swing.text.html,\
+ javax.swing.text.html.parser,\
+ javax.swing.text.rtf,\
+ javax.swing.tree,\
+ javax.swing.undo,\
+ javax.transaction,\
+ javax.transaction.xa,\
+ javax.xml,\
+ javax.xml.datatype,\
+ javax.xml.namespace,\
+ javax.xml.parsers,\
+ javax.xml.transform,\
+ javax.xml.transform.dom,\
+ javax.xml.transform.sax,\
+ javax.xml.transform.stream,\
+ javax.xml.validation,\
+ javax.xml.xpath,\
+ org.ietf.jgss,\
+ org.omg.CORBA,\
+ org.omg.CORBA_2_3,\
+ org.omg.CORBA_2_3.portable,\
+ org.omg.CORBA.DynAnyPackage,\
+ org.omg.CORBA.ORBPackage,\
+ org.omg.CORBA.portable,\
+ org.omg.CORBA.TypeCodePackage,\
+ org.omg.CosNaming,\
+ org.omg.CosNaming.NamingContextExtPackage,\
+ org.omg.CosNaming.NamingContextPackage,\
+ org.omg.Dynamic,\
+ org.omg.DynamicAny,\
+ org.omg.DynamicAny.DynAnyFactoryPackage,\
+ org.omg.DynamicAny.DynAnyPackage,\
+ org.omg.IOP,\
+ org.omg.IOP.CodecFactoryPackage,\
+ org.omg.IOP.CodecPackage,\
+ org.omg.Messaging,\
+ org.omg.PortableInterceptor,\
+ org.omg.PortableInterceptor.ORBInitInfoPackage,\
+ org.omg.PortableServer,\
+ org.omg.PortableServer.CurrentPackage,\
+ org.omg.PortableServer.POAManagerPackage,\
+ org.omg.PortableServer.POAPackage,\
+ org.omg.PortableServer.portable,\
+ org.omg.PortableServer.ServantLocatorPackage,\
+ org.omg.SendingContext,\
+ org.omg.stub.java.rmi,\
+ org.w3c.dom,\
+ org.w3c.dom.bootstrap,\
+ org.w3c.dom.css,\
+ org.w3c.dom.events,\
+ org.w3c.dom.html,\
+ org.w3c.dom.ls,\
+ org.w3c.dom.ranges,\
+ org.w3c.dom.stylesheets,\
+ org.w3c.dom.traversal,\
+ org.w3c.dom.views ,\
+ org.xml.sax,\
+ org.xml.sax.ext,\
+ org.xml.sax.helpers
+org.osgi.framework.bootdelegation = \
+ javax.*,\
+ org.ietf.jgss,\
+ org.omg.*,\
+ org.w3c.*,\
+ org.xml.*,\
+ sun.*,\
+ com.sun.*
+org.osgi.framework.executionenvironment = \
+ OSGi/Minimum-1.0,\
+ OSGi/Minimum-1.1,\
+ JRE-1.1,\
+ J2SE-1.2,\
+ J2SE-1.3,\
+ J2SE-1.4,\
+ J2SE-1.5
+osgi.java.profile.name = J2SE-1.5

Added: felix/trunk/sigil/org.cauldron.bld.core/profiles/JavaSE-1.6.profile
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/org.cauldron.bld.core/profiles/JavaSE-1.6.profile?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/org.cauldron.bld.core/profiles/JavaSE-1.6.profile (added)
+++ felix/trunk/sigil/org.cauldron.bld.core/profiles/JavaSE-1.6.profile Mon Jul 13 13:25:46 2009
@@ -0,0 +1,185 @@
+###############################################################################
+# Copyright (c) 2003, 2005 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+# 
+# Contributors:
+#     IBM Corporation - initial API and implementation
+###############################################################################
+org.osgi.framework.system.packages = \
+ javax.accessibility,\
+ javax.activation,\
+ javax.activity,\
+ javax.annotation,\
+ javax.annotation.processing,\
+ javax.crypto,\
+ javax.crypto.interfaces,\
+ javax.crypto.spec,\
+ javax.imageio,\
+ javax.imageio.event,\
+ javax.imageio.metadata,\
+ javax.imageio.plugins.bmp,\
+ javax.imageio.plugins.jpeg,\
+ javax.imageio.spi,\
+ javax.imageio.stream,\
+ javax.jws,\
+ javax.jws.soap,\
+ javax.lang.model,\
+ javax.lang.model.element,\
+ javax.lang.model.type,\
+ javax.lang.model.util,\
+ javax.management,\
+ javax.management.loading,\
+ javax.management.modelmbean,\
+ javax.management.monitor,\
+ javax.management.openmbean,\
+ javax.management.relation,\
+ javax.management.remote,\
+ javax.management.remote.rmi,\
+ javax.management.timer,\
+ javax.naming,\
+ javax.naming.directory,\
+ javax.naming.event,\
+ javax.naming.ldap,\
+ javax.naming.spi,\
+ javax.net,\
+ javax.net.ssl,\
+ javax.print,\
+ javax.print.attribute,\
+ javax.print.attribute.standard,\
+ javax.print.event,\
+ javax.rmi,\
+ javax.rmi.CORBA,\
+ javax.rmi.ssl,\
+ javax.script,\
+ javax.security.auth,\
+ javax.security.auth.callback,\
+ javax.security.auth.kerberos,\
+ javax.security.auth.login,\
+ javax.security.auth.spi,\
+ javax.security.auth.x500,\
+ javax.security.cert,\
+ javax.security.sasl,\
+ javax.sound.midi,\
+ javax.sound.midi.spi,\
+ javax.sound.sampled,\
+ javax.sound.sampled.spi,\
+ javax.sql,\
+ javax.sql.rowset,\
+ javax.sql.rowset.serial,\
+ javax.sql.rowset.spi,\
+ javax.swing,\
+ javax.swing.border,\
+ javax.swing.colorchooser,\
+ javax.swing.event,\
+ javax.swing.filechooser,\
+ javax.swing.plaf,\
+ javax.swing.plaf.basic,\
+ javax.swing.plaf.metal,\
+ javax.swing.plaf.multi,\
+ javax.swing.plaf.synth,\
+ javax.swing.table,\
+ javax.swing.text,\
+ javax.swing.text.html,\
+ javax.swing.text.html.parser,\
+ javax.swing.text.rtf,\
+ javax.swing.tree,\
+ javax.swing.undo,\
+ javax.tools,\
+ javax.transaction,\
+ javax.transaction.xa,\
+ javax.xml,\
+ javax.xml.bind,\
+ javax.xml.bind.annotation,\
+ javax.xml.bind.annotation.adapters,\
+ javax.xml.bind.attachment,\
+ javax.xml.bind.helpers,\
+ javax.xml.bind.util,\
+ javax.xml.crypto,\
+ javax.xml.crypto.dom,\
+ javax.xml.crypto.dsig,\
+ javax.xml.crypto.dsig.dom,\
+ javax.xml.crypto.dsig.keyinfo,\
+ javax.xml.crypto.dsig.spec,\
+ javax.xml.datatype,\
+ javax.xml.namespace,\
+ javax.xml.parsers,\
+ javax.xml.soap,\
+ javax.xml.stream,\
+ javax.xml.stream.events,\
+ javax.xml.stream.util,\
+ javax.xml.transform,\
+ javax.xml.transform.dom,\
+ javax.xml.transform.sax,\
+ javax.xml.transform.stax,\
+ javax.xml.transform.stream,\
+ javax.xml.validation,\
+ javax.xml.ws,\
+ javax.xml.ws.handler,\
+ javax.xml.ws.handler.soap,\
+ javax.xml.ws.http,\
+ javax.xml.ws.soap,\
+ javax.xml.ws.spi,\
+ javax.xml.xpath,\
+ org.ietf.jgss,\
+ org.omg.CORBA,\
+ org.omg.CORBA_2_3,\
+ org.omg.CORBA_2_3.portable,\
+ org.omg.CORBA.DynAnyPackage,\
+ org.omg.CORBA.ORBPackage,\
+ org.omg.CORBA.portable,\
+ org.omg.CORBA.TypeCodePackage,\
+ org.omg.CosNaming,\
+ org.omg.CosNaming.NamingContextExtPackage,\
+ org.omg.CosNaming.NamingContextPackage,\
+ org.omg.Dynamic,\
+ org.omg.DynamicAny,\
+ org.omg.DynamicAny.DynAnyFactoryPackage,\
+ org.omg.DynamicAny.DynAnyPackage,\
+ org.omg.IOP,\
+ org.omg.IOP.CodecFactoryPackage,\
+ org.omg.IOP.CodecPackage,\
+ org.omg.Messaging,\
+ org.omg.PortableInterceptor,\
+ org.omg.PortableInterceptor.ORBInitInfoPackage,\
+ org.omg.PortableServer,\
+ org.omg.PortableServer.CurrentPackage,\
+ org.omg.PortableServer.POAManagerPackage,\
+ org.omg.PortableServer.POAPackage,\
+ org.omg.PortableServer.portable,\
+ org.omg.PortableServer.ServantLocatorPackage,\
+ org.omg.SendingContext,\
+ org.omg.stub.java.rmi,\
+ org.w3c.dom,\
+ org.w3c.dom.bootstrap,\
+ org.w3c.dom.css,\
+ org.w3c.dom.events,\
+ org.w3c.dom.html,\
+ org.w3c.dom.ls,\
+ org.w3c.dom.ranges,\
+ org.w3c.dom.stylesheets,\
+ org.w3c.dom.traversal,\
+ org.w3c.dom.views ,\
+ org.xml.sax,\
+ org.xml.sax.ext,\
+ org.xml.sax.helpers
+org.osgi.framework.bootdelegation = \
+ javax.*,\
+ org.ietf.jgss,\
+ org.omg.*,\
+ org.w3c.*,\
+ org.xml.*,\
+ sun.*,\
+ com.sun.*
+org.osgi.framework.executionenvironment = \
+ OSGi/Minimum-1.0,\
+ OSGi/Minimum-1.1,\
+ JRE-1.1,\
+ J2SE-1.2,\
+ J2SE-1.3,\
+ J2SE-1.4,\
+ J2SE-1.5,\
+ JavaSE-1.6
+osgi.java.profile.name = JavaSE-1.6

Added: felix/trunk/sigil/org.cauldron.bld.core/profiles/OSGi_Minimum-1.0.profile
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/org.cauldron.bld.core/profiles/OSGi_Minimum-1.0.profile?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/org.cauldron.bld.core/profiles/OSGi_Minimum-1.0.profile (added)
+++ felix/trunk/sigil/org.cauldron.bld.core/profiles/OSGi_Minimum-1.0.profile Mon Jul 13 13:25:46 2009
@@ -0,0 +1,17 @@
+###############################################################################
+# Copyright (c) 2003, 2005 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+# 
+# Contributors:
+#     IBM Corporation - initial API and implementation
+###############################################################################
+org.osgi.framework.system.packages = 
+org.osgi.framework.bootdelegation = \
+ sun.*,\
+ com.sun.*
+org.osgi.framework.executionenvironment = \
+ OSGi/Minimum-1.0
+osgi.java.profile.name = OSGi/Minimum-1.0

Added: felix/trunk/sigil/org.cauldron.bld.core/profiles/OSGi_Minimum-1.1.profile
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/org.cauldron.bld.core/profiles/OSGi_Minimum-1.1.profile?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/org.cauldron.bld.core/profiles/OSGi_Minimum-1.1.profile (added)
+++ felix/trunk/sigil/org.cauldron.bld.core/profiles/OSGi_Minimum-1.1.profile Mon Jul 13 13:25:46 2009
@@ -0,0 +1,18 @@
+###############################################################################
+# Copyright (c) 2003, 2005 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+# 
+# Contributors:
+#     IBM Corporation - initial API and implementation
+###############################################################################
+org.osgi.framework.system.packages = 
+org.osgi.framework.bootdelegation = \
+ sun.*,\
+ com.sun.*
+org.osgi.framework.executionenvironment = \
+ OSGi/Minimum-1.0,\
+ OSGi/Minimum-1.1
+osgi.java.profile.name = OSGi/Minimum-1.1

Added: felix/trunk/sigil/org.cauldron.bld.core/profiles/profile.list
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/org.cauldron.bld.core/profiles/profile.list?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/org.cauldron.bld.core/profiles/profile.list (added)
+++ felix/trunk/sigil/org.cauldron.bld.core/profiles/profile.list Mon Jul 13 13:25:46 2009
@@ -0,0 +1,21 @@
+###############################################################################
+# Copyright (c) 2003, 2005 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+# 
+# Contributors:
+#     IBM Corporation - initial API and implementation
+###############################################################################
+java.profiles = \
+ JavaSE-1.6.profile,\
+ J2SE-1.5.profile,\
+ J2SE-1.4.profile,\
+ J2SE-1.3.profile,\
+ J2SE-1.2.profile,\
+ JRE-1.1.profile,\
+ CDC-1.1_Foundation-1.1.profile,\
+ CDC-1.0_Foundation-1.0.profile,\
+ OSGi_Minimum-1.0.profile,\
+ OSGi_Minimum-1.1.profile,\

Added: felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/bld/bnd/BundleBuilder.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/bld/bnd/BundleBuilder.java?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/bld/bnd/BundleBuilder.java (added)
+++ felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/bld/bnd/BundleBuilder.java Mon Jul 13 13:25:46 2009
@@ -0,0 +1,800 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.cauldron.bld.bnd;
+
+import static java.lang.String.format;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+import java.util.jar.Attributes;
+
+import org.cauldron.bld.config.BldAttr;
+import org.cauldron.bld.config.IBldProject;
+import org.cauldron.bld.config.IBldProject.IBldBundle;
+import org.cauldron.bld.core.internal.model.osgi.PackageImport;
+import org.cauldron.bld.core.repository.SystemRepositoryProvider;
+import org.cauldron.sigil.model.common.VersionRange;
+import org.cauldron.sigil.model.osgi.IPackageExport;
+import org.cauldron.sigil.model.osgi.IPackageImport;
+import org.cauldron.sigil.model.osgi.IRequiredBundle;
+import org.osgi.framework.Version;
+
+import aQute.lib.osgi.Builder;
+import aQute.lib.osgi.Constants;
+import aQute.lib.osgi.Jar;
+import aQute.lib.osgi.Processor;
+
+public class BundleBuilder {
+    public static final String COMPONENT_ACTIVATOR_PKG = "XXX-FIXME-XXX";
+    public static final String COMPONENT_ACTIVATOR = COMPONENT_ACTIVATOR_PKG + ".Activator";
+    public static final String[] COMPONENT_ACTIVATOR_DEPS = { "XXX-FIXME-XXX",
+            "org.osgi.framework", "org.osgi.util.tracker" };
+    public static final String COMPONENT_DIR = "META-INF/XXX-FIXME-XXX";
+    public static final String COMPONENT_FLAG = "Installable-Component";
+    public static final String COMPONENT_LIST = "Installable-Component-Templates";
+
+    private IBldProject project;
+    private File[] classpath;
+    private String destPattern;
+    private Properties env;
+    private List<String> errors = new ArrayList<String>();
+    private List<String> warnings = new ArrayList<String>();
+
+    private Set<String> unused = new HashSet<String>();
+    private String lastBundle = null;
+
+    private boolean addMissingImports;
+    private boolean omitUnusedImports;
+    private String defaultPubtype;
+    private String codebaseFormat;
+    private Set<String> systemPkgs;
+
+    public interface Log {
+        void warn(String msg);
+
+        void verbose(String msg);
+    }
+
+    /**
+     * creates a BundleBuilder.
+     * 
+     * @param classpath
+     * @param destPattern
+     *            ivy-like pattern: PATH/[id].[ext] [id] is replaced with the
+     *            bundle id. [name] is replaced with the Bundle-SymbolicName
+     *            [ext] is replaced with "jar".
+     * @param hashtable
+     */
+    public BundleBuilder(IBldProject project, File[] classpath, String destPattern, Properties env) {
+        this.project = project;
+        this.classpath = classpath;
+        this.destPattern = destPattern;
+        this.env = env;
+
+        Properties options = project.getOptions();
+
+        addMissingImports = options.containsKey(BldAttr.OPTION_ADD_IMPORTS)
+                && Boolean.parseBoolean(options.getProperty(BldAttr.OPTION_ADD_IMPORTS));
+        omitUnusedImports = options.containsKey(BldAttr.OPTION_OMIT_IMPORTS)
+                && Boolean.parseBoolean(options.getProperty(BldAttr.OPTION_OMIT_IMPORTS));
+
+        defaultPubtype = options.getProperty(BldAttr.PUBTYPE_ATTRIBUTE, "rmi.codebase");
+
+        codebaseFormat = options.getProperty("codebaseFormat",
+                "cds://%1$s?bundle.symbolic.name=%2$s&type=%3$s");
+
+        for (IBldBundle b : project.getBundles()) {
+            lastBundle = b.getId();
+            for (IPackageImport import1 : b.getImports()) {
+                if (import1.getOSGiImport().equals(IPackageImport.OSGiImport.AUTO)) {
+                    unused.add(import1.getPackageName());
+                }
+            }
+        }
+
+        try {
+            systemPkgs = new HashSet<String>();
+            Properties profile = SystemRepositoryProvider.readProfile(null);
+            String pkgs = profile.getProperty("org.osgi.framework.system.packages");
+            for (String pkg : pkgs.split(",\\s*")) {
+                systemPkgs.add(pkg);
+            }
+        } catch (IOException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+    }
+
+    public List<String> errors() {
+        return errors;
+    }
+
+    public List<String> warnings() {
+        return warnings;
+    }
+
+    @SuppressWarnings("unchecked")
+    private void convertErrors(String prefix, List messages) {
+        // TODO: make error mapping more generic
+        final String jarEmpty = "The JAR is empty";
+
+        for (Object omsg : messages) {
+            if (jarEmpty.equals(omsg))
+                warnings.add(prefix + omsg);
+            else
+                errors.add(prefix + omsg);
+        }
+    }
+
+    @SuppressWarnings("unchecked")
+    private void convertWarnings(String prefix, List messages) {
+        for (Object omsg : messages) {
+            warnings.add(prefix + omsg);
+        }
+    }
+
+    public boolean createBundle(IBldBundle bundle, boolean force, Log log) throws Exception {
+        int bracket = destPattern.indexOf('[');
+        if (bracket < 0) {
+            throw new Exception("destPattern MUST contain [id] or [name].");
+        }
+
+        String dest = destPattern.replaceFirst("\\[id\\]", bundle.getId());
+        dest = dest.replaceFirst("\\[name\\]", bundle.getSymbolicName());
+        dest = dest.replaceFirst("\\[ext\\]", "jar");
+
+        bracket = dest.indexOf('[');
+        if (bracket >= 0) {
+            String token = dest.substring(bracket);
+            throw new Exception("destPattern: expected [id] or [name]: " + token);
+        }
+
+        errors.clear();
+        warnings.clear();
+
+        if (!bundle.getDownloadContents().isEmpty()) {
+            // create dljar
+            Properties dlspec = new Properties();
+            StringBuilder sb = new StringBuilder();
+
+            for (String pkg : bundle.getDownloadContents()) {
+                if (sb.length() > 0)
+                    sb.append(",");
+                sb.append(pkg);
+            }
+
+            dlspec.setProperty(Constants.PRIVATE_PACKAGE, sb.toString());
+            dlspec.setProperty(Constants.BUNDLE_NAME, "Newton download jar");
+            dlspec.setProperty(Constants.NOEXTRAHEADERS, "true");
+            // stop it being a bundle, so cds doesn't scan it
+            dlspec.setProperty(Constants.REMOVE_HEADERS, Constants.BUNDLE_SYMBOLICNAME);
+
+            Builder builder = new Builder();
+            builder.setProperties(dlspec);
+            builder.setClasspath(classpath);
+
+            Jar dljar = builder.build();
+            convertErrors("BND (dljar): ", builder.getErrors());
+            convertWarnings("BND (dljar): ", builder.getWarnings());
+
+            String dldest = dest.replaceFirst("\\.jar$", "-dl.jar");
+            File dloutput = new File(dldest);
+            if (!dloutput.exists() || dloutput.lastModified() <= dljar.lastModified() || force) {
+                // jar.write(dldest) catches and ignores IOException
+                OutputStream out = new FileOutputStream(dldest);
+                dljar.write(out);
+                out.close();
+                dljar.close();
+                // XXX deleting dljar causes it to be rebuilt each time
+                // XXX but leaving it mean it may be installed where it's not
+                // wanted/needed.
+                dloutput.deleteOnExit();
+            }
+            builder.close();
+        }
+
+        Properties spec = getBndSpec(bundle, dest);
+
+        if (log != null) {
+            log.verbose("BND instructions: " + spec.toString());
+        }
+
+        Builder builder = new Builder();
+        builder.setPedantic(true);
+        builder.setProperties(spec);
+        builder.mergeProperties(env, false);
+
+        builder.setClasspath(classpath);
+        // builder.setSourcepath(sourcepath);
+
+        Jar jar = builder.build();
+
+        convertErrors("BND: ", builder.getErrors());
+        convertWarnings("BND: ", builder.getWarnings());
+
+        augmentImports(builder, jar, bundle);
+
+        if (log != null) {
+            for (String warn : warnings) {
+                log.warn(warn);
+            }
+        }
+
+        if (!errors.isEmpty()) {
+            throw new Exception(errors.toString());
+        }
+
+        boolean modified = false;
+        File output = new File(dest);
+
+        if (!output.exists() || force || (output.lastModified() <= jar.lastModified())
+                || (output.lastModified() <= project.getLastModified())) {
+            modified = true;
+            // jar.write(dest) catches and ignores IOException
+            OutputStream out = new FileOutputStream(dest);
+            jar.write(out);
+            out.close();
+            jar.close();
+        }
+
+        builder.close();
+
+        return modified;
+    }
+
+    private void augmentImports(Builder builder, Jar jar, IBldBundle bundle) throws IOException {
+        Attributes main = jar.getManifest().getMainAttributes();
+        String impHeader = main.getValue(Constants.IMPORT_PACKAGE);
+        Map<String, Map<String, String>> bndImports = Processor.parseHeader(impHeader, builder);
+
+        if (bndImports.isEmpty())
+            return;
+
+        ArrayList<String> self = new ArrayList<String>();
+        ArrayList<String> missing = new ArrayList<String>();
+        ArrayList<String> modified = new ArrayList<String>();
+        ArrayList<String> unversioned = new ArrayList<String>();
+
+        String expHeader = main.getValue(Constants.EXPORT_PACKAGE);
+        Set<String> bndExports = Processor.parseHeader(expHeader, builder).keySet();
+
+        HashMap<String, IPackageImport> imports = new HashMap<String, IPackageImport>();
+        for (IPackageImport pi : getImports(bundle)) {
+            switch (pi.getOSGiImport()) {
+            case NEVER:
+                break;
+            case ALWAYS:
+                String pkg = pi.getPackageName();
+                if (!bndImports.containsKey(pkg)) {
+                    // Bnd doesn't think this import is needed - but we know
+                    // better
+                    HashMap<String, String> attrs = new HashMap<String, String>();
+                    attrs.put(BldAttr.VERSION_ATTRIBUTE, pi.getVersions().toString());
+                    bndImports.put(pkg, attrs);
+                    modified.add(pkg + ";resolve=runtime");
+                }
+                // fall thru */
+            case AUTO:
+                imports.put(pi.getPackageName(), pi);
+                break;
+            }
+        }
+
+        boolean importDot = false;
+
+        for (String pkg : bndImports.keySet()) {
+            unused.remove(pkg);
+            Map<String, String> attrs = bndImports.get(pkg);
+            String currentVersion = (String) attrs.get(BldAttr.VERSION_ATTRIBUTE);
+            IPackageImport pi = imports.get(pkg);
+
+            if (pi != null) {
+                VersionRange range = pi.getVersions();
+                String version = range.toString();
+
+                if (!version.equals(currentVersion) && !range.equals(VersionRange.ANY_VERSION)) {
+                    attrs.put(BldAttr.VERSION_ATTRIBUTE, version);
+                    if (pi.isOptional())
+                        attrs.put(BldAttr.RESOLUTION_ATTRIBUTE, BldAttr.RESOLUTION_OPTIONAL);
+                    modified
+                            .add(pkg + ";version=" + version + (pi.isOptional() ? ";optional" : ""));
+                } else if ((currentVersion == null) && !systemPkgs.contains(pkg)) {
+                    unversioned.add(pkg);
+                }
+            } else {
+                // bnd added the import ...
+                if (currentVersion == null) {
+                    String defaultVersion = project.getDefaultPackageVersion(pkg);
+                    if (defaultVersion != null) {
+                        attrs.put(BldAttr.VERSION_ATTRIBUTE, defaultVersion);
+                        currentVersion = defaultVersion;
+                    }
+                }
+
+                String imp = pkg + (currentVersion == null ? "" : ";version=" + currentVersion);
+                if (bndExports.contains(pkg)) {
+                    self.add(imp);
+                } else {
+                    if (pkg.equals(".")) {
+                        warnings.add("Bnd wants to import '.' (ignored)");
+                        importDot = true;
+                    } else {
+                        missing.add(imp);
+                    }
+                }
+            }
+        }
+
+        if (!modified.isEmpty() || importDot) {
+            if (importDot)
+                bndImports.remove(".");
+            // warnings.add("INFO: sigil modified imports: " + modified);
+            main.putValue(Constants.IMPORT_PACKAGE, Processor.printClauses(bndImports,
+                    "resolution:"));
+        }
+
+        if (!self.isEmpty()) {
+            // warnings.add("INFO: added self imports: " + self);
+        }
+
+        if (!missing.isEmpty()) {
+            warnings.add("missing imports (added): " + missing);
+        }
+
+        if (!unversioned.isEmpty()) {
+            warnings.add("unversioned imports: " + unversioned);
+        }
+
+        if (bundle.getId().equals(lastBundle)) {
+            if (!unused.isEmpty()) {
+                warnings.add("unused imports (omitted): " + unused);
+            }
+        }
+    }
+
+    public Properties getBndSpec(IBldBundle bundle, String dest) throws IOException {
+        Properties spec = new Properties();
+
+        String junkHeaders = Constants.INCLUDE_RESOURCE; // shows local build
+                                                         // paths; can be
+                                                         // verbose
+        junkHeaders += "," + Constants.PRIVATE_PACKAGE; // less useful, as we
+                                                        // use it for exported
+                                                        // content too.
+
+        spec.setProperty(Constants.REMOVE_HEADERS, junkHeaders);
+        spec.setProperty(Constants.NOEXTRAHEADERS, "true"); // Created-By,
+                                                            // Bnd-LastModified
+                                                            // and Tool
+        spec.setProperty(Constants.CREATED_BY, "sigil.codecauldron.org");
+
+        Properties headers = bundle.getHeaders();
+        // XXX: catch attempts to set headers that conflict with Bnd
+        // instructions we generate?
+        spec.putAll(headers);
+
+        spec.setProperty(Constants.BUNDLE_SYMBOLICNAME, bundle.getSymbolicName());
+        spec.setProperty(Constants.BUNDLE_VERSION, bundle.getVersion());
+
+        String activator = bundle.getActivator();
+        if (activator != null)
+            spec.setProperty(Constants.BUNDLE_ACTIVATOR, activator);
+
+        addRequirements(bundle, spec);
+
+        List<String> exports = addExports(bundle, spec);
+
+        String composites = addResources(bundle, spec);
+
+        ArrayList<String> contents = new ArrayList<String>();
+        contents.addAll(bundle.getContents());
+
+        if (contents.isEmpty()) {
+            if (!project.getSourcePkgs().isEmpty()) {
+                contents.addAll(project.getSourcePkgs());
+            } else {
+                contents.addAll(exports);
+            }
+        }
+
+        if (composites.length() > 0) {
+            if (spec.containsKey(Constants.BUNDLE_ACTIVATOR))
+                warnings.add("-activator ignored when -composites specified.");
+            spec.setProperty(Constants.BUNDLE_ACTIVATOR, COMPONENT_ACTIVATOR);
+            spec.setProperty(COMPONENT_FLAG, "true");
+            spec.setProperty(COMPONENT_LIST, composites);
+            // add activator pkg directly, to avoid needing to add jar to
+            // Bundle-ClassPath.
+            // split-package directive needed to stop Bnd whinging when using
+            // other bundles containing the component-activator.
+            contents.add(COMPONENT_ACTIVATOR_PKG + ";-split-package:=merge-first");
+        }
+
+        List<String> srcPkgs = addLibs(bundle, dest, spec);
+
+        contents.addAll(srcPkgs);
+        addContents(contents, spec);
+
+        IRequiredBundle fh = bundle.getFragmentHost();
+        if (fh != null) {
+            StringBuilder sb = new StringBuilder();
+            sb.append(fh.getSymbolicName());
+            addVersions(fh.getVersions(), sb);
+            spec.setProperty(Constants.FRAGMENT_HOST, sb.toString());
+        }
+
+        return spec;
+    }
+
+    private void addContents(List<String> contents, Properties spec) {
+        // add contents
+        StringBuilder sb = new StringBuilder();
+        for (String pkg : contents) {
+            if (sb.length() > 0)
+                sb.append(",");
+            sb.append(pkg);
+        }
+
+        if (sb.length() > 0)
+            spec.setProperty(Constants.PRIVATE_PACKAGE, sb.toString());
+    }
+
+    private void appendProperty(String key, String value, Properties p) {
+        String list = p.getProperty(key);
+
+        if (list == null) {
+            list = value;
+        } else {
+            list = list + "," + value;
+        }
+
+        p.setProperty(key, list);
+    }
+
+    private List<String> addLibs(IBldBundle bundle, String dest, Properties spec)
+            throws IOException {
+        // final String cleanVersion =
+        // Builder.cleanupVersion(bundle.getVersion());
+        final String name = bundle.getSymbolicName();
+
+        ArrayList<String> srcPkgs = new ArrayList<String>();
+        Map<String, Map<String, String>> libs = bundle.getLibs();
+
+        if (!bundle.getDownloadContents().isEmpty()) {
+            // implicitly add dljar
+            File fdest = new File(dest);
+            String dlname = fdest.getName().replaceFirst("\\.jar$", "-dl.jar");
+
+            HashMap<String, String> attr = new HashMap<String, String>();
+            attr.put(BldAttr.KIND_ATTRIBUTE, "codebase");
+            attr.put(BldAttr.PUBLISH_ATTRIBUTE, dlname);
+
+            HashMap<String, Map<String, String>> lib2 = new HashMap<String, Map<String, String>>();
+            lib2.putAll(libs);
+            lib2.put(dlname, attr);
+            libs = lib2;
+        }
+
+        StringBuilder items = new StringBuilder();
+
+        for (String jarpath : libs.keySet()) {
+            Map<String, String> attr = libs.get(jarpath);
+            String kind = attr.get(BldAttr.KIND_ATTRIBUTE);
+            String publish = attr.get(BldAttr.PUBLISH_ATTRIBUTE);
+
+            // first find the lib ..
+            String path = attr.get(BldAttr.PATH_ATTRIBUTE);
+            if (path == null)
+                path = jarpath;
+
+            File fsPath = bundle.resolve(path);
+
+            if (!fsPath.exists()) {
+                // try destDir
+                File destDir = new File(dest).getParentFile();
+                File file = new File(destDir, fsPath.getName());
+
+                if (!file.exists()) {
+                    // try searching classpath
+                    file = findInClasspathDir(fsPath.getName());
+                }
+
+                if (file != null && file.exists())
+                    fsPath = file;
+            }
+
+            if (!fsPath.exists()) {
+                // XXX: find external bundle using name and version range?
+                // For now just let BND fail when it can't find resource.
+            }
+
+            appendProperty(Constants.INCLUDE_RESOURCE, jarpath + "=" + fsPath, spec);
+
+            if ("classpath".equals(kind)) {
+                String bcp = spec.getProperty(Constants.BUNDLE_CLASSPATH);
+                if (bcp == null || bcp.length() == 0)
+                    spec.setProperty(Constants.BUNDLE_CLASSPATH, ".");
+                appendProperty(Constants.BUNDLE_CLASSPATH, jarpath, spec);
+            }
+
+            if (publish != null) {
+                String pubtype = attr.get(BldAttr.PUBTYPE_ATTRIBUTE);
+                if (pubtype == null)
+                    pubtype = defaultPubtype;
+
+                if ("codebase".equals(kind)) {
+                    String codebase = format(codebaseFormat, publish, name, pubtype);
+                    String zone = attr.get(BldAttr.ZONE_ATTRIBUTE);
+                    if (zone != null)
+                        codebase += "&zone=" + zone;
+                    appendProperty("RMI-Codebase", codebase, spec);
+                }
+
+                // add item to publish xml
+                items.append(format("<item name=\"%s\" path=\"%s\">\n", publish, jarpath));
+                items.append(format("<attribute name=\"type\" value=\"%s\"/>\n", pubtype));
+                items.append("</item>\n");
+            }
+        }
+
+        if (items.length() > 0) {
+            File publishFile = new File(dest.replaceFirst("\\.jar$", "-publish.xml"));
+            publishFile.deleteOnExit();
+            PrintWriter writer = new PrintWriter(new FileWriter(publishFile));
+
+            writer.println("<publish>");
+            writer.println(format("<attribute name=\"bundle.symbolic.name\" value=\"%s\"/>", name));
+            writer.print(items.toString());
+            writer.println("</publish>");
+            writer.close();
+
+            appendProperty(Constants.INCLUDE_RESOURCE, "publish.xml=" + publishFile, spec);
+        }
+
+        return srcPkgs;
+    }
+
+    private String addResources(IBldBundle bundle, Properties spec) {
+        Map<String, String> resources = bundle.getResources();
+        StringBuilder composites = new StringBuilder();
+
+        for (String composite : bundle.getComposites()) {
+            File path = bundle.resolve(composite);
+            String name = path.getName();
+
+            String bPath = COMPONENT_DIR + "/" + name;
+            resources.put(bPath, path.getPath());
+
+            if (composites.length() > 0)
+                composites.append(",");
+            composites.append(bPath);
+        }
+
+        StringBuilder sb = new StringBuilder();
+
+        for (String bPath : resources.keySet()) {
+            if (bPath.startsWith("@")) { // Bnd in-line jar
+                if (sb.length() > 0)
+                    sb.append(",");
+                sb.append('@');
+                sb.append(bundle.resolve(bPath.substring(1)));
+                continue;
+            }
+
+            String fsPath = resources.get(bPath);
+            if ("".equals(fsPath))
+                fsPath = bPath;
+
+            File resolved = bundle.resolve(fsPath);
+
+            // fsPath may contain Bnd variable, making path appear to not exist
+
+            if (!resolved.exists()) {
+                // Bnd already looks for classpath jars
+                File found = findInClasspathDir(fsPath);
+                if (found != null) {
+                    fsPath = found.getPath();
+                } else {
+                    fsPath = resolved.getAbsolutePath();
+                }
+            } else {
+                fsPath = resolved.getAbsolutePath();
+            }
+
+            if (sb.length() > 0)
+                sb.append(",");
+            sb.append(bPath);
+            sb.append('=');
+            sb.append(fsPath);
+        }
+
+        if (sb.length() > 0)
+            spec.setProperty(Constants.INCLUDE_RESOURCE, sb.toString());
+
+        return composites.toString();
+    }
+
+    private List<IPackageImport> getImports(IBldBundle bundle) {
+        List<IPackageImport> imports = bundle.getImports();
+        Set<String> pkgs = new HashSet<String>();
+
+        for (IPackageImport pi : imports) {
+            pkgs.add(pi.getPackageName());
+        }
+
+        // add component activator imports
+        if (!bundle.getComposites().isEmpty()) {
+            for (String pkg : BundleBuilder.COMPONENT_ACTIVATOR_DEPS) {
+                if (pkgs.contains(pkg))
+                    continue;
+                PackageImport pi = new PackageImport();
+                pi.setPackageName(pkg);
+                String versions = project.getDefaultPackageVersion(pkg);
+                if (versions != null)
+                    pi.setVersions(VersionRange.parseVersionRange(versions));
+                imports.add(pi);
+            }
+        }
+
+        return imports;
+    }
+
+    private void addRequirements(IBldBundle bundle, Properties spec) {
+        StringBuilder sb = new StringBuilder();
+
+        // option;addMissingImports=true
+        // Lets Bnd calculate imports (i.e. specify *),
+        // which are then examined by augmentImports();
+
+        // option;omitUnusedImports=true (implies addMissingImports=true)
+        // When project contains multiple bundles which don't all use all
+        // imports,
+        // avoids warnings like:
+        // "Importing packages that are never referred to by any class on the Bundle-ClassPath"
+
+        if (omitUnusedImports && !addMissingImports) {
+            warnings.add("omitUnusedImports ignored as addMissingImports=false.");
+            omitUnusedImports = false;
+        }
+
+        List<IPackageImport> imports = getImports(bundle);
+
+        sb.setLength(0);
+
+        // allow existing header;Package-Import to specify ignored packages
+        sb.append(spec.getProperty(Constants.IMPORT_PACKAGE, ""));
+
+        for (IPackageImport pi : imports) {
+            switch (pi.getOSGiImport()) {
+            case AUTO:
+                if (omitUnusedImports)
+                    continue; // added by Import-Package: * and fixed by
+                              // augmentImports()
+                break;
+            case NEVER:
+                if (pi.isDependency())
+                    continue; // resolve=compile
+                break;
+            case ALWAYS:
+                // Bnd will probably whinge that this import is not used.
+                // we omit it here and replace it in augmentImports,
+                // but only if addMissingImports is true;
+                // otherwise, if the import is used, Bnd will fail.
+                if (addMissingImports)
+                    continue;
+                break;
+            }
+
+            if (sb.length() > 0)
+                sb.append(",");
+
+            if (pi.getOSGiImport().equals(IPackageImport.OSGiImport.NEVER)) {
+                sb.append("!");
+                sb.append(pi.getPackageName());
+            } else {
+                sb.append(pi.getPackageName());
+                addVersions(pi.getVersions(), sb);
+
+                if (pi.isOptional()) {
+                    sb.append(";resolution:=optional");
+                }
+            }
+        }
+
+        if (addMissingImports) {
+            if (sb.length() > 0)
+                sb.append(",");
+            sb.append("*");
+        }
+
+        spec.setProperty(Constants.IMPORT_PACKAGE, sb.toString());
+
+        sb.setLength(0);
+        for (IRequiredBundle rb : bundle.getRequires()) {
+            if (sb.length() > 0)
+                sb.append(",");
+            sb.append(rb.getSymbolicName());
+            addVersions(rb.getVersions(), sb);
+        }
+
+        if (sb.length() > 0) {
+            spec.setProperty(Constants.REQUIRE_BUNDLE, sb.toString());
+        }
+    }
+
+    private List<String> addExports(IBldBundle bundle, Properties spec) {
+        List<IPackageExport> exports = bundle.getExports();
+        ArrayList<String> list = new ArrayList<String>();
+        StringBuilder sb = new StringBuilder();
+
+        for (IPackageExport export : exports) {
+            if (sb.length() > 0)
+                sb.append(",");
+            sb.append(export.getPackageName());
+            if (!export.getVersion().equals(Version.emptyVersion)) {
+                sb.append(";version=\"");
+                sb.append(export.getVersion());
+                sb.append("\"");
+            }
+            list.add(export.getPackageName());
+        }
+
+        if (sb.length() > 0) {
+            // EXPORT_CONTENTS just sets the Export-Package manifest header;
+            // it doesn't add contents like EXPORT_PACKAGE does.
+            spec.setProperty(Constants.EXPORT_CONTENTS, sb.toString());
+        }
+
+        return list;
+    }
+
+    private void addVersions(VersionRange range, StringBuilder sb) {
+        if (!range.equals(VersionRange.ANY_VERSION)) {
+            sb.append(";version=\"");
+            sb.append(range);
+            sb.append("\"");
+        }
+    }
+
+    private File findInClasspathDir(String file) {
+        for (File cp : classpath) {
+            if (cp.isDirectory()) {
+                File path = new File(cp, file);
+                if (path.exists()) {
+                    return path;
+                }
+            }
+        }
+
+        return null;
+    }
+
+}

Added: felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/bld/config/BldAttr.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/bld/config/BldAttr.java?rev=793581&view=auto
==============================================================================
--- felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/bld/config/BldAttr.java (added)
+++ felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/bld/config/BldAttr.java Mon Jul 13 13:25:46 2009
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.cauldron.bld.config;
+
+public class BldAttr {
+	// Sigil attributes
+	
+	public static final String KIND_ATTRIBUTE = "kind";
+	
+	public static final String RESOLVE_ATTRIBUTE = "resolve";
+	public static final String RESOLVE_AUTO = "auto";
+	public static final String RESOLVE_COMPILE = "compile";
+	public static final String RESOLVE_RUNTIME = "runtime";
+	public static final String RESOLVE_IGNORE = "ignore";
+	
+	public static final String PUBLISH_ATTRIBUTE = "publish";
+	public static final String PUBTYPE_ATTRIBUTE = "type";
+	public static final String PATH_ATTRIBUTE = "path";
+	public static final Object ZONE_ATTRIBUTE = "zone";
+	
+	// Sigil options
+	
+	public static final String OPTION_ADD_IMPORTS = "addMissingImports";
+	public static final String OPTION_OMIT_IMPORTS = "omitUnusedImports";
+	
+	// OSGi attributes
+	
+	public static final String RESOLUTION_ATTRIBUTE = "resolution";
+	public static final String RESOLUTION_OPTIONAL = "optional";
+	
+	public static final String VERSION_ATTRIBUTE = "version";
+
+}