mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-22 14:59:17 +02:00
IDE: Remove IdeIntf dependency from unit Compiler.
This commit is contained in:
parent
c385c1e079
commit
86043a9919
@ -51,7 +51,7 @@ uses
|
||||
// IDEIntf
|
||||
IDEDialogs, LazIDEIntf, IDEMsgIntf, SrcEditorIntf, InputHistory,
|
||||
// IdeUtils
|
||||
IdeUtilsPkgStrConsts,
|
||||
IdeUtilsPkgStrConsts, DialogProcs,
|
||||
// IdeConfig
|
||||
LazConf, EnvironmentOpts, ModeMatrixOpts, TransferMacros, IdeConfStrConsts,
|
||||
IDEProcs, etMakeMsgParser, etFPCMsgFilePool, ParsedCompilerOpts, CompilerOptions,
|
||||
@ -59,7 +59,7 @@ uses
|
||||
// IdePackager
|
||||
IdePackagerStrConsts,
|
||||
// IDE
|
||||
LazarusIDEStrConsts, DialogProcs, ProjectResources,
|
||||
LazarusIDEStrConsts, ProjectResources,
|
||||
MiscOptions, ExtTools, etFPCMsgParser, etPas2jsMsgParser, Compiler,
|
||||
FPCSrcScan, PackageDefs, PackageSystem, Project, ProjectIcon, BaseBuildManager,
|
||||
ApplicationBundle, IdeTransferMacros, SearchPathProcs, RunParamOptions;
|
||||
@ -188,6 +188,7 @@ type
|
||||
procedure OnProjectDestroy(Sender: TObject);
|
||||
procedure SetUnitSetCache(const AValue: TFPCUnitSetCache);
|
||||
function GetProjectDefaultNamespace: string; // read .lpr file
|
||||
procedure WriteError(const Msg: string);
|
||||
protected
|
||||
// command line overrides
|
||||
OverrideTargetOS: string;
|
||||
@ -614,6 +615,13 @@ begin
|
||||
tr('EncloseBracket', lisTMFunctionEncloseBrackets);
|
||||
end;
|
||||
|
||||
procedure TBuildManager.WriteError(const Msg: string);
|
||||
begin
|
||||
DebugLn(Msg,' [TBuildManager.WriteError]');
|
||||
if IDEMessagesWindow<>nil then
|
||||
IDEMessagesWindow.AddCustomMessage(mluError,Msg);
|
||||
end;
|
||||
|
||||
procedure TBuildManager.SetupExternalTools(aToolsClass: TExternalToolsClass);
|
||||
var
|
||||
Tools: TExternalTools;
|
||||
@ -635,6 +643,7 @@ end;
|
||||
procedure TBuildManager.SetupCompilerInterface;
|
||||
begin
|
||||
TheCompiler := TCompiler.Create;
|
||||
TheCompiler.OnWriteError := @WriteError;
|
||||
end;
|
||||
|
||||
procedure TBuildManager.SetupInputHistories(aInputHist: TInputHistories);
|
||||
|
@ -44,22 +44,21 @@ uses
|
||||
// Codetools
|
||||
DefineTemplates, LinkScanner, CodeToolManager,
|
||||
// BuildIntf
|
||||
IDEExternToolIntf,
|
||||
// IdeIntf
|
||||
IDEMsgIntf, LazIDEIntf, CompOptsIntf,
|
||||
IDEExternToolIntf, CompOptsIntf,
|
||||
// IdeConfig
|
||||
TransferMacros, IDECmdLine, CompilerOptions,
|
||||
// IDE
|
||||
LazarusIDEStrConsts, Project;
|
||||
|
||||
type
|
||||
TOnCmdLineCreate = procedure(var CmdLine: string; var Abort:boolean) of object;
|
||||
//TOnCmdLineCreate = procedure(var CmdLine: string; var Abort:boolean) of object;
|
||||
TOnWriteError = procedure(const Msg: string) of object;
|
||||
|
||||
{ TCompiler }
|
||||
|
||||
TCompiler = class(TObject)
|
||||
private
|
||||
procedure WriteError(const Msg: string);
|
||||
FOnWriteError: TOnWriteError;
|
||||
public
|
||||
constructor Create;
|
||||
destructor Destroy; override;
|
||||
@ -67,6 +66,7 @@ type
|
||||
const WorkingDir, CompilerFilename: string; CompilerParams: TStrings;
|
||||
BuildAll, SkipLinking, SkipAssembler, CurrentDirectoryIsTestDir: boolean;
|
||||
const aCompileHint: string): TModalResult;
|
||||
property OnWriteError: TOnWriteError read FOnWriteError write FOnWriteError;
|
||||
end;
|
||||
|
||||
// Following classes are for compiler options parsed from "fpc -h" and "fpc -i".
|
||||
@ -296,9 +296,10 @@ begin
|
||||
CheckIfFileIsExecutable(CompilerFilename);
|
||||
except
|
||||
on E: Exception do begin
|
||||
WriteError(Format(lisCompilerErrorInvalidCompiler, [E.Message]));
|
||||
if CompilerFilename='' then begin
|
||||
WriteError(lisCompilerHintYouCanSetTheCompilerPath);
|
||||
if Assigned(OnWriteError) then begin
|
||||
OnWriteError(Format(lisCompilerErrorInvalidCompiler, [E.Message]));
|
||||
if CompilerFilename='' then
|
||||
OnWriteError(lisCompilerHintYouCanSetTheCompilerPath);
|
||||
end;
|
||||
exit;
|
||||
end;
|
||||
@ -356,13 +357,6 @@ begin
|
||||
DebugLn('Info: (lazarus) [TCompiler.Compile] end');
|
||||
end;
|
||||
|
||||
procedure TCompiler.WriteError(const Msg: string);
|
||||
begin
|
||||
DebugLn(Msg,' [TCompiler.WriteError]');
|
||||
if IDEMessagesWindow<>nil then
|
||||
IDEMessagesWindow.AddCustomMessage(mluError,Msg);
|
||||
end;
|
||||
|
||||
// Compiler options parsed from "fpc -h" and "fpc -i".
|
||||
|
||||
var
|
||||
@ -848,9 +842,9 @@ function TCompilerOptSet.SelectOptions(aOptAndValue: string): boolean;
|
||||
// -Criot
|
||||
// -vbnm6060,5087
|
||||
var
|
||||
i, Start, j: Integer;
|
||||
OneOpt, NumberValue: string;
|
||||
OptOk, Negate: Boolean;
|
||||
i, j: Integer;
|
||||
NumberValue: string;
|
||||
Negate: Boolean;
|
||||
c: Char;
|
||||
Item, NumberOpt: TCompilerOpt;
|
||||
Bools: array of char; // '+' = on, '-' = off, else not set
|
||||
@ -1496,7 +1490,7 @@ procedure TCompilerOptThread.StartParsing;
|
||||
begin
|
||||
if fStartedOnce then
|
||||
WaitFor;
|
||||
fReader.CompilerExecutable:=LazarusIDE.GetCompilerFilename;
|
||||
Assert(fReader.CompilerExecutable<>'', 'TCompilerOptThread.StartParsing: CompilerExecutable should be set by caller.');
|
||||
fReader.UpdateTargetParam;
|
||||
Start;
|
||||
fStartedOnce:=true;
|
||||
|
@ -38,7 +38,7 @@ uses
|
||||
// BuildIntf
|
||||
IDEOptionsIntf, CompOptsIntf,
|
||||
// IdeIntf
|
||||
IDEOptEditorIntf, IDECommands,
|
||||
IDEOptEditorIntf, IDECommands, LazIDEIntf,
|
||||
// SynEdit
|
||||
SynEdit, SynEditKeyCmds, SynCompletion,
|
||||
// IdeConfig
|
||||
@ -409,6 +409,7 @@ begin
|
||||
end;
|
||||
end
|
||||
else begin
|
||||
FOptionsReader.CompilerExecutable:=LazarusIDE.GetCompilerFilename;
|
||||
fOptionsThread := TCompilerOptThread.Create(FOptionsReader);
|
||||
fOptionsThread.StartParsing;
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user