How to create custom build rules for generated code?

I have an external tool that generates code files from XML. I would like to integrate this tool into the Unreal build process.

Specifically, I want to:

  • Define a build rule that launches the external tool to generate some code
  • Execute the build rule only when the source XML is more recent than the output code

This is the equivalent of creating a custom rule in Visual Studio.

Anyone know how?