Recent

Author Topic: lazbuild for lpg files  (Read 1966 times)

ConfusedSushi

  • Newbie
  • Posts: 2
lazbuild for lpg files
« on: August 28, 2024, 08:15:22 pm »
Is it possible to build Lazarus Project Groups via command line? E.g.

Code: [Select]
lazbuild MyGroup.lpg

Or is there an alternative to group several project files (*.lpi) and build them altogether?

MarkMLl

  • Hero Member
  • *****
  • Posts: 7720
Re: lazbuild for lpg files
« Reply #1 on: August 29, 2024, 12:40:49 pm »
Unfortunately it is not. I think I raised that as a minor issue a few months ago in a fairly long thread that was dealing with lazbuild parameters etc., but not many of us are using the .lpg plugin (which is a pity, since it's useful).

If this is causing you major grief I suggest raising a bug report.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

ConfusedSushi

  • Newbie
  • Posts: 2
Re: lazbuild for lpg files
« Reply #2 on: August 29, 2024, 09:07:50 pm »

MarkMLl

  • Hero Member
  • *****
  • Posts: 7720
Re: lazbuild for lpg files
« Reply #3 on: August 30, 2024, 11:00:49 am »
In the interim it should be easy enough to write a few lines of $language_of_choice to parse the .lpg file, it looks as though the only things necessary are the name of the .lpi file and the build mode.

The only real issue is intelligent handling of when something goes wrong: if one of the projects fails to build should (the equivalent of) a "make distclean" be done to erase what's already been done?

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

n7800

  • Full Member
  • ***
  • Posts: 139
Re: lazbuild for lpg files
« Reply #4 on: August 30, 2024, 09:56:48 pm »
I think it's not hard to implement, but there are some "logical" difficulties. Project groups are just a package (plugin) for the IDE. And lazbuild, AFAIK, doesn't support plugins. Of course, it would still be possible to implement lpg support "natively", but that's not quite right.

And it would still entail the problem that MarkMLl mentioned - adding new command line parameters with error handling, build order, etc. lazbuild already has a lot of parameters, and it's hardly worth overloading it. IMO, I think very few users use project groups...



An alternative option is a separate utility (in the "components\projectgroups" folder) that can be built together with the package, and can even be moved to the lazarus root folder (next to lazbuild) to be accessible from the $PATH environment variable.

glazbuild, lazbuildg, lazbuildgrp, grplazbuild, lazpjgrpbuild...? I'll leave it to you to come up with a name for such a utility )) Since it will most likely be accessible from $PATH, the name should mention its affiliation with Lazarus.

This utility can be just a "wrapper" that just parses the lpg file and calls lazbuild sequentially for each project. And it can have the above parameters for processing the build order, errors, etc. I think this will be an acceptable option that will rid lazbuild of unnecessary code and parameters, and will not clutter the installation if this plugin is not installed.

MarkMLl

  • Hero Member
  • *****
  • Posts: 7720
Re: lazbuild for lpg files
« Reply #5 on: August 30, 2024, 10:19:41 pm »
The build order is defined by the order of the XML file. Apart from the partial-build error handling (which in actual fact is brushed under the carpet by the plugin) a simple external utility would be trivial: the thing that stopped me attempting it was unfamiliarity with XML programming (and lack of documentation of the relevant FCL units).

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

n7800

  • Full Member
  • ***
  • Posts: 139
Re: lazbuild for lpg files
« Reply #6 on: August 30, 2024, 10:26:25 pm »
That's right, this utility will be part of the package and will act as a command line interface. It will hide the details of the file format implementation and will work even if the format ever changes (or a new version appears). The user will not have to update their scripts.

dsiders

  • Hero Member
  • *****
  • Posts: 1250
Re: lazbuild for lpg files
« Reply #7 on: August 30, 2024, 11:07:20 pm »
..the thing that stopped me attempting it was unfamiliarity with XML programming (and lack of documentation of the relevant FCL units).

You could use the reference for Laz2_DOM; it's nearly identical except that tit uses UTF-8 strings instead of WideString.

https://lazarus-ccr.sourceforge.io/docs/lazutils/laz2_dom/index.html
Preview Lazarus 3.99 documentation at: https://dsiders.gitlab.io/lazdocsnext

MarkMLl

  • Hero Member
  • *****
  • Posts: 7720
Re: lazbuild for lpg files
« Reply #8 on: August 30, 2024, 11:27:39 pm »
You could use the reference for Laz2_DOM; it's nearly identical except that tit uses UTF-8 strings instead of WideString.

Yes, also documented under LazUtils. But having found this in the wiki

Quote
The FCL is not documented currently (October / 2005), so this short tutorial aims at introducing XML access using those units.

...TBH, my inclination would be to do a quick-and-dirty line-by-line parse of the file, and to perdition with the notation zealots.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

MarkMLl

  • Hero Member
  • *****
  • Posts: 7720
Re: lazbuild for lpg files
« Reply #9 on: September 19, 2024, 11:00:26 am »
Oooh... I've just discovered that using IDE+plugin you can nest groups of projects...

For example, multiple related small utilities in a directory with a .lpg file, and then the parent directory can contain a master .lpg referencing the others. And a full recursive build appears to work :-)

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

TRon

  • Hero Member
  • *****
  • Posts: 3295
Re: lazbuild for lpg files
« Reply #10 on: September 19, 2024, 03:38:37 pm »
Oooh... I've just discovered that using IDE+plugin you can nest groups of projects...
:D
I wondered why nobody mentioned it.

It does make building a project group a little bit more complex than simply compiling each individual project.
This tagline is powered by AI

 

TinyPortal © 2005-2018