The Build Process
The build process converts the clauses in object definitions into a form that can be executed. The build process also runs the type inferencing process on all of the expressions in the document, which speeds up execution of commands and unit tests. At the end of the build process, the rendering of any open modules is updated to reflect any changes to the renderings in object definitions.
Clauses can contain objects that are not directly executable. Examples include the And, Or, and Where objects. These objects are converted into executable objects during the build process. The process is similar to compiling and building code in other programming languages, but here we are not compiling all the way to executable code.
The build process runs when a file is first loaded and can also be started by selecting Build (F6) or Build All (Ctrl + F6) from the File menu.
When changes are made to object definitions in Object Modules, the application will indicate that a build is pending. you will see <B> at the end of the title at the top of the main window. There is also an indicator with a Build button at the bottom of the Document Explorer window when a build is pending. The Document Explorer window shows a progress bar indicating the build progress while the build is running.
Any changes made to object definitions won't be reflected in the processing (commands and unit tests for example) until the next time the document is built. This is also true for changes to the renderings in object definitions. The changes won't be applied to expressions in the document and libraries until after a build occurs. The rendering of any objects that have changed will be updated when the build is complete.
You can build the document by pressing F6 or by selecting Build from the File menu, or by selecting the Build button at the bottom of the Document Explorer window. The Build command only builds objects that have changed since the last build. The Build All command builds everything, repeating the build process that runs when a document is first loaded.
If any of the functions in the Sym or Build namespaces are modified then a complete build of all objects is required. In this case both Build and Build All run the full build process.
- Validation
- Initialize the functions used in type inferencing
- Setup the functions that autogenerate object definitions
- Call the GetVariableTypes function
- Type inference and build all of the clauses in the object definitions
Errors during the build process
If an error occurs during the build processing, an error message is added to the Error List viewer. In most cases, the information captured in the error message includes the function call that generated the error. In these cases, you can right click on the error and select Generate Execution Details to run the function that generated the error again and capture the details during the execution. The details are added to the Execution Details window after the function finishes executing.
Cancelling a build
You can cancel a build while it's running. Normally, this would only be done if the build is taking a very long time because it's generating a large number of errors.
After cancelling a build, you can still do things like executing commands and running unit tests. Any functions that are required will be built as needed during the execution of the command or unit test.
Note about modifying build functions and type inferencing functions
The build process needs to have a working type inferencer and the type inferencer uses functions that need to be built before it can do type inferencing. As a result, there is some special processing needed to beginning of a build. In order for the initialization of the build process to work correctly, any functions used by the type inferencer must be in the Sym namespace and any functions used in the build process must be in the Build namespace.
If you modify the code in either the build functions or type inferencing functions, any new functions referenced in clauses of these functions MUST be in the Build or Sym namespace, respectively, or the build process is likely to fail.