lazbuild: IDE profile clean all: clean before build

git-svn-id: trunk@36493 -
This commit is contained in:
mattias 2012-04-01 07:19:28 +00:00
parent 783c1dec71
commit e1e12d6ea1
3 changed files with 40 additions and 20 deletions

View File

@ -149,12 +149,17 @@ type
function ShowConfigureBuildLazarusDlg(AProfiles: TBuildLazarusProfiles): TModalResult; function ShowConfigureBuildLazarusDlg(AProfiles: TBuildLazarusProfiles): TModalResult;
function BuildLazarus(Profile: TBuildLazarusProfile; { Clean all
clean ide
ide
clean ide + ide
}
function MakeLazarus(Profile: TBuildLazarusProfile;
ExternalTools: TBaseExternalToolList; Macros: TTransferMacroList; ExternalTools: TBaseExternalToolList; Macros: TTransferMacroList;
const PackageOptions, CompilerPath, MakePath: string; const PackageOptions, CompilerPath, MakePath: string;
Flags: TBuildLazarusFlags; var ProfileChanged: boolean): TModalResult; Flags: TBuildLazarusFlags; var ProfileChanged: boolean): TModalResult;
function CreateBuildLazarusOptions(Profile: TBuildLazarusProfile; function CreateIDEMakeOptions(Profile: TBuildLazarusProfile;
Macros: TTransferMacroList; const PackageOptions: string; Macros: TTransferMacroList; const PackageOptions: string;
Flags: TBuildLazarusFlags; var AExOptions: string; Flags: TBuildLazarusFlags; var AExOptions: string;
out UpdateRevisionInc: boolean; out OutputDirRedirected: boolean): TModalResult; out UpdateRevisionInc: boolean; out OutputDirRedirected: boolean): TModalResult;
@ -192,7 +197,7 @@ begin
end; end;
end; end;
function BuildLazarus(Profile: TBuildLazarusProfile; function MakeLazarus(Profile: TBuildLazarusProfile;
ExternalTools: TBaseExternalToolList; Macros: TTransferMacroList; ExternalTools: TBaseExternalToolList; Macros: TTransferMacroList;
const PackageOptions, CompilerPath, MakePath: string; const PackageOptions, CompilerPath, MakePath: string;
Flags: TBuildLazarusFlags; var ProfileChanged: boolean): TModalResult; Flags: TBuildLazarusFlags; var ProfileChanged: boolean): TModalResult;
@ -328,7 +333,7 @@ begin
// call make to clean up // call make to clean up
Tool.Title:=lisCleanLazarusSource; Tool.Title:=lisCleanLazarusSource;
Tool.WorkingDirectory:=WorkingDirectory; Tool.WorkingDirectory:=WorkingDirectory;
if IdeBuildMode=bmCleanBuild then if (IdeBuildMode=bmCleanBuild) or (blfOnlyIDE in Flags) then
Tool.CmdLineParams:='cleanide' Tool.CmdLineParams:='cleanide'
else else
Tool.CmdLineParams:='cleanlaz'; Tool.CmdLineParams:='cleanlaz';
@ -352,7 +357,7 @@ begin
Tool.CmdLineParams:='cleanide ide'; Tool.CmdLineParams:='cleanide ide';
// append extra Profile // append extra Profile
ExOptions:=''; ExOptions:='';
Result:=CreateBuildLazarusOptions(Profile,Macros,PackageOptions,Flags, Result:=CreateIDEMakeOptions(Profile,Macros,PackageOptions,Flags,
ExOptions,UpdateRevisionInc,OutputDirRedirected); ExOptions,UpdateRevisionInc,OutputDirRedirected);
if Result<>mrOk then exit; if Result<>mrOk then exit;
@ -378,7 +383,7 @@ begin
end; end;
end; end;
function CreateBuildLazarusOptions(Profile: TBuildLazarusProfile; function CreateIDEMakeOptions(Profile: TBuildLazarusProfile;
Macros: TTransferMacroList; const PackageOptions: string; Macros: TTransferMacroList; const PackageOptions: string;
Flags: TBuildLazarusFlags; var AExOptions: string; Flags: TBuildLazarusFlags; var AExOptions: string;
out UpdateRevisionInc: boolean; out OutputDirRedirected: boolean): TModalResult; out UpdateRevisionInc: boolean; out OutputDirRedirected: boolean): TModalResult;
@ -668,7 +673,7 @@ var
OutputDirRedirected: boolean; OutputDirRedirected: boolean;
begin begin
ExOptions:=''; ExOptions:='';
Result:=CreateBuildLazarusOptions(Profile, Macros, PackageOptions, Flags, Result:=CreateIDEMakeOptions(Profile, Macros, PackageOptions, Flags,
ExOptions, UpdateRevisionInc, OutputDirRedirected); ExOptions, UpdateRevisionInc, OutputDirRedirected);
if Result<>mrOk then exit; if Result<>mrOk then exit;
Filename:=GetMakeIDEConfigFilename; Filename:=GetMakeIDEConfigFilename;

View File

