IDE: added TAbstractExternalTool.CurrentDirectoryIsTestDir

git-svn-id: trunk@53206 -
This commit is contained in:
mattias 2016-10-25 20:20:05 +00:00
parent dc27fbd3f4
commit a152fd580f
4 changed files with 28 additions and 8 deletions

View File

@ -37,6 +37,7 @@ const
IDEToolCompilePackage = 'Package';
IDEToolCompileProject = 'Project'; // the active project
IDEToolCompileIDE = 'IDE';
type
{ TIDEExternalToolData
@ -48,7 +49,9 @@ type
Kind: string; // e.g. IDEToolCompilePackage or IDEToolCompileProject
ModuleName: string; // e.g. the package name
Filename: string; // e.g. the lpi or lpk filename
Flags: TStrings;
constructor Create(aKind, aModuleName, aFilename: string);
destructor Destroy; override;
end;
type
@ -462,6 +465,7 @@ type
FTitle: string;
FTools: TIDEExternalTools;
FViews: TFPList; // list of TExtToolView
FCurrentDirectoryIsTestDir: boolean;
function GetCmdLineParams: string;
function GetParserCount: integer;
function GetParsers(Index: integer): TExtToolParser;
@ -529,6 +533,8 @@ type
function ResolveMacros: boolean; virtual; abstract; // resolve macros in Process.Executable, Process.CurrentDirectory, Process.Params, Process.Environment on Execute
property ResolveMacrosOnExecute: boolean read FResolveMacrosOnExecute
write FResolveMacrosOnExecute;
property CurrentDirectoryIsTestDir: boolean read FCurrentDirectoryIsTestDir
write FCurrentDirectoryIsTestDir; // virtual files were written to test directory, parsers should reverse source filenames
property Stage: TExternalToolStage read FStage;
procedure Execute; virtual; abstract;
procedure Terminate; virtual; abstract;
@ -769,6 +775,13 @@ begin
Kind:=aKind;
ModuleName:=aModuleName;
Filename:=aFilename;
Flags:=TStringList.Create;
end;
destructor TIDEExternalToolData.Destroy;
begin
FreeAndNil(Flags);
inherited Destroy;
end;
{ TFPCParser }

View File

@ -56,9 +56,8 @@ type
destructor Destroy; override;
function Compile(AProject: TProject;
const WorkingDir, CompilerFilename, CompilerParams: string;
BuildAll, SkipLinking, SkipAssembler: boolean;
const aCompileHint: string
): TModalResult;
BuildAll, SkipLinking, SkipAssembler, CurrentDirectoryIsTestDir: boolean;
const aCompileHint: string): TModalResult;
procedure WriteError(const Msg: string);
end;
@ -218,7 +217,7 @@ type
property ErrorMsg: String read fErrorMsg write fErrorMsg;
end;
{ TCompilerOptThread }
{ TCompilerOptThread - thread for reading 'fpc -h' output }
TCompilerOptThread = class(TThread)
private
@ -265,7 +264,8 @@ end;
------------------------------------------------------------------------------}
function TCompiler.Compile(AProject: TProject; const WorkingDir,
CompilerFilename, CompilerParams: string; BuildAll, SkipLinking,
SkipAssembler: boolean; const aCompileHint: string): TModalResult;
SkipAssembler, CurrentDirectoryIsTestDir: boolean; const aCompileHint: string
): TModalResult;
var
CmdLine : String;
Abort : Boolean;
@ -335,6 +335,7 @@ begin
Tool.Process.Executable:=CompilerFilename;
Tool.CmdLineParams:=CmdLine;
Tool.Process.CurrentDirectory:=WorkingDir;
Tool.CurrentDirectoryIsTestDir:=CurrentDirectoryIsTestDir;
FPCParser:=TFPCParser(Tool.AddParsers(SubToolFPC));
FPCParser.ShowLinesCompiled:=EnvironmentOptions.MsgViewShowFPCMsgLinesCompiled;
FPCParser.HideHintsSenderNotUsed:=not AProject.CompilerOptions.ShowHintsForSenderNotUsed;

View File

@ -3180,8 +3180,13 @@ begin
if Proc<>nil then begin
if Proc.Executable<>'' then
s+='Executable: '+LineEnding+Proc.Executable+LineEnding+LineEnding;
if Proc.CurrentDirectory<>'' then
s+='CurrentDirectory: '+LineEnding+Proc.CurrentDirectory+LineEnding+LineEnding;
if Proc.CurrentDirectory<>'' then begin
if Tool.CurrentDirectoryIsTestDir then
s+='CurrentDirectory is test build directory:'
else
s+='CurrentDirectory:';
s+=LineEnding+Proc.CurrentDirectory+LineEnding+LineEnding;
end;
if Proc.Desktop<>'' then
s+='Desktop: '+Proc.Desktop+LineEnding;
if Tool.EnvironmentOverrides.Text<>'' then

View File

@ -6795,7 +6795,8 @@ begin
WorkingDir,CompilerFilename,CompilerParams,
(AReason = crBuild) or NeedBuildAllFlag,
pbfSkipLinking in Flags,
pbfSkipAssembler in Flags,aCompileHint);
pbfSkipAssembler in Flags,Project1.IsVirtual,
aCompileHint);
if ConsoleVerbosity>=0 then
debugln(['Hint: (lazarus) [TMainIDE.DoBuildProject] compiler time in s: ',(Now-StartTime)*86400]);
DoCallBuildingFinishedHandler(lihtProjectBuildingFinished, Self, Result=mrOk);