alliedmodders / ambuild

AlliedModders C++ Build System
BSD 3-Clause "New" or "Revised" License
61 stars 32 forks source link

Add an ALWAYS_RUN bit to support prebuild steps. #39

Closed dvander closed 8 years ago

dvander commented 8 years ago

Right now AMBuild does not support prebuild steps - something that runs before every build, no matter what. Arbitrary steps are sort of contrary to our design, since we don't want to mess with the output folder outside of AMBuild's graph structure.

However we can introduce the concept of a command that is "always dirty". Like normal commands, these would still have outputs and still be well-ordered with respect to their dependent commands. However they would be guaranteed to run on every build, and their dirty bit would never be removed.

This patch introduces an ALWAYS_DIRTY nonce on Context objects, which can be passed to the input parameter of AddCommand. Always-dirty commands will not necessarily run as the first step on every build, but they will always run. Like normal commands they'll also run in parallel with non-dependent tasks.

The flag is experimental and may be deprecated for something better - at the moment, I'm hesitant to wrap this in a new API call, names like "AddPrebuildStep" would imply an ordering. But the flag works for now and would not be removed from the 2.1 API.