Packager: Respect a user's choice to abort loading packages when an error happened.

This commit is contained in:
Juha 2021-11-20 16:35:01 +02:00
parent 6708a746c8
commit 097a96f950
2 changed files with 3 additions and 11 deletions

View File

@ -494,7 +494,7 @@ type
property OnDeleteAmbiguousFiles: TPkgDeleteAmbiguousFiles
read FOnDeleteAmbiguousFiles write FOnDeleteAmbiguousFiles;
property OnTranslatePackage: TPkgTranslate read FOnTranslatePackage
write FOnTranslatePackage;
write FOnTranslatePackage;
property OnUninstallPackage: TPkgUninstall read FOnUninstallPackage
write FOnUninstallPackage;
property OnBeforeCompilePackages: TOnBeforeCompilePackages read
@ -912,7 +912,6 @@ procedure TLazPackageGraph.SetRegistrationPackage(const AValue: TLazPackage);
begin
if FRegistrationPackage=AValue then exit;
FRegistrationPackage:=AValue;
AbortRegistration:=false;
LazarusPackageIntf.RegisterUnitProc:=@RegisterUnitHandler;
RegisterComponentsProc:=@RegisterComponentsGlobalHandler;
RegisterNoIconProc:=@RegisterNoIconGlobalHandler;

View File

@ -1537,32 +1537,25 @@ begin
StaticPackages:=LazarusPackageIntf.RegisteredPackages;
if StaticPackages=nil then exit;
Quiet:=false;
// register IDE's FCL components
PackageGraph.AbortRegistration:=false;
// register components in Lazarus packages
for i:=0 to StaticPackages.Count-1 do begin
StaticPackage:=PRegisteredPackage(StaticPackages[i]);
//debugln(['TPkgManager.LoadStaticCustomPackages ',StaticPackage^.Name]);
// check package name
if not IsValidPkgName(StaticPackage^.Name)
then begin
if not IsValidPkgName(StaticPackage^.Name) then begin
DebugLn('Warning: (lazarus) [TPkgManager.LoadStaticCustomPackages] Invalid Package Name: "',
BinaryStrToText(StaticPackage^.Name),'"');
continue;
end;
// check RegisterFCLBaseComponents procedure
if (StaticPackage^.RegisterProc=nil) then begin
DebugLn('Warning: (lazarus) [TPkgManager.LoadStaticCustomPackages]',
' Package "',StaticPackage^.Name,'" has no register procedure.');
continue;
end;
// load package
APackage:=LoadInstalledPackage(StaticPackage^.Name,KeepInstalledPackages,Quiet);
PackageGraph.RegisterStaticPackage(APackage,StaticPackage^.RegisterProc);
end;
PackageGraph.SortAutoInstallDependencies;