Skip to content
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

Pod does not specify a Swift version. #5

Closed
lenkaiser opened this issue Oct 28, 2019 · 11 comments
Closed

Pod does not specify a Swift version. #5

lenkaiser opened this issue Oct 28, 2019 · 11 comments

Comments

@lenkaiser
Copy link

A lot of pods give this problem that the 3rd party doesn't specify a Swift version. I get the following error:

- `RxSwift` does not specify a Swift version and none of the targets (`Dummy`) integrating it have the `SWIFT_VERSION` attribute set. Please contact the author or set the `SWIFT_VERSION` attribute in at least one of the targets that integrate this pod.

Previously I used a small script in the Podfile to solve this problem:

post_install do |installer|
    installer.pods_project.targets.each do |target|
        swift_version = SWIFT_VERSION_MAP[target.name] || DEFAULT_SWIFT_VERSION
        target.build_configurations.each do |config|
            config.build_settings['SWIFT_VERSION'] = swift_version
        end
    end
end

But I think the plugin gets the pods from the MergeFile so we cannot specify a swift version. How could I solve this without forking all pods and adding the swift version to the Podspec?

@biocross
Copy link

@lenkaiser I'm unable to reproduce this issue. RxSwift works for me. Can you please share your MergeFile?

@lenkaiser
Copy link
Author

lenkaiser commented Oct 29, 2019

I'm using RxSwift 4.4.0 and if you look in the podspec (https://github.com/CocoaPods/Specs/blob/master/Specs/2/e/c/RxSwift/4.4.0/RxSwift.podspec.json) you can see that this version doesn't include the swift_version parameter yet (5.0.1 does). However this is just one off many pods that require this setting. So if we can think about a solution that works for older dependencies that would be great.

MergeFile

group 'Obj_C'
    pod 'GCDWebServer'
    pod 'PureLayout'
end

group 'Swift'
    pod'ReachabilitySwift'
    pod'RxCocoa'
    pod'KeychainAccess'
    pod'Kingfisher'
end

@annomusa
Copy link

If you are so excited to implement it and do not have time, check this out for a quick fix.
I am trying to figure out for the long term solution

https://github.com/annomusa/cocoapods-pod-merge/pull/1/files

@lenkaiser
Copy link
Author

Maybe we can add the swift version as a parameter to the MergeFile. Another solution would be to add an dictonary with the podname and seift version to the Mergefile. Currently I’m using the latter in my Podfile. This will clean up the Podfile as well

@biocross
Copy link

@annomusa That's one way of doing it ;)

This issue is in line with something I plan to implement. We can add a flag like swift_version! in the MergeFile that can force a Swift version for the merged pod. The usage would look something like this:

group 'Swift'
    swift_version! '5.0'
    pod'ReachabilitySwift'
    pod'RxCocoa'
    pod'KeychainAccess'
    pod'Kingfisher'
end

What do you guys think?

@annomusa
Copy link

I think that is good design, putting swift version inside each group really make sense

@lenkaiser
Copy link
Author

Generally speaking this is a good solution but does this impact the optimisation potential of the plugin? If the groups need to be separated due to the swift version how much of a difference would that make in start-up time? For example: 1 group with 10 pods might be better optimised than 2 groups with 5 pods.

@biocross
Copy link

biocross commented Oct 30, 2019

The thing is, it’s anyway not possible to merge pods using different swift versions into one. The pods will fail to compile because some of them expect a different swift version.

@lenkaiser
Copy link
Author

Fair point, didn't take that into consideration this morning. It sounds like combining pods per swift version would be the perfect solution. How much time would it take to implement the feature?

@biocross
Copy link

I'll try to implement it this weekend.

@biocross
Copy link

biocross commented Nov 6, 2019

@lenkaiser, @annomusa I've just released v0.0.3 which adds a new swift_version! flag to manually override the swift version for a merge group.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants