Skip to content

Commit

Permalink
Merge pull request #5249 from maquinas07/5248-conduit-signed-bundles
Browse files Browse the repository at this point in the history
builder: Avoid modifying manifests of conduit jars
  • Loading branch information
pkriens committed May 12, 2022
2 parents bb6b233 + 25123d4 commit 951e81a
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
30 changes: 30 additions & 0 deletions biz.aQute.bndlib.tests/test/test/BuilderTest.java
Expand Up @@ -2401,6 +2401,36 @@ public void testConduit() throws Exception {
}
}

@Test
public void testSignedJarConduit() throws Exception {
Properties p = new Properties();
p.setProperty("-conduit", "jar/osgi-3.0.0.jar");
Builder b = new Builder();
try {
b.setProperties(p);
Jar jars[] = b.builds();
assertTrue(b.check());
assertNotNull(jars);
assertEquals(1, jars.length);

Jar jar = jars[0];
Resource r = jar.getResource("META-INF/OSGI.RSA");
assertNotNull(r);

File f = new File("tmp.jar");
f.deleteOnExit();
jar.write(f);

try (Jar wj = new Jar(f)) {
Resource wr = wj.getResource("META-INF/OSGI.RSA");
assertNotNull(wr);
assertEquals(wj.getSHA256(), jar.getSHA256());
}
} finally {
b.close();
}
}

/**
* Export a package that was loaded with resources
*
Expand Down
1 change: 1 addition & 0 deletions biz.aQute.bndlib/src/aQute/bnd/osgi/Builder.java
Expand Up @@ -1423,6 +1423,7 @@ public Jar[] builds() throws Exception {
int n = 0;
for (String file : map.keySet()) {
Jar c = new Jar(getFile(file));
c.setDoNotTouchManifest();

buildInstrs.compression()
.ifPresent(c::setCompression);
Expand Down

0 comments on commit 951e81a

Please sign in to comment.