--- Merging r45989 into '.':

U    packages/fpmkunit/src/fpmkunit.pp
--- Recording mergeinfo for merge of r45989 into '.':
 U   .
--- Merging r46857 into '.':
G    packages/fpmkunit/src/fpmkunit.pp
--- Recording mergeinfo for merge of r46857 into '.':
 G   .

git-svn-id: branches/fixes_3_2@46869 -
This commit is contained in:
Jonas Maebe 2020-09-15 20:12:56 +00:00
parent b6eafa3039
commit 221ca4d98c

View File

@ -482,7 +482,7 @@ Type
Function GetValue(AName : String) : String; Function GetValue(AName : String) : String;
Function GetValue(const AName,Args : String) : String; virtual; Function GetValue(const AName,Args : String) : String; virtual;
Function ReplaceStrings(Const ASource : String; Const MaxDepth: Integer = 10) : String; virtual; Function ReplaceStrings(Const ASource : String; Const MaxDepth: Integer = 10) : String; virtual;
Function Substitute(Const Source : String; Macros : Array of string) : String; virtual; Function Substitute(Const Source : String; const Macros : Array of string) : String; virtual;
end; end;
{ TPackageDictionary } { TPackageDictionary }
@ -847,6 +847,9 @@ Type
// Is set when all sourcefiles are found // Is set when all sourcefiles are found
FAllFilesResolved: boolean; FAllFilesResolved: boolean;
FPackageVariants: TFPList; FPackageVariants: TFPList;
{$ifndef NO_THREADING}
FResolveDirsCS: TRTLCriticalSection;
{$endif}
Function GetDescription : string; Function GetDescription : string;
function GetDictionary: TDictionary; function GetDictionary: TDictionary;
Function GetFileName : string; Function GetFileName : string;
@ -886,6 +889,8 @@ Type
procedure SetDefaultPackageVariant; procedure SetDefaultPackageVariant;
procedure LoadUnitConfigFromFile(Const AFileName: String); procedure LoadUnitConfigFromFile(Const AFileName: String);
procedure SaveUnitConfigToFile(Const AFileName: String;ACPU:TCPU;AOS:TOS); procedure SaveUnitConfigToFile(Const AFileName: String;ACPU:TCPU;AOS:TOS);
procedure EnterResolveDirsCS;
procedure LeaveResolveDirsCS;
Property Version : String Read GetVersion Write SetVersion; Property Version : String Read GetVersion Write SetVersion;
Property FileName : String Read GetFileName Write FFileName; Property FileName : String Read GetFileName Write FFileName;
Property ShortName : String Read GetShortName Write FShortName; Property ShortName : String Read GetShortName Write FShortName;
@ -1296,9 +1301,9 @@ Type
Procedure CheckPackages; virtual; Procedure CheckPackages; virtual;
Procedure CreateBuildEngine; virtual; Procedure CreateBuildEngine; virtual;
Procedure Error(const Msg : String); Procedure Error(const Msg : String);
Procedure Error(const Fmt : String; Args : Array of const); Procedure Error(const Fmt : String; const Args : Array of const);
Procedure AnalyzeOptions; Procedure AnalyzeOptions;
Procedure Usage(const FMT : String; Args : Array of const); Procedure Usage(const FMT : String; const Args : Array of const);
Procedure Compile(Force : Boolean); virtual; Procedure Compile(Force : Boolean); virtual;
Procedure Clean(AllTargets: boolean); virtual; Procedure Clean(AllTargets: boolean); virtual;
Procedure Install(ForceBuild : Boolean); virtual; Procedure Install(ForceBuild : Boolean); virtual;
@ -3148,10 +3153,11 @@ end;
constructor TCompileWorkerThread.Create(ABuildEngine: TBuildEngine; NotifyMainThreadEvent: PRTLEvent); constructor TCompileWorkerThread.Create(ABuildEngine: TBuildEngine; NotifyMainThreadEvent: PRTLEvent);
begin begin
inherited Create(false); inherited Create(true);
FNotifyStartTask := RTLEventCreate; FNotifyStartTask := RTLEventCreate;
FBuildEngine := ABuildEngine; FBuildEngine := ABuildEngine;
FNotifyMainThreadEvent:=NotifyMainThreadEvent; FNotifyMainThreadEvent:=NotifyMainThreadEvent;
Start;
end; end;
destructor TCompileWorkerThread.Destroy; destructor TCompileWorkerThread.Destroy;
@ -3649,6 +3655,9 @@ begin
// Implicit dependency on RTL // Implicit dependency on RTL
FDependencies.Add('rtl'); FDependencies.Add('rtl');
FSupportBuildModes:=[bmBuildUnit, bmOneByOne]; FSupportBuildModes:=[bmBuildUnit, bmOneByOne];
{$ifndef NO_THREADING}
InitCriticalSection(FResolveDirsCS);
{$endif}
end; end;
@ -3656,6 +3665,9 @@ destructor TPackage.destroy;
var var
i: integer; i: integer;
begin begin
{$ifndef NO_THREADING}
DoneCriticalSection(FResolveDirsCS);
{$endif}
FreeAndNil(FDictionary); FreeAndNil(FDictionary);
FreeAndNil(FDependencies); FreeAndNil(FDependencies);
FreeAndNil(FInstallFiles); FreeAndNil(FInstallFiles);
@ -4282,6 +4294,20 @@ begin
end; end;
end; end;
procedure TPackage.EnterResolveDirsCS;
begin
{$ifndef NO_THREADING}
EnterCriticalSection(FResolveDirsCS);
{$endif}
end;
procedure TPackage.LeaveResolveDirsCS;
begin
{$ifndef NO_THREADING}
LeaveCriticalSection(FResolveDirsCS);
{$endif}
end;
{**************************************************************************** {****************************************************************************
@ -5006,7 +5032,7 @@ begin
end; end;
procedure TCustomInstaller.Error(const Fmt: String; Args: array of const); procedure TCustomInstaller.Error(const Fmt: String; const Args: array of const);
begin begin
Raise EInstallerError.CreateFmt(Fmt,Args); Raise EInstallerError.CreateFmt(Fmt,Args);
end; end;
@ -5343,7 +5369,7 @@ begin
end; end;
procedure TCustomInstaller.Usage(const FMT: String; Args: array of const); procedure TCustomInstaller.Usage(const FMT: String; const Args: array of const);
Procedure LogCmd(const LC,Msg : String); Procedure LogCmd(const LC,Msg : String);
begin begin
@ -6568,27 +6594,36 @@ var
i: Integer; i: Integer;
Continue: Boolean; Continue: Boolean;
begin begin
if APackage.UnitDir='' then {$ifndef NO_THREADING}
begin APackage.EnterResolveDirsCS;
Log(vldebug, SDbgSearchExtDepPath, [APackage.Name]); try
GetPluginManager.BeforeResolvePackagePath(Self, APackage, Continue); {$endif}
if Continue then if APackage.UnitDir='' then
begin begin
for I := 0 to Defaults.SearchPath.Count-1 do Log(vldebug, SDbgSearchExtDepPath, [APackage.Name]);
GetPluginManager.BeforeResolvePackagePath(Self, APackage, Continue);
if Continue then
begin begin
if Defaults.SearchPath[i]<>'' then for I := 0 to Defaults.SearchPath.Count-1 do
GetPluginManager.ResolvePackagePath(Self, APackage, Defaults.SearchPath[i], Continue); begin
if not Continue then if Defaults.SearchPath[i]<>'' then
Break GetPluginManager.ResolvePackagePath(Self, APackage, Defaults.SearchPath[i], Continue);
if not Continue then
Break
end;
if Continue then
GetPluginManager.AfterResolvePackagePath(Self, APackage, Continue);
end; end;
if Continue then if APackage.UnitDir = '' then
GetPluginManager.AfterResolvePackagePath(Self, APackage, Continue); APackage.UnitDir := DirNotFound
end; end;
{$ifndef NO_THREADING}
if APackage.UnitDir = '' then finally
APackage.UnitDir := DirNotFound APackage.LeaveResolveDirsCS;
end; end;
{$endif}
end; end;
@ -9440,7 +9475,7 @@ begin
end; end;
Function TDictionary.Substitute(Const Source : String; Macros : Array of string) : String; Function TDictionary.Substitute(Const Source : String; const Macros : Array of string) : String;
Var Var
I : Integer; I : Integer;
begin begin
@ -9451,6 +9486,7 @@ begin
Inc(I,2); Inc(I,2);
end; end;
Result:=ReplaceStrings(Source); Result:=ReplaceStrings(Source);
I:=0;
While I<High(Macros) do While I<High(Macros) do
begin begin
RemoveItem(Macros[i]); RemoveItem(Macros[i]);