Skip to content

TBuildEngine

Main build engine for compiling and installing packages

Declaration

Source position: fpmkunit.pp line 1354

type

  TBuildEngine = class(TComponent)
  public
    constructor Create;
    destructor Destroy;
    function AddPathPrefix : string;
    property Verbose: Boolean; {rw}
    property Interactive: Boolean; {rw}
    procedure ResolveFileNames;
    procedure ClearResolvedFileNames;
    procedure ExecuteCommand;
    function GetExecuteCommandOutput : string;
    procedure CmdCopyFiles;
    procedure CmdCreateDir;
    procedure CmdMoveFiles;
    procedure CmdDeleteFiles;
    procedure CmdDeleteDestFiles;
    procedure CmdArchiveFiles;
    procedure CmdRenameFile;
    procedure CmdRemoveDirs;
    procedure CmdRemoveTrees;
    procedure ExecuteCommands;
    function DependencyOK : Boolean;
    function GetCompilerCommand(APackage: TPackage; ATarget: TTarget; 
                           Env: TStrings) : string;
    procedure GetCompilerCommand(Args: TStrings; APackage: TPackage; 
                            ATarget: TTarget; Env: TStrings);
    function TargetOK(ATarget: TTarget; ACPU: TCpu; AOS: TOS; 
                 const aSubTarget: string) : Boolean;
    function TargetOK(ATarget: TTarget; 
                 const aCompileTarget: TCompileTarget) : Boolean;
    function TargetInstallOK(ATarget: TTarget; ACPU: TCpu; AOS: TOS; 
                        const aSubTarget: string) : Boolean;
    function TargetInstallOK(ATarget: TTarget; 
                        const aCompileTarget: TCompileTarget) : Boolean;
    function NeedsCompile(APackage: TPackage; ATarget: TTarget) : Boolean;
    function NeedsCompile(APackage: TPackage) : Boolean;
    procedure Compile(APackage: TPackage; ATarget: TTarget);
    procedure Compile(APackage: TPackage);
    procedure Compile(Packages: TPackages);
    procedure MaybeCompile(APackage: TPackage; ATarget: TTarget);
    procedure MaybeCompile(APackage: TPackage);
    procedure CompileDependencies(APackage: TPackage; ATarget: TTarget);
    procedure CompileDependencies(APackage: TPackage);
    function PackageOK : Boolean;
    procedure DoBeforeCompile;
    procedure DoAfterCompile;
    procedure DoBeforeInstall;
    procedure DoAfterInstall;
    procedure DoBeforeArchive;
    procedure DoAfterArchive;
    procedure DoBeforeClean;
    procedure DoAfterClean;
    function ReadyToCompile : Boolean;
    procedure Install(APackage: TPackage; AnArchiveFiles: Boolean);
    procedure Install(Packages: TPackages);
    procedure UnInstall(APackage: TPackage);
    procedure UnInstall(Packages: TPackages);
    procedure Archive(APackage: TPackage);
    procedure Archive(Packages: TPackages);
    procedure PkgList(PkgList: TStrings; APackage: TPackage);
    procedure PkgList(Packages: TPackages);
    procedure Clean(APackage: TPackage; AllTargets: Boolean);
    procedure Clean(APackage: TPackage; const aTarget: TCompileTarget);
    procedure Clean(Packages: TPackages; AllTargets: Boolean);
    procedure CleanDocumentation;
    function GetFPDocOutputName : string;
    procedure Documentation(APackage: TPackage);
    procedure Documentation(Packages: TPackages);
    function CheckDependencies : TCheckDependencyResult;
    function CheckExternalPackage : TPackage;
    procedure CreateOutputDir;
    procedure ZipInstall;
    procedure Manifest;
    procedure FPDocProject;
    procedure Log(Level: TVerboseLevel; Msg: string);
    procedure Log(Level: TVerboseLevel; Fmt: string; 
             const Args: Array of const);
    property ListMode: Boolean; {rw}
    property ForceCompile: Boolean; {rw}
    property ExternalPackages: TPackages; {r}
    property StartDir: string; {r}
    property NotifyEventCollection: TNotifyEventCollection; {r}
    property OnLog: TLogEvent; {rw}
  end;

