JAL-3449 adding an installer template version. Really an md5 and a commit hash
authorBen Soares <bsoares@dundee.ac.uk>
Fri, 22 Nov 2019 15:29:39 +0000 (15:29 +0000)
committerBen Soares <bsoares@dundee.ac.uk>
Fri, 22 Nov 2019 15:29:39 +0000 (15:29 +0000)
build.gradle
utils/install4j/DMG_creation_README.md [moved from utils/install4j/mk_DS_STORE_cmds with 100% similarity]

index 9059447..3ebb7ec 100644 (file)
@@ -1215,6 +1215,26 @@ install4j {
 
 
 task copyInstall4jTemplate(type: Copy) {
+  dependsOn setGitVals
+
+  def install4jTemplateMd5 = ""
+  def digest = MessageDigest.getInstance("MD5")
+  digest.update(
+    (file("${install4jDir}/${install4j_template}").text + 
+    file("${install4jDir}/${install4j_info_plist_file_associations}").text +
+    file("${install4jDir}/${install4j_installer_file_associations}").text).bytes)
+  def filesMd5 = new BigInteger(1, digest.digest()).toString(16)
+  if (filesMd5.length() >= 8) {
+    filesMd5 = filesMd5.substring(0,8)
+  }
+  install4jTemplateMd5 += filesMd5
+  install4jTemplateMd5 += "_${gitHash}"
+
+  inputs.file("${install4jDir}/${install4j_template}")
+  inputs.file("${install4jDir}/${install4j_info_plist_file_associations}")
+  inputs.file("${install4jDir}/${install4j_installer_file_associations}")
+  outputs.files(install4jConfFile)
+
   from (install4jDir) {
     include install4j_template
     rename (install4j_template, install4jConfFileName)
@@ -1222,10 +1242,11 @@ task copyInstall4jTemplate(type: Copy) {
       beginToken: '',
       endToken: '',
       tokens: [
-        '1111111111': JAVA_MIN_VERSION,
+        '0000000000': JAVA_MIN_VERSION,
         '9999999999': JAVA_MAX_VERSION
       ]
     )
+
     filter(ReplaceTokens,
       beginToken: '$$',
       endToken: '$$',
@@ -1238,6 +1259,7 @@ task copyInstall4jTemplate(type: Copy) {
         'WINDOWS_JAVA_VM_DIR': windowsJavaVMDir,
         'WINDOWS_JAVA_VM_TGZ': windowsJavaVMTgz,
         'INSTALL4JINFOPLISTFILEASSOCIATIONS': install4j_info_plist_file_associations,
+        'INSTALLER_TEMPLATE_MD5': install4jTemplateMd5,
         'COPYRIGHT_MESSAGE': install4j_copyright_message,
         'MACOS_BUNDLE_ID': install4j_macOS_bundle_id,
         'GETDOWN_RESOURCE_DIR': getdown_resource_dir,
@@ -1264,10 +1286,6 @@ task copyInstall4jTemplate(type: Copy) {
     }
   }
   into install4jDir
-  inputs.file("${install4jDir}/${install4j_template}")
-  inputs.file("${install4jDir}/${install4j_installer_file_associations}")
-  inputs.file("${install4jDir}/${install4j_info_plist_file_associations}")
-  outputs.files(install4jConfFile)
 
   doLast {
     // include file associations in installer