Kingfisher: Invalid cache when building with Carthage

Created on 7 Oct 2019  ·  7Comments  ·  Source: onevcat/Kingfisher

Check List

Thanks for considering to open an issue. Before you submit your issue, please confirm these boxes are checked.

Issue Description

What

I'm getting Invalid cache found for Kingfisher, rebuilding with all downstream dependencies when building Kingfisher with the --cache-builds parameter.

I tried clearing the Carthage cache (rm -rf ~/Library/Caches/org.carthage.CarthageKit) and removing all Carthage related files before installing, but the error will still up, when running the carthage bootstrap command a second time (after the cleanup).

Reproduce

Running carthage bootstrap --platform iOS --cache-builds will produce the bug every time.

Other Comment

I'm not entirely sure with which version this started happening, because we were running a rather old version of Kingfisher (4.10.1) before upgrading to 5.8.1 and now 5.8.2.

Most helpful comment

Just tested – works! Thanks again.

All 7 comments

I have the same problem, also updating from a 4.x.x version.

The problem is that 5.x.x misses the auto-generated header that is used by Carthage to check version, etc and determine if rebuild is needed.

If I look at 4.x.x framework I see Kingfisher-Swift.h and Kingfisher.h in Carthage/Build/iOS/Kingfisher.framework/Headers but for 5.x.x it only contains Kingfisher.h`, the auto generated header is missing.

I would say adding back the auto-generated header is needed for Carthage to stop endlessly rebuilding the library in our CI setups.

Good catch!

I'm not too familiar on how the headers are added. Is that something that Carthage is doing or can the headers be added in the `Kingfisher's build phase?

Is that something that Carthage is doing or can the headers be added in the `Kingfisher's build phase?

It is a project setting, I think only settings SWIFT_INSTALL_OBJC_HEADER = YES is needed

I created a fork, tried it and it looks sufficient:

~/Downloads
➜ cat Cartfile
github "igorkulman/Kingfisher" "master"

~/Downloads
➜ carthage update --platform iOS --no-use-binaries
*** Fetching Kingfisher
*** Checking out Kingfisher at "f94e7e99de25a78949be3432a080f56204b355ee"
*** xcodebuild output can be found in /var/folders/bt/ckwd2h017zd6hl4gnnfhxrv80000gn/T/carthage-xcodebuild.f4unPk.log
*** Building scheme "KingfisherSwiftUI" in Kingfisher.xcworkspace
*** Building scheme "Kingfisher" in Kingfisher.xcworkspace

~/Downloads took 2m 17s 108ms
➜ carthage bootstrap  --platform iOS --no-use-binaries --cache-builds
*** Checking out Kingfisher at "f94e7e99de25a78949be3432a080f56204b355ee"
*** xcodebuild output can be found in /var/folders/bt/ckwd2h017zd6hl4gnnfhxrv80000gn/T/carthage-xcodebuild.YzGvgN.log
*** Valid cache found for Kingfisher, skipping build

@EmDee @igorkulman

Thanks for the feedback.

Removing the header files was an intended change in Kingfisher v5.8, since the framework cannot be used in ObjC and there should be no need to generate it. However, it seems that triggering a side-effect (or say bug) of Carthage. See https://github.com/Carthage/Carthage/issues/2882

Carthage fixed it in its master branch, but it is now not clear when they could tag it and release a new version.

As a temporary workaround, I will merge #1308 later today and release a new version. I guess we can remove the ObjC header again later.

@onevcat That'd be great! It will probably take Carthage to release a version, considering their last release was in April.

Just tested – works! Thanks again.

Was this page helpful?
0 / 5 - 0 ratings