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

@ -64,7 +64,7 @@ type
TBuildLazarusFlag = (
blfDontBuild, // skip all building, only cleaning
blfOnlyIDE, // skip all but IDE (for example build IDE, but not packages, not lazbuild, ...)
blfDontClean, // ignore clean up option in profile
blfDontClean, // ignore clean up option in profile
blfUseMakeIDECfg, // append @idemake.cfg
blfReplaceExe // ignore OSLocksExecutables and do not create lazarus.new.exe
);
@ -149,12 +149,17 @@ type
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;
const PackageOptions, CompilerPath, MakePath: string;
Flags: TBuildLazarusFlags; var ProfileChanged: boolean): TModalResult;
function CreateBuildLazarusOptions(Profile: TBuildLazarusProfile;
function CreateIDEMakeOptions(Profile: TBuildLazarusProfile;
Macros: TTransferMacroList; const PackageOptions: string;
Flags: TBuildLazarusFlags; var AExOptions: string;
out UpdateRevisionInc: boolean; out OutputDirRedirected: boolean): TModalResult;
@ -192,7 +197,7 @@ begin
end;
end;
function BuildLazarus(Profile: TBuildLazarusProfile;
function MakeLazarus(Profile: TBuildLazarusProfile;
ExternalTools: TBaseExternalToolList; Macros: TTransferMacroList;
const PackageOptions, CompilerPath, MakePath: string;
Flags: TBuildLazarusFlags; var ProfileChanged: boolean): TModalResult;
@ -328,7 +333,7 @@ begin
// call make to clean up
Tool.Title:=lisCleanLazarusSource;
Tool.WorkingDirectory:=WorkingDirectory;
if IdeBuildMode=bmCleanBuild then
if (IdeBuildMode=bmCleanBuild) or (blfOnlyIDE in Flags) then
Tool.CmdLineParams:='cleanide'
else
Tool.CmdLineParams:='cleanlaz';
@ -352,7 +357,7 @@ begin
Tool.CmdLineParams:='cleanide ide';
// append extra Profile
ExOptions:='';
Result:=CreateBuildLazarusOptions(Profile,Macros,PackageOptions,Flags,
Result:=CreateIDEMakeOptions(Profile,Macros,PackageOptions,Flags,
ExOptions,UpdateRevisionInc,OutputDirRedirected);
if Result<>mrOk then exit;
@ -378,7 +383,7 @@ begin
end;
end;
function CreateBuildLazarusOptions(Profile: TBuildLazarusProfile;
function CreateIDEMakeOptions(Profile: TBuildLazarusProfile;
Macros: TTransferMacroList; const PackageOptions: string;
Flags: TBuildLazarusFlags; var AExOptions: string;
out UpdateRevisionInc: boolean; out OutputDirRedirected: boolean): TModalResult;
@ -668,7 +673,7 @@ var
OutputDirRedirected: boolean;
begin
ExOptions:='';
Result:=CreateBuildLazarusOptions(Profile, Macros, PackageOptions, Flags,
Result:=CreateIDEMakeOptions(Profile, Macros, PackageOptions, Flags,
ExOptions, UpdateRevisionInc, OutputDirRedirected);
if Result<>mrOk then exit;
Filename:=GetMakeIDEConfigFilename;

View File

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

View File

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