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

View File

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