packager, IDEIntf: fixed TLazPackageGraph.ChangeStamp in BeginUpdate/EndUpdate and moved ChangeStamp property to LCLIntf

git-svn-id: trunk@50384 -
This commit is contained in:
ondrej 2015-11-18 11:18:21 +00:00
parent a562122e19
commit 9b510c5bca
4 changed files with 32 additions and 10 deletions

View File

@ -347,8 +347,18 @@ type
property Items[Index: integer]: TPackageDescriptor read GetItems; default;
end;
TPackageGraphInterface = class
protected
FChangeStamp: Int64;
protected
procedure IncChangeStamp; virtual;
public
property ChangeStamp: Int64 read FChangeStamp;
end;
var
PackageDescriptors: TPackageDescriptors; // will be set by the IDE
PackageGraphInterface: TPackageGraphInterface; // must be set along with PackageSystem.PackageGraph
procedure RegisterPackageDescriptor(PkgDesc: TPackageDescriptor);
@ -393,6 +403,15 @@ begin
Result:=PackageDescriptors.FindByName(PkgDescNameStandard);
end;
{ TPackageGraphInterface }
procedure TPackageGraphInterface.IncChangeStamp;
begin
{$push}{$R-} // range check off
Inc(FChangeStamp);
{$pop}
end;
{ TPackageDescriptor }
procedure TPackageDescriptor.SetName(const AValue: string);

View File

@ -1192,6 +1192,7 @@ begin
// package graph
PackageGraph:=TLazPackageGraph.Create;
PackageGraphInterface:=PackageGraph;
PackageGraph.OnAddPackage:=@PackageGraphAddPackage;
PackageGraph.OnCheckInterPkgFiles:=@PackageGraphCheckInterPkgFiles;
PackageGraph.Verbosity:=PkgGraphVerbosity;

View File

@ -173,7 +173,7 @@ type
{ TLazPackageGraph }
TLazPackageGraph = class
TLazPackageGraph = class(TPackageGraphInterface)
private
FAbortRegistration: boolean;
fChanged: boolean;
@ -208,9 +208,9 @@ type
FLazControlsPackage: TLazPackage;
FTree: TAVLTree; // sorted tree of TLazPackage
FUpdateLock: integer;
FLockedChangeStamp: int64;
FVerbosity: TPkgVerbosityFlags;
FFindFileCache: TLazPackageGraphFileCache;
FChangeStamp: Int64;
function CreateDefaultPackage: TLazPackage;
function GetCount: Integer;
function GetPackages(Index: integer): TLazPackage;
@ -232,7 +232,7 @@ type
procedure OnExtToolBuildStopped(Sender: TObject);
procedure PkgModify(Sender: TObject);
protected
procedure IncChangeStamp;
procedure IncChangeStamp; override;
public
constructor Create;
destructor Destroy; override;
@ -446,7 +446,6 @@ type
property Packages[Index: integer]: TLazPackage read GetPackages; default; // see Count for the number
property UpdateLock: integer read FUpdateLock;
property Verbosity: TPkgVerbosityFlags read FVerbosity write FVerbosity;
property ChangeStamp: Int64 read FChangeStamp;
// base packages
property FCLPackage: TLazPackage read FFCLPackage;
@ -1109,6 +1108,7 @@ begin
inc(FUpdateLock);
if FUpdateLock=1 then begin
fChanged:=Change;
FLockedChangeStamp:=0;
if Assigned(OnBeginUpdate) then OnBeginUpdate(Self);
end else
fChanged:=fChanged or Change;
@ -1119,7 +1119,8 @@ begin
if FUpdateLock<=0 then RaiseException('TLazPackageGraph.EndUpdate');
dec(FUpdateLock);
if FUpdateLock=0 then begin
IncChangeStamp;
if FLockedChangeStamp>0 then
IncChangeStamp;
if Assigned(OnEndUpdate) then OnEndUpdate(Self,fChanged);
end;
end;
@ -5174,12 +5175,12 @@ end;
procedure TLazPackageGraph.IncChangeStamp;
begin
{$push}{$R-} // range check off
if FUpdateLock = 0 then
begin
{$push}{$R-} // range check off
Inc(FChangeStamp);
{$pop}
end;
Inc(FChangeStamp)
else
Inc(FLockedChangeStamp)
{$pop}
end;
procedure TLazPackageGraph.SortDependencyListTopologicallyOld(

View File

@ -2922,6 +2922,7 @@ begin
// package graph
PackageGraph:=TLazPackageGraph.Create;
PackageGraphInterface:=PackageGraph;
PackageGraph.OnAddPackage:=@PackageGraphAddPackage;
PackageGraph.OnBeforeCompilePackages:=@DoBeforeCompilePackages;
PackageGraph.OnBeginUpdate:=@PackageGraphBeginUpdate;