Sign in Join

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

Mailing lists / lazarus / 2018-03

Package and project file format

8 messages · 6 people · –

Reply by email Subscribe to this list Your subscription

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

Michael Van Canneyt

Hello,

The package .lpk andproject .lpi file use the following format :

<Units Count="241">
<Unit0>
<Filename Value="lazarus.pp"/>
<IsPartOfProject Value="True"/>
<UnitName Value="Lazarus"/>
</Unit0>
<Unit1>
<Filename Value="frames/oi_options.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="OIOptionsFrame"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Frame"/>
</Unit1>

And similarly
<RequiredPackages Count="7">
<Item1>
<PackageName Value="LazDebuggerGdbmi"/>
</Item1>
<Item2>
<PackageName Value="LCLBase"/>
<MinVersion Major="1" Release="1" Valid="True"/>
</Item2>

Is it possible to get rid of the counts ?

Reason: if 2 people add files to a package/project, it always creates conflicts when updating from the VCS.
And if you're in bad luck, you need to change a lot of items.

On the other hand, if you do
<RequiredPackages>
<Package name="LazDebuggerGdbmi"/>
<Package name="LCLBase">
<MinVersion Major="1" Release="1" Valid="True"/>
</Package>

The chance of conflicts becomes less, and the resolution easier.

Michael.

Reply by email

Michalis Kamburelis
to Michael Van Canneyt

2018-03-03 11:15 GMT+01:00 Michael Van Canneyt via Lazarus :

Show quoted text 46 lines
Hello, The package .lpk andproject .lpi file use the following format : <Units Count="241"> <Unit0> <Filename Value="lazarus.pp"/> <IsPartOfProject Value="True"/> <UnitName Value="Lazarus"/> </Unit0> <Unit1> <Filename Value="frames/oi_options.pas"/> <IsPartOfProject Value="True"/> <ComponentName Value="OIOptionsFrame"/> <HasResources Value="True"/> <ResourceBaseClass Value="Frame"/> </Unit1> And similarly <RequiredPackages Count="7"> <Item1> <PackageName Value="LazDebuggerGdbmi"/> </Item1> <Item2> <PackageName Value="LCLBase"/> <MinVersion Major="1" Release="1" Valid="True"/> </Item2> Is it possible to get rid of the counts ? Reason: if 2 people add files to a package/project, it always creates conflicts when updating from the VCS. And if you're in bad luck, you need to change a lot of items. On the other hand, if you do <RequiredPackages> <Package name="LazDebuggerGdbmi"/> <Package name="LCLBase"> <MinVersion Major="1" Release="1" Valid="True"/> </Package> The chance of conflicts becomes less, and the resolution easier.

I am guessing the Count="xxx" attribute, and the numeric suffixes to <Unit1> , <Item1> are there to read and write these files using TXMLConfig class. Using TXMLConfig exposes an easy API to work with XML files, but it limits what you can do --- all the children nodes within the same parent must have a different name, so that you can do

File1 := XmlConfig.GetValue('Units /Unit1/FileName/Value');
File2 := XmlConfig.GetValue('Units /Unit2/FileName/Value'); ....

In Castle Game Engine, we added some extensions to TXMLConfig, in particular TCastleConfig.PathElement to address exactly this. It extracts a DOM element (TDOMElement) from TXMLConfig, and then you can use full power of the DOM unit to operate on this element (iterate on children etc.):
https://github.com/castle-engine/castle-engine/blob/master/src/files/castlexmlconfig.pas#L258 . This way you can still use TXMLConfig API (GetValue / SetValue) for some tasks, but you can switch to using more powerful DOM API for other tasks.

I thought maybe this is helpful :)

Regards,
Michalis

Reply by email

Graeme Geldenhuys
to Michael Van Canneyt: The package .lpk andproject .lpi file use the following format : <Units Count="241">…
Michael Van Canneyt wrote 6 lines
Is it possible to get rid of the counts ? Reason: if 2 people add files to a package/project, it always creates conflicts when updating from the VCS. And if you're in bad luck, you need to change a lot of items.

+1
This has been a long standing annoyance for me too. XML, JSON etc don't need count properties... That's relics from INI file formats.

Regards,
Graeme

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp

Reply by email

