This repository has been archived by the owner on Jul 31, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathCompilationData.pas
128 lines (110 loc) · 3.71 KB
/
CompilationData.pas
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
{**
DelphiPI (Delphi Package Installer)
Author : ibrahim dursun (ibrahimdursun gmail)
License : GNU General Public License 2.0
**}
unit CompilationData;
interface
uses Classes, PackageInfo, PackageList, JclIDEUtils;
type
TCompilationData = class
private
fBaseFolder: String;
fInstallation: TJclBorRADToolInstallation;
fPackageList: TPackageList;
fHelpFiles: TStringList;
fPattern: String;
fDCPOutputFolder: string;
fBPLOutputFolder: string;
fDCUOutputFolder: string;
FScripting: Boolean;
fConditionals: string;
procedure SetPackageList(const aPackageList: TPackageList);
procedure SetInstallation(const Value: TJclBorRADToolInstallation);
protected
public
constructor Create;
destructor Destroy; override;
procedure GetIdePackages(const list: TStringList); virtual;
function GetIdeVersionSuffix: string; virtual;
function SetDelphiVersion(const version:string):boolean; virtual;
property Pattern: String read fPattern write fPattern;
property Installation: TJclBorRADToolInstallation read fInstallation write SetInstallation;
property BaseFolder: String read fBaseFolder write fBaseFolder;
property HelpFiles: TStringList read fHelpFiles;
property PackageList: TPackageList read fPackageList write SetPackageList;
property DCPOutputFolder: string read fDCPOutputFolder write fDCPOutputFolder;
property BPLOutputFolder: string read fBPLOutputFolder write fBPLOutputFolder;
property DCUOutputFolder: string read fDCUOutputFolder write fDCUOutputFolder;
property Conditionals: string read fConditionals write fConditionals;
property Scripting: Boolean read fScripting write fScripting;
end;
implementation
uses JclFileUtils,SysUtils;
var
installations: TJclBorRADToolInstallations;
constructor TCompilationData.Create;
begin
fPattern := '*.dpk';
fPackageList := TPackageList.Create;
fHelpFiles := TStringList.Create;
fScripting := False;
end;
destructor TCompilationData.Destroy;
begin
fPackageList.Free;
fHelpFiles.Free;
inherited;
end;
procedure TCompilationData.GetIdePackages(const list: TStringList);
var
i: integer;
begin
assert(Assigned(Installation),'installation cannot be null');
for i := 0 to Installation.IdePackages.Count - 1 do
list.Add(Installation.IdePackages.PackageFileNames[i]);
end;
function TCompilationData.GetIdeVersionSuffix: string;
begin
Result := Installation.VersionNumberStr;
if Result = 'd11' then //Delphi 2007 packages have version 10 extension
Result := 'd10';
end;
function TCompilationData.SetDelphiVersion(const version: string): boolean;
var
installation: TJclBorRADToolInstallation;
i : integer;
begin
Result := false;
for i := 0 to installations.Count - 1 do
begin
installation := installations.Installations[i];
if UpperCase(Trim(installation.VersionNumberStr)) = UpperCase(Trim(version)) then
begin
fInstallation := installation;
Result := true;
break;
end;
end;
if fInstallation = nil then
raise Exception.Create('cannot find delphi version:' + version);
end;
procedure TCompilationData.SetInstallation(
const Value: TJclBorRADToolInstallation);
begin
if fInstallation = Value then
exit;
fInstallation := Value;
BPLOutputFolder := fInstallation.BPLOutputPath[bpWin32];
DCPOutputFolder := fInstallation.DCPOutputPath[bpWin32];
end;
procedure TCompilationData.SetPackageList(const aPackageList: TPackageList);
begin
fPackageList.Free;
fPackageList := aPackageList;
end;
initialization
installations := TJclBorRADToolInstallations.Create;
finalization
installations.Free;
end.