spotify / XCRemoteCache

Other
825 stars 50 forks source link

Unknown problem after migrated to XCode14 #173

Closed canhth closed 1 year ago

canhth commented 1 year ago

My integration setup

Problem description

Questions

Environment

canhth commented 1 year ago

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

polac24 commented 1 year ago

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.

canhth commented 1 year ago

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?

polac24 commented 1 year ago

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.

canhth commented 1 year ago
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).

polac24 commented 1 year ago

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

canhth commented 1 year ago

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)

polac24 commented 1 year ago

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.
polac24 commented 1 year ago

Included in https://github.com/spotify/XCRemoteCache/releases/tag/v0.3.18