Initial commit of Sigil contribution. (FELIX-1142)


git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@793581 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/sigil/bld-ivy/example/felix-log/README b/sigil/bld-ivy/example/felix-log/README
new file mode 100644
index 0000000..df71d9b
--- /dev/null
+++ b/sigil/bld-ivy/example/felix-log/README
@@ -0,0 +1,22 @@
+# http://sigil.codecauldron.org
+
+This example shows how to build the felix log service, using Ant/Ivy,
+instead of Maven.
+
+sigil.properties has been constructed to produce an identical bundle to the
+one produced by Maven.
+
+The Felix dependencies are obtained from an OBR index of
+http://repo1.maven.org/maven2/org/apache/felix, Maven repos can't be searched
+directly for package import dependencies.
+
+1. checkout felix log code
+  $ cd felix-log
+  $ svn co http://svn.apache.org/repos/asf/felix/trunk/log
+
+2. set ivy.jar location in common/build.properties
+
+3. build
+  $ cd log
+  $ ant
+
diff --git a/sigil/bld-ivy/example/felix-log/bldcommon/build.properties b/sigil/bld-ivy/example/felix-log/bldcommon/build.properties
new file mode 100644
index 0000000..ff1bcc1
--- /dev/null
+++ b/sigil/bld-ivy/example/felix-log/bldcommon/build.properties
@@ -0,0 +1,26 @@
+# common properties
+
+# CHANGE ivy.jar TO REFLECT YOUR INSTALLATION
+ivy.jar = /opt/apache-ivy-2.0.0-rc2/ivy-2.0.0-rc2.jar
+
+sigil-ivy-plugin.jar = ${common.dir}/../../../lib/sigil-ivy-plugin.jar
+
+build.dir	= ${basedir}/build
+classes.dir	= ${build.dir}/classes
+deps.dir	= ${build.dir}/deps
+resource.dir	= ${basedir}/xml
+src.dir		= ${basedir}/src
+
+dest.dir	= ${build.dir}
+dest.lib.dir	= ${dest.dir}/lib
+dest.etc.dir	= ${dest.dir}/etc
+
+ivy.file	= ${basedir}/ivy.xml
+module.version.target = 1.0
+
+cache.dir	= ${common.dir}/ivy-cache
+repository.dir	= ${common.dir}/repository
+
+example.version	= 1.0.0
+bundle.version	= ${example.version}
+
diff --git a/sigil/bld-ivy/example/felix-log/bldcommon/common.xml b/sigil/bld-ivy/example/felix-log/bldcommon/common.xml
new file mode 100644
index 0000000..8431484
--- /dev/null
+++ b/sigil/bld-ivy/example/felix-log/bldcommon/common.xml
@@ -0,0 +1,230 @@
+<?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}/build.properties"/>
+
+    <path id="lib.path.id">
+        <fileset dir="${deps.dir}" />
+    </path>
+
+    <path id="sigil.path.id">
+        <path refid="lib.path.id" />
+        <path location="${classes.dir}" />
+    </path>
+
+    <!-- setup ivy default configuration with some custom info -->
+    <property name="ivy.local.default.root" value="${repository.dir}/local"/>
+    <property name="ivy.shared.default.root" value="${repository.dir}/shared"/>
+
+    <!-- ================================= 
+          target: load-ivy
+         ================================= -->
+    <target name="load-ivy" depends="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}"/>
+
+	<taskdef name="sigil.bundle"
+		 classname="org.cauldron.bld.ant.BundleTask"
+		 classpath="${sigil-ivy-plugin.jar}"/>
+    </target>    
+
+
+
+    <!-- ================================= 
+          target: build (default target)
+         ================================= -->
+    <target name="build" depends="ident, jar, resources" />
+
+    <target name="ident">
+      <echo message="${ant.project.name}"/>
+    </target>
+
+    <!-- ================================= 
+          target: resolve              
+         ================================= -->
+    <target name="resolve" depends="load-ivy, clean-deps"
+    	description="--> resolve and retrieve dependencies with ivy">
+	<mkdir dir="${deps.dir}"/>
+    	<ivy:resolve file="${ivy.file}"/>
+    	<ivy:retrieve pattern="${deps.dir}/[artifact].[ext]" />
+    </target>
+
+    <!-- ================================= 
+          target: install
+         ================================= -->
+    <target name="install" depends="install-version, build"
+    	description="--> publish this project in the local repository">
+    	<ivy:publish artifactspattern="${dest.lib.dir}/[artifact].[ext]" 
+		       resolver="local"
+		       pubrevision="${version}" 
+		       pubdate="${now}"
+		       forcedeliver="true"
+		       status="integration"/>
+        <echo message="project ${ant.project.name} published locally with version ${version}" />
+    </target>
+
+    <target name="install-version">
+	<tstamp>
+	    <format property="now" pattern="yyyyMMddHHmmss"/>
+	</tstamp>
+        <property name="version"
+	      value="${module.version.target}-local-${now}"/>
+    </target>
+    
+    <!-- ================================= 
+          target: report              
+         ================================= -->
+    <target name="report" depends="resolve"
+    	description="--> generates a report of dependencies">
+        <ivy:report todir="${build.dir}"/>
+    </target>
+    
+    <!-- ================================= 
+          target: compile              
+         ================================= -->
+    <target name="compile" depends="resolve"
+    	description="--> compile the project">
+        <mkdir dir="${classes.dir}" />
+        <javac srcdir="${src.dir}"
+		destdir="${classes.dir}"
+		classpathref="lib.path.id"
+		target="1.5"
+		debug="true" />
+    </target>
+    
+    <!-- ================================= 
+          target: jar              
+         ================================= -->
+    <target name="jar" depends="compile"
+    	description="--> make a jar file for this project">
+	<mkdir dir="${dest.lib.dir}"/>
+        <sigil.bundle destpattern="${dest.lib.dir}/[id].[ext]"
+                classpathref="sigil.path.id"/>
+    </target>
+
+    <!-- ================================= 
+          target: resources              
+         ================================= -->
+    <available file="${resource.dir}" type="dir"
+               property="resource.dir.present"/>
+
+    <target name="resources" if="resource.dir.present"
+    	description="--> filter xml resources replacing ${VERSION} etc.">
+	<mkdir dir="${dest.etc.dir}"/>
+	<copy todir="${dest.etc.dir}">
+	  <fileset dir="${resource.dir}">
+	    <include name="*.composite"/>
+	    <include name="*.system"/>
+	  </fileset>
+	  <filterset begintoken="$${" endtoken="}">
+	    <filter token="VERSION" value="${bundle.version}"/>
+	    <filter token="BLITZ_VERSION" value="${blitz.version}"/>
+	    <filter token="JINI_VERSION" value="${jini.version}"/>
+	  </filterset>
+	</copy>
+    </target>
+
+    <!-- ================================= 
+      target: clean-local              
+     ================================= -->
+    <target name="clean-local"
+    	description="--> cleans the local repository for the current module">
+       <delete dir="${ivy.local.default.root}/${ant.project.name}"/>
+    </target>
+
+    <!-- ================================= 
+      target: clean-deps              
+     ================================= -->
+    <target name="clean-deps"
+    	description="--> clean the project libraries directory (dependencies)">
+	<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="clean-build, clean-deps"
+    	description="--> clean the project" />
+
+
+    <!-- ================================= 
+          target: buildlist
+         ================================= -->
+    <fileset id="projects" dir="${basedir}" includes="**/build.xml"/>
+
+    <target name="buildlist" depends="load-ivy">
+      <ivy:buildlist reference="ordered-list"
+		  onMissingDescriptor="skip">
+	<fileset refid="projects"/>
+      </ivy:buildlist>
+    </target>
+
+    <!-- ================================= 
+          target: install-list
+         ================================= -->
+    <target name="install-list" depends="buildlist" 
+	  description="--> compile, jar and install all projects in the right order">
+      <subant target="install" buildpathref="ordered-list">
+	<propertyset>
+	  <propertyref name="ivy.loaded" />
+	</propertyset>
+      </subant>
+    </target>
+
+    <!-- ================================= 
+          target: clean-list
+         ================================= -->
+    <target name="clean-list" depends="clean, buildlist"
+	  description="--> clean all projects">
+      <subant target="clean" buildpathref="ordered-list" />
+    </target>
+
+    <!-- ================================= 
+          target: clean-all
+         ================================= -->
+    <target name="clean-all" depends="clean-list" 
+    description="--> delete repository, ivy cache, and all projects">
+      <delete dir="${repository.dir}"/>
+      <ivy:cleancache />
+    </target>
+
+</project>
diff --git a/sigil/bld-ivy/example/felix-log/bldcommon/ivysettings.xml b/sigil/bld-ivy/example/felix-log/bldcommon/ivysettings.xml
new file mode 100644
index 0000000..dd336c7
--- /dev/null
+++ b/sigil/bld-ivy/example/felix-log/bldcommon/ivysettings.xml
@@ -0,0 +1,54 @@
+<?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}" />
+  <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/[module]-[revision].xml" />
+      <artifact pattern="${repository.dir}/local/[artifact]-[revision].[ext]" />
+    </filesystem>
+
+    <filesystem name="shared">
+      <ivy pattern="${repository.dir}/shared/[module]-[revision].xml" />
+      <artifact pattern="${repository.dir}/shared/[module]/[artifact]-[revision].[ext]" />
+    </filesystem>
+  </resolvers>
+
+  <modules>
+    <module organisation="sigil" resolver="sigil"/>
+  </modules>
+</ivysettings>
diff --git a/sigil/bld-ivy/example/felix-log/bldcommon/sigil-repos.properties b/sigil/bld-ivy/example/felix-log/bldcommon/sigil-repos.properties
new file mode 100644
index 0000000..fbc95c6
--- /dev/null
+++ b/sigil/bld-ivy/example/felix-log/bldcommon/sigil-repos.properties
@@ -0,0 +1,17 @@
+# sigil repository config
+
+-repositories:	system, project, felix
+
+system;provider:	system
+system;level:		-1
+
+project;provider:	project
+project;level:		0
+project;pattern:	../*/[sigilproject]
+
+felix;provider:         obr
+felix;level:            1
+felix;url:              http://sigil.codecauldron.org/maven-felix.obr
+felix;index:            ../bldcommon/maven-felix.obr
+
+# end
diff --git a/sigil/bld-ivy/example/felix-log/log/build.xml b/sigil/bld-ivy/example/felix-log/log/build.xml
new file mode 100644
index 0000000..c7c19f6
--- /dev/null
+++ b/sigil/bld-ivy/example/felix-log/log/build.xml
@@ -0,0 +1,22 @@
+<?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="felix-log" default="build">
+      <import file="../bldcommon/common.xml"/>
+</project>
diff --git a/sigil/bld-ivy/example/felix-log/log/ivy.xml b/sigil/bld-ivy/example/felix-log/log/ivy.xml
new file mode 100644
index 0000000..6e0b4db
--- /dev/null
+++ b/sigil/bld-ivy/example/felix-log/log/ivy.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+  
+    http://www.apache.org/licenses/LICENSE-2.0
+  
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+<ivy-module version="1.0">
+    <info 
+        organisation="org.apache.felix"
+        module="felix-log"
+        status="integration"/>
+</ivy-module>
diff --git a/sigil/bld-ivy/example/felix-log/log/sigil.properties b/sigil/bld-ivy/example/felix-log/log/sigil.properties
new file mode 100644
index 0000000..3443218
--- /dev/null
+++ b/sigil/bld-ivy/example/felix-log/log/sigil.properties
@@ -0,0 +1,38 @@
+# sigil project file, saved by plugin.
+
+-activator: ${Bundle-SymbolicName}.impl.Activator
+
+name: org.apache.felix.log
+
+version: 0.9.0.SNAPSHOT
+
+-bundles: \
+	felix-log, \
+
+-contents: \
+	${Bundle-SymbolicName}.impl, \
+	org.osgi.service.log, \
+
+-resources: \
+	=src/main/resources, \
+
+-sourcedirs: \
+	src/main/java, \
+
+-exports: \
+	org.osgi.service.log, \
+
+-imports: \
+	org.osgi.framework;version=1.4, \
+	org.osgi.service.log;version=1.3, \
+
+header;Bundle-Vendor: The Apache Software Foundation
+
+header;Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
+
+header;Export-Service: org.osgi.service.log.LogService,org.osgi.service.log.LogReaderService
+
+header;Bundle-Name: Apache Felix Log Service
+
+header;Bundle-DocURL: http://www.apache.org/
+