thanks Stefan,
I played around with workerExecutor a little bit and I wonder if you could help me convert from @ParalleliableTask syntax to workerExecutor syntax
Originally I have something like this:
@ParallelizableTask
class CustomExec extends DefaultTask {
@TaskAction
public exec() {
project.exec {
commandLine cmdArgs
}
}
}
now with WorkerExecutor, how do I pass the project variable to the Runnable?
class CustomExec extends DefaultTask {
public class CustomExecRunnable implements Runnable {
@Inject
public CustomExecRunnable(cmdArgs) {
this.cmdArgs = cmdArgs
}
public void run() {
// I tried to pass this project through workerExecutor.submit
// and it complains that project_decorated is not serializable
project.exec {
}
}
}
@TaskAction
public exec() {
workerExecutor.submit(CustomExecRunnable.class) {
params = [cmdArgs] // project can't be passed to the thread through params
}
}
}
or maybe, I should word the question as is there any other way to pass the exec closure to the CustomExecRunnable? or should I implement my customExec in different way so it’s easier to work with workerExecutor?
thanks
much appreciated
Tony