mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 18:39:10 +02:00
IDE: fpc msg parser: started showing resource output
git-svn-id: trunk@45183 -
This commit is contained in:
parent
e5cad01118
commit
73668b5f04
@ -43,6 +43,8 @@ const
|
|||||||
FPCMsgIDCantFindUnitUsedBy = 10022;
|
FPCMsgIDCantFindUnitUsedBy = 10022;
|
||||||
FPCMsgIDLinking = 9015;
|
FPCMsgIDLinking = 9015;
|
||||||
FPCMsgIDErrorWhileLinking = 9013;
|
FPCMsgIDErrorWhileLinking = 9013;
|
||||||
|
FPCMsgIDErrorWhileCompilingResources = 9029;
|
||||||
|
FPCMsgIDCallingResourceCompiler = 9028;
|
||||||
FPCMsgIDThereWereErrorsCompiling = 10026;
|
FPCMsgIDThereWereErrorsCompiling = 10026;
|
||||||
|
|
||||||
FPCMsgAttrWorkerDirectory = 'WD';
|
FPCMsgAttrWorkerDirectory = 'WD';
|
||||||
@ -141,6 +143,7 @@ type
|
|||||||
fMsgItemCompilationAborted: TFPCMsgItem;
|
fMsgItemCompilationAborted: TFPCMsgItem;
|
||||||
fMsgItemThereWereErrorsCompiling: TFPCMsgItem;
|
fMsgItemThereWereErrorsCompiling: TFPCMsgItem;
|
||||||
fMsgItemErrorWhileLinking: TFPCMsgItem;
|
fMsgItemErrorWhileLinking: TFPCMsgItem;
|
||||||
|
fMsgItemErrorWhileCompilingResources: TFPCMsgItem;
|
||||||
fMissingFPCMsgItem: TFPCMsgItem;
|
fMissingFPCMsgItem: TFPCMsgItem;
|
||||||
function FileExists(const Filename: string; aSynchronized: boolean): boolean;
|
function FileExists(const Filename: string; aSynchronized: boolean): boolean;
|
||||||
function CheckForMsgId(p: PChar): boolean; // (MsgId) message
|
function CheckForMsgId(p: PChar): boolean; // (MsgId) message
|
||||||
@ -151,13 +154,13 @@ type
|
|||||||
function CheckForAssemblingState(p: PChar): boolean; // Assembling ..
|
function CheckForAssemblingState(p: PChar): boolean; // Assembling ..
|
||||||
function CheckForLinesCompiled(p: PChar): boolean; // ..lines compiled..
|
function CheckForLinesCompiled(p: PChar): boolean; // ..lines compiled..
|
||||||
function CheckForExecutableInfo(p: PChar): boolean;
|
function CheckForExecutableInfo(p: PChar): boolean;
|
||||||
function CheckForFollowUpMessages(p: PChar): boolean;
|
|
||||||
function CheckForLineProgress(p: PChar): boolean; // 600 206.521/231.648 Kb Used
|
function CheckForLineProgress(p: PChar): boolean; // 600 206.521/231.648 Kb Used
|
||||||
function CheckForRecompilingChecksumChangedMessages(p: PChar): boolean;
|
function CheckForRecompilingChecksumChangedMessages(p: PChar): boolean;
|
||||||
function CheckForLoadFromUnit(p: PChar): Boolean;
|
function CheckForLoadFromUnit(p: PChar): Boolean;
|
||||||
function CheckForWindresErrors(p: PChar): boolean;
|
function CheckForWindresErrors(p: PChar): boolean;
|
||||||
function CreateMsgLine: TMessageLine;
|
function CreateMsgLine: TMessageLine;
|
||||||
procedure AddLinkingMessages;
|
procedure AddLinkingMessages;
|
||||||
|
procedure AddResourceMessages;
|
||||||
procedure ImproveMsgHiddenByIDEDirective(const SourceOK: Boolean;
|
procedure ImproveMsgHiddenByIDEDirective(const SourceOK: Boolean;
|
||||||
var MsgLine: TMessageLine);
|
var MsgLine: TMessageLine);
|
||||||
procedure ImproveMsgSenderNotUsed(aSynchronized: boolean; MsgLine: TMessageLine);
|
procedure ImproveMsgSenderNotUsed(aSynchronized: boolean; MsgLine: TMessageLine);
|
||||||
@ -1010,20 +1013,23 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TIDEFPCParser.InitReading;
|
procedure TIDEFPCParser.InitReading;
|
||||||
var
|
|
||||||
|
procedure AddPatternItem(MsgID: integer);
|
||||||
|
var
|
||||||
Item: TFPCMsgItem;
|
Item: TFPCMsgItem;
|
||||||
|
begin
|
||||||
|
Item:=MsgFile.GetMsg(MsgID);
|
||||||
|
if Item<>nil then
|
||||||
|
fLineToMsgID.AddLines(Item.Pattern,Item.ID);
|
||||||
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
inherited InitReading;
|
inherited InitReading;
|
||||||
|
|
||||||
fLineToMsgID.Clear;
|
fLineToMsgID.Clear;
|
||||||
// FPC logo lines
|
AddPatternItem(FPCMsgIDLogo);
|
||||||
Item:=MsgFile.GetMsg(FPCMsgIDLogo);
|
AddPatternItem(FPCMsgIDLinking);
|
||||||
if Item<>nil then
|
AddPatternItem(FPCMsgIDCallingResourceCompiler);
|
||||||
fLineToMsgID.AddLines(Item.Pattern,Item.ID);
|
|
||||||
// Linking <progname>
|
|
||||||
Item:=MsgFile.GetMsg(FPCMsgIDLinking);
|
|
||||||
if Item<>nil then
|
|
||||||
fLineToMsgID.AddLines(Item.Pattern,Item.ID);
|
|
||||||
//fLineToMsgID.WriteDebugReport;
|
//fLineToMsgID.WriteDebugReport;
|
||||||
|
|
||||||
fLastWorkerImprovedMessage[false]:=-1;
|
fLastWorkerImprovedMessage[false]:=-1;
|
||||||
@ -1290,33 +1296,6 @@ begin
|
|||||||
AddMsgLine(MsgLine);
|
AddMsgLine(MsgLine);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TIDEFPCParser.CheckForFollowUpMessages(p: PChar): boolean;
|
|
||||||
var
|
|
||||||
i: Integer;
|
|
||||||
PrevMsgLine: TMessageLine;
|
|
||||||
MsgLine: TMessageLine;
|
|
||||||
begin
|
|
||||||
Result:=false;
|
|
||||||
i:=Tool.WorkerMessages.Count-1;
|
|
||||||
if i<0 then exit;
|
|
||||||
PrevMsgLine:=Tool.WorkerMessages[i];
|
|
||||||
|
|
||||||
if (PrevMsgLine.SubTool=SubToolFPCRes)
|
|
||||||
or ((PrevMsgLine.SubTool=SubToolFPC)
|
|
||||||
and ((PrevMsgLine.MsgID=9022) // (9022) Compiling resource <resource>
|
|
||||||
or (PrevMsgLine.MsgID=9028))) // (9028) Calling resource compiler "/usr/bin/fpcres" with ...
|
|
||||||
then begin
|
|
||||||
// this is a follow up resource compiler warning/error
|
|
||||||
MsgLine:=CreateMsgLine;
|
|
||||||
MsgLine.SubTool:=SubToolFPCRes;
|
|
||||||
MsgLine.Urgency:=PrevMsgLine.Urgency;
|
|
||||||
MsgLine.Msg:=p;
|
|
||||||
//debugln(['TFPCParser.CheckForCompilingResourceErrors ',MsgLine.Msg,' ',dbgs(MsgLine.Urgency)]);
|
|
||||||
AddMsgLine(MsgLine);
|
|
||||||
exit(true);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TIDEFPCParser.CheckForRecompilingChecksumChangedMessages(p: PChar
|
function TIDEFPCParser.CheckForRecompilingChecksumChangedMessages(p: PChar
|
||||||
): boolean;
|
): boolean;
|
||||||
// example: Recompiling GtkInt, checksum changed for gdk2x
|
// example: Recompiling GtkInt, checksum changed for gdk2x
|
||||||
@ -1446,6 +1425,35 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TIDEFPCParser.AddResourceMessages;
|
||||||
|
{ Add messages for all output between "Calling resource compiler " and the
|
||||||
|
current line "Error while compiling resources"
|
||||||
|
|
||||||
|
For example:
|
||||||
|
Calling resource compiler "/usr/bin/fpcres" with "-o /home/user/project1.or -a x86_64 -of elf -v "@/home/user/project1.reslst"" as command line
|
||||||
|
Debug: parsing command line parameters
|
||||||
|
...
|
||||||
|
Error: Error while compiling resources
|
||||||
|
}
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
MsgLine: TMessageLine;
|
||||||
|
begin
|
||||||
|
// find message "Linking ..."
|
||||||
|
i:=Tool.WorkerMessages.Count-1;
|
||||||
|
while (i>=0) and (Tool.WorkerMessages[i].MsgID<>FPCMsgIDCallingResourceCompiler) do
|
||||||
|
dec(i);
|
||||||
|
if i<0 then exit;
|
||||||
|
MsgLine:=Tool.WorkerMessages[i];
|
||||||
|
for i:=MsgLine.OutputIndex+1 to fOutputIndex-1 do begin
|
||||||
|
MsgLine:=inherited CreateMsgLine(i);
|
||||||
|
MsgLine.MsgID:=0;
|
||||||
|
MsgLine.SubTool:=SubToolFPCRes;
|
||||||
|
MsgLine.Urgency:=mluHint;
|
||||||
|
AddMsgLine(MsgLine);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
function TIDEFPCParser.IsMsgID(MsgLine: TMessageLine; MsgID: integer;
|
function TIDEFPCParser.IsMsgID(MsgLine: TMessageLine; MsgID: integer;
|
||||||
var Item: TFPCMsgItem): boolean;
|
var Item: TFPCMsgItem): boolean;
|
||||||
begin
|
begin
|
||||||
@ -1829,8 +1837,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function TIDEFPCParser.CheckForMsgId(p: PChar): boolean;
|
function TIDEFPCParser.CheckForMsgId(p: PChar): boolean;
|
||||||
const
|
|
||||||
FPCMsgIDErrorWhileCompilingResources = 9029;
|
|
||||||
var
|
var
|
||||||
MsgItem: TFPCMsgItem;
|
MsgItem: TFPCMsgItem;
|
||||||
TranslatedItem: TFPCMsgItem;
|
TranslatedItem: TFPCMsgItem;
|
||||||
@ -2064,8 +2070,6 @@ begin
|
|||||||
if CheckForInfos(p) then exit;
|
if CheckForInfos(p) then exit;
|
||||||
// check for -vx output
|
// check for -vx output
|
||||||
if CheckForExecutableInfo(p) then exit;
|
if CheckForExecutableInfo(p) then exit;
|
||||||
// check for follow up errors (fpcres messages)
|
|
||||||
if CheckForFollowUpMessages(p) then exit;
|
|
||||||
// check for Recompiling, checksum changed
|
// check for Recompiling, checksum changed
|
||||||
if CheckForRecompilingChecksumChangedMessages(p) then exit;
|
if CheckForRecompilingChecksumChangedMessages(p) then exit;
|
||||||
// check for Load from unit
|
// check for Load from unit
|
||||||
@ -2081,9 +2085,18 @@ end;
|
|||||||
|
|
||||||
procedure TIDEFPCParser.AddMsgLine(MsgLine: TMessageLine);
|
procedure TIDEFPCParser.AddMsgLine(MsgLine: TMessageLine);
|
||||||
begin
|
begin
|
||||||
if IsMsgID(MsgLine,FPCMsgIDErrorWhileLinking,fMsgItemErrorWhileLinking) then
|
if IsMsgID(MsgLine,FPCMsgIDErrorWhileCompilingResources,
|
||||||
AddLinkingMessages;
|
fMsgItemErrorWhileCompilingResources)
|
||||||
if IsMsgID(MsgLine,FPCMsgIDThereWereErrorsCompiling,fMsgItemThereWereErrorsCompiling) then
|
then begin
|
||||||
|
// Error while compiling resources
|
||||||
|
AddResourceMessages;
|
||||||
|
MsgLine.Msg:=MsgLine.Msg+' -> Compile with -vd for more details. Check for duplicates.';
|
||||||
|
end
|
||||||
|
else if IsMsgID(MsgLine,FPCMsgIDErrorWhileLinking,fMsgItemErrorWhileLinking) then
|
||||||
|
AddLinkingMessages
|
||||||
|
else if IsMsgID(MsgLine,FPCMsgIDThereWereErrorsCompiling,
|
||||||
|
fMsgItemThereWereErrorsCompiling)
|
||||||
|
then
|
||||||
MsgLine.Urgency:=mluVerbose;
|
MsgLine.Urgency:=mluVerbose;
|
||||||
inherited AddMsgLine(MsgLine);
|
inherited AddMsgLine(MsgLine);
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user