mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 19:19:18 +02:00
IdeIntf: Improve timestamp updates of TLazCompilationToolOptions + inherited classes. Issue #34283.
git-svn-id: trunk@59268 -
This commit is contained in:
parent
a6008a5186
commit
6ab3884744
@ -18,7 +18,7 @@ interface
|
|||||||
uses
|
uses
|
||||||
Classes, SysUtils,
|
Classes, SysUtils,
|
||||||
// LazUtils
|
// LazUtils
|
||||||
LazMethodList, LazFileCache,
|
LazMethodList,
|
||||||
// IdeIntf
|
// IdeIntf
|
||||||
IDEOptionsIntf;
|
IDEOptionsIntf;
|
||||||
|
|
||||||
@ -116,31 +116,30 @@ const
|
|||||||
crAll = [crCompile, crBuild, crRun];
|
crAll = [crCompile, crBuild, crRun];
|
||||||
|
|
||||||
type
|
type
|
||||||
|
TLazCompilerOptions = class;
|
||||||
|
|
||||||
{ TLazCompilationToolOptions }
|
{ TLazCompilationToolOptions }
|
||||||
|
|
||||||
TLazCompilationToolOptions = class
|
TLazCompilationToolOptions = class
|
||||||
private
|
private
|
||||||
FOwner: TObject;
|
FOwner: TLazCompilerOptions;
|
||||||
FChangeStamp: int64;
|
|
||||||
FCommand: string;
|
FCommand: string;
|
||||||
FOnChanged: TNotifyEvent;
|
|
||||||
procedure SetCommand(AValue: string);
|
|
||||||
protected
|
protected
|
||||||
FCompileReasons: TCompileReasons;
|
FCompileReasons: TCompileReasons;
|
||||||
|
procedure SetCommand(AValue: string); virtual;
|
||||||
procedure SetCompileReasons(const {%H-}AValue: TCompileReasons); virtual;
|
procedure SetCompileReasons(const {%H-}AValue: TCompileReasons); virtual;
|
||||||
public
|
public
|
||||||
constructor Create(TheOwner: TObject); virtual;
|
constructor Create(TheOwner: TLazCompilerOptions); virtual;
|
||||||
procedure Clear; virtual;
|
procedure Clear; virtual;
|
||||||
procedure Assign(Src: TLazCompilationToolOptions); virtual;
|
procedure Assign(Src: TLazCompilationToolOptions); virtual;
|
||||||
procedure IncreaseChangeStamp;
|
|
||||||
public
|
public
|
||||||
property Owner: TObject read FOwner;
|
property Owner: TLazCompilerOptions read FOwner;
|
||||||
property ChangeStamp: int64 read FChangeStamp;
|
|
||||||
property Command: string read FCommand write SetCommand;
|
property Command: string read FCommand write SetCommand;
|
||||||
property CompileReasons: TCompileReasons read FCompileReasons write SetCompileReasons;
|
property CompileReasons: TCompileReasons read FCompileReasons write SetCompileReasons;
|
||||||
property OnChanged: TNotifyEvent read FOnChanged write FOnChanged;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
TLazCompilationToolClass = class of TLazCompilationToolOptions;
|
||||||
|
|
||||||
{ TLazCompilerOptions }
|
{ TLazCompilerOptions }
|
||||||
|
|
||||||
TLazCompilerOptions = class(TAbstractIDEOptions)
|
TLazCompilerOptions = class(TAbstractIDEOptions)
|
||||||
@ -209,17 +208,13 @@ type
|
|||||||
FChangeStamp: int64;
|
FChangeStamp: int64;
|
||||||
FSavedChangeStamp: int64;
|
FSavedChangeStamp: int64;
|
||||||
fOnChanged: TMethodList;
|
fOnChanged: TMethodList;
|
||||||
|
|
||||||
// Paths:
|
// Paths:
|
||||||
|
|
||||||
// conditionals / build modes
|
// conditionals / build modes
|
||||||
FConditionals: string;
|
FConditionals: string;
|
||||||
fBuildMacros: TLazBuildMacros;
|
fBuildMacros: TLazBuildMacros;
|
||||||
|
|
||||||
// Parsing:
|
// Parsing:
|
||||||
// assembler style
|
// assembler style
|
||||||
fAssemblerStyle: Integer;
|
fAssemblerStyle: Integer;
|
||||||
|
|
||||||
// syntax options
|
// syntax options
|
||||||
FSyntaxMode: string;
|
FSyntaxMode: string;
|
||||||
fCStyleOp: Boolean;
|
fCStyleOp: Boolean;
|
||||||
@ -230,7 +225,6 @@ type
|
|||||||
fCMacros: Boolean;
|
fCMacros: Boolean;
|
||||||
fInitConst: Boolean;
|
fInitConst: Boolean;
|
||||||
fStaticKeyword: Boolean;
|
fStaticKeyword: Boolean;
|
||||||
|
|
||||||
// Code generation:
|
// Code generation:
|
||||||
fSmartLinkUnit: Boolean;
|
fSmartLinkUnit: Boolean;
|
||||||
fRelocatableUnit: Boolean;
|
fRelocatableUnit: Boolean;
|
||||||
@ -249,7 +243,6 @@ type
|
|||||||
fVarsInReg: Boolean;
|
fVarsInReg: Boolean;
|
||||||
fUncertainOpt: Boolean;
|
fUncertainOpt: Boolean;
|
||||||
FSmallerCode: boolean;
|
FSmallerCode: boolean;
|
||||||
|
|
||||||
// Linking:
|
// Linking:
|
||||||
fGenDebugInfo: Boolean;
|
fGenDebugInfo: Boolean;
|
||||||
FDebugInfoType: TCompilerDbgSymbolType;
|
FDebugInfoType: TCompilerDbgSymbolType;
|
||||||
@ -268,7 +261,6 @@ type
|
|||||||
fTargetFileExt: string;
|
fTargetFileExt: string;
|
||||||
fTargetFilename: string;
|
fTargetFilename: string;
|
||||||
FTargetFilenameAppplyConventions: boolean;
|
FTargetFilenameAppplyConventions: boolean;
|
||||||
|
|
||||||
// Messages:
|
// Messages:
|
||||||
fShowWarn: Boolean;
|
fShowWarn: Boolean;
|
||||||
fShowNotes: Boolean;
|
fShowNotes: Boolean;
|
||||||
@ -287,11 +279,9 @@ type
|
|||||||
fStopAfterErrCount: integer;
|
fStopAfterErrCount: integer;
|
||||||
// Turn specific types of compiler messages on or off
|
// Turn specific types of compiler messages on or off
|
||||||
fMessageFlags: TAbstractCompilerMsgIDFlags;
|
fMessageFlags: TAbstractCompilerMsgIDFlags;
|
||||||
|
|
||||||
// Other tools:
|
// Other tools:
|
||||||
fExecuteBefore: TLazCompilationToolOptions;
|
fExecuteBefore: TLazCompilationToolOptions;
|
||||||
fExecuteAfter: TLazCompilationToolOptions;
|
fExecuteAfter: TLazCompilationToolOptions;
|
||||||
|
|
||||||
// Other:
|
// Other:
|
||||||
fDontUseConfigFile: Boolean;
|
fDontUseConfigFile: Boolean;
|
||||||
fCustomConfigFile: Boolean;
|
fCustomConfigFile: Boolean;
|
||||||
@ -477,7 +467,7 @@ implementation
|
|||||||
|
|
||||||
{ TLazCompilationToolOptions }
|
{ TLazCompilationToolOptions }
|
||||||
|
|
||||||
constructor TLazCompilationToolOptions.Create(TheOwner: TObject);
|
constructor TLazCompilationToolOptions.Create(TheOwner: TLazCompilerOptions);
|
||||||
begin
|
begin
|
||||||
FOwner:=TheOwner;
|
FOwner:=TheOwner;
|
||||||
FCompileReasons:=crAll; // This default can be used in some comparisons.
|
FCompileReasons:=crAll; // This default can be used in some comparisons.
|
||||||
@ -495,18 +485,11 @@ begin
|
|||||||
FCompileReasons := Src.CompileReasons;
|
FCompileReasons := Src.CompileReasons;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TLazCompilationToolOptions.IncreaseChangeStamp;
|
|
||||||
begin
|
|
||||||
LUIncreaseChangeStamp64(FChangeStamp);
|
|
||||||
if Assigned(OnChanged) then
|
|
||||||
OnChanged(Self);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TLazCompilationToolOptions.SetCommand(AValue: string);
|
procedure TLazCompilationToolOptions.SetCommand(AValue: string);
|
||||||
begin
|
begin
|
||||||
if FCommand=AValue then exit;
|
if FCommand=AValue then exit;
|
||||||
FCommand:=AValue;
|
FCommand:=AValue;
|
||||||
IncreaseChangeStamp;
|
FOwner.IncreaseChangeStamp;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TLazCompilationToolOptions.SetCompileReasons(const AValue: TCompileReasons);
|
procedure TLazCompilationToolOptions.SetCompileReasons(const AValue: TCompileReasons);
|
||||||
@ -927,7 +910,7 @@ end;
|
|||||||
function TLazCompilerOptions.GetModified: boolean;
|
function TLazCompilerOptions.GetModified: boolean;
|
||||||
begin
|
begin
|
||||||
Result:=(FSavedChangeStamp=InvalidChangeStamp)
|
Result:=(FSavedChangeStamp=InvalidChangeStamp)
|
||||||
or (FSavedChangeStamp<>FChangeStamp);
|
or (FSavedChangeStamp<>FChangeStamp);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
constructor TLazCompilerOptions.Create(const TheOwner: TObject);
|
constructor TLazCompilerOptions.Create(const TheOwner: TObject);
|
||||||
|
@ -342,9 +342,10 @@ type
|
|||||||
procedure SetHasParser(aParserName: string; const AValue: boolean);
|
procedure SetHasParser(aParserName: string; const AValue: boolean);
|
||||||
procedure SetParsers(const AValue: TStrings);
|
procedure SetParsers(const AValue: TStrings);
|
||||||
protected
|
protected
|
||||||
|
procedure SetCommand(AValue: string); override;
|
||||||
procedure SubstituteMacros(var s: string); virtual;
|
procedure SubstituteMacros(var s: string); virtual;
|
||||||
public
|
public
|
||||||
constructor Create(TheOwner: TObject); override;
|
constructor Create(TheOwner: TLazCompilerOptions); override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
procedure Clear; override;
|
procedure Clear; override;
|
||||||
function CreateDiff(CompOpts: TCompilationToolOptions;
|
function CreateDiff(CompOpts: TCompilationToolOptions;
|
||||||
@ -362,7 +363,6 @@ type
|
|||||||
property Parsers: TStrings read FParsers write SetParsers;
|
property Parsers: TStrings read FParsers write SetParsers;
|
||||||
property HasParser[aParserName: string]: boolean read GetHasParser write SetHasParser;
|
property HasParser[aParserName: string]: boolean read GetHasParser write SetHasParser;
|
||||||
end;
|
end;
|
||||||
TCompilationToolClass = class of TCompilationToolOptions;
|
|
||||||
|
|
||||||
TCompilerMsgIdFlag = record
|
TCompilerMsgIdFlag = record
|
||||||
MsgId: integer;
|
MsgId: integer;
|
||||||
@ -426,7 +426,6 @@ type
|
|||||||
FCreateMakefileOnBuild: boolean;
|
FCreateMakefileOnBuild: boolean;
|
||||||
function GetExecuteAfter: TCompilationToolOptions;
|
function GetExecuteAfter: TCompilationToolOptions;
|
||||||
function GetExecuteBefore: TCompilationToolOptions;
|
function GetExecuteBefore: TCompilationToolOptions;
|
||||||
procedure OnItemChanged(Sender: TObject);
|
|
||||||
procedure SetCreateMakefileOnBuild(AValue: boolean);
|
procedure SetCreateMakefileOnBuild(AValue: boolean);
|
||||||
protected
|
protected
|
||||||
function GetCompilerPath: String; override;
|
function GetCompilerPath: String; override;
|
||||||
@ -465,8 +464,7 @@ type
|
|||||||
procedure SetDefaultMakeOptionsFlags(const AValue: TCompilerCmdLineOptions);
|
procedure SetDefaultMakeOptionsFlags(const AValue: TCompilerCmdLineOptions);
|
||||||
public
|
public
|
||||||
constructor Create(const AOwner: TObject); override;
|
constructor Create(const AOwner: TObject); override;
|
||||||
constructor Create(const AOwner: TObject;
|
constructor Create(const AOwner: TObject; const AToolClass: TLazCompilationToolClass);
|
||||||
const AToolClass: TCompilationToolClass);
|
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
procedure Clear; virtual;
|
procedure Clear; virtual;
|
||||||
class function GetInstance: TAbstractIDEOptions; override;
|
class function GetInstance: TAbstractIDEOptions; override;
|
||||||
@ -1103,15 +1101,13 @@ end;
|
|||||||
TBaseCompilerOptions Constructor
|
TBaseCompilerOptions Constructor
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
constructor TBaseCompilerOptions.Create(const AOwner: TObject;
|
constructor TBaseCompilerOptions.Create(const AOwner: TObject;
|
||||||
const AToolClass: TCompilationToolClass);
|
const AToolClass: TLazCompilationToolClass);
|
||||||
begin
|
begin
|
||||||
inherited Create(AOwner);
|
inherited Create(AOwner);
|
||||||
FParsedOpts := TParsedCompilerOptions.Create(Self);
|
FParsedOpts := TParsedCompilerOptions.Create(Self);
|
||||||
FOtherDefines := TStringList.Create;
|
FOtherDefines := TStringList.Create;
|
||||||
FExecuteBefore := AToolClass.Create(Self);
|
FExecuteBefore := AToolClass.Create(Self);
|
||||||
FExecuteBefore.OnChanged := @OnItemChanged;
|
|
||||||
FExecuteAfter := AToolClass.Create(Self);
|
FExecuteAfter := AToolClass.Create(Self);
|
||||||
fExecuteAfter.OnChanged := @OnItemChanged;
|
|
||||||
fBuildMacros := TIDEBuildMacros.Create(Self);
|
fBuildMacros := TIDEBuildMacros.Create(Self);
|
||||||
fMessageFlags:=TCompilerMsgIDFlags.Create;
|
fMessageFlags:=TCompilerMsgIDFlags.Create;
|
||||||
Clear;
|
Clear;
|
||||||
@ -1305,14 +1301,6 @@ begin
|
|||||||
Result:=(inherited GetModified) or MessageFlags.Modified;
|
Result:=(inherited GetModified) or MessageFlags.Modified;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TBaseCompilerOptions.OnItemChanged(Sender: TObject);
|
|
||||||
begin
|
|
||||||
{$IFDEF VerboseIDEModified}
|
|
||||||
debugln(['TBaseCompilerOptions.OnItemChanged ',DbgSName(Sender)]);
|
|
||||||
{$ENDIF}
|
|
||||||
IncreaseChangeStamp;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TBaseCompilerOptions.SetCreateMakefileOnBuild(AValue: boolean);
|
procedure TBaseCompilerOptions.SetCreateMakefileOnBuild(AValue: boolean);
|
||||||
begin
|
begin
|
||||||
if FCreateMakefileOnBuild=AValue then Exit;
|
if FCreateMakefileOnBuild=AValue then Exit;
|
||||||
@ -4235,7 +4223,7 @@ begin
|
|||||||
if not AValue then exit;
|
if not AValue then exit;
|
||||||
FParsers.Add(aParserName);
|
FParsers.Add(aParserName);
|
||||||
end;
|
end;
|
||||||
IncreaseChangeStamp;
|
Owner.IncreaseChangeStamp;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCompilationToolOptions.SetParsers(const AValue: TStrings);
|
procedure TCompilationToolOptions.SetParsers(const AValue: TStrings);
|
||||||
@ -4245,7 +4233,13 @@ begin
|
|||||||
debugln(['TCompilationToolOptions.SetParsers ',AValue.Text]);
|
debugln(['TCompilationToolOptions.SetParsers ',AValue.Text]);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
FParsers.Assign(AValue);
|
FParsers.Assign(AValue);
|
||||||
IncreaseChangeStamp;
|
Owner.IncreaseChangeStamp;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCompilationToolOptions.SetCommand(AValue: string);
|
||||||
|
begin
|
||||||
|
inherited SetCommand(AValue);
|
||||||
|
Inc(FParsedCommandStamp);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCompilationToolOptions.SubstituteMacros(var s: string);
|
procedure TCompilationToolOptions.SubstituteMacros(var s: string);
|
||||||
@ -4253,7 +4247,7 @@ begin
|
|||||||
IDEMacros.SubstituteMacros(s);
|
IDEMacros.SubstituteMacros(s);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
constructor TCompilationToolOptions.Create(TheOwner: TObject);
|
constructor TCompilationToolOptions.Create(TheOwner: TLazCompilerOptions);
|
||||||
begin
|
begin
|
||||||
inherited Create(TheOwner);
|
inherited Create(TheOwner);
|
||||||
FParsers:=TStringList.Create;
|
FParsers:=TStringList.Create;
|
||||||
|
@ -490,7 +490,7 @@ type
|
|||||||
procedure SetCompileReasons(const AValue: TCompileReasons); override;
|
procedure SetCompileReasons(const AValue: TCompileReasons); override;
|
||||||
procedure SubstituteMacros(var s: string); override;
|
procedure SubstituteMacros(var s: string); override;
|
||||||
public
|
public
|
||||||
constructor Create(TheOwner: TObject); override;
|
constructor Create(TheOwner: TLazCompilerOptions); override;
|
||||||
function CreateDiff(CompOpts: TCompilationToolOptions;
|
function CreateDiff(CompOpts: TCompilationToolOptions;
|
||||||
Tool: TCompilerDiffTool): boolean; override;
|
Tool: TCompilerDiffTool): boolean; override;
|
||||||
procedure LoadFromXMLConfig(XMLConfig: TXMLConfig; const Path: string;
|
procedure LoadFromXMLConfig(XMLConfig: TXMLConfig; const Path: string;
|
||||||
@ -5983,7 +5983,7 @@ end;
|
|||||||
|
|
||||||
{ TProjectCompilationToolOptions }
|
{ TProjectCompilationToolOptions }
|
||||||
|
|
||||||
constructor TProjectCompilationToolOptions.Create(TheOwner: TObject);
|
constructor TProjectCompilationToolOptions.Create(TheOwner: TLazCompilerOptions);
|
||||||
begin
|
begin
|
||||||
inherited Create(TheOwner);
|
inherited Create(TheOwner);
|
||||||
FDefaultCompileReasons:=crAll;
|
FDefaultCompileReasons:=crAll;
|
||||||
@ -6029,14 +6029,14 @@ procedure TProjectCompilationToolOptions.SetCompileReasons(const AValue: TCompil
|
|||||||
begin
|
begin
|
||||||
if FCompileReasons=AValue then exit;
|
if FCompileReasons=AValue then exit;
|
||||||
FCompileReasons:=AValue;
|
FCompileReasons:=AValue;
|
||||||
IncreaseChangeStamp;
|
Owner.IncreaseChangeStamp;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TProjectCompilationToolOptions.SetDefaultCompileReasons(const AValue: TCompileReasons);
|
procedure TProjectCompilationToolOptions.SetDefaultCompileReasons(const AValue: TCompileReasons);
|
||||||
begin
|
begin
|
||||||
if FDefaultCompileReasons=AValue then exit;
|
if FDefaultCompileReasons=AValue then exit;
|
||||||
FDefaultCompileReasons:=AValue;
|
FDefaultCompileReasons:=AValue;
|
||||||
IncreaseChangeStamp;
|
Owner.IncreaseChangeStamp;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TProjectCompilationToolOptions.SubstituteMacros(var s: string);
|
procedure TProjectCompilationToolOptions.SubstituteMacros(var s: string);
|
||||||
|
Loading…
Reference in New Issue
Block a user