提交 56d5044f authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Sort files in generated jars to make META-INF/MANIFEST.MF the first record

上级 6bb90ad6
......@@ -845,6 +845,32 @@ public class BuildBase {
return comp;
}
});
} else if (jar) {
Collections.sort(files, new Comparator<File>() {
private int priority(String path) {
if (path.startsWith("META-INF/")) {
if (path.equals("META-INF/MANIFEST.MF")) {
return 0;
}
if (path.startsWith("services/", 9)) {
return 1;
}
return 2;
}
return 3;
}
@Override
public int compare(File f1, File f2) {
String p1 = f1.getPath();
String p2 = f2.getPath();
int comp = Integer.compare(priority(p1), priority(p2));
if (comp != 0) {
return comp;
}
return p1.compareTo(p2);
}
});
}
mkdirs(new File(destFile).getAbsoluteFile().getParentFile());
// normalize the path (replace / with \ if required)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论