From: Ben Soares Date: Wed, 28 Aug 2019 16:18:36 +0000 (+0100) Subject: JAL-3420 JAL-3394 Using install4j8 template with file associations. Attempts unix... X-Git-Tag: Develop-2_11_2_0-d20201215~80^2~28^2~30^2~3 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=6f88432059289564bc5349f16123b25021796af0;p=jalview.git JAL-3420 JAL-3394 Using install4j8 template with file associations. Attempts unix file associations but not working (only tested in Ubuntu) yet. --- diff --git a/build.gradle b/build.gradle index f02d8ad..6024b84 100644 --- a/build.gradle +++ b/build.gradle @@ -1057,15 +1057,16 @@ clean { install4j { def install4jHomeDir = "/opt/install4j" def hostname = "hostname".execute().text.trim() + def install4jName = (install4jVersion >= 8) ? "install4j"+install4jVersion:"install4j" if (hostname.equals("jv-bamboo")) { - install4jHomeDir = System.getProperty("user.home")+"/buildtools/install4j" + install4jHomeDir = System.getProperty("user.home")+"/buildtools/"+install4jName } else if (OperatingSystem.current().isMacOsX()) { - install4jHomeDir = '/Applications/install4j.app/Contents/Resources/app' + install4jHomeDir = '/Applications/'+install4jName+'.app/Contents/Resources/app' if (! file(install4jHomeDir).exists()) { install4jHomeDir = System.getProperty("user.home")+install4jHomeDir } } else if (OperatingSystem.current().isLinux()) { - install4jHomeDir = System.getProperty("user.home")+"/buildtools/install4j" + install4jHomeDir = System.getProperty("user.home")+"/buildtools/"+install4jName } installDir = file(install4jHomeDir) mediaTypes = Arrays.asList(install4jMediaTypes.split(",")) @@ -1088,9 +1089,10 @@ task copyInstall4jTemplate(type: Copy) { macosJavaVMTgz = System.env.HOME+"/buildtools/jre/openjdk-java_vm/install4j/tgz/macos-jre"+JAVA_VERSION+".tar.gz" windowsJavaVMDir = System.env.HOME+"/buildtools/jre/openjdk-java_vm/getdown/windows-jre"+JAVA_VERSION+"/jre" windowsJavaVMTgz = System.env.HOME+"/buildtools/jre/openjdk-java_vm/install4j/tgz/windows-jre"+JAVA_VERSION+".tar.gz" + def i4jTemplate = (install4jVersion >= 8)?install4j8Template:install4jTemplate from (install4jDir) { - include install4jTemplate - rename (install4jTemplate, install4jConfFile) + include i4jTemplate + rename (i4jTemplate, install4jConfFile) filter(ReplaceTokens, beginToken: '', endToken: '', tokens: ['9999999999': JAVA_VERSION]) filter(ReplaceTokens, beginToken: '$$', endToken: '$$', tokens: [ @@ -1120,7 +1122,8 @@ task copyInstall4jTemplate(type: Copy) { doLast { // include file associations in installer - def installerFileAssociationsXml = file("$install4jDir/$install4jInstallerFileAssociations").text + def i4jIFA = (install4jVersion >= 8)?install4j8InstallerFileAssociations:install4jInstallerFileAssociations + def installerFileAssociationsXml = file("$install4jDir/$i4jIFA").text ant.replaceregexp( byline: false, flags: "s", diff --git a/gradle.properties b/gradle.properties index 2dbdad3..3a0ef3f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -106,12 +106,15 @@ j11libDir = j11lib j11modDir = j11mod j11modules = com.sun.istack.runtime,com.sun.xml.bind,com.sun.xml.fastinfoset,com.sun.xml.streambuffer,com.sun.xml.txw2,com.sun.xml.ws.policy,java.activation,java.annotation,java.base,java.compiler,java.datatransfer,java.desktop,java.logging,java.management,java.management.rmi,java.naming,java.prefs,java.rmi,java.scripting,java.security.sasl,java.sql,java.xml,java.xml.bind,java.xml.soap,java.xml.ws,javax.jws,jdk.httpserver,jdk.jsobject,jdk.unsupported,jdk.xml.dom,org.jvnet.mimepull,org.jvnet.staxex,javax.servlet.api,java.ws.rs +install4jVersion = 8 install4jCopyrightMessage = ... install4jMacOSBundleId = org.jalview.jalview-desktop install4jResourceDir = utils/install4j install4jTemplate = install4j_template.install4j +install4j8Template = install4j8_template.install4j install4jInfoPlistFileAssociations = file_associations_auto-Info_plist.xml install4jInstallerFileAssociations = file_associations_auto-install4j.xml +install4j8InstallerFileAssociations = file_associations_auto-install4j8.xml install4jDMGUninstallerAppFiles = uninstall_old_jalview_files.xml install4jBuildDir = build/install4j install4jMediaTypes = windows,macosArchive,linuxRPM,linuxDeb,unixArchive,unixInstaller @@ -139,4 +142,4 @@ RUNRSYNC=false bamboo_channelbase = https://builds.jalview.org/browse bamboo_planKey = bamboo_getdown_channel_suffix = /latest/artifact/shared/getdown-channel - \ No newline at end of file + diff --git a/utils/install4j/auto_file_associations-i4j8.pl b/utils/install4j/auto_file_associations-i4j8.pl new file mode 100755 index 0000000..c8299f6 --- /dev/null +++ b/utils/install4j/auto_file_associations-i4j8.pl @@ -0,0 +1,137 @@ +#!/usr/bin/env perl + +use strict; + +my $i4jversion = 8; +if ($ARGV[0] eq "-v") { + shift @ARGV; + $i4jversion = shift @ARGV; + die("-v i4jversion must be an integer [probably 7 or 8]") unless $i4jversion =~ m/^\d+$/; +} + +my $fileformats = $ARGV[0]; +$fileformats = "../../src/jalview/io/FileFormat.java" unless $fileformats; + +# default mimetype will be text/x-$shortname +# TODO: find an actual extension for mat, see JAL-Xxxxx for outstanding issues too +# TODO: look up standard mime type used for BLASTfmt matrices, etc +my $mimetypes = { + rnaml => "application/rnaml+xml", + biojson => "application/x-jalview-biojson+json", + jnet => "application/x-jalview-jnet+text", + features => "application/x-jalview-features+text", + scorematrix => "application/x-jalview-scorematrix+text", + pdb => "chemical/x-pdb", + mmcif => "chemical/x-cif", + mmcif2 => "chemical/x-mcif", + jalview => "application/x-jalview+xml+zip", + jvl => "application/x-jalview-jvl+text", + annotations => "application/x-jalview-annotations+text", +}; + +my @dontaddshortname = qw(features json); +my @dontaddextension = qw(html xml json jar mfa fastq); +my $add_associations = { + biojson => {shortname=>"biojson",name=>"BioJSON",extensions=>["biojson"]}, + gff2 => {shortname=>"gff2",name=>"Generic Features Format v2",extensions=>["gff2"]}, + gff3 => {shortname=>"gff3",name=>"Generic Features Format v3",extensions=>["gff3"]}, + features => {shortname=>"features",name=>"Jalview Features",extensions=>["features","jvfeatures"]}, + annotations => {shortname=>"annotations",name=>"Jalview Annotations",extensions=>["annotations","jvannotations"]}, + mmcif2 => {shortname=>"mmcif2",name=>"mmCIF",extensions=>["mcif","mmcif"]}, + jvl => {shortname=>"jvl",name=>"Jalview Version Locator",extensions=>["jvl"],iconfile=>"Jalview-Version-Locator"}, + jnet => {shortname=>"jnet",name=>"JnetFile",extensions=>["concise","jnet"]}, + scorematrix => {shortname=>"scorematrix",name=>"Substitution Matrix",extensions=>["mat"]}, +}; +my $add_extensions = { + blc => ["blc"], +}; +my @put_first = qw(jalview jvl); + +my $v = ($i4jversion >= 8)?$i4jversion:""; +my $i4jtemplatefile = "file_associations_template-install4j${v}.xml"; +my $i4jtemplate; +open(IT,"<$i4jtemplatefile") or dir("Could not open '$i4jtemplatefile' for reading"); +while(){ + $i4jtemplate .= $_; +} +close(IT); +my $i4jauto; + +my $i4jautofile = $i4jtemplatefile; +$i4jautofile =~ s/template/auto$1/; + +open(IA,">$i4jautofile") or die ("Could not open '$i4jautofile' for writing"); + +open(IN, "<$fileformats") or die ("Could not open '$fileformats' for reading"); +my $id = 10000; +my $file_associations = {}; +while(my $line = ) { + $line =~ s/\s+/ /g; + $line =~ s/(^ | $)//g; + if ($line =~ m/^(\w+) ?\( ?"([^"]*)" ?, ?"([^"]*)" ?, ?(true|false) ?, ?(true|false) ?\)$/i) { + my $shortname = lc($1); + next if (grep($_ eq $shortname, @dontaddshortname)); + my $name = $2; + my $extensions = $3; + $extensions =~ s/\s+//g; + my @possextensions = split(m/,/,$extensions); + my @extensions; + my $addext = $add_extensions->{$shortname}; + if (ref($addext) eq "ARRAY") { + push(@possextensions, @$addext); + } + for my $possext (@possextensions) { + next if grep($_ eq $possext, @extensions); + next if grep($_ eq $possext, @dontaddextension); + push(@extensions,$possext); + } + next unless scalar(@extensions); + $file_associations->{$shortname} = { + shortname => $shortname, + name => $name, + extensions => \@extensions + }; + warn("Adding file association for $shortname\n"); + } +} +close(IN); + +my %all_associations = (%$file_associations, %$add_associations); + +for my $shortname (@put_first, sort keys %all_associations) { + my $a = $all_associations{$shortname}; + if (ref($a) ne "HASH") { + next; + } + + my $name = $a->{name}; + my $extensions = $a->{extensions}; + my $mimetype = $mimetypes->{$shortname}; + $mimetype = "text/x-$shortname" unless $mimetype; + + my $iconfile = $a->{iconfile}; + $iconfile = "Jalview-File" unless $iconfile; + + my @extensions = @$extensions; + #warn("LINE: $line\nFound extensions '".join("', '", @extensions)."' for $name Files ($shortname)'n"); + + my $i4jentry = $i4jtemplate; + + $i4jentry =~ s/\$\$NAME\$\$/$name/g; + $i4jentry =~ s/\$\$SHORTNAME\$\$/$shortname/g; + $i4jentry =~ s/\$\$MIMETYPE\$\$/$mimetype/g; + $i4jentry =~ s/\$\$ICONFILE\$\$/$iconfile/g; + + for my $ext (@extensions) { + my $i4jextentry = $i4jentry; + $i4jextentry =~ s/\$\$EXTENSION\$\$/$ext/g; + $i4jextentry =~ s/\$\$ID\$\$/$id/g; + $id++; + + print IA $i4jextentry; + } + + delete $all_associations{$shortname}; +} + +close(IA); diff --git a/utils/install4j/auto_file_associations.pl b/utils/install4j/auto_file_associations.pl index e59044f..7613778 100755 --- a/utils/install4j/auto_file_associations.pl +++ b/utils/install4j/auto_file_associations.pl @@ -2,6 +2,15 @@ use strict; +my $i4jversion = 7; +if ($ARGV[0] eq "-v") { + shift @ARGV; + $i4jversion = shift @ARGV; + die("-v i4jversion must be an integer [probably 7 or 8]") unless $i4jversion =~ m/^\d+$/; +} +# backwards compatibility +$i4jversion = "" if $i4jversion < 8; + my $fileformats = $ARGV[0]; $fileformats = "../../src/jalview/io/FileFormat.java" unless $fileformats; @@ -41,7 +50,7 @@ my $add_extensions = { my @put_first = qw(jalview jvl); my $mactemplatefile = "file_associations_template-Info_plist.xml"; -my $i4jtemplatefile = "file_associations_template-install4j.xml"; +my $i4jtemplatefile = ($i4jversion >= 8)?"file_associations_template-install4j${i4jversion}.xml"; my $mactemplate; my $i4jtemplate; open(MT,"<$mactemplatefile") or dir("Could not open '$mactemplatefile' for reading"); diff --git a/utils/install4j/file_associations_auto-install4j8.xml b/utils/install4j/file_associations_auto-install4j8.xml new file mode 100644 index 0000000..ab44bb5 --- /dev/null +++ b/utils/install4j/file_associations_auto-install4j8.xml @@ -0,0 +1,682 @@ + + + Jalview File + jvp + 737 + + + Jalview-File.icns + + + + + + + Jalview-File.ico + + + + + + + + + + Jalview Version Locator File + jvl + 737 + + + Jalview-Version-Locator.icns + + + + + + + Jalview-Version-Locator.ico + + + + + + + + + + AMSA File + amsa + 737 + + + Jalview-File.icns + + + + + + + Jalview-File.ico + + + + + + + + + + Jalview Annotations File + annotations + 737 + + + Jalview-File.icns + + + + + + + Jalview-File.ico + + + + + + + + + + Jalview Annotations File + jvannotations + 737 + + + Jalview-File.icns + + + + + + + Jalview-File.ico + + + + + + + + + + BioJSON File + biojson + 737 + + + Jalview-File.icns + + + + + + + Jalview-File.ico + + + + + + + + + + BLC File + BLC + 737 + + + Jalview-File.icns + + + + + + + Jalview-File.ico + + + + + + + + + + BLC File + blc + 737 + + + Jalview-File.icns + + + + + + + Jalview-File.ico + + + + + + + + + + Clustal File + aln + 737 + + + Jalview-File.icns + + + + + + + Jalview-File.ico + + + + + + + + + + Fasta File + fa + 737 + + + Jalview-File.icns + + + + + + + Jalview-File.ico + + + + + + + + + + Fasta File + fasta + 737 + + + Jalview-File.icns + + + + + + + Jalview-File.ico + + + + + + + + + + Jalview Features File + features + 737 + + + Jalview-File.icns + + + + + + + Jalview-File.ico + + + + + + + + + + Jalview Features File + jvfeatures + 737 + + + Jalview-File.icns + + + + + + + Jalview-File.ico + + + + + + + + + + Generic Features Format v2 File + gff2 + 737 + + + Jalview-File.icns + + + + + + + Jalview-File.ico + + + + + + + + + + Generic Features Format v3 File + gff3 + 737 + + + Jalview-File.icns + + + + + + + Jalview-File.ico + + + + + + + + + + JnetFile File + concise + 737 + + + Jalview-File.icns + + + + + + + Jalview-File.ico + + + + + + + + + + JnetFile File + jnet + 737 + + + Jalview-File.icns + + + + + + + Jalview-File.ico + + + + + + + + + + mmCIF File + cif + 737 + + + Jalview-File.icns + + + + + + + Jalview-File.ico + + + + + + + + + + mmCIF File + mcif + 737 + + + Jalview-File.icns + + + + + + + Jalview-File.ico + + + + + + + + + + mmCIF File + mmcif + 737 + + + Jalview-File.icns + + + + + + + Jalview-File.ico + + + + + + + + + + MSF File + msf + 737 + + + Jalview-File.icns + + + + + + + Jalview-File.ico + + + + + + + + + + PDB File + pdb + 737 + + + Jalview-File.icns + + + + + + + Jalview-File.ico + + + + + + + + + + PDB File + ent + 737 + + + Jalview-File.icns + + + + + + + Jalview-File.ico + + + + + + + + + + PFAM File + pfam + 737 + + + Jalview-File.icns + + + + + + + Jalview-File.ico + + + + + + + + + + PHYLIP File + phy + 737 + + + Jalview-File.icns + + + + + + + Jalview-File.ico + + + + + + + + + + PileUp File + pileup + 737 + + + Jalview-File.icns + + + + + + + Jalview-File.ico + + + + + + + + + + PIR File + pir + 737 + + + Jalview-File.icns + + + + + + + Jalview-File.ico + + + + + + + + + + RNAML File + rnaml + 737 + + + Jalview-File.icns + + + + + + + Jalview-File.ico + + + + + + + + + + Substitution Matrix File + mat + 737 + + + Jalview-File.icns + + + + + + + Jalview-File.ico + + + + + + + + + + Stockholm File + sto + 737 + + + Jalview-File.icns + + + + + + + Jalview-File.ico + + + + + + + + + + Stockholm File + stk + 737 + + + Jalview-File.icns + + + + + + + Jalview-File.ico + + + + + + + diff --git a/utils/install4j/file_associations_template-install4j8.xml b/utils/install4j/file_associations_template-install4j8.xml new file mode 100644 index 0000000..ce5ebae --- /dev/null +++ b/utils/install4j/file_associations_template-install4j8.xml @@ -0,0 +1,22 @@ + + + $$NAME$$ File + $$EXTENSION$$ + 737 + + + $$ICONFILE$$.icns + + + + + + + $$ICONFILE$$.ico + + + + + + + diff --git a/utils/install4j/install4j8_template.install4j b/utils/install4j/install4j8_template.install4j new file mode 100644 index 0000000..e595d04 --- /dev/null +++ b/utils/install4j/install4j8_template.install4j @@ -0,0 +1,1202 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 255 + 255 + 255 + 255 + + + + + + + + + + 255 + 255 + 255 + 255 + + + + + + ../../resources/images/jalview_logo_background_fade-640x480.png + + + + + 5 + 10 + 10 + 10 + + + + + imageAnchor + imageEdgeBackgroundColor + imageFile + + + + + + + + + + labelText + + + + + + + + + + + + + + + + + + + + + + + + 255 + 255 + 255 + 255 + + + + + + + + + + 25 + 143 + 220 + 255 + + + + + + ../../resources/images/jalview_logo_background_fade-640x480.png + + + + + 5 + 10 + 10 + 10 + + + + + imageAnchor + imageEdgeBackgroundColor + imageFile + + + + + + + + + sys.installationDir + + + context.getBooleanVariable("sys.confirmedUpdateInstallation") + + + + + + ${form:welcomeMessage} + + !context.isConsole() + + + + + + String message = context.getMessage("ConsoleWelcomeLabel", context.getApplicationName()); +return console.askOkCancel(message, true); + + + + + + + + updateCheck + + + + + ${i18n:ClickNext} + + + + + + !context.getBooleanVariable("sys.confirmedUpdateInstallation") + + + + + sys.installationDir + + + context.getVariable("sys.responseFile") == null + + + + + + ${i18n:SelectDirLabel(${compiler:sys.fullName})} + + + + + + + + allowSpacesOnUnix + checkFreeSpace + checkWritable + existingDirWarning + manualEntryAllowed + showFreeDiskSpace + showRequiredDiskSpace + standardValidation + suggestAppDir + validateApplicationId + validationScript + + + + + + + + + ${i18n:SelectComponentsLabel2} + + !context.isConsole() + + + + + + + selectionChangedScript + + + + + + + + + ${i18n:SelectAssociationsLabel} + + + + + + + + + showSelectionButtons + selectionButtonPosition + + + + + + + + + + ${i18n:UninstallerMenuEntry(${compiler:sys.fullName})} + + !context.getBooleanVariable("sys.programGroupDisabled") + + + + ${compiler:sys.fullName} ${compiler:sys.version} + + + + + + + + + + + + true + + + + 121 + + + + + + + + ${i18n:WizardPreparing} + + + + + + + + + + ${compiler:sys.shortName} + + + ${compiler:sys.shortName} + + + + + ../../resources/images/jalview_logos.ico + + + + + ../../resources/images/JalviewLogo_Huge.png + + + + !context.getBooleanVariable("sys.programGroupDisabled") + + + + + ${compiler:sys.shortName} + + + ${compiler:sys.shortName} + + + ${compiler:sys.fullName} + + + ../../resources/images/JalviewLogo_Huge.png + + + + + ../../resources/images/jalview_logos.ico + + + + context.getBooleanVariable("createDesktopLinkAction") + + + + + + Jalview.app + + + + context.getBooleanVariable("addToDockAction") + + + + This action, identified by its name "EXTENSIONS_REPLACED_BY_GRADLE", will be replaced by gradle with the contents of file 'file_associations_auto_install4j.xml'. + extensions_to_be_replaced_by_gradle + + + + + + + ${form:finishedMessage} + + + + + ${i18n:CreateDesktopIcon} + + createDesktopLinkAction + + + + + ${i18n:AddToDock} + + addToDockAction + + Util.isMacOS() + + + + + + + + ${i18n:UninstallerMenuEntry(${compiler:sys.fullName})} + + + + + + + + + 255 + 255 + 255 + 255 + + + + + + + + + + 192 + 192 + 192 + 255 + + + + + + ../../resources/images/jalview_logo_background_fade-640x480.png + + + + + 5 + 10 + 10 + 10 + + + + + imageAnchor + imageEdgeBackgroundColor + imageFile + + + + + + + + + + + + + + + + + + ${form:welcomeMessage} + + !context.isConsole() + + + + + + String message = context.getMessage("ConfirmUninstall", context.getApplicationName()); +return console.askYesNo(message, true); + + + + + + + + + + + + + + + + + + + + + + + + + + jre + + + + + jre.jar + + + + + .install4j + + + + + $$GETDOWN_DIST_DIR$$ + + + + + $$GETDOWN_ALT_DIR$$ + + + + + $$GETDOWN_RESOURCE_DIR$$ + + + + + getdown-launcher.jar + + + + + getdown-launcher-old.jar + + + + + getdown-launcher-new.jar + + + + + *.jarv + + + + + gettingdown.lock + + + + + *.log + + + + + *.txt + + + + + *_new + + + + + digest.txt + + + + + digest2.txt + + + + + getdown-launcher.jarv + + + + + getdown-launcher-new.jarv + + + + + channel_launch.jvl + + + + + launcher.log + + + + + proxy.txt + + + + + META-INF + + + + + install/getdown-launcher.jar + + + + + install/getdown.txt + + + + + install/build_properties + + + + + build_properties + + + + + install + + + + + dist + + + + + release + + + + + alt + + + + + resource + + + + + + + + + + + + + + + + ${i18n:UninstallerPreparing} + + + + + + + + + + ${form:successMessage} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +