1

I have a project that contains a number of design time packages (for installing components into the IDE). Some of these packages have quite long requires clauses and I was wondering if there is a way to remove any packages listed there that are not strictly required to build the package.

Just to make things clear, I'm concerned with the requires clause, not the contains or (non-existent) uses clause. Although these are related in that if a unit in the contains clause (or is implicitly imported) is in another package, that package (or another package that requires it) needs to be in the requires clause.

Alister
  • 6,527
  • 4
  • 46
  • 70
  • 3
    I am not sure if this is what you are after, but you can reduce the requires clause to just that entries required to actually compiler. The only way I know to achieve this is with try-and-error, i.e by removing all entries and adding them one by one until it compiles. In addition you can omit those packages that are required by packages already present in the reuires clause. F.i. requiring `vcl` removes the need to require `rtl` and requiring `designide` removes the need to require `vclimg`, `xmlrtl`, `vclactnband`, `vcl` and `rtl`. – Uwe Raabe Aug 26 '15 at 07:15
  • CNWizard (CNPack) has a function called *Uses cleaner*. Maybe it can be usefull. – Sotirca Mihaita George Aug 26 '15 at 11:52
  • 1
    @SotircaMihaitaGeorge: Removing units from a uses clause is not nearly the same task as removing packages from a requires list. – Rudy Velthuis Aug 26 '15 at 22:04
  • There is, AFAIK, no tool that can do it right now, but it should be possible to write one. It should be ble to parse the requires section, check all the packages referenced, and then check if any of the units of the "required" package are used in the package under review, and then do this recursively for all the requires of the packages used, etc. Not quite so simple, but doable, IMO. – Rudy Velthuis Aug 26 '15 at 22:57
  • Hmmm... I'm not even so sure about the recursion. If no unit of a package is used, it can (probably -- I'm not 100% sure yet -- see Uwe's comment about removing some packages from requires if vcl already references them) be removed from the requires section, period. – Rudy Velthuis Aug 26 '15 at 23:02
  • @SotircaMihaitaGeorge: The cnPack uses cleaner, while awesome, does not help me here. It looks like cleaning the requires clause is much trickier – Alister Aug 27 '15 at 00:03
  • @UweRaabe: I think you are correct about the trial-and-error bit. It is actually possible to completely remove the requires clause and the IDE will work one out for you in some instances - often very different to the one you had. And strange things ensue when you do this to multiple packages - you might need to a kind of iterative process until the requires clauses settle down. – Alister Aug 27 '15 at 00:07
  • @Alister, have yo looked at Pegasus's Pascal Analyzer ? It does this for uses clauses for units. It may do it for requires as well. – Rohit Gupta Aug 27 '15 at 23:52
  • @RohitGupta - I love Pascal Analyser, but in this, it leaves me wanting. – Alister Aug 28 '15 at 03:56

0 Answers0