Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update bundled Cocoa SDK to version 7.31.1 #2053

Merged
merged 15 commits into from Nov 17, 2022
Merged

Update bundled Cocoa SDK to version 7.31.1 #2053

merged 15 commits into from Nov 17, 2022

Conversation

mattjohnsonpint
Copy link
Contributor

Updates the Sentry Cocoa SDK (for iOS/MacCatalyst targets) from 7.28.0 to 7.31.1 [diff] [changelog].

Also changes how we acquire the SDK. We now use a submodule, and build it ourselves as part of building Sentry.Bindings.Cocoa. This should make it easier to update going forward.

Copy link
Collaborator

@vaind vaind left a comment

Choose a reason for hiding this comment

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

I haven't had a proper look yet, just wondering whether it would make sense to grab what we do in Unity (and Unreal) instead:

Comment on lines +7 to +23
- name: Get Carthage SHA
shell: bash
run: echo "CARTHAGE_SHA=$(git rev-parse HEAD)" >> $GITHUB_ENV
working-directory: modules/Carthage

- name: Cache Carthage
id: cache-carthage
uses: actions/cache@v3
with:
path: modules/Carthage/.build/debug/carthage
key: carthage-${{ env.CARTHAGE_SHA }}

- name: Build Carthage
if: ${{ steps.cache-carthage.outputs.cache-hit != 'true' }}
shell: bash
run: make all
working-directory: modules/Carthage
Copy link
Collaborator

@vaind vaind Nov 17, 2022

Choose a reason for hiding this comment

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

Why do we need to build Carthage? It's available on macOS

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's a custom build so we can create xcframeworks for Mac Catalyst properly. See comments in the build-sentry-cocoa.sh script. https://github.com/getsentry/sentry-dotnet/pull/2053/files#diff-6be5d334c8d46a713f0d9a5b40af751ffc613d6e52405e4a0f72fa06c2d91ed6R6-R9

Copy link
Contributor Author

Choose a reason for hiding this comment

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

(The Carthage submodule is tracking their xcframework-catalyst branch.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Happy to kill it if you can find any other solution. I figure there must be a way to skip Carthage and just use xcodebuild, but I lack expertise in this area and couldn't figure it out.

I already looked into using either Swift SPM or CocoaPods, but the matching tooling on the Xamarin side just isn't up to par (docs talk about sharpie pod, but that is very broken and MS doesn't seem to be in a hurry to fix it).

However it is done, ultimately we need the build output to look like the following to bind correctly in .NET:

.
└── Sentry.xcframework
    ├── Info.plist
    ├── ios-arm64
    │   ├── Sentry.framework
    │   └── dSYMs
    ├── ios-arm64_x86_64-maccatalyst
    │   ├── Sentry.framework
    │   └── dSYMs
    └── ios-arm64_x86_64-simulator
        ├── Sentry.framework
        └── dSYMs

We get that by using carthage build --use-xcframeworks --no-skip-current --platform ios,macCatalyst but only when using the custom Carthage build can we ask for macCatalyst.

Only reason this matters is because .NET MAUI uses Mac Catalyst to build macOS apps.

@mattjohnsonpint
Copy link
Contributor Author

wondering whether it would make sense to grab what we do in Unity

I took a lot of inspiration from there, but I believe this will work better for this repo.

We have a few different concerns. Besides just the custom build of Carthage, we also have msbuild complexities due to multi-targeting that don't arise in the Unity SDK. Some of that you can see in this PR here: https://github.com/getsentry/sentry-dotnet/pull/2053/files#diff-71d304df430c892a78a35eb87b1dcbd39ece3e782e3900129d28c9bb559672cfR29-R35

Copy link
Member

@bruno-garcia bruno-garcia left a comment

Choose a reason for hiding this comment

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

LGTM but if Ivan has ideas to simplify both this repo + Unity somehow, that could work too.
Otherwise, this works pretty well for .NET it seems

id: cache-carthage
uses: actions/cache@v3
with:
path: modules/Carthage/.build/debug/carthage
Copy link
Member

Choose a reason for hiding this comment

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

can we go without this cache since we're caching below at Cache Sentry Cocoa SDK?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I split them into separate caches because Carthage takes a very long time to build, and it's not likely we'll need to update it as often as we do the Cocoa SDK. I also restore it every time to keep it active, otherwise GHA will prune it from the cache over time.

@mattjohnsonpint mattjohnsonpint merged commit 55c6f88 into main Nov 17, 2022
@mattjohnsonpint mattjohnsonpint deleted the cocoa-sdk branch November 17, 2022 19:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants