4

We're trying to untangle a hairball of 100's of units, removing some.

It would be helpful if there was tool that would show us what units were explicitly using unit X.

Penganza doesn't seem to have a report that does that. (Although it has lots of other useful reports.)

Can anyone suggest a tool or strategy for doing this, other than just hiding unit x and then hitting F9 ... repeatedly?

Lieven Keersmaekers
  • 57,207
  • 13
  • 112
  • 146
RobertFrank
  • 7,332
  • 11
  • 53
  • 99

8 Answers8

6

MMX (Model Maker Code Explorer) has a nice unit dependency analyzer (it is especially good at detecting cycles).

For more details, see this answer.

--jeroen

Community
  • 1
  • 1
Jeroen Wiert Pluimers
  • 23,965
  • 9
  • 74
  • 154
5

From a similar question here

You might want to take a look at at CnPack.
CnPack includes a Uses cleaner wizard wich hasn't failed me yet.

Community
  • 1
  • 1
Lieven Keersmaekers
  • 57,207
  • 13
  • 112
  • 146
4

GExperts can show Project Dependencies.

Ondrej Kelle
  • 36,941
  • 2
  • 65
  • 128
2

Peganza Pascal Analyzer can do the work. I haven't worked with it much, but a former dev here wrote a system that uses PAL to do the analysis, then dumped the results into a database, and then there's a browser app that lets you enter a unit name and it returns the list of units affected, whether they would need to be rebuilt if the unit changed, or if the interface changed. We use lots of BPLs so you can sometimes change a unit and you don't have to re-build other binaries that use your unit, unless the interface changed. This saves us lots of work (hundreds of BPLs and EXEs).

Chris

Francesca
  • 21,452
  • 4
  • 49
  • 90
Chris Thornton
  • 15,620
  • 5
  • 37
  • 62
  • PAL is commercial but SO WORTH IT. We love PAL here! They just release version 5.0 I am not sure why the personal stuff had to be included. Could you remove that please? – Warren P May 25 '10 at 16:04
  • @Warren P and @Chris Thornton. Agreed. Personal stuff edited out. – Francesca May 25 '10 at 16:42
  • Agreed on the personal stuff, but the point I was making is that we really don't know how it works, and don't really have code to share, if requested. – Chris Thornton May 25 '10 at 17:06
  • How does it work? It is not too intuitive to build a dependency tree for an existing Delphi project. – The Bitman Jul 28 '16 at 14:48
1

Headway Software's Structure 101g (and Restructure 101g) can do that really well, with the Delphi plugin.

Disclaimer: I wrote the flavors to analyze Delphi. I use them professionally, helping clients.

Marcio
  • 19
  • 1
1

We've just released a freeware utility that does exactly what you need plus quite a bit more. It's called the Delphi Unit Dependency Scanner (DUDs) and you can download it here: http://www.easy-ip.net/delphi-unit-dependency-scanner.html

Sorry it's a bit late!

norgepaul
  • 6,013
  • 4
  • 43
  • 76
0

A newcomer in this field is the Delphi Plugin for Sonar. It does not list unit dependencies but can find unused files and "dead" code (and more).

Implemented features:

  1. Counting lines of code, statements, number of files
  2. Counting number of classes, number of packages, methods, accessors
  3. Counting number of public API (methods, classes and fields)
  4. Counting comments ratio, comment lines (including blank lines)
  5. CPD (code duplication, how many lines, block and in how many files)
  6. Code Complexity (per method, class, file; complexity distribution over methods, classes and files)
  7. LCOM4 and RFC
  8. Code colorization
  9. Unit tests reports
  10. Assembler syntax in grammar
  11. Include statement
  12. Parsing preprocessor statements
  13. Rules
  14. Code coverage reports
  15. Source code highlight for unit tests
  16. “Dead” code recognition
  17. Unused files recognition
mjn
  • 36,362
  • 28
  • 176
  • 378
0

I was going to mention Icarus, but when I googled them I got this stack overflow answer, which you might want to check out.

Then again, sometimes I just like to delete my whole Unit Output Directory, then count my new DCU's, and that works too.

The reason you may like Icarus and not GExperts is that it doesn't rely on you to have properly maintained the uses statements in your project file.

Community
  • 1
  • 1
Peter Turner
  • 11,199
  • 10
  • 68
  • 109