Ordering for a Domain Object

I’m using what’s called Domain Objects (section 39.6 of the 2.11 User Guide), to build objects that define which types of tasks get configured and how. It works OK… I likely would have used the new Software Model had it been around when I wrote this. What’s nice about this is users can use a standard closure in the build script to change the parameters of these types, and therefore determine the configuration of the jobs. I use an all method on the domain controller to create a closure where I loop through and configure all the jobs.

I recently modified the code in the main plugin class to add dependencies during the configuration. However… what I didn’t realize until now is the order of the entries in the Domain Object container… it’s always alphabetic. There doesn’t seem to be any way to change this. Now, using the same configuration closure to also add dependencies, I need to control the order in which these items run. Is there any way to do this? The NamedDomainObjectContainer seems to be reasonably adamant about being sorted by name.

Thank you.

Could you provide a simple example of what you’re trying to do?

What sort of “dependencies” are you adding?

Sorry Sterling… I should have used more exact text. I’m adding Task Dependencies… So project.task1.dependsOn. The problem is, that the task I want to depend on may not be created yet… thus the need for ordering.

If that explains it, then great. In the meantime I’ll work up a simple test case to demonstrate.

If you know the name of the task, you can just use that (pass a String to dependsOn). I’m assuming that you’re looking up the Task object right now by its name.