Using evaluate() to retrieve dynaimcally generated property names

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Using evaluate() to retrieve dynaimcally generated property names

khylo
This post has NOT been accepted by the mailing list yet.
Hi,

I'm writing a simple script where I want to dynamically generate property names. However when I call evaluate() the property name isn't getting resolved. e.g.

test.gradle
println "myVar = project.win${task}  :: Res = ${project.winstart}"
evaluate "myVar = project.win${task}"

CmdLine
> gradle -Pwinstart="Gogogo.bat" -Ptask=start -b test.gradle test
myVar = project.winstart  :: Res = Gogogo.bat

FAILURE: Build failed with an exception.

* Where:
Build file 'test.gradle' line: 2

* What went wrong:
A problem occurred evaluating root project 'cccp'.
> No such property: project for class: Script1

So the varialbe print out correctly on line 1, but fail on line 2.

Any ideas?