IDE: set ToolStatus to itBuilder before compiling packages, bug #32421

git-svn-id: trunk@55865 -
This commit is contained in:
mattias 2017-09-15 10:21:41 +00:00
parent 286504b5b4
commit 9d11c6253b
3 changed files with 165 additions and 162 deletions

View File

@ -5618,6 +5618,8 @@ resourcestring
lisMessagesEditor = 'Messages Editor';
lisSetDefault = 'Set default';
lisYouCanNotChangeTheBuildModeWhileCompiling = 'You can not change the build'
+' mode while compiling.';
lisSelectedLeftNeighbour = '(selected left neighbour)';
lisSelectedRightNeighbour = '(selected right neighbour)';
lisSelectedTopNeighbour = '(selected top neighbour)';

View File

@ -4119,7 +4119,7 @@ begin
if Project1=nil then exit;
// This is kind of a hack. Copy OtherDefines from project to current
// buildmode's compiler options and then back after they are modified.
// Only needed for projects, packages don't have buildmodes.
// Only needed for projects, because packages don't have buildmodes.
Project1.CompilerOptions.OtherDefines.Assign(Project1.OtherDefines);
Capt := Format(dlgProjectOptionsFor, [Project1.GetTitleOrName]);
@ -6680,6 +6680,13 @@ begin
exit;
end;
try
// change tool status
// It can still be itDebugger, if the debugger is still stopping.
// Prevent any "Run" command after building, until the debugger is clear.
OldToolStatus := ToolStatus;
ToolStatus:=itBuilder;
// get main source filename
if not Project1.IsVirtual then begin
WorkingDir:=Project1.Directory;
@ -6829,12 +6836,6 @@ begin
if (AReason in Project1.CompilerOptions.CompileReasons)
and (not (pbfDoNotCompileProject in Flags)) then begin
try
// change tool status
// It can still be itDebugger, if the debugger is still stopping.
// Prevent any "Run" command after building, until the debugger is clear.
OldToolStatus := ToolStatus;
ToolStatus:=itBuilder;
// compile
CompilerFilename:=Project1.GetCompilerFilename;
// Hint: use absolute paths, because some external tools resolve symlinked directories
@ -6882,16 +6883,6 @@ begin
debugln(['Error: (lazarus) [TMainIDE.DoBuildProject] UpdateProjectPOFile failed']);
exit;
end;
finally
if OldToolStatus = itDebugger then begin
ToolStatus := OldToolStatus;
if DebugBoss <> nil then
DebugBoss.UpdateToolStatus; // Maybe "Reset Debugger was called and changed the state?
end
else
ToolStatus:=itNone;
end;
end;
// execute compilation tool 'After'
@ -6912,6 +6903,15 @@ begin
if FinalizeResources then
Project1.ProjResources.DoAfterBuild(AReason, Project1.IsVirtual);
finally
if OldToolStatus = itDebugger then begin
ToolStatus := OldToolStatus;
if DebugBoss <> nil then
DebugBoss.UpdateToolStatus; // Maybe "Reset Debugger was called and changed the state?
end
else
ToolStatus:=itNone;
end;
finally
// check sources
DoCheckFilesOnDisk;

View File

@ -357,7 +357,8 @@ begin
NewMode := Project1.BuildModes[BuildModeIndex];
if NewMode = Project1.ActiveBuildMode then exit;
if not (MainIDE.ToolStatus in [itNone,itDebugger]) then begin
IDEMessageDialog('Error','You can not change the build mode while compiling.',
IDEMessageDialog(dlgMsgWinColorUrgentError,
lisYouCanNotChangeTheBuildModeWhileCompiling,
mtError,[mbOk]);
exit;
end;