X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=build.gradle;h=1cccc682efca2f76cbd49541334eeab3aa790d99;hb=50721af283710cf622e5c68bd826a87cf223948a;hp=227e59ad74f18682e1681e904c8420ee5f3dca0d;hpb=641e9e7f1b5678250678b0fbd13c9dbfebd67eb5;p=jalview.git diff --git a/build.gradle b/build.gradle index 227e59a..1cccc68 100644 --- a/build.gradle +++ b/build.gradle @@ -202,7 +202,10 @@ ext { case "DEVELOP": reportRsyncCommand = true + install4jDSStore = "DS_Store-DEVELOP" + install4jDMGBackgroundImage = "jalview_dmg_background-DEVELOP.png" install4jExtraScheme = "jalviewd" + install4jInstallerName = "${jalview_name} Develop Installer" break case "TEST-RELEASE": @@ -210,7 +213,7 @@ ext { JALVIEW_VERSION = "TEST" install4jSuffix = "Test" install4jDSStore = "DS_Store-TEST-RELEASE" - install4jDMGBackgroundImage = "jalview_dmg_background.png" + install4jDMGBackgroundImage = "jalview_dmg_background-TEST.png" install4jExtraScheme = "jalviewt" install4jInstallerName = "${jalview_name} Test Installer" break @@ -233,7 +236,7 @@ ext { JALVIEW_VERSION = "TEST" install4jSuffix = "Test-Local" install4jDSStore = "DS_Store-TEST-RELEASE" - install4jDMGBackgroundImage = "jalview_dmg_background.png" + install4jDMGBackgroundImage = "jalview_dmg_background-TEST.png" install4jExtraScheme = "jalviewt" install4jInstallerName = "${jalview_name} Test Installer" break @@ -280,7 +283,11 @@ ext { .replaceAll("[^\\w\\-\\.]", "_") // replace other non [alphanumeric,_,-,.] .replaceAll("_+", "") // collapse __ //.replaceAll("_*-_*", "-") // collapse _-_ - install4jUnixApplicationFolder = install4jInternalId + install4jUnixApplicationFolder = install4jApplicationName + .replaceAll(" ","_") + .replaceAll("[^\\w\\-\\.]", "_") // replace other non [alphanumeric,_,-,.] + .replaceAll("_+", "_") // collapse __ + .replaceAll("_*-_*", "-") // collapse _-_ .toLowerCase() getdownAppDir = string("${getdownWebsiteDir}/${getdownAppDistDir}") @@ -1343,6 +1350,7 @@ task copyInstall4jTemplate { def install4jFileAssociationsFile = file("${install4jDir}/${install4j_installer_file_associations}") inputs.file(install4jTemplateFile) inputs.file(install4jFileAssociationsFile) + inputs.property("CHANNEL", { CHANNEL }) outputs.file(install4jConfFile) doLast { @@ -1366,14 +1374,29 @@ task copyInstall4jTemplate { e.'@createChecksums' = "true" } + // find largest @id value + def maxId = 0 + /* NOT WORKING + install4jConfigXml.'**'.each { element -> + if ( element.'@id' != null && element.'@id'.toInteger() > maxId ) { + maxId = element.'@id'.toInteger() + } + } + */ + maxId = 10000 + def idCount = maxId + 1 + // put file association actions where placeholder action is def install4jFileAssociationsText = install4jFileAssociationsFile.text def fileAssociationActions = new XmlParser().parseText("${install4jFileAssociationsText}") - install4jConfigXml.'**'.action.any { a -> + install4jConfigXml.'**'.action.any { a -> // .any{} stops after the first one that returns true if (a.'@name' == 'EXTENSIONS_REPLACED_BY_GRADLE') { def parent = a.parent() parent.remove(a) fileAssociationActions.each { faa -> + if ( faa.'@id' != null ) { + faa.'@id' = idCount++ + } parent.append(faa) } // don't need to continue in .any loop once replacements have been made @@ -1381,6 +1404,57 @@ task copyInstall4jTemplate { } } + // use Windows Program Group with Examples folder for RELEASE, and Program Group without Examples for everything else + // NB we're deleting the /other/ one! + // Also remove the examples subdir from non-release versions + def customizedIdToDelete = "PROGRAM_GROUP_RELEASE" + def macosArchive = install4jConfigXml.'**'.macosArchive.find { ma -> ma.'@customizedId' == "MACOS_DISK_IMAGE" } + def examplesFolderPlaceholder = macosArchive.topLevelFiles.file.find { f -> f.'@file' == "EXAMPLES_FOLDER_PLACEHOLDER" } + if (CHANNEL=="RELEASE") { + customizedIdToDelete = "PROGRAM_GROUP_NON_RELEASE" + + // add all of examples folder + def tlf = examplesFolderPlaceholder.parent() + tlf.remove(examplesFolderPlaceholder) + def examplesFiles = fileTree(file(examples_dir)).findAll { f -> f.isFile() } + examplesFiles.each { f -> + def relativeFile = file(examples_dir).toPath().relativize(f.toPath()) + tlf.append( new XmlParser().parseText( + "" + ) ) + } + // let's see if we can add the snazzy Jalview Folder icon and Volume icon. Note the weird filename + tlf.append( new XmlParser().parseText( + "" + ) ) + tlf.append( new XmlParser().parseText( + "" + ) ) + + } else { + // remove the examples subdir from Full File Set + def files = install4jConfigXml.files[0] + def fileset = files.filesets.fileset.find { fs -> fs.'@customizedId' == "FULL_FILE_SET" } + def root = files.roots.root.find { r -> r.'@fileset' == fileset.'@id' } + def mountPoint = files.mountPoints.mountPoint.find { mp -> mp.'@root' == root.'@id' } + def dirEntry = files.entries.dirEntry.find { de -> de.'@mountPoint' == mountPoint.'@id' && de.'@subDirectory' == "examples" } + dirEntry.parent().remove(dirEntry) + // remove Examples folder from DMG + examplesFolderPlaceholder.parent().remove(examplesFolderPlaceholder) + } + install4jConfigXml.'**'.action.any { a -> + if (a.'@customizedId' == customizedIdToDelete) { + a.parent().remove(a) + return true + } + } + + // remove the "Uninstall Old Jalview (optional)" symlink from DMG for non-release DS_Stores + if (! (CHANNEL == "RELEASE" || CHANNEL == "TEST-RELEASE" ) ) { + def symlink = install4jConfigXml.'**'.topLevelFiles.symlink.find { sl -> sl.'@name' == "Uninstall Old Jalview (optional).app" } + symlink.parent().remove(symlink) + } + // write install4j file install4jConfFile.text = XmlUtil.serialize(install4jConfigXml) } @@ -1443,6 +1517,7 @@ task installers(type: com.install4j.gradle.Install4jTask) { 'WINDOWS_APPLICATION_ID': install4jWinApplicationId, 'MACOS_DS_STORE': install4jDSStore, 'MACOS_DMG_BG_IMAGE': install4jDMGBackgroundImage, + 'EXAMPLES_FOLDER': install4j_examples_folder, 'INSTALLER_NAME': install4jInstallerName, 'INSTALL4J_UTILS_DIR': install4j_utils_dir, 'GETDOWN_WEBSITE_DIR': getdown_website_dir, @@ -1453,15 +1528,15 @@ task installers(type: com.install4j.gradle.Install4jTask) { 'GETDOWN_INSTALL_DIR': getdown_install_dir, 'INFO_PLIST_FILE_ASSOCIATIONS_FILE': install4j_info_plist_file_associations, 'BUILD_DIR': install4jBuildDir, - 'UNIX_DESKTOP_ADDITIONS': install4j_unix_desktop_additions, + 'APPLICATION_CATEGORIES': install4j_application_categories, 'APPLICATION_FOLDER': install4jApplicationFolder, 'UNIX_APPLICATION_FOLDER': install4jUnixApplicationFolder, 'EXECUTABLE_NAME': install4jExecutableName, 'EXTRA_SCHEME': install4jExtraScheme, ] - println("INSTALL4J VARIABLES:") - variables.each{k,v->println("${k}=${v}")} + //println("INSTALL4J VARIABLES:") + //variables.each{k,v->println("${k}=${v}")} destination = "${jalviewDir}/${install4jBuildDir}" buildSelected = true