Way to add comments inline to bnd files

1,062 views
Skip to first unread message

Dave

unread,
Jan 9, 2015, 2:42:50 PM1/9/15
to bndtool...@googlegroups.com
Is there any way to add comments or document individual lines of a bnd file, something like:

-runbundles:  \

    # some comment

    org.apache.felix.gogo.runtime,\

    # another inline comment

    org.apache.felix.gogo.shell,\

    org.apache.felix.gogo.command,\

    org.apache.felix.scr,\

    org.apache.felix.configadmin,\

    org.apache.felix.eventadmin,\

    # i want to talk about the metatype bundle

    org.apache.felix.metatype,\

    org.apache.felix.log


currently it seems like you can not add comments inside of a "statement" like this.

BJ Hargrave

unread,
Jan 9, 2015, 2:48:57 PM1/9/15
to bndtool...@googlegroups.com
Did you try this:

-runbundles:  \

    \ # some comment

    org.apache.felix.gogo.runtime,\

    \ # another inline comment

    org.apache.felix.gogo.shell,\

    org.apache.felix.gogo.command,\

    org.apache.felix.scr,\

    org.apache.felix.configadmin,\

    org.apache.felix.eventadmin,\

    \ # i want to talk about the metatype bundle

    org.apache.felix.metatype,\

    org.apache.felix.log

This puts a line continuation character before the comment. bnd files are java properties files. So whatever you can do in a java properties file, you can do in a bnd file.


--
You received this message because you are subscribed to the Google Groups "bndtools-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bndtools-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

-- 

BJ



Neil Bartlett

unread,
Jan 9, 2015, 2:51:34 PM1/9/15
to bndtool...@googlegroups.com
I also sometimes break it up with variable definitions like this:

-runbundles: \
${shell-bundles},
${my-bundles},
${config-bundles}

# Felix Gogo Shell
shell-bundles: \
org.apache.felix.runtime,\
org.apache.felix.command,\

Dave

unread,
Jan 9, 2015, 3:13:27 PM1/9/15
to bndtool...@googlegroups.com
Didn't think to try this, but it doesn't seem to work. I tried: 

Import-Package: \

    \ # org.datanucleus packages needed by JDO enhanced data types

    org.datanucleus.api.jdo,\

    org.datanucleus.store.rdbms.sql,\

    org.datanucleus.store.rdbms.sql.method,\

    org.datanucleus.store.rdbms.query,\

    \ # needed by unmarshaller for JAXB classes

    com.sun.xml.internal.bind,\

    *

If there is a space between the backslash and pound sign, the formatting looks weird in the bnd editor window. However, with or without the space, the resulting bundle ends up with the comments in the import statement.

[IMPEXP]
Import-Package
  # org.datanucleus packages needed by JDO enhanced data types 

BJ Hargrave

unread,
Jan 9, 2015, 3:14:32 PM1/9/15
to bndtool...@googlegroups.com
So you need to see what is possible in a java properties file.

-- 
You received this message because you are subscribed to the Google Groups "bndtools-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bndtools-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

-- 

BJ



Dave

unread,
Jan 9, 2015, 3:15:09 PM1/9/15
to bndtool...@googlegroups.com
I ended up doing this because I have multiple integration projects all uses the same bundles. However, I did notice that when I add a bnd file to cnf/ext using Eclipse, that it isn't picked up right away (variables I added aren't available). Seems like I need to do something special for the file to be picked up.

Peter Kriens

unread,
Jan 12, 2015, 4:20:52 AM1/12/15
to bndtool...@googlegroups.com
Later bnd’s have a concept of merged properties. This is not for all properties but many have been converted. You can then do:

-runbundles.some.comment: \
    org.apache.felix.gogo.runtime

-runbundles.inline.comment: \
    org.apache.felix.gogo.shell,\
    org.apache.felix.gogo.command,\
    org.apache.felix.scr,\
    org.apache.felix.configadmin,\
    org.apache.felix.eventadmin

# i want to talk about metaype bundle
-rubundles.2: \
    org.apache.felix.metatype,\
    org.apache.felix.log

All these properties are merged in key sorted order.

The beauty of this model is that it also makes it simple to add things to these properties from different places: build.bnd, ext/*.bnd, bnd.bnd, subbundle.bnd, *.bndrun, etc.

Kind regards,

Peter Kriens

Peter Kirschner

unread,
Jan 12, 2015, 4:52:01 AM1/12/15
to bndtool...@googlegroups.com
This beauty can also become a beast sometimes ;-)
Reply all
Reply to author
Forward
0 new messages