mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-26 20:43:46 +02:00
MG: FPC unitlinks are now saved
git-svn-id: trunk@1605 -
This commit is contained in:
parent
2047305713
commit
a5b5b0b875
@ -270,7 +270,8 @@ type
|
||||
function CreateFPCTemplate(const PPC386Path: string;
|
||||
var UnitSearchPath: string): TDefineTemplate;
|
||||
function CreateFPCSrcTemplate(const FPCSrcDir,
|
||||
UnitSearchPath: string; var UnitLinkList: string): TDefineTemplate;
|
||||
UnitSearchPath: string;
|
||||
UnitLinkListValid: boolean; var UnitLinkList: string): TDefineTemplate;
|
||||
function CreateLazarusSrcTemplate(
|
||||
const LazarusSrcDir, WidgetType: string): TDefineTemplate;
|
||||
function CreateLCLProjectTemplate(const LazarusSrcDir, WidgetType,
|
||||
@ -2046,7 +2047,7 @@ end;
|
||||
|
||||
function TDefinePool.CreateFPCSrcTemplate(
|
||||
const FPCSrcDir, UnitSearchPath: string;
|
||||
var UnitLinkList: string): TDefineTemplate;
|
||||
UnitLinkListValid: boolean; var UnitLinkList: string): TDefineTemplate;
|
||||
var
|
||||
Dir, TargetOS, SrcOS, TargetProcessor, UnitLinks,
|
||||
IncPathMacro: string;
|
||||
@ -2159,7 +2160,6 @@ var
|
||||
'.', '..', 'CVS', 'examples', 'example', 'tests', 'fake', 'ide',
|
||||
'demo', 'docs', 'template', 'fakertl'
|
||||
);
|
||||
|
||||
var
|
||||
AFilename, Ext, UnitName, MakroFileName: string;
|
||||
FileInfo: TSearchRec;
|
||||
@ -2263,6 +2263,7 @@ var
|
||||
FileInfo: TSearchRec;
|
||||
begin
|
||||
// try every ppu file in every reachable directory (CompUnitPath)
|
||||
if UnitLinkListValid then exit;
|
||||
UnitLinkList:='';
|
||||
PathStart:=1;
|
||||
while PathStart<=length(UnitSearchPath) do begin
|
||||
@ -2290,6 +2291,7 @@ var
|
||||
end;
|
||||
PathStart:=PathEnd;
|
||||
end;
|
||||
UnitLinkListValid:=true;
|
||||
end;
|
||||
|
||||
// function TDefinePool.CreateFPCSrcTemplate(
|
||||
|
@ -781,7 +781,7 @@ begin
|
||||
if (FPCSrcDir<>'') and (FPCSrcDir<>DefaultFPCSrcDir)
|
||||
and (UnitSearchPath<>'') then
|
||||
FPCSrcTemplate:=Boss.DefinePool.CreateFPCSrcTemplate(FPCSrcDir,
|
||||
UnitSearchPath, UnitLinkList)
|
||||
UnitSearchPath, false, UnitLinkList)
|
||||
else
|
||||
FPCSrcTemplate:=nil;
|
||||
|
||||
@ -895,7 +895,7 @@ begin
|
||||
writeln(' FPCSrcDir="',FPCSrcDir,'"');
|
||||
UnitSearchPath:='';
|
||||
FPCSrcTemplate:=Boss.DefinePool.CreateFPCSrcTemplate(FPCSrcDir,
|
||||
UnitSearchPath, UnitLinks);
|
||||
UnitSearchPath, false, UnitLinks);
|
||||
if FPCSrcTemplate=nil then begin
|
||||
writeln('ERROR: unable to create FPC CVS Src defines for "',FPCSrcDir,'"');
|
||||
FPCTemplate.Free;
|
||||
|
@ -32,7 +32,14 @@ type
|
||||
FFindHistory: TStringList;
|
||||
FReplaceHistory: TStringList;
|
||||
FMaxFindHistory: Integer;
|
||||
|
||||
// FPC unitlinks
|
||||
FLastFPCUnitLinks: string;
|
||||
FLastFPCPath: string;
|
||||
FLastFPCAge: longint;
|
||||
|
||||
procedure SetFilename(const AValue: string);
|
||||
procedure SetLastFPCPath(const AValue: string);
|
||||
public
|
||||
constructor Create;
|
||||
destructor Destroy; override;
|
||||
@ -47,12 +54,20 @@ type
|
||||
procedure AddToFindHistory(const AFindStr: string);
|
||||
procedure AddToReplaceHistory(const AReplaceStr: String);
|
||||
|
||||
function LastFPCUnitLinksValid: boolean;
|
||||
function LastFPCUnitLinksNeedsUpdate: boolean;
|
||||
procedure SetLastFPCUnitLinks(const FPCPath, UnitLinks: string);
|
||||
public
|
||||
// Find- and replace-history
|
||||
property FindHistory: TStringList read FFindHistory write FFindHistory;
|
||||
property ReplaceHistory: TStringList read FReplaceHistory write FReplaceHistory;
|
||||
property MaxFindHistory: Integer read FMaxFindHistory write FMaxFindHistory;
|
||||
property Filename: string read FFilename write SetFilename;
|
||||
|
||||
// FPC unitlinks
|
||||
property LastFPCUnitLinks: string read FLastFPCUnitLinks;
|
||||
property LastFPCPath: string read FLastFPCPath write SetLastFPCPath;
|
||||
property LastFPCAge: longint read FLastFPCAge;
|
||||
end;
|
||||
|
||||
var InputHistories: TInputHistories;
|
||||
@ -72,6 +87,14 @@ begin
|
||||
FFilename:=AValue;
|
||||
end;
|
||||
|
||||
procedure TInputHistories.SetLastFPCPath(const AValue: string);
|
||||
begin
|
||||
if FLastFPCPath=AValue then exit;
|
||||
FLastFPCPath:=AValue;
|
||||
FLastFPCAge:=-1;
|
||||
FLastFPCUnitLinks:='';
|
||||
end;
|
||||
|
||||
constructor TInputHistories.Create;
|
||||
begin
|
||||
inherited Create;
|
||||
@ -95,6 +118,7 @@ procedure TInputHistories.Clear;
|
||||
begin
|
||||
FFindHistory.Clear;
|
||||
FReplaceHistory.Clear;
|
||||
FLastFPCPath:='';
|
||||
end;
|
||||
|
||||
procedure TInputHistories.LoadFromXMLConfig(XMLConfig: TXMLConfig;
|
||||
@ -104,6 +128,9 @@ begin
|
||||
fMaxFindHistory:=XMLConfig.GetValue(Path+'Find/History/Max',FMaxFindHistory);
|
||||
LoadRecentList(XMLConfig,FFindHistory,Path+'Find/History/Find/');
|
||||
LoadRecentList(XMLConfig,FReplaceHistory,Path+'Find/History/Replace/');
|
||||
FLastFPCAge:=XMLConfig.GetValue(Path+'FPCUnitLinks/FPCAge',-1);
|
||||
FLastFPCPath:=XMLConfig.GetValue(Path+'FPCUnitLinks/FPCPath','');
|
||||
FLastFPCUnitLinks:=XMLConfig.GetValue(Path+'FPCUnitLinks/UnitLinks','');
|
||||
end;
|
||||
|
||||
procedure TInputHistories.SaveToXMLConfig(XMLConfig: TXMLConfig;
|
||||
@ -113,6 +140,9 @@ begin
|
||||
XMLConfig.SetValue(Path+'Find/History/Max',FMaxFindHistory);
|
||||
SaveRecentList(XMLConfig,FFindHistory,Path+'Find/History/Find/');
|
||||
SaveRecentList(XMLConfig,FReplaceHistory,Path+'Find/History/Replace/');
|
||||
XMLConfig.SetValue(Path+'FPCUnitLinks/FPCAge',FLastFPCAge);
|
||||
XMLConfig.SetValue(Path+'FPCUnitLinks/FPCPath',FLastFPCPath);
|
||||
XMLConfig.SetValue(Path+'FPCUnitLinks/UnitLinks',FLastFPCUnitLinks);
|
||||
end;
|
||||
|
||||
procedure TInputHistories.SetLazarusDefaultFilename;
|
||||
@ -168,5 +198,23 @@ begin
|
||||
AddToRecentList(AReplaceStr,FReplaceHistory,FMaxFindHistory);
|
||||
end;
|
||||
|
||||
function TInputHistories.LastFPCUnitLinksValid: boolean;
|
||||
begin
|
||||
Result:=(LastFPCPath<>'') and (FLastFPCAge>=0);
|
||||
end;
|
||||
|
||||
function TInputHistories.LastFPCUnitLinksNeedsUpdate: boolean;
|
||||
begin
|
||||
Result:=(not LastFPCUnitLinksValid)
|
||||
or (FileAge(LastFPCPath)<>LastFPCAge);
|
||||
end;
|
||||
|
||||
procedure TInputHistories.SetLastFPCUnitLinks(const FPCPath, UnitLinks: string);
|
||||
begin
|
||||
FLastFPCPath:=FPCPath;
|
||||
FLastFPCUnitLinks:=UnitLinks;
|
||||
FLastFPCAge:=FileAge(FPCPath);
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
|
26
ide/main.pp
26
ide/main.pp
@ -2242,7 +2242,7 @@ Begin
|
||||
// create compiler macros to simulate the Makefiles of the FPC sources
|
||||
FPCSrcTemplate:=CodeToolBoss.DefinePool.CreateFPCSrcTemplate(
|
||||
CodeToolBoss.GlobalValues.Variables[ExternalMacroStart+'FPCSrcDir'],
|
||||
CompilerUnitSearchPath, CompilerUnitLinks);
|
||||
CompilerUnitSearchPath, false, CompilerUnitLinks);
|
||||
if FPCSrcTemplate<>nil then begin
|
||||
CodeToolBoss.DefineTree.RemoveRootDefineTemplateByName(
|
||||
FPCSrcTemplate.Name);
|
||||
@ -5221,6 +5221,7 @@ var CompilerUnitSearchPath, CompilerUnitLinks: string;
|
||||
ADefTempl: TDefineTemplate;
|
||||
c: integer;
|
||||
AFilename: string;
|
||||
UnitLinksChanged: boolean;
|
||||
begin
|
||||
FOpenEditorsOnCodeToolChange:=false;
|
||||
|
||||
@ -5229,6 +5230,8 @@ begin
|
||||
writeln('');
|
||||
writeln('NOTE: Compiler Filename not set! (see Environment Options)');
|
||||
end;
|
||||
InputHistories.LastFPCPath:=EnvironmentOptions.CompilerFilename;
|
||||
|
||||
if (EnvironmentOptions.LazarusDirectory='') then begin
|
||||
writeln('');
|
||||
writeln(
|
||||
@ -5259,18 +5262,30 @@ begin
|
||||
'NOTE: Could not create Define Template for Free Pascal Compiler');
|
||||
|
||||
// create compiler macros to simulate the Makefiles of the FPC sources
|
||||
CompilerUnitLinks:=InputHistories.LastFPCUnitLinks;
|
||||
UnitLinksChanged:=InputHistories.LastFPCUnitLinksNeedsUpdate;
|
||||
ADefTempl:=CreateFPCSrcTemplate(
|
||||
CodeToolBoss.GlobalValues.Variables[ExternalMacroStart+'FPCSrcDir'],
|
||||
CompilerUnitSearchPath,CompilerUnitLinks);
|
||||
CompilerUnitSearchPath,
|
||||
not UnitLinksChanged,
|
||||
CompilerUnitLinks);
|
||||
// save unitlinks
|
||||
if UnitLinksChanged
|
||||
or (InputHistories.LastFPCUnitLinks<>InputHistories.LastFPCUnitLinks)
|
||||
then begin
|
||||
InputHistories.SetLastFPCUnitLinks(EnvironmentOptions.CompilerFilename,
|
||||
CompilerUnitLinks);
|
||||
InputHistories.Save;
|
||||
end;
|
||||
AddTemplate(ADefTempl,false,
|
||||
'NOTE: Could not create Define Template for Free Pascal Sources');
|
||||
'NOTE: Could not create Define Template for Free Pascal Sources');
|
||||
|
||||
// create compiler macros for the lazarus sources
|
||||
ADefTempl:=CreateLazarusSrcTemplate(
|
||||
'$('+ExternalMacroStart+'LazarusDir)',
|
||||
'$('+ExternalMacroStart+'LCLWidgetType)');
|
||||
AddTemplate(ADefTempl,true,
|
||||
'NOTE: Could not create Define Template for Lazarus Sources');
|
||||
'NOTE: Could not create Define Template for Lazarus Sources');
|
||||
end;
|
||||
|
||||
// load include file relationships
|
||||
@ -6203,6 +6218,9 @@ end.
|
||||
|
||||
{ =============================================================================
|
||||
$Log$
|
||||
Revision 1.277 2002/04/12 16:36:07 lazarus
|
||||
MG: FPC unitlinks are now saved
|
||||
|
||||
Revision 1.276 2002/04/12 10:21:53 lazarus
|
||||
MG: added Event Assignment completion
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user