SPFE Documentation | Collections > SPFE Development > How the build system works

How the build system works

The SPFE build system has a modular architecture with four major stages, synthesis, presentation, formatting, and encoding.

Figure 1   The SPFE build system

An overview of the SPFE build system.

The build tool for a SPFE build is a Python program called spfe. This script takes three parameters, a build command, the path to a content set configuration file, and a build type (either “draft” or “final”). It reads the specified configuration file, resolves any inclusions, and creates the following files:

  1. A fully resolved configuration file. This file is created in the subdirectory config under the build directory. This configuration file is passed to every script in the rest of the build process, making all the relevant configuration information available to all scripts. This allows the scripts to have a uniform interface, which reduces the need to customize build rules when writing your own scripts.

  2. A generated XSLT script file for each stage of the build. These files are generated by creating a wrapper file that imports each script listed in the appropriate sections of the configuration element /topic-type/scripts, /output-format/scripts, and /object-type/scripts. These generated scripts are created in the build directory.

Next, the spfe build tool runs each stage of the build process.

The order of operations for the build is as follows:

  1. Run the synthesis stage for each topic set in turn in the order they are listed in the /content-set/topic-sets configuration setting. This involved running the extract, merge, resolve, toc, and link catalog scripts for each topic set in turn. Running the scripts in the order in which the topic sets are defined is important because it allows the scripts of later topic sets to access the synthesis, tocs, and link catalogs of the earlier topics. This is used, for instance, to generate subject list topics that draw from the entire content set.

  2. Run the presentation stage for each topic set in the content set in turn. If there are different presentation processes for different output media, each will be run in turn.

  3. Run the formatting stage for each topic set in the content set in turn. If there are multiple output formats being built, each will be run in turn.

  4. Run the encoding stage for each topic set in the content set in turn, if required.

The following build command are available:

If you make changes to scripts or configuration files, you should always run clean before building a new draft, since the dependency checking in the build does not cover the scripts and configuration file. If you don't see the changes you expect as the result of any change you have made, try running -clean and run the build again. If you see a patterns of changes not being recognized without running -clean please report this issue.