Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

builder: Avoid modifying manifests of conduit jars #5249

Merged
merged 1 commit into from May 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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