Michael Van Canneyt
to Graeme Geldenhuys
Graeme Geldenhuys wrote 12 lines
On 2018-03-03 10:15, Michael Van Canneyt via Lazarus wrote: > > Is it possible to get rid of the counts ? > > Reason: if 2 people add files to a package/project, it always creates > conflicts when updating from the VCS. And if you're in bad luck, you > need to change a lot of items. +1 This has been a long standing annoyance for me too. XML, JSON etc don't need count properties... That's relics from INI file formats.

Well, I originally wanted to propose switching to JSON, but I thought that might be stretching the goodwill a bit too much...

Michael.

Reply by email

Lubos Pintes
to Michael Van Canneyt: The package .lpk andproject .lpi file use the following format : <Units Count="241">…

Hi,
+1 for this. And really it looks stupid to me to have a different tag for every item like Item1 or Unit1.
Dňa 03.03.2018 o 11:15 Michael Van Canneyt via Lazarus napísal(a):

Show quoted text 47 lines
Hello, The package .lpk andproject .lpi file use the following format :     <Units Count="241">       <Unit0>         <Filename Value="lazarus.pp"/>         <IsPartOfProject Value="True"/>         <UnitName Value="Lazarus"/>       </Unit0>       <Unit1>         <Filename Value="frames/oi_options.pas"/>         <IsPartOfProject Value="True"/>         <ComponentName Value="OIOptionsFrame"/>         <HasResources Value="True"/>         <ResourceBaseClass Value="Frame"/>       </Unit1> And similarly      <RequiredPackages Count="7">       <Item1>         <PackageName Value="LazDebuggerGdbmi"/>       </Item1>       <Item2>         <PackageName Value="LCLBase"/>         <MinVersion Major="1" Release="1" Valid="True"/>       </Item2> Is it possible to get rid of the counts ? Reason: if 2 people add files to a package/project, it always creates conflicts when updating from the VCS. And if you're in bad luck, you need to change a lot of items. On the other hand, if you do      <RequiredPackages>       <Package name="LazDebuggerGdbmi"/>       <Package name="LCLBase">         <MinVersion Major="1" Release="1" Valid="True"/>       </Package> The chance of conflicts becomes less, and the resolution easier. Michael.

Reply by email

Denis Kozlov
to Michael Van Canneyt: The package .lpk andproject .lpi file use the following format : <Units Count="241">…

+1 for getting rid of unit count and numeric tag suffixes from XML project/package files. They always create trouble for version control.

-1 for switching to JSON. Seems radical and unjustified, in my opinion.

Denis

Michael Van Canneyt wrote 47 lines
Hello, The package .lpk andproject .lpi file use the following format :     <Units Count="241">       <Unit0>         <Filename Value="lazarus.pp"/>         <IsPartOfProject Value="True"/>         <UnitName Value="Lazarus"/>       </Unit0>       <Unit1>         <Filename Value="frames/oi_options.pas"/>         <IsPartOfProject Value="True"/>         <ComponentName Value="OIOptionsFrame"/>         <HasResources Value="True"/>         <ResourceBaseClass Value="Frame"/>       </Unit1> And similarly      <RequiredPackages Count="7">       <Item1>         <PackageName Value="LazDebuggerGdbmi"/>       </Item1>       <Item2>         <PackageName Value="LCLBase"/>         <MinVersion Major="1" Release="1" Valid="True"/>       </Item2> Is it possible to get rid of the counts ? Reason: if 2 people add files to a package/project, it always creates conflicts when updating from the VCS. And if you're in bad luck, you need to change a lot of items. On the other hand, if you do      <RequiredPackages>       <Package name="LazDebuggerGdbmi"/>       <Package name="LCLBase">         <MinVersion Major="1" Release="1" Valid="True"/>       </Package> The chance of conflicts becomes less, and the resolution easier. Michael.

Reply by email

Michael Van Canneyt
to Denis Kozlov
Denis Kozlov wrote
+1 for getting rid of unit count and numeric tag suffixes from XML project/package files. They always create trouble for version control.

That was my point.

-1 for switching to JSON. Seems radical and unjustified, in my opinion.

Radical ? Absolutely. Unjustified ? A matter of opinion... JSON has many advantages over XML.

Note that I didn't ask for that, it was just a remark on comments by someone else...

If the counts are removed, my immediate goal (less conflicts) is reached.

Michael.

Reply by email