Tool that shows unit dependencies for Delphi 2010

2019-01-19 22:30发布

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?

8条回答
叛逆
2楼-- · 2019-01-19 23:11

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

查看更多
▲ chillily
3楼-- · 2019-01-19 23:19

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
查看更多
Ridiculous、
4楼-- · 2019-01-19 23:21

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.

查看更多
贪生不怕死
5楼-- · 2019-01-19 23:23

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!

查看更多
我只想做你的唯一
6楼-- · 2019-01-19 23:25

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.

查看更多
Explosion°爆炸
7楼-- · 2019-01-19 23:26
登录 后发表回答