[Lazarus] TLazPackageGraph.CheckCompileNeedDueToDependencies: perhaps compile more than now?
Mattias Gaertner
nc-gaertnma at netcologne.de
Thu Oct 25 12:05:32 CEST 2012
Reinier Olislagers <reinierolislagers at gmail.com> hat am 25. Oktober 2012 um
10:29 geschrieben:
> In this code in packager\packagesystem.pas, the if Result<>mrOK test
> gives a note unable to load state file.. and the procedure exits:
>
> // check compile state file of required package
> if not RequiredPackage.AutoCreated then begin
> Result:=LoadPackageCompiledState(RequiredPackage,false,true);
> if Result<>mrOk then begin
Here: file broken, user was told that file is broken and user had a choice of
cancel or cancel all (=mrAbort).
File broken means that the pkgname.compiled file has an invalid format, syntax
error. The user or some external tool has altered the file. Maybe on purpose.
The IDE should not silently replace the file.
> Note+='unable to load state file of
> '+RequiredPackage.IDAsString;
> exit;
> end;
> Result:=mrYes;
> o:=RequiredPackage.GetOutputDirType;
> if not RequiredPackage.LastCompile[o].StateFileLoaded then begin
> DebugLn('TPkgManager.CheckCompileNeedDueToDependencies ',
> ' Missing state file for ',RequiredPackage.IDAsString,':
> ',RequiredPackage.GetStateFilename);
> Note+='Package '+RequiredPackage.IDAsString+' has no state
> file "'+RequiredPackage.GetStateFilename+'". Assuming compilation
> needed.'+LineEnding;
> exit;
> end;
>
>
> I wonder whether exiting with mrYes makes sense: if the state file
> cannot be found, assume the dependency will need to be compiled, e.g.
> something like:
If the state file is not found LoadPackageCompiledState returns mrOk.
> // check compile state file of required package
> if not RequiredPackage.AutoCreated then begin
> Result:=LoadPackageCompiledState(RequiredPackage,false,true);
> if Result<>mrOk then begin
> Note+='unable to load state file of
> '+RequiredPackage.IDAsString+'. Assuming compilation is needed.';
> exit(mrYes);
> end;
Mattias
More information about the Lazarus
mailing list