-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding SwiftLint Using SPM Includes Extra Packages #5434
Comments
Actually, it shouldn't be surprising that Swift packages depend on other packages transitively. However, on macOS, the SwiftLint plugin depends on a compiled binary only. So the sources shouldn't be required. There seems to be a bug in Xcode/Swift Package Manager, though, so that still all dependencies are loaded and compiled. #5404 appears to fix this. Please have a try with the current |
SwiftLint can also be consumed as a library (e.g. to develop your own version with extensions). It's a normal Swift package that provides three products: the executable, the library and the plugin. To use the plugin only you must not assign the other products to any of your targets. Otherwise, they will be seen as dependencies that must be compiled for the target platform. But SwiftLint only builds on macOS (and Linux).
Xcode and SPM behave a bit surprising with respect to binary dependencies. All source dependencies are still downloaded and checked out even though they won't be used in later steps. That's why you see all the packages listed in Xcode. Yet, the build should be fast (at least on |
ok @SimplyDanny, so will this issue be resolve or I should switch to Pod, Because i am not liking it that i have not 1 or 2 but almost 8 other libraries which i am not intended to use it. |
I don't think we can do anything on the SwiftLint side. This might rather be an issue with SPM or Xcode. If you can reproduce it with a small example, you may open a ticket on their side. |
Hello @SimplyDanny, how about providing a binary only repository for the plugin? I think its a pretty common use case that swiftlint is consumed by iOS / Mac developers and they don't necessarily need to import the actual framework. |
What I asked above is for the purposes of avoiding "spilling out" internal Swiftlint dependencies so they are never resolved by the consumer. |
I've been bitten by this before - thinking that this unnecessarily downloaded source was the source for what was executing, when it was not, and I find this SPM behaviour generally quite annoying. I did try playing around a while ago with making a binary only package, but I don't think I got it to the point where it was working. Because of the limitations of SPM I think it might require a dedicated repo, which is also a pain. I think it would be less confusing for the user though. |
I would like to second the request by @filiplazov to create a separate repo for build plugin distribution. After integration SwiftLint as a build plugin in our projects, we have noticed that SPM is extremely slow when doing the initial package fetch operation. This is because it is downloading an entire git repository with all commit history, branches and tags, which is case of SwiftLint is more than 1.5 GB in size just for the main repository. There is a long-standing issue about this on SPM Github page, but it doesn't look like it's going to be resolved any time soon: apple/swift-package-manager#6062 As could be seen in the issue description, Lottie had the similar problem, and they were able to work around the SPM limitations it by switching to a separate repo for binary releases. |
Hi,
I am trying to add SwiftLint using Swift Package Manager (SPM), but I don't know why it contains extra packages with it. I tested with CocoaPods, but there it is not adding any extra packages. I also tried to install other packages using SPM, like Alamofire, but that also did not add extra packages with it. I searched the issue logs, but I don't think anyone else is experiencing this issue. Please see the screenshots for the issue display.
Swiftlint using package manager
AlamoreFire Using Package manager
The text was updated successfully, but these errors were encountered: