JamitLabs / Accio

A dependency manager driven by SwiftPM that works for iOS/tvOS/watchOS/macOS projects.
MIT License
664 stars 32 forks source link

Accio attempts to build the same dependency multiple times #51

Closed acecilia closed 5 years ago

acecilia commented 5 years ago

Hi,

When I set RxCocoa as a dependency (version 5.0.1) I see that Accio attempts to build RxSwift twice. From the logs:

✨  Found cached build products for RxSwift in local cache - skipping build.
✨  Found cached build products for RxRelay in local cache - skipping build.
✨  Found cached build products for RxSwift in local cache - skipping build.
✨  Found cached build products for RxCocoa in local cache - skipping build.

Seems like this is because RxCocoa depends on RxSwift and RxRelay, and RxRelay depends on RxSwift. Is this intended behaviour? Shouldn't Accio, after dependency resolution, only attempt to build the necessary dependencies once?

Thanks, Andres

fredpi commented 5 years ago

Thanks for reporting this 👍 I was able to reconstruct this, and actually, Accio doesn't detect if a framework is required by multiple frameworks. This can probably be easily fixed by using a Set here:

https://github.com/JamitLabs/Accio/blob/42a8139fde98d7b2ccd67e0b7e665bb762974ae5/Sources/AccioKit/Services/CachedBuilderService.swift#L15

Jeehut commented 5 years ago

It's correct that this is the case and I never thought this would be a problem since there's always at least a local caching in place which will skip the rendering. I just didn't go the extra mile since I didn't see much benefit in it, but you guys seem to do, so let me review #53 and merge it. Thanks, @fredpi!