Skip to content
This repository was archived by the owner on Jul 19, 2023. It is now read-only.

Support Swift pods #1

Open
X140Yu opened this issue Aug 23, 2018 · 13 comments
Open

Support Swift pods #1

X140Yu opened this issue Aug 23, 2018 · 13 comments
Assignees

Comments

@X140Yu
Copy link

X140Yu commented Aug 23, 2018

When I pass RxSwift to the script, it failed with logs below,

=== BUILD TARGET RxSwift OF PROJECT Pods WITH CONFIGURATION Release ===

Check dependencies
The “Swift Language Version” (SWIFT_VERSION) build setting must be set to a supported value for targets which use Swift. This setting can be set in the build settings editor.

** ARCHIVE FAILED **


The following build commands failed:
	Check dependencies
(1 failure)
The pods combined add an extra size of -51492 bytes
@VinayGuthal
Copy link
Contributor

We probably need a way to pass in SWIFT_VERSION to the script so that we can use this setting while actually building. Assigning this to myself

@VinayGuthal VinayGuthal self-assigned this Aug 27, 2018
@paulb777
Copy link
Member

Hmm, that doesn't seem necessary. How does pod lib lint build the pod?

@davidair
Copy link

davidair commented Sep 4, 2018

One can probably just always set SWIFT_VERSION based on the output of "xcrun swift -version"

@pollini
Copy link

pollini commented Oct 10, 2018

great tool, really appreciating your work and effort! but - any news on this issue?

@VinayGuthal
Copy link
Contributor

Fixed by #7.. Use --mode swift to make it work for swift pods. Will update the read me

@pollini
Copy link

pollini commented Oct 12, 2018

Unfortunately, that's not working for me - in fact, the tool is not working anymore at all with the newest commit (16e022a), no matter if trying for Obj-C or Swift Pods. Anyone else experiencing this problem, or is it just on my side?

I think it can be broken down to the following issues according to the logs:

  • e.g. for AFNetworking (and other Obj-C Pods) (called with ./measure_cocoapod_size.py --cocoapods AFNetworking [--mode objc]):
...
/var/folders/k_/g8z_4fdj79n0ngb_270tcbl80000gn/T/tmpGFO4Pr/sizetestproject/Pods/Target Support Files/Pods-SizeTest/Pods-SizeTest-frameworks.sh: line 104: EXPANDED_CODE_SIGN_IDENTITY: unbound variable
Command PhaseScriptExecution failed with a nonzero exit code

...

** ARCHIVE FAILED **

The following build commands failed:
	PhaseScriptExecution [CP]\ Embed\ Pods\ Frameworks /Users/xxx/Library/Developer/Xcode/DerivedData/SizeTest-gysxpaegtdsfovbnelkxqiryttlb/Build/Intermediates.noindex/ArchiveIntermediates/SizeTest/IntermediateBuildFilesPath/SizeTest.build/Release-iphoneos/SizeTest.build/Script-721CCCD9C8C383FD44E1354F.sh
(1 failure)
The pods combined add an extra size of -51493 bytes
  • e.g. for RxSwift (and other Swift Pods) (called with ./measure_cocoapod_size.py --cocoapods RxSwift --mode swift):
...
/var/folders/k_/g8z_4fdj79n0ngb_270tcbl80000gn/T/tmpbrLTu_/SwiftApp/SwiftApp/AppDelegate.swift:23:96: error: 'UIApplicationLaunchOptionsKey' has been renamed to 'UIApplication.LaunchOptionsKey'
  func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
                                                                                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                                                               UIApplication.LaunchOptionsKey
UIKit.UIApplicationLaunchOptionsKey:2:18: note: 'UIApplicationLaunchOptionsKey' was obsoleted in Swift 4.2
public typealias UIApplicationLaunchOptionsKey = UIApplication.LaunchOptionsKey
                 ^
/var/folders/k_/g8z_4fdj79n0ngb_270tcbl80000gn/T/tmpbrLTu_/SwiftApp/SwiftApp/AppDelegate.swift:23:8: warning: instance method 'application(_:didFinishLaunchingWithOptions:)' nearly matches optional requirement 'application(_:didFinishLaunchingWithOptions:)' of protocol 'UIApplicationDelegate'
  func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
       ^
/var/folders/k_/g8z_4fdj79n0ngb_270tcbl80000gn/T/tmpbrLTu_/SwiftApp/SwiftApp/AppDelegate.swift:23:8: note: move 'application(_:didFinishLaunchingWithOptions:)' to an extension to silence this warning
  func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
       ^
/var/folders/k_/g8z_4fdj79n0ngb_270tcbl80000gn/T/tmpbrLTu_/SwiftApp/SwiftApp/AppDelegate.swift:23:8: note: make 'application(_:didFinishLaunchingWithOptions:)' private to silence this warning
  func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
       ^
  private 
UIKit.UIApplicationDelegate:7:26: note: requirement 'application(_:didFinishLaunchingWithOptions:)' declared here
    optional public func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool
                         ^

** ARCHIVE FAILED **


The following build commands failed:
	CompileSwift normal arm64
	CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler
(2 failures)
The pods combined add an extra size of 0 bytes

Any suggestions? 😬

@VinayGuthal VinayGuthal reopened this Oct 12, 2018
@VinayGuthal
Copy link
Contributor

I will have a look

@VinayGuthal
Copy link
Contributor

Hey, I am unable to reproduce your issue. Can you check the xcode version you have installed by trying xcode-select --print-path? Also which version of swift do you have?

@pollini
Copy link

pollini commented Oct 12, 2018

Xcode Version is 10.0
Swift Version is 4.2
xcode-select --print-path gives me /Applications/Xcode.app/Contents/Developer

@pollini
Copy link

pollini commented Oct 12, 2018

@VinayGuthal Looking into your code, I suppose you're not on the latest Xcode & Swift version which causes the problems?

@davidair
Copy link

davidair commented Oct 12, 2018

I tried both ObjC and Swift using Xcode 9 and Xcode 10.

For Xcode 9, both ObjC and Swift work for me.
For Xcode 10, ObjC works but not Swift.

@davidair
Copy link

@pollini : Which exact version of Xcode 10 do you have? There was a known issue with the ObjC problem you have reported: CocoaPods/CocoaPods#8089

@pollini
Copy link

pollini commented Oct 16, 2018

So eventually, I got above issues for Xcode 10 and Swift 4.2 fixed - namely by the following approaches:

  • Updating CocoaPods to a version >= 1.6.0 (at the moment of writing it's version 1.6.0.beta.1) - Thanks for pointing me in the right direction @davidair !
  • Converting respective Swift code to version 4.2 syntax and setting version 4.2 as the (default) language version in the build settings of the (Swift) project

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

No branches or pull requests

5 participants