Debian Codegraph @

tools/internal/check_packages/README.md

raw symbols SCIP
1 # Check that Castle Game Engine Lazarus (.lpk) and Delphi (.dpk, .dproj) packages are correct
2
3 In particular check that they contain all files they should, and none of the files they shouldn't. This checks:
4
5 - The packages are complete. Missing files from packages, while not critical, is bothersome E.g. Lazarus will not auto-recompile package if you change a file that wasn't explicitly listed in .lpk.
6
7 - The package doesn't use something it should not. E.g. castle_base.lpk should not use any files from src/window/, as they depend on CastleWindow, and castle_base.lpk deliberately doesn't depend on CastleWindow.
8
9 See https://castle-engine.io/units_map about CGE subdirectories.
10
11 Using [Castle Game Engine](https://castle-engine.io/).
12
13 ## Adjusting the tool for your own projects
14
15 While this is an internal CGE tool, it could be useful for other projects as well. The tool can be compiled with both <em>FPC</em> and <em>Delphi</em> (and regardless of the compiler, it can check both <em>Lazarus</em> and <em>Delphi</em> packages).
16
17 The core part happens in the main program, that defines what packages to check are requirements to watch:
18
19 ```delphi
20 Package := TLazarusPackage.Create('foo.lpk');
21 try
22 Package.CheckFiles([
23 'src/required_units/', // dir
24 'src/specific_required_unit.pas', // file
25 'src/required*.pas' // files, as mask
26 ],
27 [
28 'src/required_units/exceptions_to_not_include/', // dir
29 'src/required_units/specific_exception_to_not_include.pas' // file
30 ],
31 [
32 'src/optional_units/', // dir
33 'src/specific_optional_unit.pas' // file
34 ]);
35 finally FreeAndNil(Package) end;
36
37 Package := TDelphiPackage.Create('bar.dpk');
38 try
39 Package.CheckFiles([
40 'src/required_units/', // dir
41 'src/specific_required_unit.pas' // file
42 ],
43 [
44 'src/required_units/exceptions_to_not_include/', // dir
45 'src/required_units/specific_exception_to_not_include.pas'
46 ],
47 [
48 'src/optional_units/', // dir
49 'src/specific_optional_unit.pas' // file
50 ]);
51 finally FreeAndNil(Package) end;
52 ```
53
54 You may be able to just copy this project, and adjust the main piece to check your own packages.
55
56 ## Building
57
58 Compile by:
59
60 - [CGE editor](https://castle-engine.io/editor). Just use menu items _"Compile"_ or _"Compile And Run"_.
61
62 - Or use [CGE command-line build tool](https://castle-engine.io/build_tool). Run `castle-engine compile` in this directory.
63
64 - Or use [Lazarus](https://www.lazarus-ide.org/). Open in Lazarus `check_packages.lpi` file and compile / run from Lazarus. Make sure to first register [CGE Lazarus packages](https://castle-engine.io/lazarus).
65
66 - Or use [Delphi](https://www.embarcadero.com/products/Delphi). Open in Delphi `check_packages.dproj` file and compile / run from Delphi. See [CGE and Delphi](https://castle-engine.io/delphi) documentation for details.