Skip to content

Commit

Permalink
Allow enabling and disabling of reloading agent via build.gradle
Browse files Browse the repository at this point in the history
  • Loading branch information
graemerocher committed Jan 26, 2016
1 parent 763d583 commit a60670e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 19 deletions.
Expand Up @@ -34,28 +34,30 @@ class AgentTasksEnhancer implements Action<Project> {
private void addAgent(Project project, JavaExec exec, File agent) {

GrailsExtension.Agent agentConfig = project.extensions.findByType(GrailsExtension)?.agent ?: new GrailsExtension.Agent()
if(agentConfig.enabled) {
exec.jvmArgs "-javaagent:${agentConfig.path?.absolutePath ?: agent.absolutePath}"

exec.jvmArgs "-javaagent:${agentConfig.path?.absolutePath ?: agent.absolutePath}"
for(arg in agentConfig.jvmArgs) {
exec.jvmArgs arg
}
for(entry in agentConfig.systemProperties) {
exec.systemProperty(entry.key, entry.value)
}

for(arg in agentConfig.jvmArgs) {
exec.jvmArgs arg
}
for(entry in agentConfig.systemProperties) {
exec.systemProperty(entry.key, entry.value)
Map<String, String> agentArgs= [
inclusions: agentConfig.inclusions,
synchronize: String.valueOf( agentConfig.synchronize ),
allowSplitPackages: String.valueOf( agentConfig.allowSplitPackages ),
cacheDir: agentConfig.cacheDir ? project.mkdir(agentConfig.cacheDir) : project.mkdir("build/springloaded")
]
if(agentConfig.logging != null) {
agentArgs.put("logging", String.valueOf(agentConfig.logging))
}
if(agentConfig.exclusions) {
agentArgs.put('exclusions', agentConfig.exclusions)
}
exec.systemProperty('springloaded', agentArgs.collect { entry -> "$entry.key=$entry.value"}.join(';'))
}

Map<String, String> agentArgs= [
inclusions: agentConfig.inclusions,
synchronize: String.valueOf( agentConfig.synchronize ),
allowSplitPackages: String.valueOf( agentConfig.allowSplitPackages ),
cacheDir: agentConfig.cacheDir ? project.mkdir(agentConfig.cacheDir) : project.mkdir("build/springloaded")
]
if(agentConfig.logging != null) {
agentArgs.put("logging", String.valueOf(agentConfig.logging))
}
if(agentConfig.exclusions) {
agentArgs.put('exclusions', agentConfig.exclusions)
}
exec.systemProperty('springloaded', agentArgs.collect { entry -> "$entry.key=$entry.value"}.join(';'))
}
}
Expand Up @@ -41,6 +41,7 @@ class GrailsExtension {
* Configuration for the reloading agent
*/
static class Agent {
boolean enabled = true
File path
String inclusions = "grails.plugins..*"
String exclusions
Expand Down

0 comments on commit a60670e

Please sign in to comment.