[Lazarus] TLazPackageGraph.CheckCompileNeedDueToDependencies: perhaps compile more than now?

Reinier Olislagers reinierolislagers at gmail.com
Thu Oct 25 10:29:31 CEST 2012


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
            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:
        // 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;

Thanks,
Reinier
-------------- next part --------------
Index: packager/packagesystem.pas
===================================================================
--- packager/packagesystem.pas	(revision 39158)
+++ packager/packagesystem.pas	(working copy)
@@ -2868,14 +2868,15 @@
         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;
-            exit;
+            Note+='unable to load state file of '+RequiredPackage.IDAsString+'. Assuming compilation needed.';
+            exit(mrYes);
           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+'".'+LineEnding;
+            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;
           if StateFileAge<RequiredPackage.LastCompile[o].StateFileDate then begin


More information about the Lazarus mailing list