added check to never save doubles in staticpackage.inc

git-svn-id: trunk@5772 -
This commit is contained in:
mattias 2004-08-12 09:36:46 +00:00
parent 4340c26a6e
commit e603afe3a7
2 changed files with 33 additions and 17 deletions

View File

@ -2007,6 +2007,13 @@ resourcestring
lisPkgMangThePackageOwnsTheFileShouldTheFileBeRenamed = 'The package %s ' lisPkgMangThePackageOwnsTheFileShouldTheFileBeRenamed = 'The package %s '
+'owns the file%s%s%s%s.%sShould the file be renamed in the package as ' +'owns the file%s%s%s%s.%sShould the file be renamed in the package as '
+'well?'; +'well?';
lisPkgMangAddingNewDependencyForProjectPackage = '%sAdding new Dependency '
+'for project %s: package %s%s';
lisPkgMangAddingNewDependencyForPackagePackage = '%sAdding new Dependency '
+'for package %s: package %s%s';
lisPkgMangTheFollowingUnitsWillBeAddedToTheUsesSectionOf = '%sThe following '
+'units will be added to the uses section of%s%s:%s%s%s';
lisConfirmChanges = 'Confirm changes';
lisPkgMangFileNotSaved = 'File not saved'; lisPkgMangFileNotSaved = 'File not saved';
lisPkgMangPleaseSaveTheFileBeforeAddingItToAPackage = 'Please save the file ' lisPkgMangPleaseSaveTheFileBeforeAddingItToAPackage = 'Please save the file '
+'before adding it to a package.'; +'before adding it to a package.';

View File

@ -1326,8 +1326,10 @@ begin
while Dependency<>nil do begin while Dependency<>nil do begin
if (Dependency.LoadPackageResult=lprSuccess) if (Dependency.LoadPackageResult=lprSuccess)
and (not Dependency.RequiredPackage.AutoCreated) then begin and (not Dependency.RequiredPackage.AutoCreated) then begin
sl.Add(Dependency.PackageName); if sl.IndexOf(Dependency.PackageName)<0 then begin
writeln('TPkgManager.SaveAutoInstallDependencies A ',Dependency.PackageName); sl.Add(Dependency.PackageName);
writeln('TPkgManager.SaveAutoInstallDependencies A ',Dependency.PackageName);
end;
end; end;
Dependency:=Dependency.NextRequiresDependency; Dependency:=Dependency.NextRequiresDependency;
end; end;
@ -2554,29 +2556,26 @@ var
UnitOwner:=TObject(MissingDependencies[i]); UnitOwner:=TObject(MissingDependencies[i]);
RequiredPackage:=TLazPackage(MissingDependencies.Objects[i]); RequiredPackage:=TLazPackage(MissingDependencies.Objects[i]);
if UnitOwner is TProject then begin if UnitOwner is TProject then begin
PackageAdditions:=PackageAdditions PackageAdditions:=Format(
+'Adding new Dependency for project '+TProject(UnitOwner).Title lisPkgMangAddingNewDependencyForProjectPackage, [PackageAdditions,
+': package '+RequiredPackage.Name TProject(UnitOwner).Title, RequiredPackage.Name, #13#13]);
+#13#13;
end else if UnitOwner is TLazPackage then begin end else if UnitOwner is TLazPackage then begin
PackageAdditions:=PackageAdditions PackageAdditions:=Format(
+'Adding new Dependency for package '+TLazPackage(UnitOwner).Name lisPkgMangAddingNewDependencyForPackagePackage, [PackageAdditions,
+': package '+RequiredPackage.Name TLazPackage(UnitOwner).Name, RequiredPackage.Name, #13#13]);
+#13#13;
end; end;
end; end;
writeln('TPkgManager.AddUnitDependenciesForComponentClasses PackageAdditions=',PackageAdditions); writeln('TPkgManager.AddUnitDependenciesForComponentClasses PackageAdditions=',PackageAdditions);
Msg:=''; Msg:='';
if UsesAdditions<>'' then begin if UsesAdditions<>'' then begin
Msg:=Msg+'The following units will be added to the uses section of'#13 Msg:=Format(lisPkgMangTheFollowingUnitsWillBeAddedToTheUsesSectionOf, [
+UnitFilename+':'#13 Msg, #13, UnitFilename, #13, UsesAdditions, #13#13]);
+UsesAdditions+#13#13;
end; end;
if PackageAdditions<>'' then begin if PackageAdditions<>'' then begin
Msg:=Msg+PackageAdditions; Msg:=Msg+PackageAdditions;
end; end;
if Msg<>'' then begin if Msg<>'' then begin
Result:=MessageDlg('Confirm changes', Result:=MessageDlg(lisConfirmChanges,
Msg,mtConfirmation,[mbOk,mbAbort],0); Msg,mtConfirmation,[mbOk,mbAbort],0);
exit; exit;
end; end;
@ -2784,8 +2783,17 @@ end;
function TPkgManager.DoInstallPackage(APackage: TLazPackage): TModalResult; function TPkgManager.DoInstallPackage(APackage: TLazPackage): TModalResult;
var var
Dependency: TPkgDependency;
PkgList: TList; PkgList: TList;
function GetPkgListIndex(APackage: TLazPackage): integer;
begin
Result:=PkgList.Count-1;
while (Result>=0) and (TLazPackage(PkgList[Result])<>APackage) do
dec(Result);
end;
var
Dependency: TPkgDependency;
i: Integer; i: Integer;
s: String; s: String;
NeedSaving: Boolean; NeedSaving: Boolean;
@ -2822,7 +2830,7 @@ begin
// remove packages already marked for installation // remove packages already marked for installation
for i:=PkgList.Count-1 downto 0 do begin for i:=PkgList.Count-1 downto 0 do begin
RequiredPackage:=TLazPackage(PkgList[i]); RequiredPackage:=TLazPackage(PkgList[i]);
if RequiredPackage.AutoInstall<>pitNope then if (RequiredPackage.AutoInstall<>pitNope) then
PkgList.Delete(i); PkgList.Delete(i);
end; end;
@ -2842,7 +2850,8 @@ begin
end; end;
// add packages to auto installed packages // add packages to auto installed packages
PkgList.Add(APackage); if GetPkgListIndex(APackage)<0 then
PkgList.Add(APackage);
NeedSaving:=false; NeedSaving:=false;
for i:=0 to PkgList.Count-1 do begin for i:=0 to PkgList.Count-1 do begin
RequiredPackage:=TLazPackage(PkgList[i]); RequiredPackage:=TLazPackage(PkgList[i]);