view osgi-ant-bundlor.xml @ 159:0c48cfd1938b

allow projects to override branchName
author Dave Smith <smith@nwoca.org>
date Wed, 06 Nov 2013 02:13:31 +0000
parents 5f8d6291cc66
children
line wrap: on
line source
<?xml version="1.0" encoding="UTF-8"?>
<project name="osgi-project-tasks" default="" basedir="."
         xmlns:ssdtosgi="http://www.ssdt-ohio.org/ant/osgi"
         xmlns:ivy="antlib:fr.jayasoft.ivy.ant"
         xmlns:bundlor="antlib:com.springsource.bundlor.ant"
         xmlns:ssdtant="antlib:org.ssdt_ohio.tools.ant">

    <description>Ant tasks to assist building OSGi bundles.</description>
    
    <ssdtant:add-dependency target="-post-jar" depends="-osgi-jar"/>

    <target name="-osgi-jar"            depends="-init-osgi,ivy-info" unless="osgi.jar.disabled">
        <ssdtosgi:jar jar="${dist.jar}"/>
    </target>

    <target name="-init-osgi">
        <ivy:settings  file="ivysettings.xml"/>
        <ivy:cachepath  resolveId="bundlor.classpath"
                        pathid="bundlor.classpath"
                        organisation="com.springsource.bundlor"
                        module="com.springsource.bundlor.ant"
                        revision="1.0.0.RELEASE"
                        inline="true"
                        type="jar"
                        log="download-only"/>
        <taskdef resource="com/springsource/bundlor/ant/antlib.xml"
                 uri="antlib:com.springsource.bundlor.ant"
                 classpathref="bundlor.classpath"/>

        <macrodef name="jar"
                  description="OSGi-ifies jar file"
                  uri="http://www.ssdt-ohio.org/ant/osgi">
            <attribute name="jar" description="input jar"/>
            <attribute name="symbolicName" description="Bundle Symbolic Name" default="${ivy.organisation}.${ivy.module}"/>
            <attribute name="name" description="Bundle Name" default="${application.title}"/>
            <attribute name="version" description="Bundle Version" default="${ivy.revision}"/>
            <attribute name="template" description="Bundle Template" default="${basedir}/template.mf"/>
            <attribute name="profile" description="OSGI Profile" default=""/>
            <attribute name="failOnWarning" description="fail for warnings" default="true"/>
            <sequential>
                <echo message="OSGI-ifying @{jar} as @{symbolicName};@{version}" level="info"/>
                <echoproperties destfile="${build.dir}/ivydeps.txt">
                    <propertyset>
                        <propertyref prefix="ivydeps"/>
                        <mapper type="glob" from="ivydeps.*" to="*"/>
                    </propertyset>    
                </echoproperties>
                <bundlor:bundlor
                    inputPath="${basedir}/@{jar}"
                    outputPath="${basedir}/@{jar}"
                    bundleVersion="@{version}"
                    bundleSymbolicName="@{symbolicName}"
                    failOnWarnings="@{failOnWarning}"
                    manifestTemplatePath="@{template}"
                    osgiProfilePath="@{profile}">
                    <property name="bundle.name" value="@{name}"/>
                    <propertyset>
                        <propertyref prefix="ivy"/>
                        <mapper type="glob" from="ivydeps.*" to="*"/>
                    </propertyset>                    
                </bundlor:bundlor>
            </sequential>
        </macrodef>

    </target>

</project>