DelphiPackageManager / DPM

A Package Manager for Delphi
Apache License 2.0
96 stars 21 forks source link

Automatically Resolve BPL Dependencies - Solving the "Remove Component declaration issue" #14

Closed glenkleidon closed 3 years ago

glenkleidon commented 3 years ago

I think that the "The field xxx does not have a corresponding component remove the declaration?" needs to be solved. I would rather see: The field xxx does not have a corresponding component. This component is in the yyy Package do you want to install it?"

or even better during the restore process the dfm component dependencies could be checked to ensure all the required BPLs are installed.

Now, easier said than done of course - we need ot know HOW to know what packages contain what components especially if there are no clues in the project source.

We could: a) in the DPM package spec document include the list of components supported (may already be there) b) search for DPKs/DCPs using the components PAS/DCU. We quite likely know (or can work out) the path to the DCU or PAS where the component is defined. In the search path, look for dpks closely associated with the unit pas/dcu (same folder, sibling- and subfolder) to work out what what DPK to build or at least work out the name for the BPL and go search for that.

Doing any of these unobtrusively is also a trick of course. I would be happy to look into this and contribute.

vincentparrett commented 3 years ago

That's definitely easier said than done. The open tools api is pretty limited in that area, so I'm not sure how you could trap that error and react to it.. since it really only occurs when the form/frame/datamodule is opened in the IDE.

As for declaring the components in the dpm package - that would make things more verbose and onerous for package authors. Ultimately it's the design time package that controls what components are registered.

glenkleidon commented 3 years ago

Yes, I don't know how to intercept it either - possibly can't. The better solution of course is to make sure it doesn't happen in the first place by checking during the restore process to ensure all the required components are available in the IDE - but that is likely to be too slow. First step is to try to get a resolution - can we work out what components are required? Initially, just have a menu item that says "Resolve missing Design time components" which could then take as long as is required to find the resolution.

vincentparrett commented 3 years ago

I'm not sure this is really a goal for the project at the moment. I would rather focus on getting packages to install as needed, and with any design time components it provides being registered. Provided a project has the dpm packages installed previously, the missing design time component issue should happen a lot less.