Skip to content

Commit

Permalink
Add testcase for a signed artifact and remove entries from manifest
Browse files Browse the repository at this point in the history
(cherry picked from commit e6725a4)
  • Loading branch information
laeubi authored and eclipse-tycho-bot committed Feb 9, 2025
1 parent 098ee7d commit 20d1c24
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,12 @@ private static WrappedBundle getWrappedNode(DependencyNode node,
analyzer.addClasspath(depJar);
analyzer.removeClose(depJar);
}
analyzerJar.setManifest(analyzer.calcManifest());
Manifest manifest = analyzer.calcManifest();
Map<String, Attributes> entries = manifest.getEntries();
if (entries != null) {
entries.clear();
}
analyzerJar.setManifest(manifest);
analyzerJar.write(wrapArtifactFile);
for (String err : analyzer.getErrors()) {
if (err.contains("Classes found in the wrong directory")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,28 @@ public void testSourceWithSignature() throws Exception {
assertTrue("No source bundle generated!", sourcesFound);
}

@Test
public void testArtifactWithSignature() throws Exception {
ITargetLocation target = resolveMavenTarget(
"""
<location includeDependencyDepth="none" includeDependencyScopes="compile" label="verapdf" includeSource="true" missingManifest="generate" type="Maven">
<dependencies>
<dependency>
<groupId>org.verapdf</groupId>
<artifactId>core</artifactId>
<version>1.26.5</version>
</dependency>
</dependencies>
</location>
""");
assertStatusOk(getTargetStatus(target));
TargetBundle[] allBundles = target.getBundles();
for (TargetBundle targetBundle : allBundles) {
assertValidSignature(targetBundle);
}
assertTrue("No bundle generated!", allBundles.length > 0);
}

@Test
public void testBadDependencyDirect() throws Exception {
ITargetLocation target = resolveMavenTarget("""
Expand Down

0 comments on commit 20d1c24

Please sign in to comment.