IDE: unified changestamp

git-svn-id: trunk@36046 -
This commit is contained in:
mattias 2012-03-15 22:35:34 +00:00
parent a6537c8ebe
commit 587f6e9dcc
6 changed files with 64 additions and 48 deletions

View File

@ -255,8 +255,8 @@ end;
constructor TBuildManager.Create(AOwner: TComponent); constructor TBuildManager.Create(AOwner: TComponent);
begin begin
DefaultCfgVars:=TCTCfgScriptVariables.Create; DefaultCfgVars:=TCTCfgScriptVariables.Create;
DefaultCfgVarsBuildMacroStamp:=InvalidParseStamp; DefaultCfgVarsBuildMacroStamp:=CTInvalidChangeStamp;
FFPCVerChangeStamp:=InvalidParseStamp; FFPCVerChangeStamp:=CTInvalidChangeStamp;
MainBuildBoss:=Self; MainBuildBoss:=Self;
inherited Create(AOwner); inherited Create(AOwner);
fTargetOS:=GetDefaultTargetOS; fTargetOS:=GetDefaultTargetOS;

View File

@ -1761,7 +1761,7 @@ var
i: TInheritedCompilerOption; i: TInheritedCompilerOption;
p: TCompilerOptionsParseType; p: TCompilerOptionsParseType;
begin begin
fInheritedOptParseStamps:=InvalidParseStamp; fInheritedOptParseStamps:=CTInvalidChangeStamp;
for p:=Low(TCompilerOptionsParseType) to High(TCompilerOptionsParseType) do for p:=Low(TCompilerOptionsParseType) to High(TCompilerOptionsParseType) do
for i:=Low(TInheritedCompilerOption) to High(TInheritedCompilerOption) do for i:=Low(TInheritedCompilerOption) to High(TInheritedCompilerOption) do
begin begin
@ -3688,7 +3688,7 @@ end;
function TParsedCompilerOptions.HasParsedError: boolean; function TParsedCompilerOptions.HasParsedError: boolean;
begin begin
Result:=(ParsedErrorStamp<>InvalidParseStamp) Result:=(ParsedErrorStamp<>CTInvalidChangeStamp)
and (ParsedErrorStamp=CompilerParseStamp); and (ParsedErrorStamp=CompilerParseStamp);
end; end;
@ -3803,8 +3803,8 @@ begin
if Option=pcosBaseDir then if Option=pcosBaseDir then
InvalidateFiles InvalidateFiles
else begin else begin
ParsedStamp[Option]:=InvalidParseStamp; ParsedStamp[Option]:=CTInvalidChangeStamp;
ParsedPIStamp[Option]:=InvalidParseStamp; ParsedPIStamp[Option]:=CTInvalidChangeStamp;
end; end;
UnparsedValues[Option]:=NewValue; UnparsedValues[Option]:=NewValue;
end; end;
@ -3898,12 +3898,12 @@ var
begin begin
for Option:=Low(TParsedCompilerOptString) to High(TParsedCompilerOptString) do for Option:=Low(TParsedCompilerOptString) to High(TParsedCompilerOptString) do
begin begin
ParsedStamp[Option]:=InvalidParseStamp; ParsedStamp[Option]:=CTInvalidChangeStamp;
ParsedPIStamp[Option]:=InvalidParseStamp; ParsedPIStamp[Option]:=CTInvalidChangeStamp;
end; end;
InheritedMacroValuesStamp:=InvalidParseStamp; InheritedMacroValuesStamp:=CTInvalidChangeStamp;
MacroValuesStamp:=InvalidParseStamp; MacroValuesStamp:=CTInvalidChangeStamp;
ParsedErrorStamp:=InvalidParseStamp; ParsedErrorStamp:=CTInvalidChangeStamp;
end; end;
procedure TParsedCompilerOptions.InvalidateFiles; procedure TParsedCompilerOptions.InvalidateFiles;
@ -3912,8 +3912,8 @@ var
begin begin
for Option:=Low(TParsedCompilerOptString) to High(TParsedCompilerOptString) do for Option:=Low(TParsedCompilerOptString) to High(TParsedCompilerOptString) do
if (Option in ParsedCompilerFiles) then begin if (Option in ParsedCompilerFiles) then begin
ParsedStamp[Option]:=InvalidParseStamp; ParsedStamp[Option]:=CTInvalidChangeStamp;
ParsedPIStamp[Option]:=InvalidParseStamp; ParsedPIStamp[Option]:=CTInvalidChangeStamp;
end; end;
end; end;

