But project.properties.profilingEnabled doesn't throw an exception, right? ~~ Robert.
On Wed, May 16, 2012 at 12:17 PM, Luke Daley <[email protected]> wrote: > > On 16/05/2012, at 6:01 PM, phil swenson wrote: > >> Dunno why I thought I needed "hasProperty" > > Because doing project.profilingEnabled will throw an exception if that > property hasn't been set. All of the example code uses hasProperty. > >> But if I pass in -PprofilingEnabled=false, groovy would evaluate >> project.profilingEnabled as true because the property is a string set >> to "false" >> >> In other words, in a conditional groovy evaluates "false" as true. >> >> groovy> value = "false" >> groovy> if (value){ >> groovy> println "true" >> groovy> } >> true >> >> I think I need to do this: >> if (project.properties.profilingEnabled == "true"){ >> runAEJvmArguments << "-agentlib:yjpagent" >> } > > Correct, depending on how exact you need to be. > > You could do: > > if (Boolean.valueOf(project.properties.profilingEnabled)){ > runAEJvmArguments << "-agentlib:yjpagent" > } > > > -- > Luke Daley > Principal Engineer, Gradleware > http://gradleware.com > > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
