mirror of
https://github.com/architectury/architectury-loom.git
synced 2026-04-02 05:27:43 -05:00
Filter jar signing info in MANIFEST.MF properly
This commit is contained in:
@@ -213,7 +213,7 @@ public class ModProcessor {
|
||||
if (ZipUtil.containsEntry(info.getRemappedOutput(), "META-INF/MANIFEST.MF")) {
|
||||
ZipUtil.transformEntry(info.getRemappedOutput(), "META-INF/MANIFEST.MF", (in, zipEntry, out) -> {
|
||||
Manifest manifest = new Manifest(in);
|
||||
manifest.getEntries().clear();
|
||||
fixManifest(manifest);
|
||||
out.putNextEntry(new ZipEntry(zipEntry.getName()));
|
||||
manifest.write(out);
|
||||
out.closeEntry();
|
||||
@@ -233,6 +233,27 @@ public class ModProcessor {
|
||||
}
|
||||
}
|
||||
|
||||
private static void fixManifest(Manifest manifest) {
|
||||
Attributes mainAttrs = manifest.getMainAttributes();
|
||||
|
||||
mainAttrs.remove(Attributes.Name.SIGNATURE_VERSION);
|
||||
|
||||
for (Iterator<Attributes> it = manifest.getEntries().values().iterator(); it.hasNext(); ) {
|
||||
Attributes attrs = it.next();
|
||||
|
||||
for (Iterator<Object> it2 = attrs.keySet().iterator(); it2.hasNext(); ) {
|
||||
Attributes.Name attrName = (Attributes.Name) it2.next();
|
||||
String name = attrName.toString();
|
||||
|
||||
if (name.endsWith("-Digest") || name.contains("-Digest-") || name.equals("Magic")) {
|
||||
it2.remove();
|
||||
}
|
||||
}
|
||||
|
||||
if (attrs.isEmpty()) it.remove();
|
||||
}
|
||||
}
|
||||
|
||||
static JsonObject readInstallerJson(File file, Project project) {
|
||||
try {
|
||||
LoomGradleExtension extension = project.getExtensions().getByType(LoomGradleExtension.class);
|
||||
|
||||
Reference in New Issue
Block a user