Permalink
Browse files

GRIFFON-507 allow additional JVM opts to be specified before running …

…an application
  • Loading branch information...
1 parent c2327bb commit c96b49fb1b7f74505d51afa84a261fb9421155e5 @aalmiray aalmiray committed May 9, 2012
@@ -53,6 +53,7 @@ target('doRunApp': "Runs the application from the command line") {
javaVM = [javaHome, 'bin', 'java'].join(File.separator)
}
+ def jvmOpts = setupJvmOpts()
def javaOpts = setupJavaOpts(true)
if (argsMap.containsKey('debug')) {
argsMap['debug-port'] = argsMap.debugPort
@@ -85,6 +86,7 @@ target('doRunApp': "Runs the application from the command line") {
}
debug("Running JVM options:")
+ jvmOpts.each { debug(" $it") }
javaOpts.each { debug(" $it") }
sysProperties.'griffon.application.name' = getNaturalName(griffonAppName)
@@ -106,6 +108,7 @@ target('doRunApp': "Runs the application from the command line") {
try {
def cmd = [javaVM]
// let's make sure no empty/null String is added
+ jvmOpts.each { s -> if (s) cmd << s }
javaOpts.each { s -> if (s) cmd << s }
sysprops.each { s -> if (s) cmd << s }
[proxySettings, '-classpath', runtimeClasspath, griffonApplicationClass].each { s -> if (s) cmd << s }
@@ -142,6 +142,20 @@ setupJavaOpts = { includeNative = true ->
return javaOpts
}
+setupJvmOpts = {
+ def jvmOpts = []
+
+ if (buildConfig.griffon.app?.jvmOpts) {
+ buildConfig.griffon.app?.jvmOpts.each { jvmOpts << it }
+ }
+ argsMap['jvm-opts'] = argsMap.jvmOpts
+ if (argsMap['jvm-opts']) {
+ jvmOpts << argsMap['jvm-opts']
+ }
+
+ return jvmOpts
+}
+
normalizePathQuotes = { s ->
s.split(File.pathSeparator).collect { String path ->
(path.startsWith('"') && path.endsWith('"')) || (path.startsWith("'") && path.endsWith("'")) ? path[1..-2] : path
@@ -682,8 +682,8 @@ copyPlatformJars = { srcdir, destdir ->
if (!platformDir.exists() && is64Bit) plf -= '64'
_copyPlatformJars(srcdir.toString(), destdir.toString(), plf)
} else {
- doForAllPlatforms { key, value ->
- _copyPlatformJars(srcdir.toString(), destdir.toString(), key)
+ doForAllPlatforms { osdir, osname ->
+ _copyPlatformJars(srcdir.toString(), destdir.toString(),osname)
}
}
}
@@ -709,8 +709,8 @@ copyNativeLibs = { srcdir, destdir ->
if (!platformDir.exists() && is64Bit) plf -= '64'
_copyNativeLibs(srcdir.toString(), destdir.toString(), plf)
} else {
- doForAllPlatforms { key, value ->
- _copyNativeLibs(srcdir.toString(), destdir.toString(), key)
+ doForAllPlatforms { osdir, osname ->
+ _copyNativeLibs(srcdir.toString(), destdir.toString(), osname)
}
}
}

0 comments on commit c96b49f

Please sign in to comment.