View Issue Details

IDProjectCategoryView StatusLast Update
0035837PackagesPackagespublic2019-07-12 15:36
ReporterOndrej PokornyAssigned ToMattias Gaertner 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product VersionProduct Build 
Target VersionFixed in Version 
Summary0035837: Project groups: support the new LPI file format (lists)
DescriptionIf the LPI is saved in the new format (project options -> misc -> uncheck "Maximize compatibility ...") then the project group's filenames and build modes are empty.
Additional InformationPatch attached.
TagsNo tags attached.
Fixed in Revision61577.
LazTarget-
Widgetset
Attached Files
  • projectgroup-lpi-lists-01.patch (2,167 bytes)
    Index: projectgroup.pp
    ===================================================================
    --- projectgroup.pp	(revision 61575)
    +++ projectgroup.pp	(working copy)
    @@ -1637,7 +1637,7 @@
     procedure TIDECompileTarget.LoadProject;
     var
       AProject: TLazProject;
    -  i, Cnt: Integer;
    +  i, Cnt, ALPIFileVersion: Integer;
       ProjFile: TLazProjectFile;
       PkgList: TFPList;
       Pkg: TIDEPackage;
    @@ -1644,6 +1644,7 @@
       PkgName, Path, SubPath, CurFilename, BaseDir, BuildMode: String;
       xml: TXMLConfig;
       LazBuildMode: TLazProjectBuildMode;
    +  LegacyList: Boolean;
     begin
       if FFiles<>nil then exit; // already loaded
     
    @@ -1690,11 +1691,15 @@
           if xml<>nil then begin
             // load list of files from lpi
             BaseDir:=ExtractFilePath(Filename);
    +        Path:='ProjectOptions/';
    +        ALPIFileVersion := xml.GetValue(Path+'Version/Value',0);
    +
             Path:='ProjectOptions/Units/';
    -        Cnt:=xml.GetValue(Path+'Count',0);
    -        for i:=0 to Cnt-1 do begin
    -          SubPath:=Path+'Unit'+IntToStr(i)+'/';
    -          if xml.GetValue(SubPath+'IsPartOfProject/Value','')<>'True' then
    +        LegacyList:=(ALPIFileVersion<=11) or xml.IsLegacyList(Path);
    +        Cnt:=xml.GetListItemCount(Path, 'Unit', LegacyList);
    +        for i := 0 to Cnt - 1 do begin
    +          SubPath:=Path+xml.GetListItemXPath('Unit', i, LegacyList)+'/';
    +          if not xml.GetValue(SubPath+'IsPartOfProject/Value',False) then
                 continue;
               CurFilename:=xml.GetValue(SubPath+'Filename/Value','');
               if CurFilename='' then continue;
    @@ -1715,9 +1720,10 @@
     
             // load build modes
             Path:='ProjectOptions/BuildModes/';
    -        Cnt:=xml.GetValue(Path+'Count',0);
    -        for i:=1 to Cnt do begin
    -          SubPath:=Path+'Item'+IntToStr(i)+'/';
    +        LegacyList:=(ALPIFileVersion<=11) or xml.IsLegacyList(Path);
    +        Cnt:=xml.GetListItemCount(Path, 'Item', LegacyList);
    +        for i:=0 to Cnt-1 do begin
    +          SubPath:=Path+xml.GetListItemXPath('Item', i, LegacyList, True)+'/';
               BuildMode:=xml.GetValue(SubPath+'Name','');
               // load/store compile in lpg
               if BuildMode<>'' then
    

Activities

Ondrej Pokorny

2019-07-12 13:05

reporter  

projectgroup-lpi-lists-01.patch (2,167 bytes)
Index: projectgroup.pp
===================================================================
--- projectgroup.pp	(revision 61575)
+++ projectgroup.pp	(working copy)
@@ -1637,7 +1637,7 @@
 procedure TIDECompileTarget.LoadProject;
 var
   AProject: TLazProject;
-  i, Cnt: Integer;
+  i, Cnt, ALPIFileVersion: Integer;
   ProjFile: TLazProjectFile;
   PkgList: TFPList;
   Pkg: TIDEPackage;
@@ -1644,6 +1644,7 @@
   PkgName, Path, SubPath, CurFilename, BaseDir, BuildMode: String;
   xml: TXMLConfig;
   LazBuildMode: TLazProjectBuildMode;
+  LegacyList: Boolean;
 begin
   if FFiles<>nil then exit; // already loaded
 
@@ -1690,11 +1691,15 @@
       if xml<>nil then begin
         // load list of files from lpi
         BaseDir:=ExtractFilePath(Filename);
+        Path:='ProjectOptions/';
+        ALPIFileVersion := xml.GetValue(Path+'Version/Value',0);
+
         Path:='ProjectOptions/Units/';
-        Cnt:=xml.GetValue(Path+'Count',0);
-        for i:=0 to Cnt-1 do begin
-          SubPath:=Path+'Unit'+IntToStr(i)+'/';
-          if xml.GetValue(SubPath+'IsPartOfProject/Value','')<>'True' then
+        LegacyList:=(ALPIFileVersion<=11) or xml.IsLegacyList(Path);
+        Cnt:=xml.GetListItemCount(Path, 'Unit', LegacyList);
+        for i := 0 to Cnt - 1 do begin
+          SubPath:=Path+xml.GetListItemXPath('Unit', i, LegacyList)+'/';
+          if not xml.GetValue(SubPath+'IsPartOfProject/Value',False) then
             continue;
           CurFilename:=xml.GetValue(SubPath+'Filename/Value','');
           if CurFilename='' then continue;
@@ -1715,9 +1720,10 @@
 
         // load build modes
         Path:='ProjectOptions/BuildModes/';
-        Cnt:=xml.GetValue(Path+'Count',0);
-        for i:=1 to Cnt do begin
-          SubPath:=Path+'Item'+IntToStr(i)+'/';
+        LegacyList:=(ALPIFileVersion<=11) or xml.IsLegacyList(Path);
+        Cnt:=xml.GetListItemCount(Path, 'Item', LegacyList);
+        for i:=0 to Cnt-1 do begin
+          SubPath:=Path+xml.GetListItemXPath('Item', i, LegacyList, True)+'/';
           BuildMode:=xml.GetValue(SubPath+'Name','');
           // load/store compile in lpg
           if BuildMode<>'' then

Issue History

Date Modified Username Field Change
2019-07-12 13:05 Ondrej Pokorny New Issue
2019-07-12 13:05 Ondrej Pokorny File Added: projectgroup-lpi-lists-01.patch
2019-07-12 14:11 Mattias Gaertner Assigned To => Mattias Gaertner
2019-07-12 14:11 Mattias Gaertner Status new => resolved
2019-07-12 14:11 Mattias Gaertner Resolution open => fixed
2019-07-12 14:11 Mattias Gaertner Fixed in Revision => 61577.
2019-07-12 14:11 Mattias Gaertner LazTarget => -
2019-07-12 15:36 Ondrej Pokorny Status resolved => closed