-
Notifications
You must be signed in to change notification settings - Fork 1
/
DPKDep.dpr
39 lines (30 loc) · 965 Bytes
/
DPKDep.dpr
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
program DPKDep;
{$APPTYPE CONSOLE}
uses
System.SysUtils,
System.IOUtils,
DPKAnalyzer in 'DPKAnalyzer.pas';
procedure CheckParameters;
begin
if ParamCount < 2 then begin
WriteLn('RAD Studio package depdendencies analyzer');
WriteLn('Syntax: ', ExtractFileName(ParamStr(0)), ' LibraryNames PackageFiles [Defines]');
WriteLn(' ', 'LibraryNames, PackageFiles and Defines are separated by semicolon');
Halt(1);
end;
end;
var s, t, d: string;
begin
ReportMemoryLeaksOnShutdown := True;
CheckParameters;
// Declare two variables to hold ParamStr(n) to avoid unexpected memory leak
s := ParamStr(1);
t := ParamStr(2);
if ParamCount >= 3 then
d := ParamStr(3)
else
d := '';
if not TFile.Exists(t) or not TPath.GetExtension(t).ToLower.Equals('.dpk') then
t := TFile.ReadAllText(t, TEncoding.UTF8);
WriteLn(TDelphiDPKAnalyzer.ConstructBuildSequence(s.Split([';']), t.Split([';']), d.Split([';'])));
end.