Skip to content

Commit

Permalink
conditonalpackage missed classes added by plugins, like Blueprint.
Browse files Browse the repository at this point in the history
This PR fixes bndtools#6408. The conditional package has been moved _after_ the plugin processing.
This felt dangerous but no test failed. We need to keep a close eye on this however.

---
 Signed-off-by: github-actions <[email protected]>

Signed-off-by: github-actions <[email protected]>
  • Loading branch information
github-actions committed Jan 2, 2025
1 parent 1fb6873 commit 13a150a
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 4 deletions.
27 changes: 26 additions & 1 deletion biz.aQute.bndlib.tests/test/test/AnalyzerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ class T3 extends T2 {}
public class AnalyzerTest {
static File cwd = new File(System.getProperty("user.dir"));


/**
* Verify that the manifest overrides a version in a package info
*/
Expand Down Expand Up @@ -317,6 +316,32 @@ public void testExportReferencesToPrivatePackages() throws Exception {
}
}

/**
* Check if bnd handles blueprint
*/

@Test
public void testBlueprintReferences() throws Exception {
try (Builder b = new Builder()) {
b.addClasspath(IO.getFile("jar/osgi.jar"));
b.addClasspath(new File("bin_test"));
b.setIncludeResource(
"""
OSGI-INF/blueprint/blueprint.xml;literal='<blueprint xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
<bean id="fw" class="org.osgi.framework.Framework"/>
<bean id="ea" class="org.osgi.service.event.EventAdmin" factory-method="newBuilder"/>
</blueprint>'""");
b.setConditionalPackage("org.osgi.*");
b.setProperty("-plugin", "aQute.lib.spring.SpringXMLType");
Jar jar = b.build();
assertTrue(b.check());
assertThat(jar.getResources()).containsKey("org/osgi/service/event/packageinfo");
assertThat(jar.getResources()).containsKey("org/osgi/framework/packageinfo");
}
}

/**
* Test basic functionality of he BCP
*/
Expand Down
7 changes: 4 additions & 3 deletions biz.aQute.bndlib/src/aQute/bnd/osgi/Analyzer.java
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,10 @@ private void analyze0() throws Exception {

doPlugins();

// Conditional packages

doConditionalPackages();

//
// calculate class versions in use
//
Expand Down Expand Up @@ -476,9 +480,6 @@ private void analyzeContent() throws Exception {
logger.debug("activator {} {}", s, activator);
}

// Conditional packages

doConditionalPackages();
}

/**
Expand Down

0 comments on commit 13a150a

Please sign in to comment.