Skip to content

Commit 951e81a

Browse files
authored
Merge pull request #5249 from maquinas07/5248-conduit-signed-bundles
builder: Avoid modifying manifests of conduit jars
2 parents bb6b233 + 25123d4 commit 951e81a

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

Diff for: biz.aQute.bndlib.tests/test/test/BuilderTest.java

+30
Original file line numberDiff line numberDiff line change
@@ -2401,6 +2401,36 @@ public void testConduit() throws Exception {
24012401
}
24022402
}
24032403

2404+
@Test
2405+
public void testSignedJarConduit() throws Exception {
2406+
Properties p = new Properties();
2407+
p.setProperty("-conduit", "jar/osgi-3.0.0.jar");
2408+
Builder b = new Builder();
2409+
try {
2410+
b.setProperties(p);
2411+
Jar jars[] = b.builds();
2412+
assertTrue(b.check());
2413+
assertNotNull(jars);
2414+
assertEquals(1, jars.length);
2415+
2416+
Jar jar = jars[0];
2417+
Resource r = jar.getResource("META-INF/OSGI.RSA");
2418+
assertNotNull(r);
2419+
2420+
File f = new File("tmp.jar");
2421+
f.deleteOnExit();
2422+
jar.write(f);
2423+
2424+
try (Jar wj = new Jar(f)) {
2425+
Resource wr = wj.getResource("META-INF/OSGI.RSA");
2426+
assertNotNull(wr);
2427+
assertEquals(wj.getSHA256(), jar.getSHA256());
2428+
}
2429+
} finally {
2430+
b.close();
2431+
}
2432+
}
2433+
24042434
/**
24052435
* Export a package that was loaded with resources
24062436
*

Diff for: biz.aQute.bndlib/src/aQute/bnd/osgi/Builder.java

+1
Original file line numberDiff line numberDiff line change
@@ -1423,6 +1423,7 @@ public Jar[] builds() throws Exception {
14231423
int n = 0;
14241424
for (String file : map.keySet()) {
14251425
Jar c = new Jar(getFile(file));
1426+
c.setDoNotTouchManifest();
14261427

14271428
buildInstrs.compression()
14281429
.ifPresent(c::setCompression);

0 commit comments

Comments
 (0)