Unit Utils.Check

Description

Unit which checks the layout of a project or package against its file: the folders with units that are not in the search paths of every build mode, and for a package the units that are not in its files and the files that no longer exist, and the search paths that do not exist, like the modules folder of a workspace that was moved or not installed. FPC does not search the unit folders recursively and a package only compiles the units it lists, so each case would only fail later, with "Can't find unit" at the first uses that reaches it, or not at all while the old .ppu files are still in lib.

Overview

Classes, Interfaces, Objects and Records

Name Description
Record TBuildModePaths The search paths of a build mode.

Functions and Procedures

function GetBuildModesPaths(const AProjectFile: string): TBuildModesPaths;
function GetUnitFolders(const AProjectDir: string): TArray<string>;
function GetPackageFiles(const APackageFile: string): TArray<string>;
function CheckProject(const AProjectFile, ABaseDir: string): TArray<string>;
function CheckWorkspaceModules(const AWorkspaceDir: string; const AMemberDirs: TArray<string>): TArray<string>;

Types

TBuildModesPaths = TArray<TBuildModePaths>;

Description

Functions and Procedures

function GetBuildModesPaths(const AProjectFile: string): TBuildModesPaths;

Returns the search paths of each build mode of a .lpi, or the search paths of a .lpk. A build mode without compiler options of its own uses the ones of the project.

Parameters
AProjectFile
.lpi or .lpk file.
function GetUnitFolders(const AProjectDir: string): TArray<string>;

Returns the folders under the project folder that have units (.pas or .pp), not the project folder itself, which is always searched. Hidden, lib, backup, modules and tests folders are skipped, and so are the folders with a project or package of their own.

Parameters
AProjectDir
Project or package folder.
function GetPackageFiles(const APackageFile: string): TArray<string>;

Returns the absolute files listed in the Files of a .lpk.

Parameters
APackageFile
.lpk file.
function CheckProject(const AProjectFile, ABaseDir: string): TArray<string>;

Checks a project or package and returns one warning per problem found, with the paths relative to ABaseDir. A search path under the modules folder of ABaseDir that does not exist comes with the hint to run pasc deps. Returns empty when there is nothing to fix.

Parameters
AProjectFile
.lpi or .lpk file.
ABaseDir
Folder the paths of the warnings are relative to, like the workspace root.
function CheckWorkspaceModules(const AWorkspaceDir: string; const AMemberDirs: TArray<string>): TArray<string>;

Checks the modules folder of a workspace and returns one warning per problem found: a modules folder out of place, under apps, packages or a member, where pasc deps does not install the dependencies; no modules folder at the root while boss.json has dependencies; and modules recorded in boss-lock.json that are not in the modules folder.

Parameters
AWorkspaceDir
Workspace root folder.
AMemberDirs
Folders of the workspace members.

Types

TBuildModesPaths = TArray<TBuildModePaths>;

This item has no description.


Generated by PasDoc 1.0.4.