mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-11 16:16:05 +02:00
IDE: clean ide on clean common files
git-svn-id: trunk@36449 -
This commit is contained in:
parent
910b1da806
commit
8477a4ae67
@ -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, ...)
|
||||
blfDontCleanAll, // 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
|
||||
);
|
||||
@ -243,6 +243,7 @@ var
|
||||
WorkingDirectory: String;
|
||||
OutputDirRedirected, UpdateRevisionInc: boolean;
|
||||
IdeBuildMode: TIdeBuildMode;
|
||||
CmdLineParams: String;
|
||||
begin
|
||||
Result:=mrCancel;
|
||||
|
||||
@ -271,38 +272,47 @@ begin
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
// add -w option to print leaving/entering messages
|
||||
CmdLineParams:=' -w';
|
||||
// append target OS
|
||||
if Profile.TargetOS<>'' then
|
||||
CmdLineParams+=' OS_TARGET='+Profile.FPCTargetOS;
|
||||
// append target CPU
|
||||
if Profile.TargetCPU<>'' then
|
||||
CmdLineParams+=' CPU_TARGET='+Profile.FPCTargetCPU;
|
||||
|
||||
Tool.ScanOutputForFPCMessages:=true;
|
||||
Tool.ScanOutputForMakeMessages:=true;
|
||||
|
||||
// clean up
|
||||
if (IdeBuildMode=bmCleanAllBuild) and ([blfDontCleanAll,blfOnlyIDE]*Flags=[])
|
||||
then begin
|
||||
if (IdeBuildMode<>bmBuild) and (not (blfDontClean in Flags)) then begin
|
||||
WorkingDirectory:=EnvironmentOptions.GetParsedLazarusDirectory;
|
||||
if not CheckDirectoryWritable(WorkingDirectory) then exit(mrCancel);
|
||||
|
||||
// clean lazarus source directories
|
||||
// Note: Some installations put the fpc units into the lazarus directory
|
||||
CleanLazarusSrcDir(WorkingDirectory,false);
|
||||
CleanLazarusSrcDir(WorkingDirectory+PathDelim+'examples');
|
||||
CleanLazarusSrcDir(WorkingDirectory+PathDelim+'components');
|
||||
CleanLazarusSrcDir(WorkingDirectory+PathDelim+'units');
|
||||
CleanLazarusSrcDir(WorkingDirectory+PathDelim+'ide');
|
||||
CleanLazarusSrcDir(WorkingDirectory+PathDelim+'packager');
|
||||
CleanLazarusSrcDir(WorkingDirectory+PathDelim+'lcl');
|
||||
CleanLazarusSrcDir(WorkingDirectory+PathDelim+'ideintf');
|
||||
CleanLazarusSrcDir(WorkingDirectory+PathDelim+'tools');
|
||||
CleanLazarusSrcDir(WorkingDirectory+PathDelim+'test');
|
||||
if (IdeBuildMode=bmCleanAllBuild) and (not (blfOnlyIDE in Flags)) then begin
|
||||
// clean all lazarus source directories
|
||||
// Note: Some installations put the fpc units into the lazarus directory
|
||||
// => clean only the known directories
|
||||
CleanLazarusSrcDir(WorkingDirectory,false);
|
||||
CleanLazarusSrcDir(WorkingDirectory+PathDelim+'examples');
|
||||
CleanLazarusSrcDir(WorkingDirectory+PathDelim+'components');
|
||||
CleanLazarusSrcDir(WorkingDirectory+PathDelim+'units');
|
||||
CleanLazarusSrcDir(WorkingDirectory+PathDelim+'ide');
|
||||
CleanLazarusSrcDir(WorkingDirectory+PathDelim+'packager');
|
||||
CleanLazarusSrcDir(WorkingDirectory+PathDelim+'lcl');
|
||||
CleanLazarusSrcDir(WorkingDirectory+PathDelim+'ideintf');
|
||||
CleanLazarusSrcDir(WorkingDirectory+PathDelim+'tools');
|
||||
CleanLazarusSrcDir(WorkingDirectory+PathDelim+'test');
|
||||
end;
|
||||
|
||||
// call make to clean up
|
||||
Tool.Title:=lisCleanLazarusSource;
|
||||
Tool.WorkingDirectory:=WorkingDirectory;
|
||||
Tool.CmdLineParams:='cleanlaz';
|
||||
// append target OS
|
||||
if Profile.TargetOS<>'' then
|
||||
Tool.CmdLineParams:=Tool.CmdLineParams+' OS_TARGET='+Profile.FPCTargetOS;
|
||||
// append target CPU
|
||||
if Profile.TargetCPU<>'' then
|
||||
Tool.CmdLineParams:=Tool.CmdLineParams+' CPU_TARGET='+Profile.FPCTargetCPU;
|
||||
if IdeBuildMode=bmCleanBuild then
|
||||
Tool.CmdLineParams:='cleanide'
|
||||
else
|
||||
Tool.CmdLineParams:='cleanlaz';
|
||||
Tool.CmdLineParams:=Tool.CmdLineParams+CmdLineParams;
|
||||
Result:=ExternalTools.Run(Tool,Macros,false);
|
||||
if Result<>mrOk then exit;
|
||||
|
||||
@ -312,14 +322,14 @@ begin
|
||||
// build IDE
|
||||
if not (blfDontBuild in Flags) then begin
|
||||
WorkingDirectory:=EnvironmentOptions.GetParsedLazarusDirectory;
|
||||
if blfDontCleanAll in Flags then
|
||||
if blfDontClean in Flags then
|
||||
IdeBuildMode:=bmBuild;
|
||||
Tool.Title:=lisIDE;
|
||||
Tool.WorkingDirectory:=WorkingDirectory;
|
||||
if IdeBuildMode=bmCleanBuild then
|
||||
Tool.CmdLineParams:='cleanide ide'
|
||||
if IdeBuildMode=bmBuild then
|
||||
Tool.CmdLineParams:='ide'
|
||||
else
|
||||
Tool.CmdLineParams:='ide'; // bmBuild or bmCleanAllBuild
|
||||
Tool.CmdLineParams:='cleanide ide';
|
||||
// append extra Profile
|
||||
ExOptions:='';
|
||||
Result:=CreateBuildLazarusOptions(Profile,Macros,PackageOptions,Flags,
|
||||
@ -334,14 +344,7 @@ begin
|
||||
Tool.EnvironmentOverrides.Values['OPT'] := ExOptions;
|
||||
if not UpdateRevisionInc then
|
||||
Tool.EnvironmentOverrides.Values['USESVN2REVISIONINC'] := '0';
|
||||
// add -w option to print leaving/entering messages
|
||||
Tool.CmdLineParams:=Tool.CmdLineParams+' -w';
|
||||
// append target OS
|
||||
if Profile.TargetOS<>'' then
|
||||
Tool.CmdLineParams:=Tool.CmdLineParams+' OS_TARGET='+Profile.FPCTargetOS;
|
||||
// append target CPU
|
||||
if Profile.TargetCPU<>'' then
|
||||
Tool.CmdLineParams:=Tool.CmdLineParams+' CPU_TARGET='+Profile.FPCTargetCPU;
|
||||
Tool.CmdLineParams:=Tool.CmdLineParams+CmdLineParams;
|
||||
// run
|
||||
Result:=ExternalTools.Run(Tool,Macros,false);
|
||||
if Result<>mrOk then exit;
|
||||
@ -451,13 +454,12 @@ begin
|
||||
//DebugLn(['CreateBuildLazarusOptions NewTargetOS=',NewTargetOS,' NewTargetCPU=',NewTargetCPU]);
|
||||
if (Profile.TargetDirectory<>'') then begin
|
||||
// Case 1. the user has set a target directory
|
||||
NewTargetDirectory:=Profile.TargetDirectory;
|
||||
if not Macros.SubstituteStr(NewTargetDirectory) then begin
|
||||
NewTargetDirectory:=Profile.GetParsedTargetDirectory(Macros);
|
||||
if NewTargetDirectory='' then begin
|
||||
debugln('CreateBuildLazarusOptions macro aborted Options.TargetDirectory=',Profile.TargetDirectory);
|
||||
Result:=mrAbort;
|
||||
exit;
|
||||
end;
|
||||
NewTargetDirectory:=CleanAndExpandDirectory(NewTargetDirectory);
|
||||
NewUnitDirectory:=AppendPathDelim(NewTargetDirectory)+'units';
|
||||
debugln('CreateBuildLazarusOptions TargetDirectory=',NewTargetDirectory);
|
||||
debugln('CreateBuildLazarusOptions UnitsTargetDirectory=',NewUnitDirectory);
|
||||
|
@ -31,10 +31,10 @@ unit BuildProfileManager;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, FileUtil, Laz2_XMLCfg, LResources, Forms, Controls,
|
||||
Graphics, Dialogs, ExtCtrls, Buttons, StdCtrls, ComCtrls, Contnrs,
|
||||
Classes, SysUtils, FileUtil, Laz2_XMLCfg, LazLogger, LResources, Forms,
|
||||
Controls, Graphics, Dialogs, ExtCtrls, Buttons, StdCtrls, ComCtrls, Contnrs,
|
||||
ButtonPanel, DefineTemplates, IDEImagesIntf, IDEMsgIntf, IDEHelpIntf,
|
||||
LazarusIDEStrConsts, LazConf, InterfaceBase, IDEProcs,
|
||||
LazarusIDEStrConsts, LazConf, InterfaceBase, IDEProcs, TransferMacros,
|
||||
CompilerOptions;
|
||||
|
||||
type
|
||||
@ -73,6 +73,7 @@ type
|
||||
procedure Save(XMLConfig: TXMLConfig; const Path: string);
|
||||
function FPCTargetOS: string;
|
||||
function FPCTargetCPU: string;
|
||||
function GetParsedTargetDirectory(Macros: TTransferMacroList): string;
|
||||
public
|
||||
property Name: string read fName;
|
||||
property ExtraOptions: string read GetExtraOptions write SetExtraOptions;
|
||||
@ -269,6 +270,19 @@ begin
|
||||
Result:=GetFPCTargetCPU(TargetCPU);
|
||||
end;
|
||||
|
||||
function TBuildLazarusProfile.GetParsedTargetDirectory(
|
||||
Macros: TTransferMacroList): string;
|
||||
begin
|
||||
Result:=TargetDirectory;
|
||||
if Result='' then exit;
|
||||
if not Macros.SubstituteStr(Result) then begin
|
||||
DebugLn('TBuildLazarusProfile.GetParsedTargetDirectory macro aborted Options.TargetDirectory=',TargetDirectory);
|
||||
Result:='';
|
||||
exit;
|
||||
end;
|
||||
Result:=CleanAndExpandDirectory(Result);
|
||||
end;
|
||||
|
||||
function TBuildLazarusProfile.GetExtraOptions: string;
|
||||
var
|
||||
i: Integer;
|
||||
|
28
ide/main.pp
28
ide/main.pp
@ -12495,17 +12495,19 @@ begin
|
||||
|
||||
// clean up
|
||||
PkgCompileFlags:=[];
|
||||
if (not (blfDontCleanAll in Flags))
|
||||
and (BuildLazProfiles.Current.IdeBuildMode=bmCleanAllBuild) then begin
|
||||
if (not (blfDontClean in Flags))
|
||||
and (BuildLazProfiles.Current.IdeBuildMode<>bmBuild) then begin
|
||||
PkgCompileFlags:=PkgCompileFlags+[pcfCompileDependenciesClean];
|
||||
SourceEditorManager.ClearErrorLines;
|
||||
Result:=BuildLazarus(BuildLazProfiles.Current,ExternalTools,GlobalMacroList,
|
||||
'',EnvironmentOptions.GetParsedCompilerFilename,
|
||||
EnvironmentOptions.GetParsedMakeFilename, [blfDontBuild],
|
||||
ProfileChanged);
|
||||
if Result<>mrOk then begin
|
||||
DebugLn('TMainIDE.DoBuildLazarus: Clean up failed.');
|
||||
exit;
|
||||
if BuildLazProfiles.Current.IdeBuildMode=bmCleanAllBuild then begin
|
||||
SourceEditorManager.ClearErrorLines;
|
||||
Result:=BuildLazarus(BuildLazProfiles.Current,ExternalTools,GlobalMacroList,
|
||||
'',EnvironmentOptions.GetParsedCompilerFilename,
|
||||
EnvironmentOptions.GetParsedMakeFilename, [blfDontBuild],
|
||||
ProfileChanged);
|
||||
if Result<>mrOk then begin
|
||||
DebugLn('TMainIDE.DoBuildLazarus: Clean all failed.');
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -12544,15 +12546,15 @@ begin
|
||||
// save extra options
|
||||
IDEBuildFlags:=Flags;
|
||||
Result:=SaveIDEMakeOptions(BuildLazProfiles.Current,GlobalMacroList,PkgOptions,
|
||||
IDEBuildFlags-[blfUseMakeIDECfg,blfDontCleanAll]);
|
||||
IDEBuildFlags-[blfUseMakeIDECfg,blfDontClean]);
|
||||
if Result<>mrOk then begin
|
||||
DebugLn('TMainIDE.DoBuildLazarus: Save IDEMake options failed.');
|
||||
exit;
|
||||
end;
|
||||
|
||||
// make lazarus ide and/or examples
|
||||
// make lazarus ide
|
||||
SourceEditorManager.ClearErrorLines;
|
||||
IDEBuildFlags:=IDEBuildFlags+[blfUseMakeIDECfg,blfDontCleanAll];
|
||||
IDEBuildFlags:=IDEBuildFlags+[blfUseMakeIDECfg,blfDontClean];
|
||||
Result:=BuildLazarus(BuildLazProfiles.Current,ExternalTools,GlobalMacroList,
|
||||
PkgOptions,EnvironmentOptions.GetParsedCompilerFilename,
|
||||
EnvironmentOptions.GetParsedMakeFilename,IDEBuildFlags,
|
||||
|
@ -3785,7 +3785,7 @@ begin
|
||||
end;
|
||||
|
||||
// save IDE build configs, so user can build IDE on command line
|
||||
BuildIDEFlags:=[blfDontCleanAll,blfOnlyIDE];
|
||||
BuildIDEFlags:=[blfDontClean,blfOnlyIDE];
|
||||
Result:=MainIDE.DoSaveBuildIDEConfigs(BuildIDEFlags);
|
||||
if Result<>mrOk then exit;
|
||||
|
||||
@ -3866,7 +3866,7 @@ begin
|
||||
end;
|
||||
|
||||
// save IDE build configs, so user can build IDE on command line
|
||||
BuildIDEFlags:=[blfDontCleanAll,blfOnlyIDE];
|
||||
BuildIDEFlags:=[blfDontClean,blfOnlyIDE];
|
||||
Result:=MainIDE.DoSaveBuildIDEConfigs(BuildIDEFlags);
|
||||
if Result<>mrOk then exit;
|
||||
|
||||
@ -4150,7 +4150,7 @@ begin
|
||||
SaveAutoInstallDependencies;
|
||||
|
||||
// save IDE build configs, so user can build IDE on command line
|
||||
BuildIDEFlags:=[blfDontCleanAll,blfOnlyIDE];
|
||||
BuildIDEFlags:=[blfDontClean,blfOnlyIDE];
|
||||
if MainIDE.DoSaveBuildIDEConfigs(BuildIDEFlags)<>mrOk then exit(mrCancel);
|
||||
|
||||
if piiifRebuildIDE in Flags then
|
||||
|
Loading…
Reference in New Issue
Block a user