spotify / XCRemoteCache

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unknown problem after migrated to XCode14

canhth opened this issue · comments

My integration setup

  • CocoaPods cocoapods-xcremotecache plugin

Problem description

  • In the past, we used Xcode 13.4.1 to build our project in CI. But after migrating to Xcode 14.0, we got a weird issue with a framework inside a Flutter package.
  • It is still okay if we use the old Xcode 13.4.1 and the MoonImCoreSwift generated by 13.4.1.
/Users/canhtran/Library/Developer/Xcode/DerivedData/MyApp-hbydakxttvkkggdnfmcfqpdwplfx/Build/Intermediates.noindex/MoonImCoreSwift.build/Dev Debug-iphonesimulator/MoonImCoreSwift.build/Objects-normal/x86_64/MoonImCoreSwift.private.swiftinterface: No such file or directory (in target 'MoonImCoreSwift' from project 'MoonImCoreSwift')

(MoonImCoreSwift is the source code compile pod)

Questions

  • Is there any potential problem that might cause this issue?
  • Or something specific we need to support for Xcode14?

Environment

  • XCRemoteCache: 0.3.17
  • cocoapods-xcremotecache: 0.0.14
  • **HTTP cache server:**docker
  • Xcode: 14.0 (14A309)

Hi @polac24,
May I ask about your thought/idea to fix this issue?
My team has disabled RemoteCache to make the CI works again.

Xcode 14 changed the way Swift's SPI is generated and produces .private.swiftinterface for Library evolution/distributable mode, next to the .swiftinterface file.
You can either disable the evolution mode in that MoonImCoreSwift (which is always recommended unless you really want to distribute that library) or try to fix XCRemoteCache. Hopefully, that change will be simple, something like here

I tried to reproduce the error in a sample project but couln;t find a way to force swift compiler relying on a .private.swiftinterface but at glance, it looks, it will just work.

Sidenote: I also included in a commit bundling abi.json. Don't know if that is required in Xcode 14 so if you have a real-world project, you can check that too.

Hi @polac24,
Yes, you're right.
The error is gone when disabling BUILD_LIBRARY_FOR_DISTRIBUTION option for MoonImCoreSwift.
But I am afraid the other team won't accept that option, there must be some reason that they enabled it for Flutter package.

I tried your branch here, generate the release package, and replace it with my real project.

'product_files_extensions_with_content_override' => ["swiftmodule", "h", "private.swiftinterface", "abiJson"]

Unfortunately, it doesn't work. Or did I miss something?

I think you don't need to add anything to product_files_extensions_with_content_override, updating the producer and consumer's XCRemoteCache library from a branch should be enough.

If that still doesn't work: make sure the zip file the producer creates for MoonImCoreSwift contains .private.swiftinterface next to the .swiftinterface.

Screen Shot 2022-11-15 at 10 33 08

Hi @polac24 , Yes, the zip producer of `MoonImCoreSwift` contains all the new options (abi.json, private.swiftinterface).

Hmmm, can you double-check that your local cache is not reusing previous artifacts on the consumer sides (e.g. nuke ~/Library/Caches/XCRemoteCache or artifact_maximum_age: 0 in .rcinfo)?

I wrote some tests and everything seems to play well with that. Created even a PR: #175. If that doesn't work, probably you have to debug it locally: https://github.com/spotify/XCRemoteCache/blob/master/docs/FAQ.md

Hi @polac24,
It works after I clear the local cache. Thanks a lot.
May I ask when we can have a New Release contains this PR?

The issue was getting the wrong fileKey.
(the producer job still running every day, maybe it always fetch the latest fileKey which does not support .private.swiftinterface yet)

once we get +1 review, I can make a new release. Probably that will be in 2-3 days.

to workaround, maybe you can:

  1. either change the directory where the new cache puts data (e.g. https://s3.aws.../cache_1 (recommended)
  2. or temporarily set artifact_maximum_age:1 and nuke your remote cache server's storage. After day-two, you can move artifact_maximum_age to the previous value.