Yup of course, subbundles, thanks. I had already looked through the Project class, but hadn't found anything the first time, so I looked again after you pointed me back in that direction...
For any other people who are apparently bad at finding things: After another search it looks like what I needed was getSubBuilders(), which inherits the same getProperty and getUnprocessedProperty methods as Project, from aQute.bnd.osgi.Processor.
For further reference, here is a simple publication setup using this, for e.g. publishing to maven local or using the artifactory plugin (previously I was using bnd.project.getBuildFiles(true) and pulling the bsn and version from the jars themselves, but this way is more straightforward and flexible):
publishing {
publications {
project.bnd.project.getSubBuilders().each {
builder -> "maven_${builder.getBsn()}"(MavenPublication) {
artifactId = builder.getBsn()
version = builder.getProperty('Bundle-Version')
artifact new File("${buildDir}/${artifactId}.jar")
}
}
}
}
Thanks for the help, BJ