Check

Description

Checks the projects and packages for units that lazbuild would not find. FPC does not search the unit folders recursively, and a package only compiles the units listed in its files, so these problems only show up later, as Can't find unit at the first uses that reaches the unit, after the build of every member before it.

Example:

pasc check

In a workspace it checks every member and its test project; outside of one, the project in the current folder and its test project. Each problem is a warning with the path to add or to remove:

In a workspace, it also checks the modules folder, where pasc deps installs the dependencies of every member:

Without these checks, a moved or missing modules folder goes unnoticed while the old .ppu files are still in lib, and later shows up only as a Can't find unit in the lazbuild output.

Warning packages/core/src/core.rules.pas is not in the Files of core.lpk, add it to the package
Warning apps/app/extra has units but is not in the search paths of app.lpi (Release), add extra to its OtherUnitFiles
Warning apps/cmd/tests/Testcmd.lpi (Default): search paths ../../../modules/github_com_HashLoad_horse/src, ../../../modules/github_com_laprado_pascli/src do not exist, run pasc deps to install the dependencies
  Check 3 problems found

The exit code is 1 when there is any problem, so it can be used in a CI. Some folders hold units that are deliberately not compiled, like platform specific code: they are reported too, and can be ignored.

Build and test

In a workspace, pasc build and pasc test show the same warnings before calling lazbuild, without stopping. When the build of a member fails, the summary of pasc test shows the first error of the compiler, like Not run cmd: TestCommandGreet.pas(11,3) Fatal: Can't find unit Command.Interfaces used by TestCommandGreet. Before that, they add the folders with units under src of each app to its search paths and to those of its test project, as pasc deps does, so those folders are never reported.

Next Clean Command


Generated by PasDoc 1.0.4.