Some tools like purify must be executed against the compile or link step when building an executable. This isn't currently supported in cc-tasks, as there isn't a way to directly access the command line. It would be useful if cc-tasks provided a way to prepend arbitrary commands before the compile or link commands when executing requests.
The following is a rough proposal for a syntax for supporting decorators (in this case, demonstrating a link decorator, however it would look the same for a compile decorator:
<project name="test" default="test1" xmlns:cpp="antlib:net.sf.antcontrib.cpptasks">
<cpp:linker name="msvc" id="link1">
<decorator command="A.bat">
<arg value="/1" />
</decorator>
</cpp:linker>
<cpp:linker extends="link1" id="link2">
<decorator command="B.bat">
<arg value="/2" />
</decorator>
</cpp:linker>
<target name="test1">
<echo>Hello World</echo>
<mkdir dir="obj" />
<cpp:cc objdir="obj" outfile="foo.exe" outtype="executable" subsystem="console">
<compiler name="msvc">
</compiler>
<linker extends="link2">
<decorator command="C.bat" />
<decorator command="D.bat" />
</linker>
<fileset dir="src" id="id">
<include name="*.cpp" />
</fileset>
</cpp:cc>
</target>
</project>
When linking, this would produce a command-line like the following:
D.bat C.bat B.bat /2 A.bat /1 link /NOLOGO /SUBSYSTEM:CONSOLE /INCREMENTAL:NO /OUT:foo.exe.exe obj\main.obj
A prototype implementation for the API above is defined in the attached diff.
decorator implementation prototype.