mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-14 14:59:22 +02:00
IDE: package editor: add new component: do not add dependency if already indirectly required
git-svn-id: trunk@35197 -
This commit is contained in:
parent
f819ed7030
commit
7360413d68
@ -34,17 +34,14 @@
|
||||
<OutDir Value="languages"/>
|
||||
</i18n>
|
||||
<Type Value="RunAndDesignTime"/>
|
||||
<RequiredPkgs Count="3">
|
||||
<RequiredPkgs Count="2">
|
||||
<Item1>
|
||||
<PackageName Value="LCL"/>
|
||||
<PackageName Value="IDEIntf"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<PackageName Value="IDEIntf"/>
|
||||
</Item2>
|
||||
<Item3>
|
||||
<PackageName Value="FCL"/>
|
||||
<MinVersion Major="1" Valid="True"/>
|
||||
</Item3>
|
||||
</Item2>
|
||||
</RequiredPkgs>
|
||||
<UsageOptions>
|
||||
<UnitPath Value="$(PkgOutDir)"/>
|
||||
|
@ -1463,6 +1463,26 @@ function TPackageEditorForm.ShowAddDialog(var DlgPage: TAddToPkgType
|
||||
var
|
||||
IgnoreUnitPaths, IgnoreIncPaths: TFilenameToStringTree;
|
||||
|
||||
function PkgDependsOn(PkgName: string): boolean;
|
||||
var
|
||||
List: TFPList;
|
||||
i: Integer;
|
||||
begin
|
||||
if PkgName='' then exit;
|
||||
List:=nil;
|
||||
try
|
||||
LazPackage.GetAllRequiredPackages(List,true);
|
||||
if (List<>nil) then begin
|
||||
for i:=0 to List.Count-1 do
|
||||
if SysUtils.CompareText(TLazPackage(List[i]).Name,PkgName)=0 then
|
||||
exit(true);
|
||||
end;
|
||||
finally
|
||||
List.Free;
|
||||
end;
|
||||
Result:=false;
|
||||
end;
|
||||
|
||||
procedure AddUnit(AddParams: TAddToPkgResult);
|
||||
var
|
||||
NewLFMFilename: String;
|
||||
@ -1516,11 +1536,10 @@ var
|
||||
PkgFileFlags,cpNormal);
|
||||
// add dependency
|
||||
if (AddParams.Dependency<>nil)
|
||||
and (LazPackage.FindDependencyByName(AddParams.Dependency.PackageName)=nil)
|
||||
then
|
||||
and (not PkgDependsOn(AddParams.Dependency.PackageName)) then
|
||||
PackageGraph.AddDependencyToPackage(LazPackage,AddParams.Dependency);
|
||||
if (AddParams.IconFile<>'')
|
||||
and (LazPackage.FindDependencyByName('LCL')=nil) then
|
||||
and (not PkgDependsOn('LCL')) then
|
||||
PackageGraph.AddDependencyToPackage(LazPackage,PackageGraph.LCLPackage);
|
||||
PackageEditors.DeleteAmbiguousFiles(LazPackage,AddParams.UnitFilename);
|
||||
// open file in editor
|
||||
|
Loading…
Reference in New Issue
Block a user