From: James Procter Date: Tue, 23 Jan 2024 14:21:59 +0000 (+0000) Subject: Merge branch 'develop' into bug/JAL-4290_headless_alignment_export_with_structure_ann... X-Git-Tag: Release_2_11_3_3~7^2~2^2 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=d1d89672d38fb328eca3495177d651c396970fd1;hp=ea920b2f6a5fb611397ec1fd51bc12402c5a8d09;p=jalview.git Merge branch 'develop' into bug/JAL-4290_headless_alignment_export_with_structure_annotations_doesnt_include_secondary_structure_and_temperature_factor --- diff --git a/build.gradle b/build.gradle index 3b81404..3ed6c56 100644 --- a/build.gradle +++ b/build.gradle @@ -2150,6 +2150,16 @@ task cleanDist { } +task launcherJar(type: Jar) { + manifest { + attributes ( + "Main-Class": shadow_jar_main_class, + "Implementation-Version": JALVIEW_VERSION, + "Application-Name": applicationName + ) + } +} + shadowJar { group = "distribution" description = "Create a single jar file with all dependency libraries merged. Can be run with java -jar" @@ -2163,6 +2173,10 @@ shadowJar { from groovyJars from otherJars + manifest { + // shadowJar manifest must inheritFrom another Jar task. Can't set attributes here. + inheritFrom(project.tasks.launcherJar.manifest) + } // we need to include the groovy-swing Include-Package for it to run in the shadowJar doFirst { def jarFileManifests = [] @@ -2172,9 +2186,7 @@ shadowJar { jarFileManifests += mf } } - manifest { - attributes "Implementation-Version": JALVIEW_VERSION, "Application-Name": applicationName from (jarFileManifests) { eachEntry { details -> if (!details.key.equals("Import-Package")) { @@ -2187,6 +2199,7 @@ shadowJar { duplicatesStrategy "INCLUDE" + // this mainClassName is mandatory but gets ignored due to manifest created in doFirst{}. Set the Main-Class as an attribute in launcherJar instead mainClassName = shadow_jar_main_class mergeServiceFiles() classifier = "all-"+JALVIEW_VERSION+"-j"+JAVA_VERSION diff --git a/src/jalview/bin/Commands.java b/src/jalview/bin/Commands.java index a72da0d..b6a5a25 100644 --- a/src/jalview/bin/Commands.java +++ b/src/jalview/bin/Commands.java @@ -331,9 +331,17 @@ public class Commands } // colour alignment - String colour = avm.getFromSubValArgOrPref(av, Arg.COLOUR, sv, - null, "DEFAULT_COLOUR_PROT", ""); - this.colourAlignFrame(af, colour); + String colour = null; + if (avm.containsArg(Arg.COLOUR) + || !(format == FileFormat.Jalview)) + { + colour = avm.getFromSubValArgOrPref(av, Arg.COLOUR, sv, null, + "DEFAULT_COLOUR_PROT", null); + } + if (colour != null) + { + this.colourAlignFrame(af, colour); + } // Change alignment frame title String title = avm.getFromSubValArgOrPref(av, Arg.TITLE, sv, null, @@ -1293,8 +1301,19 @@ public class Commands private void colourAlignFrame(AlignFrame af, ColourSchemeI cs) { - // Note that cs == null removes colour scheme from af - af.changeColour(cs); + try { + SwingUtilities.invokeAndWait(new Runnable() + { + @Override + public void run() + { + // Note that cs == null removes colour scheme from af + af.changeColour(cs); + } + }); } catch (Exception x) { + Console.trace("Interrupted whilst waiting for colorAlignFrame action",x); + + } } private ColourSchemeI getColourScheme(AlignFrame af) diff --git a/src/jalview/bin/Launcher.java b/src/jalview/bin/Launcher.java index 507f501..2a78d8e 100644 --- a/src/jalview/bin/Launcher.java +++ b/src/jalview/bin/Launcher.java @@ -28,6 +28,7 @@ import java.util.List; import java.util.Locale; import java.util.concurrent.TimeUnit; +import jalview.bin.argparser.Arg; import jalview.util.ChannelProperties; import jalview.util.LaunchUtils; @@ -35,12 +36,12 @@ import jalview.util.LaunchUtils; * A Launcher class for Jalview. This class is used to launch Jalview from the * shadowJar when Getdown is not used or available. It attempts to take all the * command line arguments to pass on to the jalview.bin.Jalview class, but to - * insert a -Xmx memory setting to a sensible default, using the -jvmmempc and + * insert a -Xmx memory setting to a sensible default, using the --jvmmempc and * -jvmmemmax application arguments if specified. If not specified then system * properties will be looked for by jalview.bin.MemorySetting. If the user has - * provided the JVM with a -Xmx setting directly and not set -jvmmempc or - * -jvmmemmax then this setting will be used and system properties ignored. If - * -Xmx is set as well as -jvmmempc or -jvmmemmax as argument(s) then the -Xmx + * provided the JVM with a -Xmx setting directly and not set --jvmmempc or + * --jvmmemmax then this setting will be used and system properties ignored. If + * -Xmx is set as well as --jvmmempc or --jvmmemmax as argument(s) then the -Xmx * argument will NOT be passed on to the main application launch. * * @author bsoares @@ -62,8 +63,8 @@ public class Launcher /** * main method for jalview.bin.Launcher. This restarts the same JRE's JVM with - * the same arguments but with memory adjusted based on extracted -jvmmempc - * and -jvmmemmax application arguments. If on a Mac then extra dock:icon and + * the same arguments but with memory adjusted based on extracted --jvmmempc + * and --jvmmemmax application arguments. If on a Mac then extra dock:icon and * dock:name arguments are also set. * * @param args @@ -168,32 +169,24 @@ public class Launcher } // jvmmempc and jvmmemmax args used to set memory and are not passed on to // startClass - if (arg.startsWith( - "-" + MemorySetting.MAX_HEAPSIZE_PERCENT_PROPERTY_NAME + "=")) + final String jvmmempcArg = Arg.JVMMEMPC.getName(); + final String jvmmemmaxArg = Arg.JVMMEMMAX.getName(); + if (arg.startsWith("-" + jvmmempcArg + "=")) { - jvmmempc = arg.substring( - MemorySetting.MAX_HEAPSIZE_PERCENT_PROPERTY_NAME.length() - + 2); + jvmmempc = arg.substring(jvmmempcArg.length() + 2); } - else if (arg.startsWith( - "-" + MemorySetting.MAX_HEAPSIZE_PROPERTY_NAME + "=")) + else if (arg.startsWith("-" + jvmmemmaxArg + "=")) { - jvmmemmax = arg.substring( - MemorySetting.MAX_HEAPSIZE_PROPERTY_NAME.length() + 2); + jvmmemmax = arg.substring(jvmmemmaxArg.length() + 2); } // --doubledash versions - else if (arg.startsWith("--" - + MemorySetting.MAX_HEAPSIZE_PERCENT_PROPERTY_NAME + "=")) + else if (arg.startsWith("--" + jvmmempcArg + "=")) { - jvmmempc = arg.substring( - MemorySetting.MAX_HEAPSIZE_PERCENT_PROPERTY_NAME.length() - + 3); + jvmmempc = arg.substring(jvmmempcArg.length() + 3); } - else if (arg.startsWith( - "--" + MemorySetting.MAX_HEAPSIZE_PROPERTY_NAME + "=")) + else if (arg.startsWith("--" + jvmmemmaxArg + "=")) { - jvmmemmax = arg.substring( - MemorySetting.MAX_HEAPSIZE_PROPERTY_NAME.length() + 3); + jvmmemmax = arg.substring(jvmmemmaxArg.length() + 3); } // retain arg else diff --git a/src/jalview/bin/MemorySetting.java b/src/jalview/bin/MemorySetting.java index 7458d55..738d1e7 100644 --- a/src/jalview/bin/MemorySetting.java +++ b/src/jalview/bin/MemorySetting.java @@ -24,6 +24,8 @@ package jalview.bin; import java.util.Locale; +import jalview.bin.argparser.Arg; + /** * Methods to decide on appropriate memory setting for Jalview based on two * optionally provided values: jvmmempc - the maximum percentage of total @@ -37,9 +39,11 @@ import java.util.Locale; */ public class MemorySetting { - public static final String MAX_HEAPSIZE_PERCENT_PROPERTY_NAME = "jvmmempc"; + public static final String MAX_HEAPSIZE_PERCENT_PROPERTY_NAME = Arg.JVMMEMPC + .getName(); - public static final String MAX_HEAPSIZE_PROPERTY_NAME = "jvmmemmax"; + public static final String MAX_HEAPSIZE_PROPERTY_NAME = Arg.JVMMEMMAX + .getName(); private static final int MAX_HEAPSIZE_PERCENT_DEFAULT = 90; // 90% diff --git a/src/jalview/bin/argparser/Arg.java b/src/jalview/bin/argparser/Arg.java index 9a05c9f..36f7794 100644 --- a/src/jalview/bin/argparser/Arg.java +++ b/src/jalview/bin/argparser/Arg.java @@ -311,7 +311,7 @@ public enum Arg // these last two have no purpose in the normal Jalview application but are // used by jalview.bin.Launcher to set memory settings. They are not used by - // argparser but are here for Usage statement reasons. + // argparser but are here for Usage statement and parsing reasons. JVMMEMPC(Type.CONFIG, "Limit maximum heap size (memory) to PERCENT% of total physical memory detected. This defaults to 90 if total physical memory can be detected.\n" + "The equals sign (\"=\") separator must be used with no spaces.", diff --git a/src/jalview/ws/dbsources/Uniprot.java b/src/jalview/ws/dbsources/Uniprot.java index 69ee379..299224d 100644 --- a/src/jalview/ws/dbsources/Uniprot.java +++ b/src/jalview/ws/dbsources/Uniprot.java @@ -68,7 +68,7 @@ import jalview.xml.binding.uniprot.PropertyType; */ public class Uniprot extends DbSourceProxyImpl { - private static final String DEFAULT_UNIPROT_DOMAIN = "https://www.uniprot.org"; + private static final String DEFAULT_UNIPROT_DOMAIN = "https://rest.uniprot.org"; private static final String BAR_DELIMITER = "|"; @@ -144,7 +144,7 @@ public class Uniprot extends DbSourceProxyImpl "(UNIPROT\\|?|UNIPROT_|UNIREF\\d+_|UNIREF\\d+\\|?)", ""); AlignmentI al = null; - String downloadstring = getDomain() + "/uniprot/" + queries + ".xml"; + String downloadstring = getDomain() + "/uniprotkb/" + queries + ".xml"; URL url = new URL(downloadstring); HttpURLConnection urlconn = (HttpURLConnection) url.openConnection();