How to "automatically" remove unused units from uses clause?
Asked Answered
P

2

27

Does anyone know about a utility, that can automatically detect and remove unrequired units from the uses clause?

Preferably it ..

  • can be run against a unit and/or a project
  • is free and works with Delphi 2010

Thanks in advance.

Preform answered 4/2, 2010 at 14:16 Comment(3)
Hmmm. How about searching for "[delphi] unused uses" on this site? :-)Jurgen
I suppose you're right... please forgive me, this is my very first question posted on SO. However, the notion of posting a very specific question and getting a prompt, up-to-date response, from people willing to share is very compelling :) LONG LIVE DELPHI!!! (sorry I couldn't resist)Preform
No prob. I just wanted to give you a heads up. :-)Jurgen
V
30

Try using the "Uses Unit Cleaner" Wizard from CnPack you can download from here

alt text

Another option is use ICARUS.

ICARUS is a small subset of Pascal Analyzer. It parses Delphi or Borland Pascal source code and generates a list of unneeded unit references in your uses lists

Vulpecula answered 4/2, 2010 at 14:24 Comment(5)
Thanks, these both look very promising. Sidebar: It never ceases to amaze me how I've managed to miss little nuggets, like these... after using Delphi for more than a decade!Preform
The uses cleaner in cnPack is awesome, although I've found it a bit buggy when removing unused units (works great in finding them). Sometimes it removes some extra characters.Ventricose
It's also worth checking out Pascal Analyser also from Peganza, which adds a lot of functionality beyond IcarusVentricose
ICARUS is no longer listed as a product at Peganza.Mauretta
"Pascal Analyzer Lite replaces ICARUS, our free product for analysis of Delphi uses lists."Whinstone
T
9

ICARUS from Peganza does something similar.

Treble answered 4/2, 2010 at 14:31 Comment(1)
Since 2017 Icarus is replaced with Pascal Analyzer liteHelicopter

© 2022 - 2024 — McMap. All rights reserved.