X-Git-Url: http://source.jalview.org/gitweb/?p=jalview.git;a=blobdiff_plain;f=build.gradle;h=b8dd62060c4956c4d0ec8886506f0c5a3a5ed331;hp=100bc59d8705aff75233dd119119df64a84d16bd;hb=01e95ae1be5ae83392de930dea48c531e2afa339;hpb=8d46b6025f358a2642fb5996be91a75885f8fc88 diff --git a/build.gradle b/build.gradle index 100bc59..b8dd620 100644 --- a/build.gradle +++ b/build.gradle @@ -47,8 +47,6 @@ plugins { id 'com.install4j.gradle' version '9.0.6' id 'com.dorongold.task-tree' version '1.5' // only needed to display task dependency tree with gradle task1 [task2 ...] taskTree id 'com.palantir.git-version' version '0.13.0' apply false -// id 'org.gradle.crypto.checksum' version '1.4.0' - } repositories { @@ -208,7 +206,7 @@ ext { // the following values might be overridden by the CHANNEL switch getdownDir = string("${getdownChannelName}/${JAVA_VERSION}") getdownAppBase = string("${getdown_channel_base}/${getdownDir}") - getdownArchiveAppBase = null + getdownArchiveAppBase = getdown_archive_base getdownLauncher = string("${jalviewDir}/${getdown_lib_dir}/${getdown_launcher}") getdownAppDistDir = getdown_app_dir_alt getdownImagesDir = string("${jalviewDir}/${getdown_images_dir}") @@ -248,7 +246,6 @@ ext { reportRsyncCommand = true install4jSuffix = "" install4jInstallerName = "${jalview_name} Installer" - getdownArchiveAppBase = getdown_archive_base break case "ARCHIVE": @@ -346,6 +343,7 @@ ext { } JALVIEW_VERSION_UNDERSCORES = JALVIEW_VERSION.replaceAll("\\.", "_") + hugoDataJsonFile = file("${jalviewDir}/${hugo_build_dir}/data/installers/installers-${JALVIEW_VERSION_UNDERSCORES}.json") // override getdownAppBase if requested if (findProperty("getdown_appbase_override") != null) { // revert to LOCAL if empty string @@ -1816,10 +1814,6 @@ task getdownArchiveBuild() { def archiveImagesDir = "${jalviewDir}/${channel_properties_dir}/old/images" doFirst { - if (getdownArchiveAppBase == null) { - throw new StopExecutionException("Cannot create getdownArchive for CHANNEL=${CHANNEL}") - } - // cleanup old "old" dir delete getdownArchiveDir @@ -2142,72 +2136,62 @@ def getDataHash(File myFile) { HashCode hash = Files.asByteSource(myFile).hash(Hashing.sha256()) return myFile.exists() ? [ - "filename" : myFile.getName(), + "file" : myFile.getName(), "filesize" : myFile.length(), "sha256" : hash.toString() ] : null } -def writeDataJsonFile(File installersOutputTxt, File installersSha256, File hugoDataJsonFile) { - if (!installersOutputTxt.exists()) { - throw new GradleException("Required input file '${installersOutputTxt.getPath()}' doesn't exist.") - return null; - } - if (install4jCheckSums && (!installersSha256)) { - throw new GradleException("Required input file '${installersSha256.getPath()}' doesn't exist.") - return null; - } +def writeDataJsonFile(File installersOutputTxt, File installersSha256, File dataJsonFile) { def hash = [ "channel" : getdownChannelName, "date" : getDate("yyyy-MM-dd HH:mm:ss"), "git-commit" : "${gitHash} [${gitBranch}]", "version" : JALVIEW_VERSION ] - def idHash = [:] - installersOutputTxt.readLines().each { def line -> - if (line.startsWith("#")) { - return; - } - line.replaceAll("\n","") - def vals = line.split("\t") - def filename = vals[3] - def filesize = file(filename).length() - filename = filename.replaceAll(/^.*\//, "") - hash[vals[0]] = [ "id" : vals[0], "os" : vals[1], "name" : vals[2], "file" : filename, "filesize" : filesize ] - idHash."${filename}" = vals[0] - } - if (install4jCheckSums) { - installersSha256.readLines().each { def line -> + // install4j installer files + if (installersOutputTxt.exists()) { + def idHash = [:] + installersOutputTxt.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] + def vals = line.split("\t") + def filename = vals[3] + def filesize = file(filename).length() + filename = filename.replaceAll(/^.*\//, "") + hash[vals[0]] = [ "id" : vals[0], "os" : vals[1], "name" : vals[2], "file" : filename, "filesize" : filesize ] + 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] + } } } - // executable JAR - def jarHash = getDataHash(file(shadowJar.archiveFile)) - if (jarHash != null) { - hash."JAR" = jarHash; - } - - // version JVL - def jvlHash =getDataHash(file(getdownVersionLaunchJvl)) - if (jvlHash != null) { - hash."JVL" = jvlHash; - } - - // source TGZ - def tarHash = getDataHash(file(sourceDist.archiveFile)) - if (tarHash != null) { - hash."SOURCE" = tarHash; + [ + "JAR": shadowJar.archiveFile, // executable JAR + "JVL": getdownVersionLaunchJvl, // version JVL + "SOURCE": sourceDist.archiveFile // source TGZ + ].each { key, value -> + def file = file(value) + if (file.exists()) { + def fileHash = getDataHash(file) + if (fileHash != null) { + hash."${key}" = fileHash; + } + } } - - return hugoDataJsonFile.write(new JsonBuilder(hash).toPrettyString()) + return dataJsonFile.write(new JsonBuilder(hash).toPrettyString()) } task staticMakeInstallersJsonFile { @@ -2362,19 +2346,28 @@ task sourceDist(type: Tar) { } task makeDataJsonFile { - dependsOn installerFiles - dependsOn sourceDist - dependsOn getdownArchive - dependsOn shadowJar + group "website" + description "Create the installers-VERSION.json data file for installer files created" def installersOutputTxt = file("${jalviewDir}/${install4jBuildDir}/output.txt") def installersSha256 = file("${jalviewDir}/${install4jBuildDir}/sha256sums") - def hugoDataJsonFile = file("${jalviewDir}/${hugo_build_dir}/data/installers-${JALVIEW_VERSION_UNDERSCORES}.json") - inputs.file(installersOutputTxt) - if (install4jCheckSums) { + if (installersOutputTxt.exists()) { + inputs.file(installersOutputTxt) + } + if (install4jCheckSums && installersSha256.exists()) { inputs.file(installersSha256) } + [ + shadowJar.archiveFile, // executable JAR + getdownVersionLaunchJvl, // version JVL + sourceDist.archiveFile // source TGZ + ].each { fileName -> + if (file(fileName).exists()) { + inputs.file(fileName) + } + } + outputs.file(hugoDataJsonFile) doFirst { @@ -2382,6 +2375,12 @@ task makeDataJsonFile { } } +makeDataJsonFile.mustRunAfter installers +makeDataJsonFile.mustRunAfter shadowJar +makeDataJsonFile.mustRunAfter sourceDist +makeDataJsonFile.mustRunAfter getdownArchive + + task helppages { dependsOn copyHelp dependsOn pubhtmlhelp