IDE/lazbuild: fixed check orphaned ppu

git-svn-id: trunk@48410 -
This commit is contained in:
mattias 2015-03-18 09:56:33 +00:00
parent 9cefd73299
commit 907bd03e63

View File

@ -839,6 +839,7 @@ var
OtherPPUFile: TPGInterPkgFile; OtherPPUFile: TPGInterPkgFile;
i: Integer; i: Integer;
Msg: String; Msg: String;
SrcFile: TPGInterPkgFile;
begin begin
CurNode:=Units.FindLowest; CurNode:=Units.FindLowest;
FirstNodeSameUnitname:=nil; FirstNodeSameUnitname:=nil;
@ -854,6 +855,7 @@ var
// => check units with same name // => check units with same name
FileGroup:=nil; FileGroup:=nil;
PPUFile:=nil; PPUFile:=nil;
SrcFile:=nil;
OtherNode:=FirstNodeSameUnitname; OtherNode:=FirstNodeSameUnitname;
while OtherNode<>nil do begin while OtherNode<>nil do begin
OtherFile:=TPGInterPkgFile(OtherNode.Data); OtherFile:=TPGInterPkgFile(OtherNode.Data);
@ -866,19 +868,17 @@ var
//debugln(['CheckPPUFilesInWrongDirs duplicate units found: file1="',CurUnit.FullFilename,'"(',CurUnit.OwnerInfo.Name,') file2="',OtherFile.FullFilename,'"(',OtherFile.OwnerInfo.Name,')']); //debugln(['CheckPPUFilesInWrongDirs duplicate units found: file1="',CurUnit.FullFilename,'"(',CurUnit.OwnerInfo.Name,') file2="',OtherFile.FullFilename,'"(',OtherFile.OwnerInfo.Name,')']);
FindUnitSourcePPU(OtherFile,OtherPPUFile); FindUnitSourcePPU(OtherFile,OtherPPUFile);
if FileGroup=nil then begin if FileGroup=nil then begin
FindUnitSourcePPU(CurUnit,PPUFile); SrcFile:=CurUnit;
Assert(Assigned(CurUnit), 'CheckDuplicateUnits: FindUnitSourcePPU() changed CurUnit to Nil. Not good!'); FindUnitSourcePPU(SrcFile,PPUFile);
end; end;
if (CurUnit<>nil) and (OtherFile<>nil) if (SrcFile<>nil) and (OtherFile<>nil)
and (CompareFilenames(CurUnit.FullFilename,OtherFile.FullFilename)=0) then and (CompareFilenames(SrcFile.FullFilename,OtherFile.FullFilename)=0) then
begin begin
// two packages share source directories // two packages share source directories
// -> do not warn single files // -> do not warn single files
continue; continue;
end; end;
//debugln(['CheckPPUFilesInWrongDirs duplicate units found: file1="',CurUnit.FullFilename,'"(',CurUnit.OwnerInfo.Name,') ppu=',PPUFile<>nil,' file2="',OtherFile.FullFilename,'"(',OtherFile.OwnerInfo.Name,') ppu=',OtherPPUFile<>nil]);
if (PPUFile<>nil) and (OtherPPUFile<>nil) if (PPUFile<>nil) and (OtherPPUFile<>nil)
and (CompareFilenames(PPUFile.FullFilename,OtherPPUFile.FullFilename)=0) and (CompareFilenames(PPUFile.FullFilename,OtherPPUFile.FullFilename)=0)
and (OtherFile=nil) then begin and (OtherFile=nil) then begin
@ -891,7 +891,7 @@ var
if FileGroup=nil then begin if FileGroup=nil then begin
FileGroup:=TPGIPAmbiguousFileGroup.Create; FileGroup:=TPGIPAmbiguousFileGroup.Create;
FileGroup.Add(CurUnit,PPUFile); FileGroup.Add(SrcFile,PPUFile);
AmbiguousFileGroups.Add(FileGroup); AmbiguousFileGroups.Add(FileGroup);
end; end;
FileGroup.Add(OtherFile,OtherPPUFile); FileGroup.Add(OtherFile,OtherPPUFile);
@ -906,19 +906,19 @@ var
if FileGroup<>nil then begin if FileGroup<>nil then begin
for i:=0 to length(FileGroup.Sources)-1 do for i:=0 to length(FileGroup.Sources)-1 do
begin begin
CurUnit:=FileGroup.CompiledFiles[i]; SrcFile:=FileGroup.Sources[i];
PPUFile:=FileGroup.Sources[i]; PPUFile:=FileGroup.CompiledFiles[i];
if PPUFile<>nil then if SrcFile<>nil then
begin begin
Msg:='Duplicate unit "'+SrcFile.AnUnitName+'"';
Msg+=' in "'+SrcFile.OwnerInfo.Name+'"';
if PPUFile<>nil then
Msg+=', ppu="'+PPUFile.FullFilename+'"';
Msg+=', source="'+SrcFile.FullFilename+'"';
end else begin
Msg:='Duplicate unit "'+PPUFile.AnUnitName+'"'; Msg:='Duplicate unit "'+PPUFile.AnUnitName+'"';
Msg+=' in "'+PPUFile.OwnerInfo.Name+'"'; Msg+=' in "'+PPUFile.OwnerInfo.Name+'"';
if CurUnit<>nil then Msg+=', orphaned ppu "'+PPUFile.FullFilename+'"';
Msg+=', ppu="'+CurUnit.FullFilename+'"';
Msg+=', source="'+PPUFile.FullFilename+'"';
end else begin
Msg:='Duplicate unit "'+CurUnit.AnUnitName+'"';
Msg+=' in "'+CurUnit.OwnerInfo.Name+'"';
Msg+=', orphaned ppu "'+CurUnit.FullFilename+'"';
end; end;
if IDEMessagesWindow<>nil then if IDEMessagesWindow<>nil then
IDEMessagesWindow.AddCustomMessage(mluNote,Msg) IDEMessagesWindow.AddCustomMessage(mluNote,Msg)