How to make WindowsResourceCompile Task depend on custom Task?


(Jan Jörke) #1


i want to generate an input file for the WindowsResourceCompile tasks of my cpp project, which is dependent on the project version, buildType, etc. Therefore i try to create new tasks and make the WindowsResourceCompile tasks depend on them. Unfortunately i was unable to figure out, how to access the WindowsResourceCompile tasks. I tried the following:

@Mutate void createTasks(ModelMap<Task> tasks, ComponentSpecContainer components) {
    components.each { ComponentSpec componentSpec ->
        componentSpec.binaries.each { BinarySpec binarySpec ->
            binarySpec.tasks.each { Task task ->
                if(task instanceof WindowsResourceCompile) {
                    // do stuff (WindowsResourceCompile tasks have not created yet)

I suspect the necessary rules for creating the WindowsResourceCompile task have not been fired, when my mutation rule is evaluated.

Are my inputs for the mutation rule not sufficient? Is there another way to make my custom tasks depend ont the WindowsResourceCompile tasks?