View File

@ -171,6 +171,25 @@ var
ExternalToolListClass: TExternalToolListClass; // set by ExtToolDialog ExternalToolListClass: TExternalToolListClass; // set by ExtToolDialog
type type
TParsedEnvOptType = (
peoLazarusDirectory,
peoCompilerFilename,
peopFPCSourceDirectory,
peoTestBuildDirectory,
peoDebuggerFilename,
peoMakeFilename,
peoDebuggerSearchPath,
peoFPDocPaths,
peoCompilerMessagesFilename
);
TParsedEnvOptTypes = set of TParsedEnvOptType;
TParsedEnvOption = record
Value: string;
ParseStamp: integer;
end;
type
{ TEnvironmentOptions - class for storing environment options } { TEnvironmentOptions - class for storing environment options }
TEnvironmentOptions = class(TAbstractIDEEnvironmentOptions) TEnvironmentOptions = class(TAbstractIDEEnvironmentOptions)
@ -245,7 +264,7 @@ type
// compiler + debugger + lazarus files // compiler + debugger + lazarus files
FLazarusDirectory: string; FLazarusDirectory: string;
FLazarusDirsHistory: TStringList; FLazarusDirHistory: TStringList;
FCompilerFilename: string; FCompilerFilename: string;
FCompilerFilenameParsed: string; FCompilerFilenameParsed: string;
FCompilerFilenameParsedStamp: integer; FCompilerFilenameParsedStamp: integer;
@ -346,9 +365,10 @@ type
procedure Save(OnlyDesktop:boolean); procedure Save(OnlyDesktop:boolean);
property Filename: string read FFilename write SetFilename; property Filename: string read FFilename write SetFilename;
procedure CreateConfig; procedure CreateConfig;
function GetLazarusDirectory: string;
function GetTestBuildDirectory: string; function GetTestBuildDirectory: string;
function GetFPCSourceDirectory: string;
function GetCompilerFilename: string; function GetCompilerFilename: string;
function GetFPCSourceDirectory: string;
// macro functions // macro functions
procedure InitMacros(AMacroList: TTransferMacroList); procedure InitMacros(AMacroList: TTransferMacroList);
@ -459,8 +479,8 @@ type
// files // files
property LazarusDirectory: string read FLazarusDirectory property LazarusDirectory: string read FLazarusDirectory
write SetLazarusDirectory; write SetLazarusDirectory;
property LazarusDirHistory: TStringList read FLazarusDirsHistory property LazarusDirHistory: TStringList read FLazarusDirHistory
write FLazarusDirsHistory; write FLazarusDirHistory;
property CompilerFilename: string read FCompilerFilename property CompilerFilename: string read FCompilerFilename
write SetCompilerFilename; write SetCompilerFilename;
property CompilerFileHistory: TStringList read FCompilerFileHistory property CompilerFileHistory: TStringList read FCompilerFileHistory
@ -780,12 +800,12 @@ begin
// files // files
LazarusDirectory:=IDEProcs.ProgramDirectory(true); LazarusDirectory:=IDEProcs.ProgramDirectory(true);
FLazarusDirsHistory:=TStringList.Create; FLazarusDirHistory:=TStringList.Create;
CompilerFilename:=''; CompilerFilename:='';
FCompilerFilenameParsedStamp:=InvalidParseStamp; FCompilerFilenameParsedStamp:=CTInvalidChangeStamp;
FCompilerFileHistory:=TStringList.Create; FCompilerFileHistory:=TStringList.Create;
FPCSourceDirectory:=''; FPCSourceDirectory:='';
FFPCSrcDirParsedStamp:=InvalidParseStamp; FFPCSrcDirParsedStamp:=CTInvalidChangeStamp;
FFPCSourceDirHistory:=TStringList.Create; FFPCSourceDirHistory:=TStringList.Create;
MakeFilename:=''; MakeFilename:='';
FMakeFileHistory:=TStringList.Create; FMakeFileHistory:=TStringList.Create;
@ -850,7 +870,7 @@ begin
FreeAndNil(FRecentProjectFiles); FreeAndNil(FRecentProjectFiles);
FreeAndNil(FRecentPackageFiles); FreeAndNil(FRecentPackageFiles);
FreeAndNil(FObjectInspectorOptions); FreeAndNil(FObjectInspectorOptions);
FreeAndNil(FLazarusDirsHistory); FreeAndNil(FLazarusDirHistory);
FreeAndNil(FCompilerFileHistory); FreeAndNil(FCompilerFileHistory);
FreeAndNil(FFPCSourceDirHistory); FreeAndNil(FFPCSourceDirHistory);
FreeAndNil(FMakeFileHistory); FreeAndNil(FMakeFileHistory);
@ -899,6 +919,11 @@ begin
Filename:=ConfFilename; Filename:=ConfFilename;
end; end;
function TEnvironmentOptions.GetLazarusDirectory: string;
begin
end;
procedure TEnvironmentOptions.SetFileName(const NewFilename: string); procedure TEnvironmentOptions.SetFileName(const NewFilename: string);
begin begin
if FFilename=NewFilename then exit; if FFilename=NewFilename then exit;
@ -1079,10 +1104,10 @@ begin
if not FilenameIsAbsolute(s) then if not FilenameIsAbsolute(s) then
s:=TrimFilename(AppendPathDelim(GetPrimaryConfigPath)+s); s:=TrimFilename(AppendPathDelim(GetPrimaryConfigPath)+s);
LazarusDirectory:=s; LazarusDirectory:=s;
LoadRecentList(XMLConfig,FLazarusDirsHistory, LoadRecentList(XMLConfig,FLazarusDirHistory,
Path+'LazarusDirectory/History/'); Path+'LazarusDirectory/History/');
if FLazarusDirsHistory.Count=0 then if FLazarusDirHistory.Count=0 then
FLazarusDirsHistory.Add(ProgramDirectory(true)); FLazarusDirHistory.Add(ProgramDirectory(true));
CompilerFilename:=TrimFilename(XMLConfig.GetValue( CompilerFilename:=TrimFilename(XMLConfig.GetValue(
Path+'CompilerFilename/Value',FCompilerFilename)); Path+'CompilerFilename/Value',FCompilerFilename));
LoadRecentList(XMLConfig,FCompilerFileHistory, LoadRecentList(XMLConfig,FCompilerFileHistory,
@ -1427,7 +1452,7 @@ begin
CurLazDir:=CreateRelativePath(CurLazDir,GetPrimaryConfigPath); CurLazDir:=CreateRelativePath(CurLazDir,GetPrimaryConfigPath);
end; end;
XMLConfig.SetDeleteValue(Path+'LazarusDirectory/Value',CurLazDir,''); XMLConfig.SetDeleteValue(Path+'LazarusDirectory/Value',CurLazDir,'');
SaveRecentList(XMLConfig,FLazarusDirsHistory, SaveRecentList(XMLConfig,FLazarusDirHistory,
Path+'LazarusDirectory/History/'); Path+'LazarusDirectory/History/');
XMLConfig.SetDeleteValue( XMLConfig.SetDeleteValue(
Path+'CompilerFilename/Value',FCompilerFilename,''); Path+'CompilerFilename/Value',FCompilerFilename,'');
@ -1643,7 +1668,7 @@ end;
function TEnvironmentOptions.GetFPCSourceDirectory: string; function TEnvironmentOptions.GetFPCSourceDirectory: string;
begin begin
if (FFPCSrcDirParsedStamp=InvalidParseStamp) if (FFPCSrcDirParsedStamp=CTInvalidChangeStamp)
or (FFPCSrcDirParsedStamp<>CompilerParseStamp) or (FFPCSrcDirParsedStamp<>CompilerParseStamp)
then begin then begin
FFPCSrcDirParsed:=FFPCSourceDirectory; FFPCSrcDirParsed:=FFPCSourceDirectory;
@ -1655,7 +1680,7 @@ end;
function TEnvironmentOptions.GetCompilerFilename: string; function TEnvironmentOptions.GetCompilerFilename: string;
begin begin
if (FCompilerFilenameParsedStamp=InvalidParseStamp) if (FCompilerFilenameParsedStamp=CTInvalidChangeStamp)
or (FCompilerFilenameParsedStamp<>CompilerParseStamp) or (FCompilerFilenameParsedStamp<>CompilerParseStamp)
then begin then begin
FCompilerFilenameParsed:=FCompilerFilename; FCompilerFilenameParsed:=FCompilerFilename;
@ -1837,14 +1862,14 @@ procedure TEnvironmentOptions.SetFPCSourceDirectory(const AValue: string);
begin begin
if FFPCSourceDirectory=AValue then exit; if FFPCSourceDirectory=AValue then exit;
FFPCSourceDirectory:=AppendPathDelim(TrimFilename(AValue)); FFPCSourceDirectory:=AppendPathDelim(TrimFilename(AValue));
FFPCSrcDirParsedStamp:=InvalidParseStamp; FFPCSrcDirParsedStamp:=CTInvalidChangeStamp;
end; end;
procedure TEnvironmentOptions.SetCompilerFilename(const AValue: string); procedure TEnvironmentOptions.SetCompilerFilename(const AValue: string);
begin begin
if FCompilerFilename=AValue then exit; if FCompilerFilename=AValue then exit;
FCompilerFilename:=TrimFilename(AValue); FCompilerFilename:=TrimFilename(AValue);
FCompilerFilenameParsedStamp:=InvalidParseStamp; FCompilerFilenameParsedStamp:=CTInvalidChangeStamp;
end; end;
function TEnvironmentOptions.GetDebuggerEventLogColors(AIndex: TDBGEventType): TDebuggerEventLogColor; function TEnvironmentOptions.GetDebuggerEventLogColors(AIndex: TDBGEventType): TDebuggerEventLogColor;

View File

@ -6670,7 +6670,7 @@ constructor TProjectBuildMacros.Create;
begin begin
FItems:=TStringList.Create; FItems:=TStringList.Create;
FCfgVars:=TCTCfgScriptVariables.Create; FCfgVars:=TCTCfgScriptVariables.Create;
FCfgVarsBuildMacroStamp:=InvalidParseStamp; FCfgVarsBuildMacroStamp:=CTInvalidChangeStamp;
FChangeStamp:=CTInvalidChangeStamp; FChangeStamp:=CTInvalidChangeStamp;
fOnChanged:=TMethodList.Create; fOnChanged:=TMethodList.Create;
end; end;

View File

@ -45,7 +45,8 @@ unit TransferMacros;
interface interface
uses Classes, SysUtils, LCLProc, FileUtil, LazarusIDEStrConsts, MacroIntf; uses Classes, SysUtils, LCLProc, FileUtil, FileProcs, LazarusIDEStrConsts,
MacroIntf;
type type
TTransferMacro = class; TTransferMacro = class;
@ -134,16 +135,12 @@ type
var var
GlobalMacroList: TTransferMacroList = nil; GlobalMacroList: TTransferMacroList = nil;
const
MaxParseStamp = $7fffffff;
MinParseStamp = -$7fffffff;
InvalidParseStamp = MinParseStamp-1;
type type
TCompilerParseStampIncreasedEvent = procedure of object; TCompilerParseStampIncreasedEvent = procedure of object;
var var
CompilerParseStamp: integer; // TimeStamp of base value for macros CompilerParseStamp: integer = 0; // TimeStamp of base value for macros
CompilerParseStampIncreased: TCompilerParseStampIncreasedEvent = nil; CompilerParseStampIncreased: TCompilerParseStampIncreasedEvent = nil;
BuildMacroChangeStamp: integer; // TimeStamp of base value for build macros BuildMacroChangeStamp: integer = 0; // TimeStamp of base value for build macros
procedure IncreaseCompilerParseStamp; procedure IncreaseCompilerParseStamp;
procedure IncreaseBuildMacroChangeStamp; { called when a package dependency change procedure IncreaseBuildMacroChangeStamp; { called when a package dependency change
@ -157,10 +154,7 @@ var
procedure IncreaseCompilerParseStamp; procedure IncreaseCompilerParseStamp;
begin begin
if CompilerParseStamp<MaxParseStamp then CTIncreaseChangeStamp(CompilerParseStamp);
inc(CompilerParseStamp)
else
CompilerParseStamp:=MinParseStamp;
if Assigned(CompilerParseStampIncreased) then if Assigned(CompilerParseStampIncreased) then
CompilerParseStampIncreased(); CompilerParseStampIncreased();
end; end;
@ -168,10 +162,7 @@ end;
procedure IncreaseBuildMacroChangeStamp; procedure IncreaseBuildMacroChangeStamp;
begin begin
IncreaseCompilerParseStamp; IncreaseCompilerParseStamp;
if BuildMacroChangeStamp<MaxParseStamp then CTIncreaseChangeStamp(BuildMacroChangeStamp);
inc(BuildMacroChangeStamp)
else
BuildMacroChangeStamp:=MinParseStamp;
end; end;
{ TTransferMacro } { TTransferMacro }

View File

@ -1497,7 +1497,7 @@ begin
DoDirSeparators(NewFilename); DoDirSeparators(NewFilename);
if Filename=NewFilename then exit; if Filename=NewFilename then exit;
inherited SetFilename(NewFilename); inherited SetFilename(NewFilename);
fFullFilenameStamp:=InvalidParseStamp; fFullFilenameStamp:=CTInvalidChangeStamp;
OldDirectory:=FDirectory; OldDirectory:=FDirectory;
FDirectory:=ExtractFilePath(Filename); FDirectory:=ExtractFilePath(Filename);
if OldDirectory<>FDirectory then begin if OldDirectory<>FDirectory then begin
@ -2406,7 +2406,7 @@ begin
FDirectory:=FFilename FDirectory:=FFilename
else else
FDirectory:=ExtractFilePath(FFilename); FDirectory:=ExtractFilePath(FFilename);
FDirectoryExpandedChangeStamp:=InvalidParseStamp; FDirectoryExpandedChangeStamp:=CTInvalidChangeStamp;
FHasDirectory:=(FDirectory<>'') and (FDirectory[length(FDirectory)]=PathDelim); FHasDirectory:=(FDirectory<>'') and (FDirectory[length(FDirectory)]=PathDelim);
FHasStaticDirectory:=FHasDirectory and FilenameIsAbsolute(FDirectory); FHasStaticDirectory:=FHasDirectory and FilenameIsAbsolute(FDirectory);
FUsageOptions.BaseDirectory:=FDirectory; FUsageOptions.BaseDirectory:=FDirectory;
@ -2675,7 +2675,7 @@ begin
FCompilerOptions.Clear; FCompilerOptions.Clear;
FDescription:=''; FDescription:='';
FDirectory:=''; FDirectory:='';
FDirectoryExpandedChangeStamp:=InvalidParseStamp; FDirectoryExpandedChangeStamp:=CTInvalidChangeStamp;
FEnableI18N:=false; FEnableI18N:=false;
FEnableI18NForLFM:=false; FEnableI18NForLFM:=false;
FPOOutputDirectory:=''; FPOOutputDirectory:='';