Configure a task with the execution result of another

Hi,

In a custom plugin, one the custom task calculate a value and place it in the extension of this plugin.

void apply(Project project) {
project.extensions.create(“myExtension”, MyExtension)

project.task(‘doSomeStuff’) << {

project.myExtension.myExtensionObject = myCalculatedObject

Another task use a field of myCalculatedObject

Task buildTar = project.tasks.create([name:“buildTar”, type:Tar, dependsOn: “doSomeStuff”]) {
// baseName = "${->project.myExtension.myCalculatedObject.getResolvedName()}"
from “files/”
}

Of course it does not work, as execution is after configuration. But how can I solve it in an elegant manner ?
Right now I am using doLast to rename the tar file to the correct file.

Regards,