Description

TBuildEngine is the central component that orchestrates the entire build process for fpmake packages. It manages compilation, dependency resolution, file operations, and installation procedures.

The build engine provides the following functionality:

  • Package compilation with dependency resolution
  • Cross-platform build support
  • File operations (copy, move, delete, archive)
  • Installation and uninstallation procedures
  • Clean and archive operations
  • Multi-threaded compilation support
  • Command execution and logging

The engine works with TPackage objects to compile targets, resolve dependencies, and manage the entire build lifecycle from compilation through installation.

Properties

Member Visibility Description
ExternalPackages read only public Collection of external package dependencies
ForceCompile public Whether to force recompilation of all targets
Interactive public Whether the build engine runs in interactive mode
ListMode public Mode for listing package information
NotifyEventCollection read only public Collection of notification event handlers
StartDir read only public Starting directory for build operations
Verbose public Controls verbose output during build operations
See all Properties

Methods

Member Visibility Description
AddPathPrefix public Adds package-specific path prefix to a path
Archive public Creates archive of package files
CheckDependencies public Checks package dependencies are satisfied
CheckExternalPackage public Checks if external package is available
Clean public Cleans compiled files and outputs
CleanDocumentation public
ClearResolvedFileNames public Clears resolved file name cache for a package
CmdArchiveFiles public Creates archive file containing specified files
CmdCopyFiles public Copies files to destination directory
CmdCreateDir public Creates a directory with necessary parent directories
CmdDeleteDestFiles public Deletes files from destination directory
CmdDeleteFiles public Deletes files from filesystem
CmdMoveFiles public Moves files to destination directory
CmdRemoveDirs public Removes directories from the filesystem
CmdRemoveTrees public Removes directory trees from the filesystem
CmdRenameFile public Renames or moves a file to new location
Compile public Compiles a specific target within a package
CompileDependencies public Compiles all dependencies for a target
Create public Creates a new build engine instance
CreateOutputDir public Creates output directory for package
DependencyOK public Checks if dependency is satisfied
Destroy public Destroys the build engine and frees resources
DoAfterArchive public Executes actions after package archiving
DoAfterClean public Executes actions after package cleaning
DoAfterCompile public Executes actions after package compilation
DoAfterInstall public Executes actions after package installation
DoBeforeArchive public Executes actions before package archiving
DoBeforeClean public Executes actions before package cleaning
DoBeforeCompile public Executes actions before package compilation
DoBeforeInstall public Executes actions before package installation
Documentation public
ExecuteCommand public Executes a command with arguments and environment variables
ExecuteCommands public Executes a collection of build commands
FPDocProject public Generates FPDoc documentation project
GetCompilerCommand public Gets compiler command for target
GetExecuteCommandOutput public Executes command and captures output text
GetFPDocOutputName public
Install public Installs package files to target location
Log public Logs message with specified level and formatting
Manifest public Creates manifest of package contents
MaybeCompile public Compiles target if compilation is needed
NeedsCompile public Checks if target needs compilation
PackageOK public Checks if package is valid for compilation
PkgList public Lists package contents and information
ReadyToCompile public Checks if package is ready for compilation
ResolveFileNames public Resolves and validates file paths for package targets
TargetInstallOK public Checks if target can be installed on platform
TargetOK public Checks if target is valid for platform
UnInstall public Uninstalls package files from target location
ZipInstall public Creates ZIP archive during installation
See all Methods

Events

Member Visibility Description
OnLog public Event handler for logging messages
See all Events

See also

Name Description
TPackage Central class for package management and building
TTarget Build target representation in the fpmake system
TCustomDefaults Base class for build system default configurations
TCustomInstaller Base class for package installers