Debian Codegraph @

tools/internal/check_packages/check_packages.dpr

raw
1 // -*- compile-command: "castle-engine compile --mode=debug && castle-engine run" -*-
2 {
3 Copyright 2021-2024 Michalis Kamburelis.
4
5 This file is part of "Castle Game Engine".
6
7 "Castle Game Engine" is free software; see the file COPYING.txt,
8 included in this distribution, for details about the copyright.
9
10 "Castle Game Engine" is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
14 ----------------------------------------------------------------------------
15 }
16
17 program check_packages;
18
19 {$ifdef MSWINDOWS} {$apptype CONSOLE} {$endif}
20
21 { Check Castle Game Engine Lazarus (.lpk) and Delphi (.dpk, .dproj) packages.
22 See README.md for more description. }
23
24 uses SysUtils, DOM, Classes,
25 CastleXmlUtils, CastleUtils, CastleFindFiles, CastleStringUtils, CastleParameters,
26 CastleLog, CastleApplicationProperties, CastleDownload,
27 PackageUtils;
28
29 var
30 CgePath: String = '../../../';
31 CgePathExpanded: String;
32 WarningsCount: Cardinal = 0;
33
34 const
35 TryFixing = false;
36
37 type
38 EInvalidPackage = class(Exception);
39
40 { Report warning.
41 Continue the work, but the test will exit with non-zero status signalling invalid package.
42 This way we report many problems in one go. }
43 procedure PackageWarning(const S: String; const Args: array of const);
44 begin
45 WriteLnWarning(Format(S, Args));
46 Inc(WarningsCount);
47 end;
48
49 { TPackage ------------------------------------------------------------------- }
50
51 type
52 { Abstract class that represents Lazarus or Delphi package.
53
54 Descendants:
55 - Must implement constructor to read PackageFileName file and fill Files.
56 May also extend ConsideredFilesMask.
57 - May override ProposeFix. }
58 TPackage = class
59 strict private
60 RequiredFilesList: TCastleStringList;
61 FPackageFileName: String;
62 procedure GatherRequiredFiles(const FileInfo: TFileInfo; var StopSearch: Boolean);
63 procedure ExcludeFromRequiredFiles(const FileInfo: TFileInfo; var StopSearch: Boolean);
64 protected
65 { List of filenames.
66 Relative to CGE root.
67 Use only slash (/) as path separator, for simplicity -- convert backslashes
68 to slashes when filling this list. }
69 Files: TCastleStringList;
70
71 { Filename masks (like *.pas) that must be present in packages
72 if found in CGE sources.
73 By default this contains just *.pas, and this is good enough for Delphi packages
74 that only include units.
75 For Lazarus packages, they should include also *.inc and some other files,
76 so descendant TLazarusPackage extends this. }
77 ConsideredFilesMask: TCastleStringList;
78
79 { If TryFixing, this will overwrite PackageFileName adding the missing units.
80
81 This automatic fix is not perfect, so beware! Known issues:
82
83 - It is implemented now only for Lazarus packages, not Delphi.
84 - It only adds missing files. Doesn't remove files that should not be in package.
85 - It can mess some initial LPK XML stuff, causing unnecessary edits. Revert them.
86 - Generated UnitName follows filename, so it is all lowercase.
87 - It doesn't add to units (because it doesn't know which are platform-specific)
88 <AddToUsesPkgSection Value="False"/>
89
90 Descendants: you can override this.
91 Do not call inherited when overriding (since this implementation makes
92 warning).
93 You can assume when this is called that TryFixing = true. }
94 procedure ProposeFix(const MissingFiles: TCastleStringList); virtual;
95 public
96 property PackageFileName: String read FPackageFileName;
97 constructor Create(const APackageFileName: String);
98 destructor Destroy; override;
99
100 { Check that package contains all files from
101 RequiredFiles (except ExcludedFromRequiredFiles).
102
103 Moreover, check it doesn't contain anything additional,
104 except OptionalFiles.
105
106 All the lists can contain
107
108 - directories, end with / (in which case all Pascal files
109 in this directory are considered, following ConsideredFilesMask,
110 by default just *.pas)
111
112 - or mask for files (to indicate a specific file, or files
113 if you use wildcards * and ?).
114
115 Use only slash, never backslash (including PathDelim which may be backslash
116 on Windows), as path separator.
117 We make things easier at certain places in this implementation,
118 by just working only with slashes. }
119 procedure CheckFiles(const RequiredFiles, ExcludedFromRequiredFiles,
120 OptionalFiles: array of String);
121 end;
122
123 constructor TPackage.Create(const APackageFileName: String);
124 begin
125 inherited Create;
126 Files := TCastleStringList.Create;
127 Files.CaseSensitive := FileNameCaseSensitive;
128
129 ConsideredFilesMask := TCastleStringList.Create;
130 //ConsideredFilesMask.CaseSensitive := FileNameCaseSensitive; // doesn't matter
131 ConsideredFilesMask.Append('*.pas');
132
133 FPackageFileName := APackageFileName;
134 end;
135
136 destructor TPackage.Destroy;
137 begin
138 FreeAndNil(Files);
139 FreeAndNil(ConsideredFilesMask);
140 inherited;
141 end;
142
143 procedure TPackage.GatherRequiredFiles(const FileInfo: TFileInfo; var StopSearch: Boolean);
144 var
145 FileName, CgePrefix: String;
146 begin
147 FileName := FileInfo.AbsoluteName;
148 FileName := SReplaceChars(FileName, '\', '/'); // replace backslashes with slashes
149
150 CgePrefix := CgePathExpanded;
151 if not IsPrefix(CgePrefix, FileName, not FileNameCaseSensitive) then
152 PackageWarning('All found files must be in CGE root, invalid: %s', [FileName]);
153 FileName := PrefixRemove(CgePrefix, FileName, not FileNameCaseSensitive);
154
155 RequiredFilesList.Append(FileName);
156 end;
157
158 procedure TPackage.ExcludeFromRequiredFiles(const FileInfo: TFileInfo; var StopSearch: Boolean);
159 var
160 FileName, CgePrefix: String;
161 I: Integer;
162 begin
163 FileName := FileInfo.AbsoluteName;
164 FileName := SReplaceChars(FileName, '\', '/'); // replace backslashes with slashes
165
166 CgePrefix := CgePathExpanded;
167 if not IsPrefix(CgePrefix, FileName, not FileNameCaseSensitive) then
168 PackageWarning('All found files must be in CGE root, invalid: %s', [FileName]);
169 FileName := PrefixRemove(CgePrefix, FileName, not FileNameCaseSensitive);
170
171 I := RequiredFilesList.IndexOf(FileName);
172 if I = -1 then
173 raise EInternalError.Create('File found in ExcludeFromRequiredFiles, but not in RequiredFiles: ' + FileName);
174 RequiredFilesList.Delete(I);
175 end;
176
177 procedure TPackage.CheckFiles(const RequiredFiles, ExcludedFromRequiredFiles, OptionalFiles: array of String);
178
179 function InsideOptionalFiles(const FileName: String): Boolean;
180 var
181 I: Integer;
182 begin
183 for I := 0 to High(OptionalFiles) do
184 begin
185 if Pos('\', OptionalFiles[I]) <> 0 then
186 raise Exception.CreateFmt('OptionalFiles must use only slashes, not backslashes: %s', [OptionalFiles[I]]);
187
188 if IsPrefix(OptionalFiles[I], FileName, not FileNameCaseSensitive) then
189 Exit(true);
190 end;
191 Result := false;
192 end;
193
194 var
195 I, FilesIndex: Integer;
196 FindPath, Mask: String;
197 MissingFiles: TCastleStringList;
198 begin
199 RequiredFilesList := TCastleStringList.Create;
200 RequiredFilesList.CaseSensitive := FileNameCaseSensitive;
201 for I := 0 to High(RequiredFiles) do
202 begin
203 if Pos('\', RequiredFiles[I]) <> 0 then
204 raise Exception.CreateFmt('RequiredFiles must use only slashes, not backslashes: %s', [RequiredFiles[I]]);
205
206 FindPath := CgePathExpanded + RequiredFiles[I];
207 if IsSuffix('/', FindPath) then
208 begin
209 for Mask in ConsideredFilesMask do
210 FindFiles(FindPath, Mask, false, {$ifdef FPC}@{$endif} GatherRequiredFiles, [ffRecursive]);
211 end else
212 // just use this mask with FindFiles, to find matching files
213 FindFiles(FindPath, false, {$ifdef FPC}@{$endif} GatherRequiredFiles, [ffRecursive]);
214 end;
215 Writeln('Found required files on disk: ', RequiredFilesList.Count);
216
217 { remove ExcludedFromRequiredFiles }
218 for I := 0 to High(ExcludedFromRequiredFiles) do
219 begin
220 if Pos('\', ExcludedFromRequiredFiles[I]) <> 0 then
221 raise Exception.CreateFmt('ExcludedFromRequiredFiles must use only slashes, not backslashes: %s', [ExcludedFromRequiredFiles[I]]);
222
223 FindPath := CgePathExpanded + ExcludedFromRequiredFiles[I];
224 if IsSuffix('/', FindPath) then
225 begin
226 for Mask in ConsideredFilesMask do
227 FindFiles(FindPath, Mask, false, {$ifdef FPC}@{$endif} ExcludeFromRequiredFiles, [ffRecursive]);
228 end else
229 // just use this mask with FindFiles, to find matching files
230 FindFiles(FindPath, false, {$ifdef FPC}@{$endif} ExcludeFromRequiredFiles, [ffRecursive]);
231 end;
232 Writeln('Required files after removing exclusions: ', RequiredFilesList.Count);
233
234 { verify that all RequiredFilesList are in package, remove them from Files }
235 MissingFiles := TCastleStringList.Create;
236 try
237 for I := 0 to RequiredFilesList.Count - 1 do
238 begin
239 FilesIndex := Files.IndexOf(RequiredFilesList[I]);
240 if FilesIndex = -1 then
241 begin
242 PackageWarning('Required file "%s" is not present in package "%s"', [
243 RequiredFilesList[I],
244 FPackageFileName
245 ]);
246 MissingFiles.Add(RequiredFilesList[I]);
247 end else
248 Files.Delete(FilesIndex);
249 end;
250
251 if (MissingFiles.Count <> 0) and TryFixing then
252 ProposeFix(MissingFiles);
253 finally FreeAndNil(MissingFiles) end;
254
255 { verify that rest of Files is in OptionalFiles }
256 for I := 0 to Files.Count - 1 do
257 if not InsideOptionalFiles(Files[I]) then
258 PackageWarning('File "%s" in package "%s" is neither in OptionalFiles or RequiredFiles of this package, or it is in package but not existing on disk', [
259 Files[I],
260 FPackageFileName
261 ]);
262
263 FreeAndNil(RequiredFilesList);
264 end;
265
266 procedure TPackage.ProposeFix(const MissingFiles: TCastleStringList);
267 begin
268 PackageWarning('Automatic fixing not implemented for this package type %s', [
269 ClassName
270 ]);
271 end;
272
273 { TLazarusPackage ------------------------------------------------------------ }
274
275 type
276 { Represents Lazarus package (.lpk). }
277 TLazarusPackage = class(TPackage)
278 protected
279 procedure ProposeFix(const MissingFiles: TCastleStringList); override;
280 public
281 constructor Create(const APackageFileName: String);
282 end;
283
284 constructor TLazarusPackage.Create(const APackageFileName: String);
285 var
286 Doc: TXMLDocument;
287 FilesElement, FileElement: TDOMElement;
288 I, FilesCount: Cardinal;
289 FileName: String;
290 begin
291 inherited;
292
293 ConsideredFilesMask.Append('*.inc');
294 ConsideredFilesMask.Append('*.image_data');
295 ConsideredFilesMask.Append('*.lrs');
296
297 Doc := URLReadXML(PackageFileName);
298 try
299 FilesElement := Doc.DocumentElement.Child('Package').Child('Files');
300 FilesCount := FilesElement.AttributeCardinal('Count');
301 for I := 1 to FilesCount do
302 begin
303 FileElement := FilesElement.Child('Item' + IntToStr(I));
304 FileName := FileElement.Child('Filename').AttributeString('Value');
305 if not IsPrefix('../', FileName, not FileNameCaseSensitive) then
306 PackageWarning('All filenames in lpk must be in CGE root, invalid: %s', [FileName]);
307 FileName := PrefixRemove('../', FileName, not FileNameCaseSensitive);
308 Files.Append(FileName);
309 end;
310 finally FreeAndNil(Doc) end;
311
312 Writeln(Format('LPK %s: %d files', [PackageFileName, Files.Count]));
313 end;
314
315 procedure TLazarusPackage.ProposeFix(const MissingFiles: TCastleStringList);
316 var
317 Doc: TXMLDocument;
318 FilesElement, FileElement,
319 FileFilenameElement, FileTypeElement, FileUnitNameElement: TDOMElement;
320 FilesCount: Cardinal;
321 MissingFile: String;
322 begin
323 Assert(TryFixing);
324
325 Doc := URLReadXML(PackageFileName);
326 try
327 FilesElement := Doc.DocumentElement.Child('Package').Child('Files');
328 FilesCount := FilesElement.AttributeCardinal('Count');
329 for MissingFile in MissingFiles do
330 begin
331 Inc(FilesCount); // ItemXxx numbering is 1-based, so increment FilesCount first
332 FileElement := FilesElement.CreateChild('Item' + IntToStr(FilesCount));
333 FileFilenameElement := FileElement.CreateChild('Filename');
334 FileFilenameElement.AttributeSet('Value', '../' + MissingFile);
335 if ExtractFileExt(MissingFile) = '.inc' then
336 begin
337 FileTypeElement := FileElement.CreateChild('Type');
338 FileTypeElement.AttributeSet('Value', 'Include');
339 end;
340 if ExtractFileExt(MissingFile) = '.pas' then
341 begin
342 FileUnitNameElement := FileElement.CreateChild('UnitName');
343 FileUnitNameElement.AttributeSet('Value', DeleteFileExt(ExtractFileName(MissingFile)));
344 end;
345 end;
346 FilesElement.AttributeSet('Count', FilesCount);
347 URLWriteXML(Doc, PackageFileName);
348 finally FreeAndNil(Doc) end;
349 end;
350
351 { TDelphiPackage ------------------------------------------------------------ }
352
353 const
354 { Delphi packages may have various default platforms.
355 For ease of installation, we require it to be Win32
356 (the platform you need to install in Delphi IDE). }
357 RequiredDefaultPlatform = 'Win32';
358
359 type
360 { Represents Delphi package (.dpk and .dproj, PackageFileName should point to .dpk). }
361 TDelphiPackage = class(TPackage)
362 strict private
363 FDefaultPlatform: String;
364 public
365 property DefaultPlatform: String read FDefaultPlatform;
366 constructor Create(const APackageFileName: String);
367 end;
368
369 constructor TDelphiPackage.Create(const APackageFileName: String);
370
371 function FixFileNameFromPackage(const FileName: String): String;
372 begin
373 Result := FileName;
374
375 // replace backslashes with slashes
376 Result := SReplaceChars(Result, '\', '/');
377
378 // strip prefix, to make it relative to CGE root
379 if not IsPrefix('../../', Result, not FileNameCaseSensitive) then
380 PackageWarning('All filenames in dpk must be in CGE root, invalid: %s', [Result]);
381 Result := PrefixRemove('../../', Result, not FileNameCaseSensitive);
382 end;
383
384 procedure ReadDpk;
385 var
386 Reader: TTextReader;
387 Line, FoundFileName: String;
388 Matches: TCastleStringList;
389 begin
390 Matches := TCastleStringList.Create;
391 try
392 Reader := TTextReader.Create(PackageFileName);
393 try
394 while not Reader.Eof do
395 begin
396 Line := Reader.Readln;
397 Matches.Clear;
398 if StringMatchesRegexp(Line, '^ (.*) in ''(.*)''', Matches) then
399 begin
400 Check(Matches.Count = 3);
401 FoundFileName := Matches[2];
402 FoundFileName := FixFileNameFromPackage(FoundFileName);
403 Files.Append(FoundFileName);
404 end;
405 end;
406 finally FreeAndNil(Reader) end;
407 finally FreeAndNil(Matches) end;
408
409 Writeln(Format('DPK %s: %d files', [PackageFileName, Files.Count]));
410 end;
411
412 procedure ReadDefaultPlatformFromDproj(const DocumentRoot: TDOMElement);
413 var
414 PropertyGroupIterator: TXMLElementIterator;
415 PropertyGroupElement: TDOMElement;
416 begin
417 { Choose first PropertyGroup from the XML document }
418 PropertyGroupIterator := DocumentRoot.ChildrenIterator('PropertyGroup');
419 if not PropertyGroupIterator.GetNext then
420 raise EInvalidPackage.Create('No PropertyGroup in DPROJ file');
421 PropertyGroupElement := PropertyGroupIterator.Current;
422
423 FDefaultPlatform := PropertyGroupElement.Child('Platform').TextData;
424 if DefaultPlatform <> RequiredDefaultPlatform then
425 PackageWarning('DefaultPlatform is "%s", but we require "%s"', [
426 DefaultPlatform,
427 RequiredDefaultPlatform
428 ]);
429 end;
430
431 procedure ReadDproj;
432 var
433 Doc: TXMLDocument;
434 ItemGroupElement, DccReferenceElement: TDOMElement;
435 I: TXMLElementIterator;
436 FileName, DprojFileName: String;
437 AltFiles: TCastleStringList;
438 begin
439 AltFiles := TCastleStringList.Create;
440 try
441 DprojFileName := ChangeFileExt(PackageFileName, '.dproj');
442 Doc := UrlReadXml(DprojFileName);
443 try
444 ItemGroupElement := Doc.DocumentElement.Child('ItemGroup');
445 I := ItemGroupElement.ChildrenIterator('DCCReference');
446 try
447 while I.GetNext do
448 begin
449 DccReferenceElement := I.Current;
450 FileName := DccReferenceElement.AttributeString('Include');
451 if ExtractFileExt(FileName) <> '.dcp' then
452 begin
453 FileName := FixFileNameFromPackage(FileName);
454 AltFiles.Append(FileName);
455 end;
456 end;
457 finally FreeAndNil(I) end;
458
459 ReadDefaultPlatformFromDproj(Doc.DocumentElement);
460 finally FreeAndNil(Doc) end;
461
462 CompareFilesLists(Files, AltFiles, Format('Files in DPK (%s) and DPROJ differ (%s)', [
463 PackageFileName,
464 DprojFileName
465 ]));
466
467 Writeln(Format('DPROJ %s: %d files', [DprojFileName, AltFiles.Count]));
468 finally FreeAndNil(AltFiles) end;
469 end;
470
471 begin
472 inherited;
473 ReadDpk;
474 ReadDproj;
475 end;
476
477 { main routine --------------------------------------------------------------- }
478
479 var
480 Package: TPackage;
481 begin
482 ApplicationProperties.ApplicationName := 'check_packages';
483 ApplicationProperties.Version := CastleEngineVersion;
484 ApplicationProperties.OnWarning.Add({$ifdef FPC}@{$endif} ApplicationProperties.WriteWarningOnConsole);
485
486 Parameters.CheckHighAtMost(1);
487 if Parameters.High = 1 then
488 CgePath := Parameters[1];
489
490 CgePathExpanded := InclPathDelim(ExpandFileName(CgePath));
491 CgePathExpanded := SReplaceChars(CgePathExpanded, '\', '/'); // replace backslashes with slashes
492 Writeln('Checking CGE in directory: ', CgePathExpanded);
493
494 Package := TLazarusPackage.Create(CgePathExpanded + 'packages/castle_base.lpk');
495 try
496 Package.CheckFiles([
497 'src/common_includes/',
498 'src/transform/',
499 'src/audio/',
500 'src/base/',
501 'src/base_rendering/',
502 'src/castlescript/',
503 'src/files/',
504 'src/fonts/',
505 'src/images/',
506 'src/physics/',
507 'src/services/',
508 'src/ui/',
509 'src/scene/',
510 'src/deprecated_units/'
511 ],
512 [
513 'src/base/android/',
514 'src/files/indy/'
515 ],
516 [
517 'src/vampyre_imaginglib/'
518 ]);
519 finally FreeAndNil(Package) end;
520
521 Package := TLazarusPackage.Create(CgePathExpanded + 'packages/castle_window.lpk');
522 try
523 Package.CheckFiles([
524 'src/window/'
525 ],
526 [ ],
527 [ ]);
528 finally FreeAndNil(Package) end;
529
530 Package := TLazarusPackage.Create(CgePathExpanded + 'packages/alternative_castle_window_based_on_lcl.lpk');
531 try
532 Package.CheckFiles([
533 'src/window/'
534 ],
535 [ ],
536 [ ]);
537 finally FreeAndNil(Package) end;
538
539 Package := TLazarusPackage.Create(CgePathExpanded + 'packages/castle_components.lpk');
540 try
541 Package.CheckFiles([
542 'src/lcl/'
543 ],
544 [],
545 [ ]);
546 finally FreeAndNil(Package) end;
547
548 Package := TLazarusPackage.Create(CgePathExpanded + 'packages/castle_indy.lpk');
549 try
550 Package.CheckFiles([
551 'src/files/indy/'
552 ],
553 [ ],
554 [ ]);
555 finally FreeAndNil(Package) end;
556
557 Package := TLazarusPackage.Create(CgePathExpanded + 'packages/castle_editor_components.lpk');
558 try
559 Package.CheckFiles([
560 'tools/castle-editor/components/'
561 ],
562 [
563 'tools/castle-editor/components/mbColorLib/examples/'
564 ],
565 [ ]);
566 finally FreeAndNil(Package) end;
567
568 Package := TDelphiPackage.Create(CgePathExpanded + 'packages/delphi/castle_engine.dpk');
569 try
570 Package.CheckFiles([
571 'src/common_includes/',
572 'src/transform/',
573 'src/audio/',
574 'src/base/',
575 'src/base_rendering/',
576 'src/castlescript/',
577 'src/files/',
578 'src/fonts/',
579 'src/images/',
580 'src/physics/',
581 'src/services/',
582 'src/ui/',
583 'src/scene/',
584 // Delphi specific:
585 'src/delphi/',
586 'src/compatibility/delphi-only/'
587 // TODO: not in package, but maybe they should be?
588 // 'src/deprecated_units/'
589 ],
590 [
591 'src/delphi/castleinternaldelphidesign.pas',
592 'src/base/android/',
593 'src/files/indy/',
594
595 // This is in castle_engine_vcl package
596 'src/delphi/vcl.castlecontrol.pas',
597
598 // This is in castle_engine_fmx package
599 'src/delphi/*fmx*.pas',
600
601 // Internal units only for FPC
602 'src/audio/castleinternalsoxsoundbackend.pas',
603 'src/base/castleinternalgzio.pas',
604
605 // TODO: FMOD is not yet supported with Delphi
606 'src/audio/fmod/castlefmodsoundbackend.pas',
607 'src/audio/fmod/castleinternalfmod.pas',
608
609 // TODO: CGE localization is not yet supported with Delphi, uses FPC GetText
610 'src/base/castlesystemlanguage.pas',
611 'src/files/castlelocalizationgettext.pas',
612
613 // TODO: OpenGLES (mobile) is not yet supported with Delphi
614 'src/base_rendering/castlegles.pas',
615
616 // TODO: CastleScript is not yet fully supported with Delphi
617 'src/castlescript/castlescriptxml.pas',
618
619 // TODO: Joysticks on Linux are not yet supported with Delphi
620 'src/ui/castleinternaljoystickslinux.pas',
621
622 // This is VCL-specific with Delphi, maybe in the future will be in some VCL package.
623 // It also makes warnings about dispinterface not being portable.
624 // It's only for 3dconnexion devices -- it is uncertain do we even want to maintain it in CGE core.
625 'src/ui/windows/castleinternaltdxinput_tlb.pas',
626
627 // This is only supported with FPC, but planned to be removed from CGE
628 'src/scene/castleraytracer.pas'
629 ],
630 [
631 'src/vampyre_imaginglib/'
632 ]);
633 finally FreeAndNil(Package) end;
634
635 Package := TDelphiPackage.Create(CgePathExpanded + 'packages/delphi/castle_engine_design.dpk');
636 try
637 Package.CheckFiles([
638 'src/delphi/castleinternaldelphidesign.pas'
639 ],
640 [ ],
641 [ ]);
642 finally FreeAndNil(Package) end;
643
644 Package := TDelphiPackage.Create(CgePathExpanded + 'packages/delphi/castle_engine_window.dpk');
645 try
646 Package.CheckFiles([
647 'src/window/'
648 ],
649 [
650 // TODO: not in package, but maybe they should be?
651 'src/window/deprecated_units/',
652
653 // Only for CASTLE_WINDOW_XLIB, available only with FPC, and that's OK -- it's not a default for Linux
654 'src/window/unix/castleinternalxlib.pas'
655 ],
656 [ ]);
657 finally FreeAndNil(Package) end;
658
659 Package := TDelphiPackage.Create(CgePathExpanded + 'packages/delphi/castle_engine_vcl.dpk');
660 try
661 Package.CheckFiles([
662 'src/delphi/vcl.castlecontrol.pas'
663 ],
664 [ ],
665 [ ]);
666 finally FreeAndNil(Package) end;
667
668 Package := TDelphiPackage.Create(CgePathExpanded + 'packages/delphi/castle_engine_fmx.dpk');
669 try
670 Package.CheckFiles([
671 'src/delphi/*fmx*.pas'
672 ],
673 [ ],
674 [ ]);
675 finally FreeAndNil(Package) end;
676
677 if WarningsCount <> 0 then
678 begin
679 Writeln(Format('%d package problems found (see report above), exiting with status 1', [WarningsCount]));
680 Halt(1);
681 end else
682 Writeln('All packages OK');
683 end.