@ -113,7 +113,7 @@ type
// IDE // IDE
function BuildLazarusIDE: boolean; function BuildLazarusIDE: boolean;
function CompileAutoInstallPackages: boolean; function CompileAutoInstallPackages(Clean: boolean): boolean;
function Init: boolean; function Init: boolean;
procedure LoadEnvironmentOptions; procedure LoadEnvironmentOptions;
@ -474,6 +474,20 @@ begin
exit; exit;
end; end;
// clean
ProfileChanged:=false;
if BuildLazProfiles.Current.IdeBuildMode=bmCleanAllBuild then begin
CurResult:=MakeLazarus(BuildLazProfiles.Current,
EnvironmentOptions.ExternalTools,GlobalMacroList,
'',EnvironmentOptions.GetParsedCompilerFilename,
EnvironmentOptions.GetParsedMakeFilename, [blfDontBuild],
ProfileChanged);
if CurResult<>mrOk then begin
DebugLn('TLazBuildApplication.BuildLazarusIDE: Clean all failed.');
exit;
end;
end;
// save configs for 'make' // save configs for 'make'
CurResult:=PackageGraph.SaveAutoInstallConfig; CurResult:=PackageGraph.SaveAutoInstallConfig;
if CurResult<>mrOk then begin if CurResult<>mrOk then begin
@ -482,7 +496,8 @@ begin
end; end;
// compile auto install static packages // compile auto install static packages
if not CompileAutoInstallPackages then begin if not CompileAutoInstallPackages(BuildLazProfiles.Current.IdeBuildMode<>bmBuild)
then begin
DebugLn('TLazBuildApplication.BuildLazarusIDE: Compile AutoInstall Packages failed.'); DebugLn('TLazBuildApplication.BuildLazarusIDE: Compile AutoInstall Packages failed.');
exit; exit;
end; end;
@ -499,12 +514,12 @@ begin
end; end;
// compile IDE // compile IDE
ProfileChanged:=false; CurResult:=MakeLazarus(BuildLazProfiles.Current,
CurResult:=BuildLazarus(BuildLazProfiles.Current,
EnvironmentOptions.ExternalTools,GlobalMacroList, EnvironmentOptions.ExternalTools,GlobalMacroList,
PkgOptions,EnvironmentOptions.CompilerFilename, PkgOptions,EnvironmentOptions.CompilerFilename,
EnvironmentOptions.MakeFilename, EnvironmentOptions.MakeFilename,
Flags+[blfUseMakeIDECfg,blfReplaceExe],ProfileChanged); Flags+[blfUseMakeIDECfg,blfReplaceExe,blfOnlyIDE],
ProfileChanged);
if CurResult<>mrOk then begin if CurResult<>mrOk then begin
DebugLn('TLazBuildApplication.BuildLazarusIDE: Building IDE failed.'); DebugLn('TLazBuildApplication.BuildLazarusIDE: Building IDE failed.');
exit; exit;
@ -513,7 +528,7 @@ begin
Result:=true; Result:=true;
end; end;
function TLazBuildApplication.CompileAutoInstallPackages: boolean; function TLazBuildApplication.CompileAutoInstallPackages(Clean: boolean): boolean;
var var
Dependency: TPkgDependency; Dependency: TPkgDependency;
OldDependency: TPkgDependency; OldDependency: TPkgDependency;
@ -540,7 +555,7 @@ begin
// compile all auto install dependencies // compile all auto install dependencies
CompilePolicy:=pupAsNeeded; CompilePolicy:=pupAsNeeded;
if BuildRecursive and BuildAll then if (BuildRecursive and BuildAll) or Clean then
CompilePolicy:=pupOnRebuildingAll; CompilePolicy:=pupOnRebuildingAll;
CurResult:=PackageGraph.CompileRequiredPackages(nil, CurResult:=PackageGraph.CompileRequiredPackages(nil,
PackageGraph.FirstAutoInstallDependency,false,CompilePolicy); PackageGraph.FirstAutoInstallDependency,false,CompilePolicy);

View File

@ -12512,7 +12512,7 @@ begin
PkgCompileFlags:=PkgCompileFlags+[pcfCompileDependenciesClean]; PkgCompileFlags:=PkgCompileFlags+[pcfCompileDependenciesClean];
if BuildLazProfiles.Current.IdeBuildMode=bmCleanAllBuild then begin if BuildLazProfiles.Current.IdeBuildMode=bmCleanAllBuild then begin
SourceEditorManager.ClearErrorLines; SourceEditorManager.ClearErrorLines;
Result:=BuildLazarus(BuildLazProfiles.Current,ExternalTools,GlobalMacroList, Result:=MakeLazarus(BuildLazProfiles.Current,ExternalTools,GlobalMacroList,
'',EnvironmentOptions.GetParsedCompilerFilename, '',EnvironmentOptions.GetParsedCompilerFilename,
EnvironmentOptions.GetParsedMakeFilename, [blfDontBuild], EnvironmentOptions.GetParsedMakeFilename, [blfDontBuild],
ProfileChanged); ProfileChanged);
@ -12567,7 +12567,7 @@ begin
// make lazarus ide // make lazarus ide
SourceEditorManager.ClearErrorLines; SourceEditorManager.ClearErrorLines;
IDEBuildFlags:=IDEBuildFlags+[blfUseMakeIDECfg,blfDontClean]; IDEBuildFlags:=IDEBuildFlags+[blfUseMakeIDECfg,blfDontClean];
Result:=BuildLazarus(BuildLazProfiles.Current,ExternalTools,GlobalMacroList, Result:=MakeLazarus(BuildLazProfiles.Current,ExternalTools,GlobalMacroList,
PkgOptions,EnvironmentOptions.GetParsedCompilerFilename, PkgOptions,EnvironmentOptions.GetParsedCompilerFilename,
EnvironmentOptions.GetParsedMakeFilename,IDEBuildFlags, EnvironmentOptions.GetParsedMakeFilename,IDEBuildFlags,
ProfileChanged); ProfileChanged);