Carthage: `--cache-builds` incorrectly detects some libraries as having an invalid cache in 0.21

Created on 27 Apr 2017  Â·  13Comments  Â·  Source: Carthage/Carthage

This just recently started after I upgraded to 0.21. If I run the same carthage command multiple times in a row with --cache-builds specified, later times still try to rebuild dependencies even though they shouldn't be rebuilt. Here is the full command I'm running (building with Xcode 8.2.1):

carthage bootstrap --platform iOS --toolchain com.apple.dt.toolchain.Swift_2_3 --no-use-binaries --cache-builds --configuration Debug

In the carthage output below the libraries that are detected as invalid will always rebuild. My hunch as to the cause is that these libraries all use swift, while the ones that are treated as valid are objc-only (or at least they don't contain swift code).

  • carthage version: 0.21
  • xcodebuild -version: 8.2.1
  • Are you using --no-build? No
  • Are you using --no-use-binaries? Yes
  • Are you using --use-submodules? No
  • Are you using --cache-builds? Yes

Cartfile

github "paypal/PayPal-iOS-SDK" == 2.14.5
github "iziz/libPhoneNumber-iOS" == 0.8.13
github "johnsundell/unbox" == 1.9
github "johnsundell/wrap" == 1.1.1
github "FutureKit/FutureKit" == 2.3
github "jdg/MBProgressHUD" == 0.9.2
github "wayfair/brickkit-ios" == 1.4.0
github "facebook/Shimmer" "bfeedb7"

github "seanscal/SDWebImage" "master"
github "klopez89/PagedArray" "release4.17"
github "seanscal/card.io-iOS-source" == 5.4.2

github "akashivskyy/GoogleAnalytics-Framework"
github "ekurutepe/CLTokenInputView" "master"

github "jonreid/OCMockito" == 3.0.2
github "hamcrest/OCHamcrest" == 5.3.0
github "Quick/Quick" == 0.9.3
github "Quick/Nimble" == 4.1.0
github "seanscal/Mockingjay" "MockingjayMinusDependencies"

Carthage Output

*** Checking out brickkit-ios at "1.4.0"
*** Checking out card.io-iOS-source at "5.4.2"
*** Checking out CLTokenInputView at "bb3064786da864ae68ef2d39c891cd630ca9eb48"
*** Checking out FutureKit at "2.3.0"
*** Checking out libPhoneNumber-iOS at "0.8.13"
*** Checking out MBProgressHUD at "0.9.2"
*** Checking out Mockingjay at "82eae4094d7d2da325b714870990a4501417feac"
*** Checking out Nimble at "v4.1.0"
*** Checking out OCHamcrest at "v5.3.0"
*** Checking out OCMockito at "v3.0.2"
*** Checking out PagedArray at "7ea35bc2343049b69ecd9fceafe3541fe3f36f09"
*** Checking out PayPal-iOS-SDK at "2.14.5"
*** Checking out Quick at "v0.9.3"
*** Checking out SDWebImage at "adee1cb25e93d13a7d540123e610daf18a4a8386"
*** Checking out Shimmer at "bfeedb79a8aba946649ef48521eb4ae53d2eeb72"
*** Checking out unbox at "1.9"
*** Checking out wrap at "1.1.1"
*** Checking out xcconfigs at "0.10"
*** Checking out GoogleAnalytics-Framework at "3.17"
*** xcodebuild output can be found in /var/folders/_6/x99xj8f55_1fqyl24cqzsypw00344n/T/carthage-xcodebuild.y7Hxm3.log
*** Invalid cache found for brickkit-ios, rebuilding with all downstream dependencies
*** Valid cache found for card.io-iOS-source, skipping build
*** Valid cache found for CLTokenInputView, skipping build
*** Invalid cache found for FutureKit, rebuilding with all downstream dependencies
*** Valid cache found for libPhoneNumber-iOS, skipping build
*** Valid cache found for MBProgressHUD, skipping build
*** Invalid cache found for Mockingjay, rebuilding with all downstream dependencies
*** Invalid cache found for Nimble, rebuilding with all downstream dependencies
*** Valid cache found for OCHamcrest, skipping build
*** Valid cache found for OCMockito, skipping build
*** Invalid cache found for PagedArray, rebuilding with all downstream dependencies
*** Valid cache found for PayPal-iOS-SDK, skipping build
*** Invalid cache found for Quick, rebuilding with all downstream dependencies
*** Valid cache found for SDWebImage, skipping build
*** Valid cache found for Shimmer, skipping build
*** Invalid cache found for unbox, rebuilding with all downstream dependencies
*** Invalid cache found for wrap, rebuilding with all downstream dependencies
*** Valid cache found for xcconfigs, skipping build
*** Valid cache found for GoogleAnalytics-Framework, skipping build
*** Building scheme "BrickKit" in BrickKit.xcworkspace
*** Building scheme "FutureKit iOS" in FutureKit.xcworkspace
*** Building scheme "Mockingjay" in Mockingjay.xcodeproj
*** Building scheme "Nimble-iOS" in Nimble.xcodeproj
*** Building scheme "PagedArray-iOS" in PagedArray.xcodeproj
*** Building scheme "Quick-iOS" in Quick.xcworkspace
*** Building scheme "Unbox-iOS" in Unbox.xcodeproj
*** Building scheme "Wrap-iOS" in Wrap.xcodeproj

All 13 comments

I'd guess that we're not handling the --toolchain here wrt the cache.

Should swiftVersion take into account the --toolchain argument (if it's defined) as a way to resolve this? https://github.com/Carthage/Carthage/blob/8c38d2c5b7b492c5be88b9d625db2f68f4aec431/Source/CarthageKit/Xcode.swift#L20-L33

That's probably the solution:

$ xcrun --toolchain com.apple.dt.toolchain.Swift_2_3 swift --version                                                                     Thu Apr 27 17:24:43 2017
Apple Swift version 2.3 (swiftlang-800.10.13 clang-800.0.42.1)
Target: x86_64-apple-macosx10.9

I'm considering tackling this myself, perhaps tonight or tomorrow. Would swiftVersion in that file need to change to a function that takes a BuildOptions as a parameter?

Should swiftVersion take into account the --toolchain argument (if it's defined) as a way to resolve this?

Yup.

I'm considering tackling this myself, perhaps tonight or tomorrow. Would swiftVersion in that file need to change to a function that takes a BuildOptions as a parameter?

I wouldn't pass the whole BuildOptions. Just the toolchain argument would be enough.

I'll close this since it looks to be fixed in 0.22!

Seems that it doesn't work in 0.23.

  • carthage version: 0.23
  • xcodebuild -version: 8.3.2
  • Are you using --no-build? No
  • Are you using --no-use-binaries? No
  • Are you using --use-submodules? No
  • Are you using --cache-builds? Yes
[14:31:45]: â–¸ *** xcodebuild output can be found in /var/folders/xw/grctk2kn40lb4jx824s5b77r0000gp/T/carthage-xcodebuild.a99AJb.log
[14:31:45]: â–¸ *** Valid cache found for ios-core-contextualmanager, skipping build
[14:31:45]: â–¸ *** Valid cache found for ios-fixtures, skipping build
[14:31:46]: â–¸ *** Valid cache found for ios-fake-iadataservice, skipping build
[14:31:46]: â–¸ *** Invalid cache found for Nimble, rebuilding with all downstream dependencies
[14:31:46]: â–¸ *** Valid cache found for sdl_ios, skipping build
[14:31:47]: â–¸ *** Building scheme "Nimble-iOS" in Nimble.xcodeproj
[14:32:18]: â–¸ *** Building scheme "FordSyncProvider" in FordSyncProvider.xcodeproj

Can you share your cartfile? I use nimble at work and caching works for us with that library

cartfile

git "[email protected]:intelematics/ios-core-contextualmanager.git"
github "smartdevicelink/sdl_ios" "4.5.5"

cartfile.private

github "Quick/Nimble"
git "[email protected]:intelematics/ios-fake-iadataservice.git"

I suspect this is related to #1956. If the latest version of nimble doesn't have the expected header, Carthage can't know what to do so it rebuilds to be safe (haven't verified this myself though). All of the other swift frameworks in my cartfile cache properly.

I don't think so. It actually has Nimble-Swift.h with Swift version in there.

Nimble:

// Generated by Apple Swift version 3.1 effective-3 (swiftlang-802.0.53 clang-802.0.42)

All others:

// Generated by Apple Swift version 3.1 (swiftlang-802.0.53 clang-802.0.42)

But that should be covered by parseSwiftVersionCommand(output: String?) -> String?, shouldn't it?

@poborin I think you're hitting the same as #1983, given the 'effective-3' showing up in the version.

Should be fixed in the latest master, as we now compare to the compiler version instead of the language version. There hasn't been a release with that fix yet though.

We should have a release in a few days.

Was this page helpful?
0 / 5 - 0 ratings