From b7329b23e42ae3edaba9911d42ee1d77eca8c90b Mon Sep 17 00:00:00 2001 From: Ben Soares Date: Mon, 30 Sep 2024 20:24:23 +0100 Subject: [PATCH] JAL-4428 Change writeDataJsonFile to NOT use sha256sums output from install4j as this doesn't change after signing the DMGs. Calculate a sha256 sum directly from the files. --- build.gradle | 38 ++++++++++---------------------------- 1 file changed, 10 insertions(+), 28 deletions(-) diff --git a/build.gradle b/build.gradle index b9b3ad9..ccccb9e 100644 --- a/build.gradle +++ b/build.gradle @@ -2846,11 +2846,9 @@ clean { task cleanInstallersDataFiles { def installersOutputTxt = file("${jalviewDir}/${install4jBuildDir}/output.txt") - def installersSha256 = file("${jalviewDir}/${install4jBuildDir}/sha256sums") def hugoDataJsonFile = file("${jalviewDir}/${install4jBuildDir}/installers-${JALVIEW_VERSION_UNDERSCORES}.json") doFirst { delete installersOutputTxt - delete installersSha256 delete hugoDataJsonFile } } @@ -3162,7 +3160,7 @@ def getDataHash(File myFile) { : null } -def writeDataJsonFile(File installersOutputTxt, File installersSha256, File dataJsonFile) { +def writeDataJsonFile(File installersOutputTxt, File dataJsonFile) { def hash = [ "channel" : getdownChannelName, "date" : getDate("yyyy-MM-dd HH:mm:ss"), @@ -3179,24 +3177,15 @@ def writeDataJsonFile(File installersOutputTxt, File installersSha256, File data line.replaceAll("\n","") def vals = line.split("\t") def filename = vals[3] - def filesize = file(filename).length() + def file = file(vals[3]) + def filesize = file.length() + def sha256 = getDataHash(file) filename = filename.replaceAll(/^.*\//, "") - hash[vals[0]] = [ "id" : vals[0], "os" : vals[1], "name" : vals[2], "file" : filename, "filesize" : filesize ] + hash[vals[0]] = [ "id" : vals[0], "os" : vals[1], "name" : vals[2], "file" : filename, "filesize" : filesize, "sha256": sha256 ] idHash."${filename}" = vals[0] } - if (install4jCheckSums && installersSha256.exists()) { - installersSha256.readLines().each { def line -> - if (line.startsWith("#")) { - return; - } - line.replaceAll("\n","") - def vals = line.split(/\s+\*?/) - def filename = vals[1] - def innerHash = (hash.(idHash."${filename}"))."sha256" = vals[0] - } - } } - + [ "JAR": shadowJar.archiveFile, // executable JAR "JVL": getdownVersionLaunchJvl, // version JVL @@ -3216,12 +3205,11 @@ def writeDataJsonFile(File installersOutputTxt, File installersSha256, File data task staticMakeInstallersJsonFile { doFirst { def output = findProperty("i4j_output") - def sha256 = findProperty("i4j_sha256") def json = findProperty("i4j_json") if (output == null || sha256 == null || json == null) { - throw new GradleException("Must provide paths to all of output.txt, sha256sums, and output.json with '-Pi4j_output=... -Pi4j_sha256=... -Pi4j_json=...") + throw new GradleException("Must provide paths to all of output.txt and output.json with '-Pi4j_output=... -Pi4j_json=...") } - writeDataJsonFile(file(output), file(sha256), file(json)) + writeDataJsonFile(file(output), file(json)) } } @@ -3377,14 +3365,8 @@ task dataInstallersJson { mustRunAfter getdownArchive def installersOutputTxt = file("${jalviewDir}/${install4jBuildDir}/output.txt") - def installersSha256 = file("${jalviewDir}/${install4jBuildDir}/sha256sums") - if (installersOutputTxt.exists()) { - inputs.file(installersOutputTxt) - } - if (install4jCheckSums && installersSha256.exists()) { - inputs.file(installersSha256) - } + inputs.dir("${jalviewDir}/${install4j_build_dir}/${JAVA_VERSION}") [ shadowJar.archiveFile, // executable JAR getdownVersionLaunchJvl, // version JVL @@ -3398,7 +3380,7 @@ task dataInstallersJson { outputs.file(hugoDataJsonFile) doFirst { - writeDataJsonFile(installersOutputTxt, installersSha256, hugoDataJsonFile) + writeDataJsonFile(installersOutputTxt, hugoDataJsonFile) } } -- 1.7.10.2