I have a class, say
class Foo {
def fooEcho()
echo "Hello Foo"
}
}
but of course this fails if I
Foo foo = new Foo()
foo.fooEcho()
because the Foo class doesn't know about Script echo() function. The general workaround is to do
class Foo {
Foo(Script s) {
this.script = s
}
def fooEcho() {
script.echo "Hello Foo"
}
def script = null
}
Foo foo = new Foo(this)
foo.fooEcho()
But this is ugly, and it means that I have to prepend ALL normal Script calls (echo, println, stage, etc.) with "script."
Can Foo be defined as
class Foo extends Script {
...
}