SwiftInfo icon indicating copy to clipboard operation
SwiftInfo copied to clipboard

Confused about TargetCountProvider

Open joeboyscout04 opened this issue 5 years ago • 4 comments

Hey there, thanks for the great library! I've just started using it in our project but I'm a bit confused about the TargetCountProvider. I'm not exactly sure what it's counting...it seems to be dependencies, but in my project I get the count==30, but we have many (many) more which are pulled in via Cocoapods. When looking at the Frameworks folder in our IPA bundle, we have 84 frameworks (70 when you exclude the libswift ones) included.

Our project is mixed Swift/ObjC, we have some internal frameworks which are incorporated into the main project. New build system, Xcode 11.

Can you clarify a bit what TargetCountProvider is attempting to do and why it might be generating a different number than what I would expect?

Thanks!

joeboyscout04 avatar Jun 07 '20 19:06 joeboyscout04

Hi there! It picks up the number of modules in your target, so anything where you have to do import .... I think it doesn't recognize static frameworks that are bundled inside your app (frameworks usable without the import keyword -- I forgot the proper name for them). Is this your case? I haven't considered this possibility before.

rockbruno avatar Jun 08 '20 07:06 rockbruno

@joeboyscout04 are you using static frameworks?

@rockbruno I'm also confused by your definition. Our project points out 7 dependencies, but we're easily importing over 40 dependencies (from Pods) as well as many from native libs (e.g. AVFoundation) 🤔

rogerluan avatar Jun 18 '20 00:06 rogerluan

I see. Are these pods dependencies pre-compiled? I think it only catches things that your compile since this provider works by searching for --module-name compilations

rockbruno avatar Jun 18 '20 08:06 rockbruno

They're mostly precompiled, yes! We use https://github.com/leavez/cocoapods-binary, which precompiles all pods upon installing them.

If we exclude all the precompiled ones (which probably include the native ones - right?), I think the count is correct 👍 Sounds like this opens an opportunity for a future improvement (such as counting how how many static libs and/or precompiled libs we're using). Maybe it's worth rephrasing the docs of the current Target Counter while there's no "generic" dependency counter?

rogerluan avatar Jun 18 '20 17:06 rogerluan