mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-01 15:00:24 +02:00
lazbuild: added check if project needs compilation
git-svn-id: trunk@39454 -
This commit is contained in:
parent
9849a7034c
commit
048b9be0b8
@ -713,6 +713,9 @@ var
|
|||||||
NewBuildMode: TProjectBuildMode;
|
NewBuildMode: TProjectBuildMode;
|
||||||
CompilePolicy: TPackageUpdatePolicy;
|
CompilePolicy: TPackageUpdatePolicy;
|
||||||
i: Integer;
|
i: Integer;
|
||||||
|
Note: String;
|
||||||
|
NeedBuildAllFlag: Boolean;
|
||||||
|
SubResult: TModalResult;
|
||||||
begin
|
begin
|
||||||
Result:=false;
|
Result:=false;
|
||||||
CloseProject(Project1);
|
CloseProject(Project1);
|
||||||
@ -814,7 +817,7 @@ begin
|
|||||||
if not Project1.ProjResources.Regenerate(SrcFileName, False, True, '') then
|
if not Project1.ProjResources.Regenerate(SrcFileName, False, True, '') then
|
||||||
begin
|
begin
|
||||||
if ConsoleVerbosity>=-1 then
|
if ConsoleVerbosity>=-1 then
|
||||||
DebugLn('TMainIDE.DoSaveProject Project1.Resources.Regenerate failed');
|
DebugLn('TLazBuildApplication.BuildProject Project1.Resources.Regenerate failed');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// get compiler parameters
|
// get compiler parameters
|
||||||
@ -822,10 +825,32 @@ begin
|
|||||||
CompilerFilename := CompilerOverride
|
CompilerFilename := CompilerOverride
|
||||||
else
|
else
|
||||||
CompilerFilename:=Project1.GetCompilerFilename;
|
CompilerFilename:=Project1.GetCompilerFilename;
|
||||||
//DebugLn(['TMainIDE.DoBuildProject CompilerFilename="',CompilerFilename,'" CompilerPath="',Project1.CompilerOptions.CompilerPath,'"']);
|
//DebugLn(['TLazBuildApplication.BuildProject CompilerFilename="',CompilerFilename,'" CompilerPath="',Project1.CompilerOptions.CompilerPath,'"']);
|
||||||
CompilerParams:=Project1.CompilerOptions.MakeOptionsString(SrcFilename,[])
|
CompilerParams:=Project1.CompilerOptions.MakeOptionsString(SrcFilename,[])
|
||||||
+' '+PrepareCmdLineOption(SrcFilename);
|
+' '+PrepareCmdLineOption(SrcFilename);
|
||||||
|
|
||||||
|
NeedBuildAllFlag:=false;
|
||||||
|
if (crCompile in Project1.CompilerOptions.CompileReasons) then begin
|
||||||
|
// check if project is already uptodate
|
||||||
|
Note:='';
|
||||||
|
SubResult:=MainBuildBoss.DoCheckIfProjectNeedsCompilation(Project1,
|
||||||
|
NeedBuildAllFlag,Note);
|
||||||
|
if (not BuildAll)
|
||||||
|
and (not (pfAlwaysBuild in Project1.Flags)) then begin
|
||||||
|
if SubResult=mrNo then begin
|
||||||
|
if ConsoleVerbosity>=0 then
|
||||||
|
debugln(['TLazBuildApplication.BuildProject MainBuildBoss.DoCheckIfProjectNeedsCompilation nothing to be done']);
|
||||||
|
exit(true);
|
||||||
|
end;
|
||||||
|
if SubResult<>mrYes then
|
||||||
|
begin
|
||||||
|
if ConsoleVerbosity>=0 then
|
||||||
|
debugln(['TLazBuildApplication.BuildProject MainBuildBoss.DoCheckIfProjectNeedsCompilation failed']);
|
||||||
|
exit(false);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
// execute compilation tool 'Before'
|
// execute compilation tool 'Before'
|
||||||
ToolBefore:=TProjectCompilationToolOptions(
|
ToolBefore:=TProjectCompilationToolOptions(
|
||||||
Project1.CompilerOptions.ExecuteBefore);
|
Project1.CompilerOptions.ExecuteBefore);
|
||||||
@ -843,7 +868,7 @@ begin
|
|||||||
Error(ErrorBuildFailed,'failed saving statefile of project '+AFilename);
|
Error(ErrorBuildFailed,'failed saving statefile of project '+AFilename);
|
||||||
if TheCompiler.Compile(Project1,
|
if TheCompiler.Compile(Project1,
|
||||||
WorkingDir,CompilerFilename,CompilerParams,
|
WorkingDir,CompilerFilename,CompilerParams,
|
||||||
BuildAll,false,false)<>mrOk
|
BuildAll or NeedBuildAllFlag,false,false)<>mrOk
|
||||||
then
|
then
|
||||||
Error(ErrorBuildFailed,'failed compiling of project '+AFilename);
|
Error(ErrorBuildFailed,'failed compiling of project '+AFilename);
|
||||||
// compilation succeded -> write state file
|
// compilation succeded -> write state file
|
||||||
@ -854,7 +879,6 @@ begin
|
|||||||
// execute compilation tool 'After'
|
// execute compilation tool 'After'
|
||||||
ToolAfter:=TProjectCompilationToolOptions(
|
ToolAfter:=TProjectCompilationToolOptions(
|
||||||
Project1.CompilerOptions.ExecuteAfter);
|
Project1.CompilerOptions.ExecuteAfter);
|
||||||
// no need to check for mrOk, we are exit if it wasn't
|
|
||||||
if (crCompile in ToolAfter.CompileReasons) then begin
|
if (crCompile in ToolAfter.CompileReasons) then begin
|
||||||
if ToolAfter.Execute(
|
if ToolAfter.Execute(
|
||||||
Project1.ProjectDirectory,lisExecutingCommandAfter)<>mrOk
|
Project1.ProjectDirectory,lisExecutingCommandAfter)<>mrOk
|
||||||
@ -862,6 +886,7 @@ begin
|
|||||||
Error(ErrorBuildFailed,'failed "tool after" of project '+AFilename);
|
Error(ErrorBuildFailed,'failed "tool after" of project '+AFilename);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
// no need to check for mrOk, we are exit if it wasn't
|
||||||
Result:=true;
|
Result:=true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user