Skip to content
This repository has been archived by the owner on Jun 21, 2023. It is now read-only.

Refine Apple Silicon / CocoaPods workaround #549

Merged
merged 1 commit into from
Nov 24, 2020
Merged

Conversation

1ec5
Copy link
Contributor

@1ec5 1ec5 commented Nov 17, 2020

The CocoaPods podspec now excludes 64-bit ARM architectures less aggressively with build settings that match the iOS navigation SDK. The new build setting takes into account the native architecture of the build machine, the Xcode major version, and the target environment.

I pushed a clone of this podspec to a throwaway pod to CocoaPods trunk in CocoaPods/Specs@a1b0a72. I also pushed a clone of the navigation SDK podspec that depends on this throwaway pod in CocoaPods/Specs@c641e30.

Fixes mapbox/mapbox-navigation-ios#2739.

/cc @mapbox/navigation-ios @julianrex @ZiZasaurus @frederoni

@1ec5
Copy link
Contributor Author

1ec5 commented Nov 17, 2020

This PR is a draft because I’m still verifying that the workaround has the expected behavior when integrated into a project and built in various configurations.

@knov knov requested a review from lloydsheng November 17, 2020 16:57
@1ec5
Copy link
Contributor Author

1ec5 commented Nov 17, 2020

  • Lint podspecs with Xcode 11
  • Lint podspecs with Xcode 12
  • Push test podspecs to CocoaPods trunk with Xcode 12
  • Build and run internal dogfooding application in Xcode 11
    • Debug
      • Simulators
      • Devices
    • Release
      • Simulators
      • Devices
  • Build and run internal dogfooding application in Xcode 12
    • Debug
      • Simulators
      • Devices
    • Release
      • Simulators
      • Devices
  • Build and run customer application in Xcode 12
    • Debug
      • Simulators
      • Devices
    • Release
      • Simulators
      • Devices

@zugaldia
Copy link
Member

@1ec5 could you provide an update when you have a chance? I can't take the suspense. Thanks!

@1ec5 1ec5 marked this pull request as ready for review November 24, 2020 01:28
@1ec5 1ec5 requested a review from a team November 24, 2020 01:28
@1ec5 1ec5 force-pushed the 1ec5-pod-excluded-arm64-2739 branch from c88e314 to 7f6d075 Compare November 24, 2020 01:29
@1ec5
Copy link
Contributor Author

1ec5 commented Nov 24, 2020

(Sorry for the radio silence; didn’t see the update until I force-reloaded the page. 🤐)

All the scenarios in #549 (comment) now pass with the test pod in both our internal dogfooding application and a real-world project that a customer provided. We were close, but the affected projects had a blank EXCLUDED_ARCHS explicitly defined in the application target’s build settings, overwriting any build settings specified by the podspecs via .xcconfig files. It was probably left there by an earlier podspec.

After we incorporate the changes in this PR in a new release of the map SDK, if any developer continues to see the linker error in mapbox/mapbox-navigation-ios#2739 (comment), they’ll need to manually clear that EXCLUDED_ARCHS build setting from their application target.

Copy link
Contributor

@lloydsheng lloydsheng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also tested pod lib lint on my Apple Silicon DTK, it's ok.
I dislike using s.user_target_xcconfig. It changes the user's target build setting without the user's knowledge. Is there a better solution way to do it?

@1ec5
Copy link
Contributor Author

1ec5 commented Nov 24, 2020

I dislike using s.user_target_xcconfig. It changes the user's target build setting without the user's knowledge. Is there a solutation way to do it?

Not that I know of; this is pretty much a last resort to work around CocoaPods/CocoaPods#10065 CocoaPods/CocoaPods#10104 until we fix #171. In fairness, the CocoaPods developers prefer that we avoid setting user_target_xcconfig and instead communicate to every developer that they should manually set the build setting in their application target. I’m not opposed that approach, but it runs counter to CocoaPods users’ expectations (whereas Carthage users are quite used to mucking around with project settings), and we shouldn’t regress automatic functionality we’ve already introduced.

@1ec5 1ec5 merged commit 7f6d075 into main Nov 24, 2020
@1ec5 1ec5 deleted the 1ec5-pod-excluded-arm64-2739 branch November 24, 2020 15:20
@1ec5
Copy link
Contributor Author

1ec5 commented Nov 24, 2020

I hotfixed v6.2.2 using the following commands:

git checkout ios-v6.2.2
patch -p1 -i excludearchs.patch
pod repo update
pod trunk delete Mapbox-iOS-SDK 6.2.2
make idocument OUTPUT=6.2.2 JAZZY_CUSTOM_HEAD="<script src='https://docs.mapbox.com/analytics.js'></script>"
git stash
git checkout publisher-production
git add 6.2.2
git commit -m '6.2.2 [ci skip]'
git push
git checkout -
git stash pop
pod trunk push platform/ios/Mapbox-iOS-SDK.podspec

These commands resulted in CocoaPods/Specs@bce50de deleting v6.2.2 and CocoaPods/Specs@ec2ac3f restoring v6.2.2 with the hotfix:

--------------------------------------------------------------------------------
 🎉  Congrats

 🚀  Mapbox-iOS-SDK (6.2.2) successfully published
 📅  October 19th, 12:03
 🌎  https://cocoapods.org/pods/Mapbox-iOS-SDK
 👍  Tell your friends!
--------------------------------------------------------------------------------

@1ec5
Copy link
Contributor Author

1ec5 commented Nov 25, 2020

I similarly hotfixed v6.3.0, deleting it in CocoaPods/Specs@721f34a and restoring a patched podspec in CocoaPods/Specs@64d7704:

--------------------------------------------------------------------------------
 🎉  Congrats

 🚀  Mapbox-iOS-SDK (6.3.0) successfully published
 📅  November 10th, 16:46
 🌎  https://cocoapods.org/pods/Mapbox-iOS-SDK
 👍  Tell your friends!
--------------------------------------------------------------------------------

@1ec5 1ec5 added the dependencies Pull requests that update a dependency file label Nov 25, 2020
@1ec5 1ec5 added this to the release-apfelsaft milestone Nov 25, 2020
@zugaldia
Copy link
Member

🔥 🔥 thank you @1ec5 for running with those manual hotfixes! 🔥 🔥

@1ec5
Copy link
Contributor Author

1ec5 commented Nov 25, 2020

If anyone is getting errors or warnings installing either v6.2.2 or v6.3.0 using CocoaPods, try the following commands:

rm -rf ~/Library/Caches/CocoaPods/Pods/
rm -rf ~/.cocoapods/repos/trunk/Specs/a/5/9/Mapbox-iOS-SDK/
pod repo update
pod update

/ref CocoaPods/CocoaPods#10229

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
build dependencies Pull requests that update a dependency file
Projects
None yet
3 participants