Menu

#89 Build OSGi bundle as part of ANT build

None
closed-accepted
nobody
None
5
2019-05-18
2010-05-05
Anonymous
No

OSGi is getting more and more popular these days. Thus shipping an OSGi-fied version of dnsjava along with the regular Jar simplifies adoption in OSGi projects. This patch adds a "bundle" target to the ANT build, that does exactly this.

Discussion

  • Nobody/Anonymous

    Adds a "bundle" target to ANT build

     
  • Markus Alexander Kuppe

    FYI I intent to consume dnsjava to implement a DNS-SD based discovery provider [0] for ECF (Eclipse Communication Framework).

    [0] https://bugs.eclipse.org/bugs/show_bug.cgi?id=310580

     
  • Brian Wellington

    I don't have any opinion on OSGi, but this looks mostly self contained. Unfortunately, attempting to run the bundle target results in:

    [bndwrap] Warnings
    [bndwrap] Superfluous export-package instructions: [org, org.xbill]

    I have no idea what this means, but I'm not going to commit a patch that adds warnings.

     
  • Markus Alexander Kuppe

    Fair enough, I will address the warning with an updated patch .

     
  • Markus Alexander Kuppe

    Here's the revised patch. Unfortunately I can't find a way to update the original patch. Hope it's usable nonetheless.

    ### Eclipse Workspace Patch 1.0
    #P dnsjava
    Index: build.xml
    ===================================================================
    --- build.xml (revision 1610)
    +++ build.xml (working copy)
    @@ -44,11 +44,30 @@
    </metainf>
    </jar>
    </target>
    +
    + <target name="bundle" description="Creates an OSGi bundle" depends="jar">
    + <get src="http://www.aqute.biz/repo/biz/aQute/bnd/0.0.384/bnd-0.0.384.jar"
    + dest="${build_dir}/bnd.jar"/>
    + <taskdef resource="aQute/bnd/ant/taskdef.properties"
    + classpath="${build_dir}/bnd.jar"/>
    + <echo file="${dist_dir}/dnsjava-${version}.bnd" append="false">
    + Bundle-Version: ${version}
    + Bundle-Name: dnsjava is an implementation of DNS in Java
    + Bundle-SymbolicName: org.xbill.dns
    + Export-Package: org.xbill.DNS;uses:="org.xbill.DNS.utils",org.xbill.DNS.spi;uses:="org.xbill.DNS,sun.net.spi.nameservice",org.xbill.DNS.utils,org.xbill.DNS.windows
    + Bundle-Vendor: Brian Wellington
    + Bundle-RequiredExecutionEnvironment: J2SE-1.4
    + </echo>
    + <bndwrap
    + definitions="${dist_dir}"
    + jars="${dist_dir}/${jarname}"
    + output="${dist_dir}/org.xbill.dns_${version}.jar"/>
    + </target>

    <target name="clean" description="Remove old class files">
    <delete>
    <fileset dir="${build_dir}" includes="**/*.class"/>
    - <fileset dir="${build_dir}" includes="*.jar *.zip *.tar.gz jcoverage.ser"/>
    + <fileset dir="${build_dir}" includes="*.bnd *.jar *.zip *.tar.gz jcoverage.ser"/>
    </delete>
    </target>

     
  • Brian Wellington

    Committed, with a minor change replacing my name with dnsjava.org in Bundle-Vendor.

     
  • Brian Wellington

    • status: open --> closed-accepted
     
  • Markus Alexander Kuppe

    Thanks for applying the fix.

    Would it be possible for you to create a (2.0.8 and/or HEAD) bundle and distributed it via sf.net? Would make my build integration into ECF a lot easier. Thx

     
  • Nobody/Anonymous

    There will be a new release sometime soon (in the next week or two), but the sf release process is painful enough that doing releases on demand isn't realistic.

     
  • Ingo

    Ingo - 2019-05-18

    Ticket moved from /p/dnsjava/patches/17/