Recent

Author Topic: [Solved] Extending IDE: How to query required packages of project?  (Read 3579 times)

Pascal

  • Hero Member
  • *****
  • Posts: 932
I am just adding features to LazProfiler (IDE-Addon) and need to know the required packages of a project. I have no clue where to start.
« Last Edit: March 06, 2019, 12:35:56 pm by Pascal »
laz trunk x64 - fpc trunk i386 (cross x64) - Windows 10 Pro x64 (21H2)

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: Extending IDE: How to query required packages of project?
« Reply #1 on: March 05, 2019, 02:05:46 pm »
There's probably a better way but in the last ditch you could always parse the project's .lpi
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

BrunoK

  • Sr. Member
  • ****
  • Posts: 452
  • Retired programmer
Re: Extending IDE: How to query required packages of project?
« Reply #2 on: March 05, 2019, 02:11:03 pm »
As lucamar says, load the project.lpi as an xml file and read the RequiredPackages list. That seems to be the only place where it is specified.

Pascal

  • Hero Member
  • *****
  • Posts: 932
Re: Extending IDE: How to query required packages of project?
« Reply #3 on: March 05, 2019, 02:32:40 pm »
There's probably a better way but in the last ditch you could always parse the project's .lpi

 I've hoped there would be something like
Code: Pascal  [Select][+][-]
  1.     property Files[Index: integer]: TLazProjectFile read GetFiles;
  2.     property FileCount: integer read GetFileCount;
for required packages  >:D
laz trunk x64 - fpc trunk i386 (cross x64) - Windows 10 Pro x64 (21H2)

Pascal

  • Hero Member
  • *****
  • Posts: 932
Re: Extending IDE: How to query required packages of project?
« Reply #4 on: March 06, 2019, 12:35:29 pm »
 :D There is another solution in unit PackageIntf:
Code: Pascal  [Select][+][-]
  1. TPackageEditingInterface = class(TComponent)
  2. ...
  3.     procedure GetRequiredPackages(AnOwner: TObject; // a TLazProject or TIDEPackage
  4.       out PkgList: TFPList; // list of TIDEPackage
  5.       Flags: TPkgIntfRequiredFlags = []) virtual; abstract;
  6. ...
laz trunk x64 - fpc trunk i386 (cross x64) - Windows 10 Pro x64 (21H2)

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: [Solved] Extending IDE: How to query required packages of project?
« Reply #5 on: March 06, 2019, 01:44:45 pm »
Hmm... You could write a tutorial on how to build IDE-addons and where to look for answers to questions like this (other than eye-grepping the sources). It would be quite useful.
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

Pascal

  • Hero Member
  • *****
  • Posts: 932
Re: [Solved] Extending IDE: How to query required packages of project?
« Reply #6 on: March 06, 2019, 04:36:21 pm »
Good idea. I'll update the wiki.
laz trunk x64 - fpc trunk i386 (cross x64) - Windows 10 Pro x64 (21H2)

Pascal

  • Hero Member
  • *****
  • Posts: 932
Re: [Solved] Extending IDE: How to query required packages of project?
« Reply #7 on: March 07, 2019, 09:29:52 am »
laz trunk x64 - fpc trunk i386 (cross x64) - Windows 10 Pro x64 (21H2)

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: [Solved] Extending IDE: How to query required packages of project?
« Reply #8 on: March 07, 2019, 10:06:27 am »
Thanks! Updated my local copy :)
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

 

TinyPortal © 2005-2018