Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Niefer2010-08-17 16:36:51 -0400
committerAndrew Niefer2010-08-17 16:36:51 -0400
commit66952afa517d11351a5eb2200c76f518184cb8a2 (patch)
tree32b7f700d0dbfe7601bb020ef31fc07c0a6c3736
parentd2932748b310c332670c3d74500c20952d06cf09 (diff)
downloadrt.equinox.framework-66952afa517d11351a5eb2200c76f518184cb8a2.tar.gz
rt.equinox.framework-66952afa517d11351a5eb2200c76f518184cb8a2.tar.xz
rt.equinox.framework-66952afa517d11351a5eb2200c76f518184cb8a2.zip
bug 149994 - override/append vmargs
-rw-r--r--bundles/org.eclipse.equinox.executable/library/eclipse.c26
-rw-r--r--bundles/org.eclipse.equinox.executable/library/eclipseConfig.c23
-rw-r--r--bundles/org.eclipse.equinox.executable/library/eclipseConfig.h13
-rw-r--r--bundles/org.eclipse.equinox.executable/library/make_version.mak2
-rw-r--r--bundles/org.eclipse.equinox.launcher/src/org/eclipse/equinox/launcher/Main.java7
5 files changed, 48 insertions, 23 deletions
diff --git a/bundles/org.eclipse.equinox.executable/library/eclipse.c b/bundles/org.eclipse.equinox.executable/library/eclipse.c
index 3982f5c26..ca2a06458 100644
--- a/bundles/org.eclipse.equinox.executable/library/eclipse.c
+++ b/bundles/org.eclipse.equinox.executable/library/eclipse.c
@@ -268,6 +268,7 @@ static _TCHAR* permGen = NULL; /* perm gen size for sun */
static _TCHAR** filePath = NULL; /* list of files to open */
static _TCHAR* timeoutString = NULL; /* timeout value for opening a file */
static _TCHAR* defaultAction = NULL; /* default action for non '-' command line arguments */
+static _TCHAR* iniFile = NULL; /* the launcher.ini file set if --launcher.ini was specified */
/* variables for ee options */
static _TCHAR* eeExecutable = NULL;
@@ -305,7 +306,7 @@ static Option options[] = {
{ APPEND_VMARGS, &appendVmargs, VALUE_IS_FLAG, 1 },
{ OVERRIDE_VMARGS, &appendVmargs, VALUE_IS_FLAG | INVERT_FLAG, 1 },
{ LIBRARY, NULL, 0, 2 }, /* library was parsed by exe, just remove it */
- { INI, NULL, 0, 2 }, /* same with ini */
+ { INI, &iniFile, 0, 2 },
{ OS, &osArg, 0, 2 },
{ OSARCH, &osArchArg, 0, 2 },
{ SHOWSPLASH, &showSplashArg, OPTIONAL_VALUE, 2 },
@@ -813,23 +814,15 @@ static _TCHAR** parseArgList( _TCHAR* data ) {
/* Return the list of args from the launcher ini file (if it exists). Caller is responsible to free(). */
static _TCHAR** getConfigArgs() {
- _TCHAR* iniFile = NULL;
_TCHAR** configArgv = NULL;
+ _TCHAR * configFile = NULL;
int configArgc = 0;
int ret = 0;
- int iniArg;
- /* Parse configuration file arguments */
- iniArg = indexOf(INI, initialArgv);
- if (iniArg > 0) {
- iniFile = initialArgv[iniArg + 1];
- ret = readConfigFile(iniFile, &configArgc, &configArgv);
- } else {
- ret = readIniFile(program, &configArgc, &configArgv);
- }
- if (ret == 0) {
+ configFile = (iniFile != NULL) ? iniFile : getIniFile(program, consoleLauncher);
+ ret = readConfigFile(configFile, &configArgc, &configArgv);
+ if (ret == 0)
return configArgv;
- }
return NULL;
}
@@ -946,11 +939,11 @@ static void getVMCommand( int launchMode, int argc, _TCHAR* argv[], _TCHAR **vmA
/* Program arguments */
/* OS <os> + WS <ws> + ARCH <arch> + LAUNCHER <launcher> + NAME <officialName> +
- * + LIBRARY <library> + SHOWSPLASH <cmd> + EXITDATA <cmd> + STARTUP <jar> + argv[] + VM + <vm> +
+ * + LIBRARY <library> + SHOWSPLASH <cmd> + EXITDATA <cmd> + STARTUP <jar> + OVERRIDE/APPEND + argv[] + VM + <vm> +
* VMARGS + vmArg + requiredVMargs
* + NULL)
*/
- totalProgArgs = 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + argc + 2 + 1 + nVMarg + nEEargs + nReqVMarg + 1;
+ totalProgArgs = 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 1 + argc + 2 + 1 + nVMarg + nEEargs + nReqVMarg + 1;
*progArgv = malloc( totalProgArgs * sizeof( _TCHAR* ) );
dst = 0;
@@ -990,6 +983,9 @@ static void getVMCommand( int launchMode, int argc, _TCHAR* argv[], _TCHAR **vmA
(*progArgv)[ dst++ ] = STARTUP;
(*progArgv)[ dst++ ] = jarFile;
+ /* override or append vm args */
+ (*progArgv)[ dst++ ] = appendVmargs ? APPEND_VMARGS : OVERRIDE_VMARGS;
+
/* Append the exit data command. */
if (sharedID) {
(*progArgv)[ dst++ ] = EXITDATA;
diff --git a/bundles/org.eclipse.equinox.executable/library/eclipseConfig.c b/bundles/org.eclipse.equinox.executable/library/eclipseConfig.c
index 3088c89c5..bc7a5cdc0 100644
--- a/bundles/org.eclipse.equinox.executable/library/eclipseConfig.c
+++ b/bundles/org.eclipse.equinox.executable/library/eclipseConfig.c
@@ -38,6 +38,20 @@ int readIniFile(_TCHAR* program, int *argc, _TCHAR ***argv)
int result;
if (program == NULL || argc == NULL || argv == NULL) return -1;
+
+#if defined(_WIN32) && defined(_WIN32_CONSOLE)
+ config_file = getIniFile(program, 1);
+#else
+ config_file = getIniFile(program, 0);
+#endif
+
+ result = readConfigFile(config_file, argc, argv);
+ free(config_file);
+ return result;
+}
+
+_TCHAR* getIniFile(_TCHAR* program, int consoleLauncher){
+ _TCHAR* config_file = NULL;
/* Get a copy with room for .ini at the end */
config_file = malloc( (_tcslen(program) + 5) * sizeof(_TCHAR));
@@ -53,8 +67,7 @@ int readIniFile(_TCHAR* program, int *argc, _TCHAR ***argv)
extension = config_file + _tcslen(config_file);
}
_tcscpy(extension, _T_ECLIPSE(".ini"));
-#ifdef _WIN32_CONSOLE
- {
+ if(consoleLauncher){
/* We are the console version, if the ini file does not exist, try
* removing the 'c' from the end of the program name */
struct _stat stats;
@@ -62,16 +75,12 @@ int readIniFile(_TCHAR* program, int *argc, _TCHAR ***argv)
_tcscpy(extension - 1, extension);
}
}
-#endif
}
#else
/* Append the extension */
strcat(config_file, ".ini");
#endif
-
- result = readConfigFile(config_file, argc, argv);
- free(config_file);
- return result;
+ return config_file;
}
int readConfigFile( _TCHAR * config_file, int *argc, _TCHAR ***argv )
diff --git a/bundles/org.eclipse.equinox.executable/library/eclipseConfig.h b/bundles/org.eclipse.equinox.executable/library/eclipseConfig.h
index 5315beb02..17aa50959 100644
--- a/bundles/org.eclipse.equinox.executable/library/eclipseConfig.h
+++ b/bundles/org.eclipse.equinox.executable/library/eclipseConfig.h
@@ -24,11 +24,24 @@
*
* This method will call readConfigFile to read the actual ini file
*
+ * This method will use getIniFile with a value for consoleLauncher that
+ * is determined at compile time. Clients who are not the actual
+ * win32 console executable should instead use getIniFile and readConfigFile.
+ *
* Returns 0 if success.
*/
extern int readIniFile(_TCHAR* program, int *argc, _TCHAR ***argv);
/**
+ * Return the path to the launcher ini file for the corresponding program
+ * argument. On win32, an "eclipsec.exe' console launcher can use the "eclipse.ini"
+ * ini file.
+ * consoleLauncher : whether or not we are using the win32 "eclipsec" console launcher
+ * has no affect on other platforms
+ */
+extern _TCHAR* getIniFile(_TCHAR* program, int consoleLauncher);
+
+/**
* Reads the given configuration file
* The argument argv refers to a newly allocated array of strings.
* The first entry is the program name to mimic the expectations
diff --git a/bundles/org.eclipse.equinox.executable/library/make_version.mak b/bundles/org.eclipse.equinox.executable/library/make_version.mak
index d586682f7..8c836d88c 100644
--- a/bundles/org.eclipse.equinox.executable/library/make_version.mak
+++ b/bundles/org.eclipse.equinox.executable/library/make_version.mak
@@ -10,5 +10,5 @@
#*******************************************************************************
maj_ver=1
-min_ver=401
+min_ver=402
LIB_VERSION = $(maj_ver)$(min_ver)
diff --git a/bundles/org.eclipse.equinox.launcher/src/org/eclipse/equinox/launcher/Main.java b/bundles/org.eclipse.equinox.launcher/src/org/eclipse/equinox/launcher/Main.java
index da30753c8..099686cdc 100644
--- a/bundles/org.eclipse.equinox.launcher/src/org/eclipse/equinox/launcher/Main.java
+++ b/bundles/org.eclipse.equinox.launcher/src/org/eclipse/equinox/launcher/Main.java
@@ -138,6 +138,8 @@ public class Main {
private static final String NAME = "-name"; //$NON-NLS-1$
private static final String LAUNCHER = "-launcher"; //$NON-NLS-1$
private static final String LIBRARY = "--launcher.library"; //$NON-NLS-1$
+ private static final String APPEND_VMARGS = "--launcher.appendVmargs";
+ private static final String OVERRIDE_VMARGS = "--launcher.overrideVmargs";
private static final String NL = "-nl"; //$NON-NLS-1$
private static final String ENDSPLASH = "-endsplash"; //$NON-NLS-1$
private static final String SPLASH_IMAGE = "splash.bmp"; //$NON-NLS-1$
@@ -1621,6 +1623,11 @@ public class Main {
found = true;
}
+ //just consume the --launcher.overrideVmargs and --launcher.appendVmargs
+ if (args[i - 1].equalsIgnoreCase(APPEND_VMARGS) || args[i - 1].equalsIgnoreCase(OVERRIDE_VMARGS)) {
+ found = true;
+ }
+
if (args[i - 1].equalsIgnoreCase(LIBRARY)) {
library = arg;
found = true;

Back to the top