Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions scripts/merge-maven-publications.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@ for (const variant of moduleMetadata.variants) {
}
writeFileSync(modulePath, `${JSON.stringify(moduleMetadata, null, 2)}\n`);

// The staged repository carries Maven checksum sidecars next to every file;
// the two files mutated above must have theirs recomputed or a
// checksum-verifying consumer (and a Central upload) rejects the merged
// publication.
for (const mutated of [jvmJar, modulePath]) {
refreshSidecars(mutated);
}

const entries = execFileSync("unzip", ["-Z1", jvmJar], { encoding: "utf8" });
for (const required of [
"com/nouprax/markdown/core/native/linux-x64/libmarkdown_core_kotlin.so",
Expand Down Expand Up @@ -90,3 +98,11 @@ function walk(directory, prefix = "") {
function digest(algorithm, bytes) {
return createHash(algorithm).update(bytes).digest("hex");
}

function refreshSidecars(file) {
const contents = readFileSync(file);
for (const algorithm of ["md5", "sha1", "sha256", "sha512"]) {
const sidecar = `${file}.${algorithm}`;
if (existsSync(sidecar)) writeFileSync(sidecar, digest(algorithm, contents));
}
}
Loading