|
@@ -326,6 +326,32 @@ Type
|
|
Property ConditionalStrings[Index : Integer] : TConditionalString Read GetConditionalString Write SetConditionalString; default;
|
|
Property ConditionalStrings[Index : Integer] : TConditionalString Read GetConditionalString Write SetConditionalString; default;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+ { TDictionary }
|
|
|
|
+
|
|
|
|
+ TReplaceFunction = Function (Const AName,Args : String) : String of Object;
|
|
|
|
+
|
|
|
|
+ TDictionary = Class(TComponent)
|
|
|
|
+ private
|
|
|
|
+ FList : TStringList;
|
|
|
|
+ Public
|
|
|
|
+ Constructor Create(AOwner : TComponent); override;
|
|
|
|
+ Destructor Destroy;override;
|
|
|
|
+ Procedure AddVariable(const AName,Value : String);
|
|
|
|
+ Procedure AddFunction(const AName : String; FReplacement : TReplaceFunction);
|
|
|
|
+ Procedure RemoveItem(const AName : String);
|
|
|
|
+ Function GetValue(AName : String) : String;
|
|
|
|
+ Function GetValue(const AName,Args : String) : String; virtual;
|
|
|
|
+ Function ReplaceStrings(Const ASource : String) : String; virtual;
|
|
|
|
+ end;
|
|
|
|
+
|
|
|
|
+ { TPackageDictionary }
|
|
|
|
+
|
|
|
|
+ TPackageDictionary = Class(TDictionary)
|
|
|
|
+ Public
|
|
|
|
+ Function GetValue(const AName,Args : String) : String; override;
|
|
|
|
+ end;
|
|
|
|
+
|
|
|
|
+
|
|
{ TDependency }
|
|
{ TDependency }
|
|
TDependency = Class(TConditionalString)
|
|
TDependency = Class(TConditionalString)
|
|
private
|
|
private
|
|
@@ -584,9 +610,13 @@ Type
|
|
FInstalledChecksum : Cardinal;
|
|
FInstalledChecksum : Cardinal;
|
|
// Cached directory of installed packages
|
|
// Cached directory of installed packages
|
|
FUnitDir : String;
|
|
FUnitDir : String;
|
|
|
|
+ // Used by buildunits
|
|
FBUTargets: TTargets;
|
|
FBUTargets: TTargets;
|
|
FBUTarget: TTarget;
|
|
FBUTarget: TTarget;
|
|
|
|
+ // Dictionary
|
|
|
|
+ FDictionary : TDictionary;
|
|
Function GetDescription : string;
|
|
Function GetDescription : string;
|
|
|
|
+ function GetDictionary: TDictionary;
|
|
Function GetFileName : string;
|
|
Function GetFileName : string;
|
|
function GetOptions: TStrings;
|
|
function GetOptions: TStrings;
|
|
Function GetVersion : string;
|
|
Function GetVersion : string;
|
|
@@ -597,6 +627,7 @@ Type
|
|
procedure LoadUnitConfigFromFile(Const AFileName: String);
|
|
procedure LoadUnitConfigFromFile(Const AFileName: String);
|
|
procedure SaveUnitConfigToStringList(Const AStringList: TStrings;ACPU:TCPU;AOS:TOS); virtual;
|
|
procedure SaveUnitConfigToStringList(Const AStringList: TStrings;ACPU:TCPU;AOS:TOS); virtual;
|
|
procedure SaveUnitConfigToFile(Const AFileName: String;ACPU:TCPU;AOS:TOS);
|
|
procedure SaveUnitConfigToFile(Const AFileName: String;ACPU:TCPU;AOS:TOS);
|
|
|
|
+ property Dictionary: TDictionary read GetDictionary;
|
|
Public
|
|
Public
|
|
constructor Create(ACollection: TCollection); override;
|
|
constructor Create(ACollection: TCollection); override;
|
|
destructor destroy; override;
|
|
destructor destroy; override;
|
|
@@ -841,7 +872,7 @@ Type
|
|
Function InstallPackageSourceFiles(APAckage : TPackage; stt : TSourceTypes; ttt : TTargetTypes; Const Dest : String):Boolean;
|
|
Function InstallPackageSourceFiles(APAckage : TPackage; stt : TSourceTypes; ttt : TTargetTypes; Const Dest : String):Boolean;
|
|
Function FileNewer(const Src,Dest : String) : Boolean;
|
|
Function FileNewer(const Src,Dest : String) : Boolean;
|
|
Procedure LogSearchPath(const ASearchPathName:string;Path:TConditionalStrings; ACPU:TCPU;AOS:TOS);
|
|
Procedure LogSearchPath(const ASearchPathName:string;Path:TConditionalStrings; ACPU:TCPU;AOS:TOS);
|
|
- Function FindFileInPath(Path:TConditionalStrings; AFileName:String; var FoundPath:String;ACPU:TCPU;AOS:TOS):Boolean;
|
|
|
|
|
|
+ Function FindFileInPath(APackage: TPackage; Path:TConditionalStrings; AFileName:String; var FoundPath:String;ACPU:TCPU;AOS:TOS):Boolean;
|
|
|
|
|
|
procedure GetDirectoriesFromFilelist(const AFileList, ADirectoryList: TStringList);
|
|
procedure GetDirectoriesFromFilelist(const AFileList, ADirectoryList: TStringList);
|
|
//package commands
|
|
//package commands
|
|
@@ -977,8 +1008,6 @@ Type
|
|
Constructor Create(AOwner : TComponent); override;
|
|
Constructor Create(AOwner : TComponent); override;
|
|
end;
|
|
end;
|
|
|
|
|
|
- TReplaceFunction = Function (Const AName,Args : String) : String of Object;
|
|
|
|
-
|
|
|
|
{ TValueItem }
|
|
{ TValueItem }
|
|
|
|
|
|
TValueItem = Class(TObject)
|
|
TValueItem = Class(TObject)
|
|
@@ -993,20 +1022,6 @@ Type
|
|
Constructor Create(AFunc : TReplaceFunction);
|
|
Constructor Create(AFunc : TReplaceFunction);
|
|
end;
|
|
end;
|
|
|
|
|
|
- { TDictionary }
|
|
|
|
-
|
|
|
|
- TDictionary = Class(TComponent)
|
|
|
|
- FList : TStringList;
|
|
|
|
- Public
|
|
|
|
- Constructor Create(AOwner : TComponent); override;
|
|
|
|
- Destructor Destroy;override;
|
|
|
|
- Procedure AddVariable(Const AName,Value : String);
|
|
|
|
- Procedure AddFunction(Const AName : String; FReplacement : TReplaceFunction);
|
|
|
|
- Procedure RemoveItem(Const AName : String);
|
|
|
|
- Function GetValue(Const AName : String) : String;
|
|
|
|
- Function GetValue(Const AName,Args : String) : String; virtual;
|
|
|
|
- Function ReplaceStrings(Const ASource : String) : String; virtual;
|
|
|
|
- end;
|
|
|
|
|
|
|
|
ECollectionError = Class(Exception);
|
|
ECollectionError = Class(Exception);
|
|
EDictionaryError = Class(Exception);
|
|
EDictionaryError = Class(Exception);
|
|
@@ -1021,11 +1036,12 @@ Type
|
|
|
|
|
|
Var
|
|
Var
|
|
DictionaryClass : TDictionaryClass = TDictionary;
|
|
DictionaryClass : TDictionaryClass = TDictionary;
|
|
|
|
+ PackageDictionaryClass : TDictionaryClass = TPackageDictionary;
|
|
OnArchiveFiles : TArchiveEvent = Nil;
|
|
OnArchiveFiles : TArchiveEvent = Nil;
|
|
ArchiveFilesProc : TArchiveProc = Nil;
|
|
ArchiveFilesProc : TArchiveProc = Nil;
|
|
|
|
|
|
Defaults : TCustomDefaults; // Set by installer.
|
|
Defaults : TCustomDefaults; // Set by installer.
|
|
- Dictionary : TDictionary;
|
|
|
|
|
|
+ GlobalDictionary : TDictionary;
|
|
|
|
|
|
|
|
|
|
Function CurrentOS : String;
|
|
Function CurrentOS : String;
|
|
@@ -1707,24 +1723,30 @@ function AddConditionalStrings(Dest : TStrings; Src : TConditionalStrings;ACPU:T
|
|
Var
|
|
Var
|
|
I : Integer;
|
|
I : Integer;
|
|
C : TConditionalString;
|
|
C : TConditionalString;
|
|
|
|
+ D : TDictionary;
|
|
S : String;
|
|
S : String;
|
|
begin
|
|
begin
|
|
Result:=0;
|
|
Result:=0;
|
|
- Dictionary.AddVariable('CPU',CPUToString(ACPU));
|
|
|
|
- Dictionary.AddVariable('OS',OSToString(AOS));
|
|
|
|
- For I:=0 to Src.Count-1 do
|
|
|
|
- begin
|
|
|
|
- C:=Src[I];
|
|
|
|
- if (ACPU in C.CPUs) and (AOS in C.OSes) then
|
|
|
|
- begin
|
|
|
|
- If (APrefix<>'') then
|
|
|
|
- S:=APrefix+C.Value
|
|
|
|
- else
|
|
|
|
- S:=C.Value;
|
|
|
|
- Dest.Add(Dictionary.ReplaceStrings(S));
|
|
|
|
- Inc(Result);
|
|
|
|
- end;
|
|
|
|
- end;
|
|
|
|
|
|
+ D := PackageDictionaryClass.Create(nil);
|
|
|
|
+ try
|
|
|
|
+ D.AddVariable('CPU',CPUToString(ACPU));
|
|
|
|
+ D.AddVariable('OS',OSToString(AOS));
|
|
|
|
+ For I:=0 to Src.Count-1 do
|
|
|
|
+ begin
|
|
|
|
+ C:=Src[I];
|
|
|
|
+ if (ACPU in C.CPUs) and (AOS in C.OSes) then
|
|
|
|
+ begin
|
|
|
|
+ If (APrefix<>'') then
|
|
|
|
+ S:=APrefix+C.Value
|
|
|
|
+ else
|
|
|
|
+ S:=C.Value;
|
|
|
|
+ Dest.Add(D.ReplaceStrings(S));
|
|
|
|
+ Inc(Result);
|
|
|
|
+ end;
|
|
|
|
+ end;
|
|
|
|
+ finally
|
|
|
|
+ D.Free;
|
|
|
|
+ end;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
@@ -1929,6 +1951,26 @@ begin
|
|
end;
|
|
end;
|
|
{$endif HAS_UNIT_PROCESS}
|
|
{$endif HAS_UNIT_PROCESS}
|
|
|
|
|
|
|
|
+{ TPackageDictionary }
|
|
|
|
+
|
|
|
|
+function TPackageDictionary.GetValue(const AName, Args: String): String;
|
|
|
|
+Var
|
|
|
|
+ O : TObject;
|
|
|
|
+ I : Integer;
|
|
|
|
+begin
|
|
|
|
+ I:=Flist.IndexOf(AName);
|
|
|
|
+ If (I=-1) then
|
|
|
|
+ begin
|
|
|
|
+ result := GlobalDictionary.GetValue(AName,Args);
|
|
|
|
+ Exit;
|
|
|
|
+ end;
|
|
|
|
+ O:=Flist.Objects[I];
|
|
|
|
+ If O is TValueItem then
|
|
|
|
+ Result:=TValueItem(O).FValue
|
|
|
|
+ else
|
|
|
|
+ Result:=TFunctionItem(O).FFunc(AName,Args);
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
|
|
{****************************************************************************
|
|
{****************************************************************************
|
|
TUnsortedDuplicatesStringList
|
|
TUnsortedDuplicatesStringList
|
|
@@ -2350,6 +2392,7 @@ end;
|
|
|
|
|
|
destructor TPackage.destroy;
|
|
destructor TPackage.destroy;
|
|
begin
|
|
begin
|
|
|
|
+ FreeAndNil(FDictionary);
|
|
FreeAndNil(FDependencies);
|
|
FreeAndNil(FDependencies);
|
|
FreeAndNil(FInstallFiles);
|
|
FreeAndNil(FInstallFiles);
|
|
FreeAndNil(FCleanFiles);
|
|
FreeAndNil(FCleanFiles);
|
|
@@ -2488,6 +2531,13 @@ begin
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+function TPackage.GetDictionary: TDictionary;
|
|
|
|
+begin
|
|
|
|
+ if not assigned(FDictionary) then
|
|
|
|
+ FDictionary:=PackageDictionaryClass.Create(Nil);
|
|
|
|
+ result := FDictionary;
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
|
|
Function TPackage.GetVersion : string;
|
|
Function TPackage.GetVersion : string;
|
|
begin
|
|
begin
|
|
@@ -2758,6 +2808,7 @@ end;
|
|
procedure TCustomDefaults.SetCPU(const AValue: TCPU);
|
|
procedure TCustomDefaults.SetCPU(const AValue: TCPU);
|
|
begin
|
|
begin
|
|
FCPU:=AValue;
|
|
FCPU:=AValue;
|
|
|
|
+ GlobalDictionary.AddVariable('CPU',CPUToString(FCPU));
|
|
RecalcTarget;
|
|
RecalcTarget;
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -2836,9 +2887,7 @@ end;
|
|
|
|
|
|
function TCustomDefaults.GetUnitInstallDir: String;
|
|
function TCustomDefaults.GetUnitInstallDir: String;
|
|
begin
|
|
begin
|
|
- Dictionary.AddVariable('target',Target);
|
|
|
|
- Dictionary.AddVariable('BaseInstallDir',BaseInstallDir);
|
|
|
|
- result := FixPath(Dictionary.ReplaceStrings(FUnitInstallDir));
|
|
|
|
|
|
+ result := FixPath(GlobalDictionary.ReplaceStrings(FUnitInstallDir));
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
@@ -2892,6 +2941,7 @@ begin
|
|
FBaseInstallDir:=IncludeTrailingPathDelimiter(ExpandFileName(AValue))
|
|
FBaseInstallDir:=IncludeTrailingPathDelimiter(ExpandFileName(AValue))
|
|
else
|
|
else
|
|
FBaseInstallDir:='';
|
|
FBaseInstallDir:='';
|
|
|
|
+ GlobalDictionary.AddVariable('baseinstalldir',BaseInstallDir);
|
|
BinInstallDir:='';
|
|
BinInstallDir:='';
|
|
ExamplesInstallDir:='';
|
|
ExamplesInstallDir:='';
|
|
end;
|
|
end;
|
|
@@ -2900,6 +2950,7 @@ end;
|
|
procedure TCustomDefaults.SetOS(const AValue: TOS);
|
|
procedure TCustomDefaults.SetOS(const AValue: TOS);
|
|
begin
|
|
begin
|
|
FOS:=AValue;
|
|
FOS:=AValue;
|
|
|
|
+ GlobalDictionary.AddVariable('OS',OSToString(FOS));
|
|
Recalctarget;
|
|
Recalctarget;
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -2922,11 +2973,14 @@ begin
|
|
If (P<>0) then
|
|
If (P<>0) then
|
|
begin
|
|
begin
|
|
FOS:=StringToOS(System.Copy(Avalue,P+1,Length(AValue)-P));
|
|
FOS:=StringToOS(System.Copy(Avalue,P+1,Length(AValue)-P));
|
|
|
|
+ GlobalDictionary.AddVariable('OS',OSToString(FOS));
|
|
FCPU:=StringToCPU(System.Copy(Avalue,1,P-1));
|
|
FCPU:=StringToCPU(System.Copy(Avalue,1,P-1));
|
|
|
|
+ GlobalDictionary.AddVariable('CPU',CPUToString(FCPU));
|
|
end
|
|
end
|
|
else
|
|
else
|
|
FOS:=StringToOS(AValue);
|
|
FOS:=StringToOS(AValue);
|
|
FTarget:=AValue;
|
|
FTarget:=AValue;
|
|
|
|
+ GlobalDictionary.AddVariable('target',Target);
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -2942,6 +2996,7 @@ end;
|
|
procedure TCustomDefaults.RecalcTarget;
|
|
procedure TCustomDefaults.RecalcTarget;
|
|
begin
|
|
begin
|
|
Ftarget:=CPUToString(FCPU)+'-'+OStoString(FOS);
|
|
Ftarget:=CPUToString(FCPU)+'-'+OStoString(FOS);
|
|
|
|
+ GlobalDictionary.AddVariable('target',Target);
|
|
end;
|
|
end;
|
|
|
|
|
|
function TCustomDefaults.CmdLineOptions: String;
|
|
function TCustomDefaults.CmdLineOptions: String;
|
|
@@ -3164,6 +3219,9 @@ begin
|
|
FInstallExamples:=(Upcase(Values[KeyInstallExamples])='Y');
|
|
FInstallExamples:=(Upcase(Values[KeyInstallExamples])='Y');
|
|
FNoFPCCfg:=(Upcase(Values[KeyNoFPCCfg])='Y');
|
|
FNoFPCCfg:=(Upcase(Values[KeyNoFPCCfg])='Y');
|
|
FUseEnvironment:=(Upcase(Values[KeyUseEnv])='Y');
|
|
FUseEnvironment:=(Upcase(Values[KeyUseEnv])='Y');
|
|
|
|
+
|
|
|
|
+ GlobalDictionary.AddVariable('target',Target);
|
|
|
|
+ GlobalDictionary.AddVariable('baseinstalldir',BaseInstallDir);
|
|
end;
|
|
end;
|
|
Finally
|
|
Finally
|
|
L.Free;
|
|
L.Free;
|
|
@@ -3218,8 +3276,10 @@ end;
|
|
|
|
|
|
constructor TCustomInstaller.Create(AOwner: TComponent);
|
|
constructor TCustomInstaller.Create(AOwner: TComponent);
|
|
begin
|
|
begin
|
|
- Dictionary:=DictionaryClass.Create(Nil);
|
|
|
|
|
|
+ GlobalDictionary:=DictionaryClass.Create(Nil);
|
|
AnalyzeOptions;
|
|
AnalyzeOptions;
|
|
|
|
+ GlobalDictionary.AddVariable('BaseInstallDir',Defaults.BaseInstallDir);
|
|
|
|
+ GlobalDictionary.AddVariable('Target',Defaults.Target);
|
|
CreatePackages;
|
|
CreatePackages;
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -3228,7 +3288,7 @@ destructor TCustomInstaller.Destroy;
|
|
begin
|
|
begin
|
|
FreePackages;
|
|
FreePackages;
|
|
FreeAndNil(Defaults);
|
|
FreeAndNil(Defaults);
|
|
- FreeAndNil(Dictionary);
|
|
|
|
|
|
+ FreeAndNil(GlobalDictionary);
|
|
inherited destroy;
|
|
inherited destroy;
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -4048,7 +4108,7 @@ begin
|
|
begin
|
|
begin
|
|
E:=True;
|
|
E:=True;
|
|
If (C.SourceFile<>'') and (C.DestFile<>'') then
|
|
If (C.SourceFile<>'') and (C.DestFile<>'') then
|
|
- E:=FileNewer(C.SourceFile,IncludeTrailingPathDelimiter(Dictionary.GetValue('OUTPUTDIR'))+C.DestFile);
|
|
|
|
|
|
+ E:=FileNewer(C.SourceFile,IncludeTrailingPathDelimiter(GlobalDictionary.GetValue('OUTPUTDIR'))+C.DestFile);
|
|
If E then
|
|
If E then
|
|
begin
|
|
begin
|
|
If Assigned(C.BeforeCommand) then
|
|
If Assigned(C.BeforeCommand) then
|
|
@@ -4080,7 +4140,7 @@ begin
|
|
begin
|
|
begin
|
|
if S<>'' then
|
|
if S<>'' then
|
|
S:=S+PathSeparator;
|
|
S:=S+PathSeparator;
|
|
- S:=S+Dictionary.ReplaceStrings(C.Value)
|
|
|
|
|
|
+ S:=S+GlobalDictionary.ReplaceStrings(C.Value)
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
if S<>'' then
|
|
if S<>'' then
|
|
@@ -4088,7 +4148,7 @@ begin
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
-Function TBuildEngine.FindFileInPath(Path:TConditionalStrings; AFileName:String; var FoundPath:String;ACPU:TCPU;AOS:TOS):Boolean;
|
|
|
|
|
|
+Function TBuildEngine.FindFileInPath(APackage: TPackage; Path:TConditionalStrings; AFileName:String; var FoundPath:String;ACPU:TCPU;AOS:TOS):Boolean;
|
|
var
|
|
var
|
|
I : Integer;
|
|
I : Integer;
|
|
C : TConditionalString;
|
|
C : TConditionalString;
|
|
@@ -4099,7 +4159,7 @@ begin
|
|
C:=Path[I];
|
|
C:=Path[I];
|
|
if (ACPU in C.CPUs) and (AOS in C.OSes) then
|
|
if (ACPU in C.CPUs) and (AOS in C.OSes) then
|
|
begin
|
|
begin
|
|
- FoundPath:=IncludeTrailingPathDelimiter(Dictionary.ReplaceStrings(C.Value));
|
|
|
|
|
|
+ FoundPath:=IncludeTrailingPathDelimiter(APackage.Dictionary.ReplaceStrings(C.Value));
|
|
if FileExists(FoundPath+AFileName) then
|
|
if FileExists(FoundPath+AFileName) then
|
|
begin
|
|
begin
|
|
result:=true;
|
|
result:=true;
|
|
@@ -4128,10 +4188,10 @@ Procedure TBuildEngine.ResolveFileNames(APackage : TPackage; ACPU:TCPU;AOS:TOS;D
|
|
SD,SF : String;
|
|
SD,SF : String;
|
|
begin
|
|
begin
|
|
LogSearchPath('package source',APackage.SourcePath,ACPU,AOS);
|
|
LogSearchPath('package source',APackage.SourcePath,ACPU,AOS);
|
|
- SD:=Dictionary.ReplaceStrings(T.Directory);
|
|
|
|
- SF:=Dictionary.ReplaceStrings(T.SourceFileName);
|
|
|
|
|
|
+ SD:=APackage.Dictionary.ReplaceStrings(T.Directory);
|
|
|
|
+ SF:=APackage.Dictionary.ReplaceStrings(T.SourceFileName);
|
|
if SD='' then
|
|
if SD='' then
|
|
- FindFileInPath(APackage.SourcePath,SF,SD,ACPU,AOS);
|
|
|
|
|
|
+ FindFileInPath(APackage,APackage.SourcePath,SF,SD,ACPU,AOS);
|
|
if SD<>'' then
|
|
if SD<>'' then
|
|
SD:=IncludeTrailingPathDelimiter(SD);
|
|
SD:=IncludeTrailingPathDelimiter(SD);
|
|
T.FTargetSourceFileName:=SD+SF;
|
|
T.FTargetSourceFileName:=SD+SF;
|
|
@@ -4162,11 +4222,11 @@ Procedure TBuildEngine.ResolveFileNames(APackage : TPackage; ACPU:TCPU;AOS:TOS;D
|
|
begin
|
|
begin
|
|
if ExtractFilePath(D.Value)='' then
|
|
if ExtractFilePath(D.Value)='' then
|
|
begin
|
|
begin
|
|
- SF:=Dictionary.ReplaceStrings(D.Value);
|
|
|
|
|
|
+ SF:=APAckage.Dictionary.ReplaceStrings(D.Value);
|
|
SD:='';
|
|
SD:='';
|
|
// first check the target specific path
|
|
// first check the target specific path
|
|
- if not FindFileInPath(T.IncludePath,SF,SD,ACPU,AOS) then
|
|
|
|
- FindFileInPath(APackage.IncludePath,SF,SD,ACPU,AOS);
|
|
|
|
|
|
+ if not FindFileInPath(APackage, T.IncludePath,SF,SD,ACPU,AOS) then
|
|
|
|
+ FindFileInPath(APackage, APackage.IncludePath,SF,SD,ACPU,AOS);
|
|
if SD<>'' then
|
|
if SD<>'' then
|
|
SD:=IncludeTrailingPathDelimiter(SD);
|
|
SD:=IncludeTrailingPathDelimiter(SD);
|
|
D.TargetFileName:=SD+SF;
|
|
D.TargetFileName:=SD+SF;
|
|
@@ -4190,10 +4250,10 @@ Procedure TBuildEngine.ResolveFileNames(APackage : TPackage; ACPU:TCPU;AOS:TOS;D
|
|
SD,SF : String;
|
|
SD,SF : String;
|
|
begin
|
|
begin
|
|
LogSearchPath('package example',APackage.ExamplePath,ACPU,AOS);
|
|
LogSearchPath('package example',APackage.ExamplePath,ACPU,AOS);
|
|
- SD:=Dictionary.ReplaceStrings(T.Directory);
|
|
|
|
- SF:=Dictionary.ReplaceStrings(T.SourceFileName);
|
|
|
|
|
|
+ SD:=APackage.Dictionary.ReplaceStrings(T.Directory);
|
|
|
|
+ SF:=APackage.Dictionary.ReplaceStrings(T.SourceFileName);
|
|
if SD='' then
|
|
if SD='' then
|
|
- FindFileInPath(APackage.ExamplePath,SF,SD,ACPU,AOS);
|
|
|
|
|
|
+ FindFileInPath(APackage, APackage.ExamplePath,SF,SD,ACPU,AOS);
|
|
if SD<>'' then
|
|
if SD<>'' then
|
|
SD:=IncludeTrailingPathDelimiter(SD);
|
|
SD:=IncludeTrailingPathDelimiter(SD);
|
|
T.FTargetSourceFileName:=SD+SF;
|
|
T.FTargetSourceFileName:=SD+SF;
|
|
@@ -4215,8 +4275,8 @@ begin
|
|
try
|
|
try
|
|
if DoChangeDir and (APackage.Directory<>'') then
|
|
if DoChangeDir and (APackage.Directory<>'') then
|
|
EnterDir(APackage.Directory);
|
|
EnterDir(APackage.Directory);
|
|
- Dictionary.AddVariable('CPU',CPUToString(ACPU));
|
|
|
|
- Dictionary.AddVariable('OS',OSToString(AOS));
|
|
|
|
|
|
+ APackage.Dictionary.AddVariable('CPU',CPUToString(ACPU));
|
|
|
|
+ APackage.Dictionary.AddVariable('OS',OSToString(AOS));
|
|
For I:=0 to APackage.Targets.Count-1 do
|
|
For I:=0 to APackage.Targets.Count-1 do
|
|
begin
|
|
begin
|
|
T:=APackage.FTargets.TargetItems[I];
|
|
T:=APackage.FTargets.TargetItems[I];
|
|
@@ -4985,8 +5045,8 @@ begin
|
|
If (APackage.Directory<>'') then
|
|
If (APackage.Directory<>'') then
|
|
EnterDir(APackage.Directory);
|
|
EnterDir(APackage.Directory);
|
|
CreateOutputDir(APackage);
|
|
CreateOutputDir(APackage);
|
|
- Dictionary.AddVariable('UNITSOUTPUTDIR',APackage.GetUnitsOutputDir(Defaults.CPU,Defaults.OS));
|
|
|
|
- Dictionary.AddVariable('BINOUTPUTDIR',APackage.GetBinOutputDir(Defaults.CPU,Defaults.OS));
|
|
|
|
|
|
+ APackage.Dictionary.AddVariable('UNITSOUTPUTDIR',APackage.GetUnitsOutputDir(Defaults.CPU,Defaults.OS));
|
|
|
|
+ APackage.Dictionary.AddVariable('BINOUTPUTDIR',APackage.GetBinOutputDir(Defaults.CPU,Defaults.OS));
|
|
DoBeforeCompile(APackage);
|
|
DoBeforeCompile(APackage);
|
|
RegenerateUnitconfigFile:=False;
|
|
RegenerateUnitconfigFile:=False;
|
|
if APackage.BuildMode=bmBuildUnit then
|
|
if APackage.BuildMode=bmBuildUnit then
|
|
@@ -5204,7 +5264,7 @@ begin
|
|
DoBeforeInstall(APackage);
|
|
DoBeforeInstall(APackage);
|
|
// units
|
|
// units
|
|
B:=false;
|
|
B:=false;
|
|
- Dictionary.AddVariable('PackageName',APackage.Name);
|
|
|
|
|
|
+ GlobalDictionary.AddVariable('PackageName',APackage.Name);
|
|
D:=IncludeTrailingPathDelimiter(Defaults.UnitInstallDir);
|
|
D:=IncludeTrailingPathDelimiter(Defaults.UnitInstallDir);
|
|
if InstallPackageFiles(APAckage,ttUnit,D) then
|
|
if InstallPackageFiles(APAckage,ttUnit,D) then
|
|
B:=true;
|
|
B:=true;
|
|
@@ -6204,7 +6264,7 @@ begin
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
-function TDictionary.GetValue(const AName: String): String;
|
|
|
|
|
|
+function TDictionary.GetValue(AName: String): String;
|
|
begin
|
|
begin
|
|
Result:=GetValue(AName,'');
|
|
Result:=GetValue(AName,'');
|
|
end;
|
|
end;
|
|
@@ -6264,13 +6324,13 @@ begin
|
|
I:=0;
|
|
I:=0;
|
|
While I<High(Macros) do
|
|
While I<High(Macros) do
|
|
begin
|
|
begin
|
|
- Dictionary.AddVariable(Macros[i],Macros[I+1]);
|
|
|
|
|
|
+ GlobalDictionary.AddVariable(Macros[i],Macros[I+1]);
|
|
Inc(I,2);
|
|
Inc(I,2);
|
|
end;
|
|
end;
|
|
- Result:=Dictionary.ReplaceStrings(Source);
|
|
|
|
|
|
+ Result:=GlobalDictionary.ReplaceStrings(Source);
|
|
While I<High(Macros) do
|
|
While I<High(Macros) do
|
|
begin
|
|
begin
|
|
- Dictionary.RemoveItem(Macros[i]);
|
|
|
|
|
|
+ GlobalDictionary.RemoveItem(Macros[i]);
|
|
Inc(I,2);
|
|
Inc(I,2);
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
@@ -6347,6 +6407,6 @@ Finalization
|
|
FreeAndNil(CustomFpMakeCommandlineValues);
|
|
FreeAndNil(CustomFpMakeCommandlineValues);
|
|
FreeAndNil(CustomFpmakeCommandlineOptions);
|
|
FreeAndNil(CustomFpmakeCommandlineOptions);
|
|
FreeAndNil(DefInstaller);
|
|
FreeAndNil(DefInstaller);
|
|
- FreeAndNil(Dictionary);
|
|
|
|
|
|
+ FreeAndNil(GlobalDictionary);
|
|
FreeAndNil(Defaults);
|
|
FreeAndNil(Defaults);
|
|
end.
|
|
end.
|