mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-30 17:11:59 +02:00
IDE: messages: hint for execute before/after tool
git-svn-id: trunk@45156 -
This commit is contained in:
parent
ae4fb969e4
commit
d8e83aafcf
@ -346,7 +346,7 @@ type
|
||||
DoSwitchPathDelims: boolean); virtual;
|
||||
procedure SaveToXMLConfig(XMLConfig: TXMLConfig; const Path: string;
|
||||
UsePathDelim: TPathDelimSwitch); virtual;
|
||||
function Execute(const WorkingDir, ToolTitle: string): TModalResult;
|
||||
function Execute(const WorkingDir, ToolTitle, CompileHint: string): TModalResult;
|
||||
property ChangeStamp: int64 read FChangeStamp;
|
||||
procedure IncreaseChangeStamp;
|
||||
property OnChanged: TNotifyEvent read FOnChanged write FOnChanged;
|
||||
@ -4206,13 +4206,17 @@ begin
|
||||
if Done(Tool.AddDiff('ShowAllMessages',ShowAllMessages,CompOpts.ShowAllMessages)) then exit;
|
||||
end;
|
||||
|
||||
function TCompilationToolOptions.Execute(const WorkingDir, ToolTitle: string
|
||||
): TModalResult;
|
||||
function TCompilationToolOptions.Execute(const WorkingDir, ToolTitle,
|
||||
CompileHint: string): TModalResult;
|
||||
var
|
||||
ProgramFilename, Params: string;
|
||||
Filename: String;
|
||||
CurCommand: String;
|
||||
{$IFDEF EnableNewExtTools}
|
||||
ExtTool: TAbstractExternalTool;
|
||||
{$ELSE}
|
||||
ExtTool: TIDEExternalToolOptions;
|
||||
{$ENDIF}
|
||||
begin
|
||||
Result:=mrCancel;
|
||||
|
||||
@ -4229,23 +4233,29 @@ begin
|
||||
if Filename<>'' then ProgramFilename:=Filename;
|
||||
end;
|
||||
|
||||
{$IFDEF EnableNewExtTools}
|
||||
ExtTool:=ExternalToolList.Add(ToolTitle);
|
||||
ExtTool.Hint:=CompileHint;
|
||||
ExtTool.Process.CurrentDirectory:=WorkingDir;
|
||||
ExtTool.Process.Executable:=ProgramFilename;
|
||||
ExtTool.CmdLineParams:=Params;
|
||||
if ScanForFPCMessages then
|
||||
ExtTool.AddParsers(SubToolFPC);
|
||||
if ScanForMakeMessages then
|
||||
ExtTool.AddParsers(SubToolMake);
|
||||
if ExtTool.ParserCount=0 then
|
||||
ExtTool.AddParsers(SubToolDefault);
|
||||
// run
|
||||
ExtTool.Execute;
|
||||
ExtTool.WaitForExit;
|
||||
if ExtTool.ErrorMessage='' then
|
||||
Result:=mrOK;
|
||||
{$ELSE}
|
||||
ExtTool:=TIDEExternalToolOptions.Create;
|
||||
try
|
||||
ExtTool.Title:=ToolTitle;
|
||||
ExtTool.WorkingDirectory:=WorkingDir;
|
||||
ExtTool.CmdLineParams:=Params;
|
||||
{$IFDEF EnableNewExtTools}
|
||||
ExtTool.Executable:=ProgramFilename;
|
||||
if ScanForFPCMessages then
|
||||
ExtTool.Scanners.Add(SubToolFPC);
|
||||
if ScanForMakeMessages then
|
||||
ExtTool.Scanners.Add(SubToolMake);
|
||||
if ExtTool.Scanners.Count=0 then
|
||||
ExtTool.Scanners.Add(SubToolDefault);
|
||||
// run
|
||||
if RunExternalTool(ExtTool) then
|
||||
Result:=mrOk;
|
||||
{$ELSE}
|
||||
ExtTool.Filename:=ProgramFilename;
|
||||
ExtTool.ScanOutputForFPCMessages:=ScanForFPCMessages;
|
||||
ExtTool.ScanOutputForMakeMessages:=ScanForMakeMessages;
|
||||
@ -4253,11 +4263,11 @@ begin
|
||||
ExtTool.ShowAllOutput:=ShowAllMessages;
|
||||
// run
|
||||
Result:=RunExternalTool(ExtTool);
|
||||
{$ENDIF}
|
||||
finally
|
||||
// clean up
|
||||
ExtTool.Free;
|
||||
end;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
procedure TCompilationToolOptions.IncreaseChangeStamp;
|
||||
|
@ -733,6 +733,7 @@ resourcestring
|
||||
+'compiler while debugging or compiling.';
|
||||
lisProjectSuccessfullyBuilt = 'Project %s%s%s successfully built';
|
||||
lisExecutingCommandBefore = 'Executing command before';
|
||||
lisProject2 = 'Project: ';
|
||||
lisExecutingCommandAfter = 'Executing command after';
|
||||
lisNoProgramFileSFound = 'No program file %s%s%s found.';
|
||||
lisNotNow = 'Not now';
|
||||
|
10
ide/main.pp
10
ide/main.pp
@ -7089,6 +7089,8 @@ begin
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
if aCompileHint<>'' then
|
||||
aCompileHint:='Compile Reason: '+aCompileHint;
|
||||
|
||||
// create unit output directory
|
||||
UnitOutputDirectory:=Project1.CompilerOptions.GetUnitOutPath(false);
|
||||
@ -7159,7 +7161,8 @@ begin
|
||||
Project1.CompilerOptions.ExecuteBefore);
|
||||
if (AReason in ToolBefore.CompileReasons) then begin
|
||||
Result:=Project1.CompilerOptions.ExecuteBefore.Execute(
|
||||
Project1.ProjectDirectory,lisExecutingCommandBefore);
|
||||
Project1.ProjectDirectory, lisProject2+lisExecutingCommandBefore,
|
||||
aCompileHint);
|
||||
if Result<>mrOk then
|
||||
begin
|
||||
debugln(['TMainIDE.DoBuildProject CompilerOptions.ExecuteBefore.Execute failed']);
|
||||
@ -7188,7 +7191,7 @@ begin
|
||||
|
||||
// compile
|
||||
CompilerFilename:=Project1.GetCompilerFilename;
|
||||
// aCompileHint: use absolute paths, because some external tools resolve symlinked directories
|
||||
// Hint: use absolute paths, because some external tools resolve symlinked directories
|
||||
CompilerParams :=
|
||||
Project1.CompilerOptions.MakeOptionsString(SrcFilename,[ccloAbsolutePaths])
|
||||
+ ' ' + PrepareCmdLineOption(SrcFilename);
|
||||
@ -7249,7 +7252,8 @@ begin
|
||||
// no need to check for mrOk, we are exit if it wasn't
|
||||
if (AReason in ToolAfter.CompileReasons) then begin
|
||||
Result:=Project1.CompilerOptions.ExecuteAfter.Execute(
|
||||
Project1.ProjectDirectory,lisExecutingCommandAfter);
|
||||
Project1.ProjectDirectory,
|
||||
lisProject2+lisExecutingCommandAfter,aCompileHint);
|
||||
if Result<>mrOk then
|
||||
begin
|
||||
debugln(['TMainIDE.DoBuildProject CompilerOptions.ExecuteAfter.Execute failed']);
|
||||
|
@ -3415,6 +3415,8 @@ begin
|
||||
Result:=CheckIfPackageNeedsCompilation(APackage,
|
||||
pcfSkipDesignTimePackages in Flags,
|
||||
NeedBuildAllFlag,Note);
|
||||
if Note<>'' then
|
||||
Note:='Compile reason: '+Note;
|
||||
if (pcfOnlyIfNeeded in Flags) then begin
|
||||
if Result=mrNo then begin
|
||||
//DebugLn(['TLazPackageGraph.CompilePackage ',APackage.IDAsString,' does not need compilation.']);
|
||||
@ -3481,8 +3483,8 @@ begin
|
||||
|
||||
// run compilation tool 'Before'
|
||||
if not (pcfDoNotCompilePackage in Flags) then begin
|
||||
Result:=APackage.CompilerOptions.ExecuteBefore.Execute(
|
||||
APackage.Directory,'Executing command before');
|
||||
Result:=APackage.CompilerOptions.ExecuteBefore.Execute(APackage.Directory,
|
||||
'Package '+APackage.IDAsString+': '+lisExecutingCommandBefore,Note);
|
||||
if Result<>mrOk then begin
|
||||
DebugLn(['TLazPackageGraph.CompilePackage ExecuteBefore failed: ',APackage.IDAsString]);
|
||||
exit;
|
||||
@ -3532,13 +3534,13 @@ begin
|
||||
PkgCompileTool.Process.CurrentDirectory:=APackage.Directory;
|
||||
PkgCompileTool.Process.Executable:=CompilerFilename;
|
||||
PkgCompileTool.CmdLineParams:=EffectiveCompilerParams;
|
||||
PkgCompileTool.Execute;
|
||||
PkgCompileTool.WaitForExit;
|
||||
if Note<>'' then
|
||||
PkgCompileTool.Hint:='Compile reason: '+Note;
|
||||
PkgCompileTool.Hint:=Note;
|
||||
PkgCompileTool.Data:=TIDEExternalToolData.Create(IDEToolCompilePackage,
|
||||
APackage.Name,APackage.Filename);
|
||||
PkgCompileTool.FreeData:=true;
|
||||
// run
|
||||
PkgCompileTool.Execute;
|
||||
PkgCompileTool.WaitForExit;
|
||||
|
||||
// check if main ppu file was created
|
||||
SrcPPUFile:=APackage.GetSrcPPUFilename;
|
||||
@ -3609,8 +3611,8 @@ begin
|
||||
|
||||
// run compilation tool 'After'
|
||||
if not (pcfDoNotCompilePackage in Flags) then begin
|
||||
Result:=APackage.CompilerOptions.ExecuteAfter.Execute(
|
||||
APackage.Directory,'Executing command after');
|
||||
Result:=APackage.CompilerOptions.ExecuteAfter.Execute(APackage.Directory,
|
||||
'Package '+APackage.IDAsString+': '+lisExecutingCommandAfter,Note);
|
||||
if Result<>mrOk then begin
|
||||
DebugLn(['TLazPackageGraph.CompilePackage ExecuteAfter failed: ',APackage.IDAsString]);
|
||||
{$IFDEF EnableNewExtTools}
|
||||
|
Loading…
Reference in New Issue
Block a user