Should I add new subtype for a toolchain or extend an already existing one?


We have custom code generation tool that generates cpp and cs code from some txt files, and I was wondering what would be the best way to implement this.

Regards, Ante

For a tool that generates source files, you probably don’t want to add a new tool chain. (The infrastructure doesn’t currently make this easy to do, and it’s not really necessary).

Instead, just create a task type that takes the text files as inputs and generates the source outputs. Then you can define a CppSourceSet that is ‘generatedBy’ your task. See the ‘native-binaries/idl’ sample for an example. 

Thanks! Yeah that makes sense.

I have another question regarding tool chains and it concerns Csharp compiler. Are there any plans to support it? Would it make sense to add the Csharp compiler as a toolchain or is that better done with a task as well?

Regards, Ante

There are lots of changes going on which may help make ToolChains more extensible. At this stage you’re probably best just doing it with a task, although the “right” way will be to extend the ToolChain.