mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-04 18:29:37 +02:00
GT-2913: launch.properties can now take platform-specific VMARGS.
This commit is contained in:
parent
8c689a0099
commit
fa20ba3762
7 changed files with 87 additions and 75 deletions
|
@ -41,12 +41,7 @@ public abstract class AbstractGCellRenderer extends GDHtmlLabel {
|
|||
protected static boolean systemAlternateRowColors = getAlternateRowColors();
|
||||
|
||||
private static boolean getAlternateRowColors() {
|
||||
String disable = System.getProperty(DISABLE_ALTERNATING_ROW_COLORS_PROPERTY);
|
||||
if (disable == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return !Boolean.parseBoolean(disable);
|
||||
return !Boolean.getBoolean(DISABLE_ALTERNATING_ROW_COLORS_PROPERTY);
|
||||
}
|
||||
|
||||
protected final Border focusBorder;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
/* ###
|
||||
* IP: GHIDRA
|
||||
* REVIEWED: YES
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -22,11 +21,7 @@ import net.sf.cglib.proxy.Enhancer;
|
|||
|
||||
public class ContinuesFactory implements GenericFactory {
|
||||
|
||||
private static final String CONTINUES_INTERCEPTOR_DISABLED_PROPERTY =
|
||||
"ContinuesInterceptor.disabled";
|
||||
|
||||
private static final boolean disabled =
|
||||
System.getProperty(CONTINUES_INTERCEPTOR_DISABLED_PROPERTY) != null;
|
||||
private static final boolean disabled = Boolean.getBoolean("ContinuesInterceptor.disabled");
|
||||
|
||||
private ExceptionHandler exceptionHandler;
|
||||
|
||||
|
|
|
@ -137,8 +137,8 @@ public class ApplicationUtilities {
|
|||
throws FileNotFoundException {
|
||||
|
||||
// Look for preset cache directory
|
||||
String cachedir = System.getProperty("application.cachedir");
|
||||
if (cachedir != null && !cachedir.isEmpty()) {
|
||||
String cachedir = System.getProperty("application.cachedir", "").trim();
|
||||
if (!cachedir.isEmpty()) {
|
||||
return new File(cachedir,
|
||||
SystemUtilities.getUserName() + "-" + applicationProperties.getApplicationName());
|
||||
}
|
||||
|
|
|
@ -15,20 +15,14 @@ VMARGS=-Duser.country=US
|
|||
VMARGS=-Duser.language=en
|
||||
VMARGS=-Duser.variant=
|
||||
|
||||
# The following two options increase rendering performance when using
|
||||
# anti-aliasing/transparency/transforms. If you experience any trouble
|
||||
# rendering Ghidra, try toggling these values
|
||||
|
||||
# The following options affect rendering on different platforms. It may be necessary to play
|
||||
# with these settings to get Ghidra to display and perform optimally on HiDPI monitors or in VM's.
|
||||
# - All platforms
|
||||
VMARGS=-Dsun.java2d.opengl=false
|
||||
VMARGS=-Dsun.java2d.uiScale=1
|
||||
# - Linux
|
||||
VMARGS=-Dsun.java2d.pmoffscreen=false
|
||||
VMARGS=-Dsun.java2d.xrender=true
|
||||
# - Windows
|
||||
VMARGS=-Dsun.java2d.d3d=false
|
||||
VMARGS=-Dsun.java2d.opengl=false
|
||||
VMARGS=-Dsun.java2d.uiScale=1
|
||||
VMARGS_LINUX=-Dsun.java2d.pmoffscreen=false
|
||||
VMARGS_LINUX=-Dsun.java2d.xrender=true
|
||||
VMARGS_LINUX=-Dawt.useSystemAAFontSettings=on
|
||||
VMARGS_WINDOWS=-Dsun.java2d.d3d=false
|
||||
|
||||
# Set acceptable HTTPS protocols
|
||||
VMARGS=-Dhttps.protocols=TLSv1,TLSv1.1,TLSv1.2
|
||||
|
@ -52,31 +46,34 @@ VMARGS=-Dcpu.core.override=
|
|||
# Default font size for many java swing elements.
|
||||
VMARGS=-Dfont.size.override=
|
||||
|
||||
# Temporary directory used by the application. This directory will be used for
|
||||
# all temporary files and may also be used for the persistent user cache
|
||||
# directory <java.io.tmpdir>/<username>-Ghidra. The specified directory must
|
||||
# exist and have appropriate read/write/execute permissions
|
||||
#VMARGS=-Djava.io.tmpdir=
|
||||
# Eclipse on macOS can have file locking issues if the user home directory is networked. Therefore,
|
||||
# we will disable file locking by default for macOS. Comment the following line out if Eclipse file
|
||||
# locking is needed and known to work.
|
||||
VMARGS_MACOS=-Declipse.filelock.disable=true
|
||||
|
||||
# Persistent cache directory used by the application. This directory will be
|
||||
# used to store persistent application caches for all users. The default
|
||||
# location for Mac/Linux is the same as specified by java.io.tmpdir property.
|
||||
# The default location for Windows corresponds to the application local
|
||||
# settings directory for the user (e.g., %LOCALAPPDATA%). If you wish to use a
|
||||
# directory with more storage or avoid system cleanups, it may be desirable to
|
||||
# override the default location.
|
||||
# Where the menu bar is displayed on macOS
|
||||
VMARGS_MACOS=-Dapple.laf.useScreenMenuBar=false
|
||||
|
||||
# Prevent log4j from using the Jansi DLL on Windows.
|
||||
VMARGS_WINDOWS=-Dlog4j.skipJansi=true
|
||||
|
||||
# Persistent cache directory used by the application. This directory will be used to store
|
||||
# persistent application caches for all users. The default location for Mac/Linux is the same as
|
||||
# specified by java.io.tmpdir property. The default location for Windows corresponds to the
|
||||
# application local settings directory for the user (e.g., %LOCALAPPDATA%). If you wish to use a
|
||||
# directory with more storage or avoid system cleanups, it may be desirable to override the default
|
||||
# location.
|
||||
#VMARGS=-Dapplication.cachedir=
|
||||
|
||||
# Temporary directory used by the application. This directory will be used for all temporary files
|
||||
# and may also be used for the persistent user cache directory <java.io.tmpdir>/<username>-Ghidra.
|
||||
# The specified directory must exist and have appropriate read/write/execute permissions
|
||||
#VMARGS=-Djava.io.tmpdir=
|
||||
|
||||
# Disable alternating row colors in tables
|
||||
#VMARGS=-Ddisable.alternating.row.colors=true
|
||||
|
||||
# Hoist the menu bar out of the window on macOS
|
||||
#VMARGS=-Dapple.laf.useScreenMenuBar=true
|
||||
|
||||
# The ContinuesInterceptor allows the import process to proceed if parsing corrupted headers
|
||||
# generates uncaught exceptions. Disabling it can be helpful when trying to debug what went
|
||||
# wrong because the ContinuesIntercepter affects the usefulness of the stack trace.
|
||||
#VMARGS=-DContinuesInterceptor.disabled
|
||||
|
||||
# Prevent log4j from using the Jansi DLL on Windows.
|
||||
VMARGS=-Dlog4j.skipJansi=true
|
||||
#VMARGS=-DContinuesInterceptor.disabled=true
|
||||
|
|
|
@ -116,17 +116,6 @@ VMARG_LIST+=" $(java -cp "${LS_CPATH}" LaunchSupport "${INSTALL_DIR}" -vmargs)"
|
|||
# Add extra macOS VM arguments
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
VMARG_LIST+=" -Xdock:name=${APPNAME}"
|
||||
VMARG_LIST+=" -Xdock:icon=\"${INSTALL_DIR}/Ghidra/Features/Base/os/osx64/ghidra.icns\""
|
||||
|
||||
# Eclipse on macOS (Darwin) can have file locking issues if the user home directory is
|
||||
# networked. Therefore, we will disable file locking by default for macOS. Comment the
|
||||
# following line out if Eclipse file locking is needed and known to work.
|
||||
VMARG_LIST+=" -Declipse.filelock.disable=true"
|
||||
fi
|
||||
|
||||
# Add extra Linux VM arguments
|
||||
if [ "$(uname -s)" = "Linux" ]; then
|
||||
VMARG_LIST+=" -Dawt.useSystemAAFontSettings=on"
|
||||
fi
|
||||
|
||||
# Set Max Heap Size if specified
|
||||
|
|
|
@ -33,23 +33,46 @@ public abstract class JavaFinder {
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates a Java finder to use for the current OS.
|
||||
* The different supported platforms (operating systems).
|
||||
*/
|
||||
public enum Platform {
|
||||
WINDOWS, MACOS, LINUX;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current {@link Platform}.
|
||||
*
|
||||
* @return The Java finder to use for the current OS.
|
||||
* @return The current {@link Platform}
|
||||
*/
|
||||
public static Platform getCurrentPlatform() {
|
||||
String os = System.getProperty("os.name");
|
||||
if (os != null) {
|
||||
os = os.toLowerCase();
|
||||
if (os.contains("win")) {
|
||||
return Platform.WINDOWS;
|
||||
}
|
||||
if (os.contains("mac")) {
|
||||
return Platform.MACOS;
|
||||
}
|
||||
}
|
||||
return Platform.LINUX;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a Java finder to use for the current {@link Platform platform}.
|
||||
*
|
||||
* @return The Java finder to use for the current {@link Platform platform}
|
||||
*/
|
||||
public static JavaFinder create() {
|
||||
JavaFinder javaFinder;
|
||||
String os = System.getProperty("os.name").toLowerCase();
|
||||
if (os != null && os.contains("win")) {
|
||||
javaFinder = new WindowsJavaFinder();
|
||||
switch (getCurrentPlatform()) {
|
||||
case WINDOWS:
|
||||
return new WindowsJavaFinder();
|
||||
case MACOS:
|
||||
return new MacJavaFinder();
|
||||
case LINUX:
|
||||
default:
|
||||
return new LinuxJavaFinder();
|
||||
}
|
||||
else if (os != null && os.contains("mac")) {
|
||||
javaFinder = new MacJavaFinder();
|
||||
}
|
||||
else {
|
||||
javaFinder = new LinuxJavaFinder();
|
||||
}
|
||||
return javaFinder;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -19,6 +19,8 @@ import java.io.*;
|
|||
import java.text.ParseException;
|
||||
import java.util.*;
|
||||
|
||||
import ghidra.launch.JavaFinder.Platform;
|
||||
|
||||
/**
|
||||
* Parses and provides convenient access to the properties defined in a launch properties file.
|
||||
* <p>
|
||||
|
@ -34,10 +36,15 @@ public class LaunchProperties {
|
|||
public static String JAVA_HOME_OVERRIDE = "JAVA_HOME_OVERRIDE";
|
||||
|
||||
/**
|
||||
* The VM arguments to use to launch.
|
||||
* The VM arguments to use to launch (all platforms).
|
||||
*/
|
||||
public static String VMARGS = "VMARGS";
|
||||
|
||||
/**
|
||||
* The VM arguments to use to launch (current platform only).
|
||||
*/
|
||||
public static String VMARGS_PLATFORM = "VMARGS_" + JavaFinder.getCurrentPlatform();
|
||||
|
||||
private Map<String, List<String>> propertyMap;
|
||||
|
||||
/**
|
||||
|
@ -68,12 +75,11 @@ public class LaunchProperties {
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the command line string of VM arguments to use for the launch.
|
||||
* This will be the union of all VM arguments defined in both the user and installation launch
|
||||
* properties. If conflicting VM arguments are defined in both files, the user version
|
||||
* will override the installation version.
|
||||
* Gets the command line string of VM arguments to use for the launch for the current
|
||||
* {@link Platform platform}.
|
||||
*
|
||||
* @return The command line string of VM arguments to use for the launch.
|
||||
* @return The command line string of VM arguments to use for the launch for the current
|
||||
* {@link Platform}
|
||||
*/
|
||||
public String getVmArgs() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
@ -84,6 +90,13 @@ public class LaunchProperties {
|
|||
sb.append(" ");
|
||||
}
|
||||
}
|
||||
List<String> vmargPlatformList = propertyMap.get(VMARGS_PLATFORM);
|
||||
if (vmargPlatformList != null) {
|
||||
for (String arg : vmargPlatformList) {
|
||||
sb.append(arg);
|
||||
sb.append(" ");
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue