Carthage / Carthage

A simple, decentralized dependency manager for Cocoa
Other
14.95k stars 1.55k forks source link

--cache-builds does not work for Xcode 9 for carthage update or build #1983

Closed kashifshaikh closed 7 years ago

kashifshaikh commented 7 years ago

Cartfile

github "realm/realm-cocoa" "tg/xcode-9"

Carthage Output

KashifsWorkMBP:iOS.EsiMobile kshaikh$ carthage update --cache-builds --platform iOS
*** Fetching realm-cocoa
*** Checking out realm-cocoa at "0cc6f7a0e008476c21ea6d8fb06d90f57f4ef0e6"
*** xcodebuild output can be found in /var/folders/q7/pr0h22nd4cdgb2f6zrx7sg_w0000gn/T/carthage-xcodebuild.HOmVdT.log
*** No cache found for realm-cocoa, building with all downstream dependencies
*** Building scheme "Realm" in Realm.xcworkspace
*** Building scheme "RealmSwift" in Realm.xcworkspace

KashifsWorkMBP:iOS.EsiMobile kshaikh$ carthage update --cache-builds --platform iOS
*** Fetching realm-cocoa
*** Checking out realm-cocoa at "0cc6f7a0e008476c21ea6d8fb06d90f57f4ef0e6"
*** xcodebuild output can be found in /var/folders/q7/pr0h22nd4cdgb2f6zrx7sg_w0000gn/T/carthage-xcodebuild.lnX9Za.log
*** Invalid cache found for realm-cocoa, rebuilding with all downstream dependencies
*** Building scheme "Realm" in Realm.xcworkspace

It will always rebuild framework - doesn't matter which package I choose.

With Xcode 8, cached builds works.

BobElDevil commented 7 years ago

It looks like it's due to the swift version detection in a framework. I saw this happen in my frameworks, and looked at the "*-swift.h" header and this was the first line: // Generated by Apple Swift version 4.0 effective-3.2 (swiftlang-900.0.43 clang-900.0.22.8)

while swift --version prints out

Apple Swift version 4.0 (swiftlang-900.0.43 clang-900.0.22.8)

the 'effective' version has to do with swift running in 'swift 3.2' mode, while still being the 4.0 toolchain. The crux of the issue is that the 4.0 toolchain is effectively 2 different swift versions so there's no accurate way to know 'current version' of swift is. We'll likely have to introspect the 'SWIFT_VERSION' build setting in addition to 'swift --version'.

If the toolchain version is 4.0, but SWIFT_VERSION is 3.*, then we should equate that to '4.0 effective-3.2', otherwise 4.0

ikesyo commented 7 years ago

3.2 frameworks are binary compatible with 4.0 frameworks since they are both built by 4.0 compiler (they can be linked each other). So we should test against Swift compiler version, not Swift language version.

mdiep commented 7 years ago

3.2 frameworks are binary compatible with 4.0 frameworks since they are both built by 4.0 compiler (they can be linked each other). So we should test against Swift compiler version, not Swift language version.

Yes. ☝️

We should be able to take whatever's inside the parentheses.