33.8. Loading Abuild Interfaces

When abuild prepares to build, it creates the base Interface object by reading private/base.interface from the abuild distribution. Then, for every item that is a plugin in any known build tree (remember: an item can be a plugin in one build tree but not in another because plugin status is not inherited through tree dependencies), abuild creates an InterfaceParser object, imports the base interface, and loads the plugin's plugin.interface file, if any. Plugins' interface files are not allowed to have after-build files, so it is an error if any are declared.

After this preparation has been done, abuild constructs the build graph (see Section 33.6, “Construction of the Build Graph”.) and traverses the graph in dependency order to build each build item/platform pair. For each build item/platform pair, abuild creates an InterfaceParser object and retrieves the underlying Interface object. Before loading that item's Abuild.interface file, if any, abuild first imports the base interface and the interfaces for any plugin that pertains to this build item. (These would be all items that were declared as plugins in the build item's home build tree.) Then it imports the interfaces of all of its direct dependencies which, as nodes in the build graph, are actually build item/platform pairs. Those interfaces, therefore, already include the interfaces of their direct dependencies, and so forth—this is how we achieve the effect of having each build item read the interfaces of its entire dependency chain.

Once this has been done, abuild performs override assignments for all variables that are specific to the build item (ABUILD_THIS, ABUILD_OUTPUT_DIR, etc.) and then uses the InterfaceParser object to load the item's own Abuild.interface file. At this point, the build item's interface is in the state required to build the item itself, so we perform the build. If the build succeeds, we then see whether the Abuild.interface had any any after-build statements. If so, we use the same InterfaceParser object to load those, verifying that each one has no after-build declarations of its own. The resulting Interface object is then stored with the build item by platform so that it can be imported by items that depend on it.