mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-05-30 19:22:42 +02:00
IDE: started checking write only package output directories
git-svn-id: trunk@28902 -
This commit is contained in:
parent
599efccf86
commit
9a97f52cf6
@ -523,6 +523,14 @@ const
|
||||
pupAllAuto = [pupAsNeeded,pupOnRebuildingAll];
|
||||
|
||||
type
|
||||
TPkgLastCompileStats = record
|
||||
CompilerFilename: string;
|
||||
CompilerFileDate: integer;
|
||||
Params: string;
|
||||
Complete: boolean;
|
||||
ViaMakefile: boolean;
|
||||
end;
|
||||
|
||||
TIterateComponentClassesEvent =
|
||||
procedure(PkgComponent: TPkgComponent) of object;
|
||||
TPkgChangeNameEvent = procedure(Pkg: TLazPackage;
|
||||
@ -556,11 +564,6 @@ type
|
||||
FHoldPackageCount: integer;
|
||||
FIconFile: string;
|
||||
FInstalled: TPackageInstallType;
|
||||
FLastCompileComplete: boolean;
|
||||
FLastCompilerFileDate: integer;
|
||||
FLastCompilerFilename: string;
|
||||
FLastCompilerParams: string;
|
||||
FLastCompilerViaMakefile: boolean;
|
||||
FLastStateFileName: string;
|
||||
FLazDocPaths: string;
|
||||
FLicense: string;
|
||||
@ -733,6 +736,8 @@ type
|
||||
function ProvidesPackage(const AName: string): boolean;
|
||||
// ID
|
||||
procedure ChangeID(const NewName: string; NewVersion: TPkgVersion);
|
||||
public
|
||||
LastCompile: TPkgLastCompileStats;
|
||||
public
|
||||
property AddToProjectUsesSection: boolean read FAddToProjectUsesSection
|
||||
write SetAddToProjectUsesSection;
|
||||
@ -766,16 +771,6 @@ type
|
||||
property HoldPackageCount: integer read FHoldPackageCount;
|
||||
property IconFile: string read FIconFile write SetIconFile;
|
||||
property Installed: TPackageInstallType read FInstalled write SetInstalled;
|
||||
property LastCompilerFileDate: integer read FLastCompilerFileDate
|
||||
write FLastCompilerFileDate;
|
||||
property LastCompilerFilename: string read FLastCompilerFilename
|
||||
write FLastCompilerFilename;
|
||||
property LastCompilerParams: string read FLastCompilerParams
|
||||
write FLastCompilerParams;
|
||||
property LastCompileComplete: boolean read FLastCompileComplete
|
||||
write FLastCompileComplete;
|
||||
property LastCompilerViaMakefile: boolean read FLastCompilerViaMakefile
|
||||
write FLastCompilerViaMakefile;
|
||||
property LazDocPaths: string read FLazDocPaths write SetLazDocPaths;
|
||||
property License: string read FLicense write SetLicense;
|
||||
property LPKSource: TCodeBuffer read FLPKSource write SetLPKSource;// can be nil when file on disk was removed
|
||||
@ -3460,8 +3455,8 @@ end;
|
||||
|
||||
function TLazPackage.GetLastCompilerParams: string;
|
||||
begin
|
||||
Result:=FLastCompilerParams;
|
||||
if LastCompilerViaMakefile then begin
|
||||
Result:=LastCompile.Params;
|
||||
if LastCompile.ViaMakefile then begin
|
||||
Result:=StringReplace(Result,'%(CPU_TARGET)','$(TargetCPU)',[rfReplaceAll]);
|
||||
Result:=StringReplace(Result,'%(OS_TARGET)','$(TargetOS)',[rfReplaceAll]);
|
||||
Result:=StringReplace(Result,'%(LCL_PLATFORM)','$(LCLWidgetType)',[rfReplaceAll]);
|
||||
|
@ -2827,11 +2827,11 @@ begin
|
||||
try
|
||||
CompilerFileDate:=FileAgeCached(CompilerFilename);
|
||||
|
||||
APackage.LastCompilerFilename:=CompilerFilename;
|
||||
APackage.LastCompilerFileDate:=CompilerFileDate;
|
||||
APackage.LastCompilerParams:=CompilerParams;
|
||||
APackage.LastCompileComplete:=Complete;
|
||||
APackage.LastCompilerViaMakefile:=false;
|
||||
APackage.LastCompile.CompilerFilename:=CompilerFilename;
|
||||
APackage.LastCompile.CompilerFileDate:=CompilerFileDate;
|
||||
APackage.LastCompile.Params:=CompilerParams;
|
||||
APackage.LastCompile.Complete:=Complete;
|
||||
APackage.LastCompile.ViaMakefile:=false;
|
||||
|
||||
XMLConfig:=TXMLConfig.CreateClean(StateFile);
|
||||
try
|
||||
@ -2884,11 +2884,11 @@ begin
|
||||
try
|
||||
XMLConfig:=TXMLConfig.Create(StateFile);
|
||||
try
|
||||
APackage.LastCompilerFilename:=XMLConfig.GetValue('Compiler/Value','');
|
||||
APackage.LastCompilerFileDate:=XMLConfig.GetValue('Compiler/Date',0);
|
||||
APackage.LastCompilerParams:=XMLConfig.GetValue('Params/Value','');
|
||||
APackage.LastCompileComplete:=XMLConfig.GetValue('Complete/Value',true);
|
||||
APackage.LastCompilerViaMakefile:=XMLConfig.GetValue('Makefile/Value',false);
|
||||
APackage.LastCompile.CompilerFilename:=XMLConfig.GetValue('Compiler/Value','');
|
||||
APackage.LastCompile.CompilerFileDate:=XMLConfig.GetValue('Compiler/Date',0);
|
||||
APackage.LastCompile.Params:=XMLConfig.GetValue('Params/Value','');
|
||||
APackage.LastCompile.Complete:=XMLConfig.GetValue('Complete/Value',true);
|
||||
APackage.LastCompile.ViaMakefile:=XMLConfig.GetValue('Makefile/Value',false);
|
||||
finally
|
||||
XMLConfig.Free;
|
||||
end;
|
||||
@ -2973,6 +2973,14 @@ end;
|
||||
function TLazPackageGraph.CheckIfPackageNeedsCompilation(APackage: TLazPackage;
|
||||
const CompilerFilename, CompilerParams, SrcFilename: string;
|
||||
out NeedBuildAllFlag: boolean): TModalResult;
|
||||
{ returns: mrYes, mrNo
|
||||
|
||||
First checks normal output directory
|
||||
If that needs update and is read only, changes output directory to secondary
|
||||
and checks that.
|
||||
Checks .compiled file for compiler date and parameters and if some file is
|
||||
newer than the .compiled file.
|
||||
}
|
||||
var
|
||||
StateFilename: String;
|
||||
StateFileAge: Integer;
|
||||
@ -2995,12 +3003,12 @@ begin
|
||||
if APackage.AutoUpdate=pupManually then exit(mrNo);
|
||||
|
||||
//debugln(['TLazPackageGraph.CheckIfPackageNeedsCompilation Last="',ExtractCompilerParamsForBuildAll(APackage.LastCompilerParams),'" Now="',ExtractCompilerParamsForBuildAll(CompilerParams),'"']);
|
||||
if (APackage.LastCompilerFilename<>CompilerFilename)
|
||||
or (ExtractFPCParamsForBuildAll(APackage.LastCompilerParams)
|
||||
if (APackage.LastCompile.CompilerFilename<>CompilerFilename)
|
||||
or (ExtractFPCParamsForBuildAll(APackage.LastCompile.Params)
|
||||
<>ExtractFPCParamsForBuildAll(CompilerParams))
|
||||
or ((APackage.LastCompilerFileDate>0)
|
||||
or ((APackage.LastCompile.CompilerFileDate>0)
|
||||
and FileExistsCached(CompilerFilename)
|
||||
and (FileAgeUTF8(CompilerFilename)<>APackage.LastCompilerFileDate))
|
||||
and (FileAgeCached(CompilerFilename)<>APackage.LastCompile.CompilerFileDate))
|
||||
then
|
||||
NeedBuildAllFlag:=true;
|
||||
|
||||
@ -3047,26 +3055,26 @@ begin
|
||||
end;
|
||||
|
||||
// check compiler and params
|
||||
if (not APackage.LastCompilerViaMakefile)
|
||||
and (CompilerFilename<>APackage.LastCompilerFilename) then begin
|
||||
if (not APackage.LastCompile.ViaMakefile)
|
||||
and (CompilerFilename<>APackage.LastCompile.CompilerFilename) then begin
|
||||
DebugLn('TLazPackageGraph.CheckIfPackageNeedsCompilation Compiler filename changed for ',APackage.IDAsString);
|
||||
DebugLn(' Old="',APackage.LastCompilerFilename,'"');
|
||||
DebugLn(' Old="',APackage.LastCompile.CompilerFilename,'"');
|
||||
DebugLn(' Now="',CompilerFilename,'"');
|
||||
exit(mrYes);
|
||||
end;
|
||||
if not FileExistsUTF8(CompilerFilename) then begin
|
||||
if not FileExistsCached(CompilerFilename) then begin
|
||||
DebugLn('TLazPackageGraph.CheckIfPackageNeedsCompilation Compiler filename not found for ',APackage.IDAsString);
|
||||
DebugLn(' File="',CompilerFilename,'"');
|
||||
exit(mrYes);
|
||||
end;
|
||||
if (not APackage.LastCompilerViaMakefile)
|
||||
and (FileAgeUTF8(CompilerFilename)<>APackage.LastCompilerFileDate) then begin
|
||||
if (not APackage.LastCompile.ViaMakefile)
|
||||
and (FileAgeCached(CompilerFilename)<>APackage.LastCompile.CompilerFileDate) then begin
|
||||
DebugLn('TLazPackageGraph.CheckIfPackageNeedsCompilation Compiler file changed for ',APackage.IDAsString);
|
||||
DebugLn(' File="',CompilerFilename,'"');
|
||||
exit(mrYes);
|
||||
end;
|
||||
LastParams:=APackage.GetLastCompilerParams;
|
||||
if APackage.LastCompilerViaMakefile then begin
|
||||
if APackage.LastCompile.ViaMakefile then begin
|
||||
// the package was compiled via Makefile
|
||||
CurPaths:=nil;
|
||||
LastPaths:=nil;
|
||||
@ -3118,7 +3126,7 @@ begin
|
||||
// quick compile is possible
|
||||
NeedBuildAllFlag:=false;
|
||||
|
||||
if not APackage.LastCompileComplete
|
||||
if not APackage.LastCompile.Complete
|
||||
then begin
|
||||
DebugLn('TLazPackageGraph.CheckIfPackageNeedsCompilation Compile was incomplete for ',APackage.IDAsString);
|
||||
exit(mrYes);
|
||||
|
Loading…
Reference in New Issue
Block a user