76
procedure TFPCSrcScan.Execute;
79
// scan fpc source directory, check for terminated
80
Files:=GatherFilesInFPCSources(Directory,nil);
81
//debugln(['TFPCSrcScan.Execute ',Files<>nil]);
82
// let main thread update the codetools fpc source cache
83
Synchronize(@OnFilesGathered);
85
on E: Exception do begin
86
debugln(['TFPCSrcScan.Execute error: ',E.Message]);
91
procedure TFPCSrcScan.OnFilesGathered;
77
procedure ApplyFPCSrcFiles(FPCSrcDir: string; var Files: TStringList);
93
79
SrcCache: TFPCSourceCache;
95
//debugln(['TFPCSrcScan.OnFilesGathered ',Directory,' FileCount=',Files.Count]);
81
debugln(['ApplyFPCSrcFiles ',FPCSrcDir,' FileCount=',Files.Count]);
96
82
// copy Files to codetools cache
97
83
if CodeToolBoss<>nil then
99
SrcCache:=CodeToolBoss.FPCDefinesCache.SourceCaches.Find(Directory,true);
85
SrcCache:=CodeToolBoss.FPCDefinesCache.SourceCaches.Find(FPCSrcDir,true);
86
debugln(['ApplyFPCSrcFiles SrcCache.Update ...']);
100
87
SrcCache.Update(Files);
102
//debugln(['TFPCSrcScan.OnFilesGathered BuildBoss.RescanCompilerDefines ...']);
89
debugln(['ApplyFPCSrcFiles BuildBoss.RescanCompilerDefines ...']);
103
90
if BuildBoss<>nil then
104
BuildBoss.RescanCompilerDefines(false,false,false);
91
BuildBoss.RescanCompilerDefines(false,false,false,true);
106
93
FreeAndNil(Files);
107
// delete item in progress window
108
//debugln(['TFPCSrcScan.OnFilesGathered closing progress item ...']);
109
FreeAndNil(ProgressItem);
111
//debugln(['TFPCSrcScan.OnFilesGathered END']);
98
procedure TFPCSrcScan.Execute;
101
Log('TFPCSrcScan.Execute START '+Directory);
102
// scan fpc source directory, check for terminated
103
Files:=GatherFilesInFPCSources(Directory,nil);
104
Log('TFPCSrcScan.Execute found some files: '+dbgs((Files<>nil) and (Files.Count>0)));
106
on E: Exception do begin
107
Log('TFPCSrcScan.Execute error: '+E.Message);
111
Files:=TStringList.Create;
112
// let main thread update the codetools fpc source cache
113
Synchronize(@OnFilesGathered);
116
procedure TFPCSrcScan.OnFilesGathered;
119
ApplyFPCSrcFiles(Directory,Files);
120
// delete item in progress window
121
debugln(['TFPCSrcScan.OnFilesGathered closing progress item ...']);
122
FreeAndNil(ProgressItem);
124
debugln(['TFPCSrcScan.OnFilesGathered END']);
127
debugln(['TFPCSrcScan.OnFilesGathered ERROR: ',E.Message]);
131
procedure TFPCSrcScan.MainThreadLog;
136
procedure TFPCSrcScan.Log(Msg: string);
139
Synchronize(@MainThreadLog);
184
212
procedure TFPCSrcScans.Scan(Directory: string);
214
{$IFDEF DisableMultiThreading}
187
218
Item: TFPCSrcScan;
189
EnterCriticalsection;
191
// check if already scanning that directory
192
for i:=0 to Count-1 do
193
if CompareFilenames(Directory,Items[i].Directory)=0 then exit;
194
// create thread and create progress window
195
Item:=TFPCSrcScan.Create(true);
196
Item.FreeOnTerminate:=true;
198
Item.Directory:=Directory;
201
LeaveCriticalsection;
203
Item.ProgressItem:=CreateProgressItem('FPCSrcScan',
204
Format(lisCreatingFileIndexOfFPCSources, [Directory]),
205
lisTheFileIndexIsNeededForFunctionsLikeFindDeclaratio);
221
{$IFDEF DisableMultiThreading}
222
// scan fpc source directory, check for terminated
223
Files:=GatherFilesInFPCSources(Directory,nil);
225
Files:=TStringList.Create;
226
ApplyFPCSrcFiles(Directory,Files);
228
EnterCriticalsection;
230
// check if already scanning that directory
231
for i:=0 to Count-1 do
232
if CompareFilenames(Directory,Items[i].Directory)=0 then exit;
233
// create thread and create progress window
234
Item:=TFPCSrcScan.Create(true);
235
Item.FreeOnTerminate:=true;
237
Item.Directory:=Directory;
240
LeaveCriticalsection;
242
Item.ProgressItem:=CreateProgressItem('FPCSrcScan',
243
Format(lisCreatingFileIndexOfFPCSources, [Directory]),
244
lisTheFileIndexIsNeededForFunctionsLikeFindDeclaratio);
245
{$IF defined(VER2_4_2) or defined(VER2_4_3)}