Jump to content
PeterPanettone

List of all uses clause items in the whole project

Recommended Posts

You may also try to use Delphi Unit Dependency Scanner. View used units in "list" tab. This program, compiled from the sources, supporting export scanned results to csv file, where the first column will be the all units. I hope you know that csv file can be open with Microsoft Excel (WPS Spreadsheets, LibreOffice Calc, etc.), where columns can be filtered, that allow you to find unique cell contents in a column (just in case, although the exported list should be, in theory, already unique)

CEC05FC1-8ACB-4671-B53E-17166F68F337.png

Edited by Dinar

Share this post


Link to post

@PeterPanettone Isn't GExperts -> Project Dependencies what you are looking for?

GEXperts-Project-Dependencies.thumb.png.4a01516f129f4a10b06b11f23377d723.pngThe only shortcoming is that it does not list the indirect dependencies for the whole project, into which I am looking right now. If it's possible to be done easily, I will add that.

  • Like 1

Share this post


Link to post
8 hours ago, dummzeuch said:

The only shortcoming is that it does not list the indirect dependencies for the whole project, into which I am looking right now. If it's possible to be done easily, I will add that.

Done. I even improved performance of the indirect list by a factor of about 5 to 10 (I didn't do any exact timing on the original code, so I don't know. But it now takes less than 2 seconds for the GExperts project where before it took more than 10.)

 

Note to self: If the performance of some code is bad, check whether it stores and accesses data in the UI all the time. Remove this access and watch the performance skyrocket.

 

Another note to self: TListView is one of the worst performing controls out there. If you want to improve performance further, use a TStringList or maybe even better a virtual string list.

  • Like 1

Share this post


Link to post
2 hours ago, dummzeuch said:

Another note to self: TListView is one of the worst performing controls out there. If you want to improve performance further, use a TStringList or maybe even better a virtual string list.

You can use TListView in a virtual mode then it is as fast as a VirtualStringTree.

 

OwnerData = True
OnData = ListView1Data

procedure TForm6.Button1Click(Sender: TObject);
begin
  ListView1.Items.Count := 100000000;
end;

procedure TForm1.ListView1Data(Sender: TObject; Item: TListItem);
begin
  Item.Caption := IntToStr(Item.Index);
end;


 

  • Thanks 3

Share this post


Link to post
9 hours ago, Attila Kovacs said:

TListView.Items.BeginUpdate / EndUpdate?

Was already used, that was the first thing I checked.

  • Like 1

Share this post


Link to post
17 hours ago, dummzeuch said:

Done.

 

Thomas, I've built #2590. But I don't see where I can display and/or export a merged list of all used units in the whole project. The list created by "Export Used Units..." is the same as before.

 

BTW, is there somewhere a possibility to see the current version/release number in the IDE, because both the old and the new show the same version number:

 

image.png.840cfdf202a3439e58f9f9bfff8aaad6.png

 

image.png.e26b4c741b0b4ca44f410bffc4dcc90a.png

 

 

Share this post


Link to post
1 hour ago, PeterPanettone said:

Thomas, I've built #2590. But I don't see where I can display and/or export a merged list of all used units in the whole project. The list created by "Export Used Units..." is the same as before.

That list already contained all used units, including those indirectly used.

 

And the list for the project (root node in the tree) contains all units of the project.

Edited by dummzeuch

Share this post


Link to post
9 minutes ago, dummzeuch said:

That list already contained all used units, including those indirectly used.

Thomas, you are right.

 

However, this is not a merged list without duplicates in the strict sense because in the following case ComCtrls is being listed twice:

 

uPDFViewer,ComCtrls

SkinDemoUtils,ComCtrls

 

So, the exported list is certainly useful. But for my purpose, I need to remove the duplicates.

Share this post


Link to post
3 hours ago, dummzeuch said:

And the list for the project (root node in the tree) contains all units of the project.

 

Thomas, what do you mean by "contains all units of the project"? When I select the root node "GExpertsRS103.dproj" on the left side then only the GX_* project units are displayed in the "Unit Uses" tab on the right side:

 

image.png.058abb431cbbefe77c17c1ec79eab1de.png

 

... and no indirectly used units are displayed in this tab.

Edited by PeterPanettone

Share this post


Link to post
3 hours ago, dummzeuch said:

... and then you switch to the "indirect dependencies" tab and ... ?

OK, I get it.

 

But then, why I don't get indirect units in the same way if I select a directly used unit node in the left tree:

 

screenshot.jpg.163d453a51f36aa680085c17e67ec6bf.jpg

 

In this case, even the "Unit Uses" tab does not show any used units in "ToolsApi".pas, although it has a uses clause:

 

image.png.057970f9ee717fe314df9ce1f6cd3e57.png

Edited by PeterPanettone

Share this post


Link to post

Not a bug.

 

ToolsApi.pas is not in the search path (only ToolsApi.dcu), so it isn't parsed. You can see that in the Unit Uses list of GX_About: There is no Location info for that unit because it cannot be found.

 

OK, that means that the list of indirect depencencies is not complete, because it does not contain units that are only in the uses list of units that are not in  the search path.

 

Hm, not sure I like that.

Share this post


Link to post
On 3/19/2019 at 9:43 AM, dummzeuch said:

Not a bug.

Still was a but. It didn't work for units in the project either.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×