提交 248e2bd6 authored 作者: Thomas Mueller's avatar Thomas Mueller

Write SHA1 checksums

上级 b3443d1e
...@@ -260,10 +260,18 @@ public class Build extends BuildBase { ...@@ -260,10 +260,18 @@ public class Build extends BuildBase {
print("NSIS is not available: " + e); print("NSIS is not available: " + e);
} }
String buildDate = getStaticField("org.h2.engine.Constants", "BUILD_DATE"); String buildDate = getStaticField("org.h2.engine.Constants", "BUILD_DATE");
writeFile(new File("../h2web/h2-" + buildDate + ".zip"), readFile(new File("../h2web/h2.zip"))); byte[] data = readFile(new File("../h2web/h2.zip"));
String sha1Zip = getSHA1(data), sha1Exe = "";
writeFile(new File("../h2web/h2-" + buildDate + ".zip"), data);
if (installer) { if (installer) {
writeFile(new File("../h2web/h2-setup-" + buildDate + ".exe"), readFile(new File("../h2web/h2-setup.exe"))); data = readFile(new File("../h2web/h2-setup.exe"));
sha1Exe = getSHA1(data);
writeFile(new File("../h2web/h2-setup-" + buildDate + ".exe"), data);
} }
String checksums = "<h1>SHA1 Checksums</h1>" +
"<h2>h2-" + buildDate + ".zip</h2><p>" + sha1Zip + "</p>" +
"<h2>h2-setup-" + buildDate + ".exe</h2><p>" + sha1Exe + "</p>";
writeFile(new File("../h2web/html/checksums.html"), checksums.getBytes());
} }
/** /**
......
...@@ -450,7 +450,13 @@ public class BuildBase { ...@@ -450,7 +450,13 @@ public class BuildBase {
return buff.toString(); return buff.toString();
} }
private String getSHA1(byte[] data) { /**
* Generate the SHA1 checksum of a byte array.
*
* @param data the byte array
* @return the SHA1 checksum
*/
protected String getSHA1(byte[] data) {
MessageDigest md; MessageDigest md;
try { try {
md = MessageDigest.getInstance("SHA-1"); md = MessageDigest.getInstance("SHA-1");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论