Need help with establishing tasks dependencies

(guai) #1

I have a project on netbeans platform. There is a gradle plugin, which builds netbeans’ nbm modules.
Netbeans also have junit-based test framework, which can run tests inside well-established netbeans’ environment.
So what am I doing is making another one test task calling nbtest to which I include *NbTest classes and simultaniously I exclude them from default test task. (Some tests does not need netbeans environment, so this way I can have simple junit tests too)
It works fine.
But there is a problem:
When test sources being changed test task (with some help of it’s predecessors I think) rebuilds test classes. And I need first pack them with netbeans task and only then run my nbtest. Or else my test will be run against classes inside old nbm module, which was build last time I called netbeans task explicitly.
So I need something like: when test task rebuilds the classes then first call netbeans task and then nbtest task. And I also do not want to type gradle netbeans nbtest all the time, I want just gradle nbtest and it to detect all the things automatically.
And there is also an obstacle: netbeans task does not detect if it is UP-TO-DATE, so I cannot bind them unconditionally or else it will lead to time waisting on every launch.