Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2012-10

TLazPackageGraph.CheckCompileNeedDueToDependencies: perhaps compile more than now?

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Reinier Olislagers

In this code in packager\packagesystem.pas, the if ResultmrOK 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 ResultmrOk 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 ResultmrOk 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 ResultmrOk 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

Reply by email

Mattias Gaertner
to Reinier Olislagers

Reinier Olislagers hat am 25. Oktober 2012 um
10:29 geschrieben:

Show quoted text 7 lines
In this code in packager\packagesystem.pas, the if ResultmrOK 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 ResultmrOk 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.

Show quoted text 20 lines
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.

Show quoted text 8 lines
// check compile state file of required package if not RequiredPackage.AutoCreated then begin Result:=LoadPackageCompiledState(RequiredPackage,false,true); if ResultmrOk then begin Note+='unable to load state file of '+RequiredPackage.IDAsString+'. Assuming compilation is needed.'; exit(mrYes); end;

Mattias

Reply by email

Reinier Olislagers
to Mattias Gaertner
Mattias Gaertner wrote 16 lines
Reinier Olislagers hat am 25. Oktober 2012 um 10:29 geschrieben: > In this code in packager\packagesystem.pas, the if ResultmrOK 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 ResultmrOk 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.

Ok, thanks, Matthias.

Reply by email