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

Hybrids SDKs need to test integration with new Cocoa version #69

Closed
6 tasks done
brustolin opened this issue Nov 16, 2022 · 16 comments
Closed
6 tasks done

Hybrids SDKs need to test integration with new Cocoa version #69

brustolin opened this issue Nov 16, 2022 · 16 comments

Comments

@brustolin
Copy link

brustolin commented Nov 16, 2022

We are close to make a new major release of our Cocoa SDK, but first we gonna launch a beta version.

This new release will introduce a paradigm shift into the project structure, and we need to make sure we don't have any issue with all the cross platform SDKs.

Here is the branch containing the new project.

For those platforms that relies on cocoapod, all you need to do to try this is add this two dependencies that points to this branch

pod 'Sentry/HybridSDK', :git => 'https://github.com/getsentry/sentry-cocoa/', :branch => 'feat/swift'
pod 'SentryPrivate', :git => 'https://github.com/getsentry/sentry-cocoa/', :branch => 'feat/swift'
@marandaneto
Copy link

What has to be tested? what is the paradigm shift? more info would be nice so we can focus our testing on what really matters.

@brustolin
Copy link
Author

We just really need to know if it compiles and run with no problem.
As mentioned, changes are related to project structure, not code.

So, if the project compiles and don't complain about something missing is good enough.

@philipphofmann
Copy link
Member

We are close to make a new major release of our Cocoa SDK

Are we bumping a major @brustolin? That would be news to me.

@brustolin
Copy link
Author

brustolin commented Nov 16, 2022

Aren't we?
We have breaking changes in there, like this one.
And we need this change or the test don't compile because some class name ambiguity.

@philipphofmann
Copy link
Member

I get that, but then we should also do getsentry/sentry-cocoa#1842 getsentry/sentry-cocoa#1100 and getsentry/sentry-cocoa#1844 for 8.0.0

@mattjohnsonpint
Copy link

For .NET (MAUI, etc.), it built for iOS but failed for Mac Catalyst with an error "code object is not signed at all".

Tool /usr/bin/codesign execution finished (exit code = 1).
          
  /Users/matt/Code/getsentry/sentry-dotnet/samples/Sentry.Samples.MacCatalyst/bin/Debug/net6.0-maccatalyst/maccatalyst-x64/Sentry.Samples.MacCatalyst.app/Contents/Frameworks/Sentry.framework: code object is not signed at all
  In subcomponent: /Users/matt/Code/getsentry/sentry-dotnet/samples/Sentry.Samples.MacCatalyst/bin/Debug/net6.0-maccatalyst/maccatalyst-x64/Sentry.Samples.MacCatalyst.app/Contents/Frameworks/Sentry.framework/Versions/Current/Frameworks/SentryPrivate.framework
Full log
matt@XHFHLG2CJP-Matt-JohnsonPint sentry-dotnet % dotnet build samples/Sentry.Samples.MacCatalyst
MSBuild version 17.4.0+18d5aef85 for .NET
  Determining projects to restore...
  Restored /Users/matt/Code/getsentry/sentry-dotnet/samples/Sentry.Samples.MacCatalyst/Sentry.Samples.MacCatalyst.csproj (in 144 ms).
  3 of 4 projects are up-to-date for restore.
  Detected signing identity:
          
    Bundle Id: io.sentry.dotnet.samples.maccatalyst
    App Id: io.sentry.dotnet.samples.maccatalyst
  Sentry Cocoa SDK 7.31.0-104-g76d6d1db (76d6d1db) was already built
  Sentry.Bindings.Cocoa -> /Users/matt/Code/getsentry/sentry-dotnet/src/Sentry.Bindings.Cocoa/bin/Debug/net6.0-maccatalyst/Sentry.Bindings.Cocoa.dll
  Sentry -> /Users/matt/Code/getsentry/sentry-dotnet/src/Sentry/bin/Debug/net6.0-maccatalyst/Sentry.dll
  Sentry.Samples.MacCatalyst -> /Users/matt/Code/getsentry/sentry-dotnet/samples/Sentry.Samples.MacCatalyst/bin/Debug/net6.0-maccatalyst/maccatalyst-x64/Sentry.Samples.MacCatalyst.dll
  Optimizing assemblies for size may change the behavior of the app. Be sure to test after publishing. See: https://aka.ms/dotnet-illink
  Optimizing assemblies for size. This process might take a while.
  Tool /usr/bin/codesign execution finished (exit code = 1).
          
  /Users/matt/Code/getsentry/sentry-dotnet/samples/Sentry.Samples.MacCatalyst/bin/Debug/net6.0-maccatalyst/maccatalyst-x64/Sentry.Samples.MacCatalyst.app/Contents/Frameworks/Sentry.framework: code object is not signed at all
  In subcomponent: /Users/matt/Code/getsentry/sentry-dotnet/samples/Sentry.Samples.MacCatalyst/bin/Debug/net6.0-maccatalyst/maccatalyst-x64/Sentry.Samples.MacCatalyst.app/Contents/Frameworks/Sentry.framework/Versions/Current/Frameworks/SentryPrivate.framework
  
/usr/local/share/dotnet/packs/Microsoft.MacCatalyst.Sdk/15.4.471/tools/msbuild/iOS/Xamarin.Shared.targets(2069,3): error : /usr/bin/codesign exited with code 1 [/Users/matt/Code/getsentry/sentry-dotnet/samples/Sentry.Samples.MacCatalyst/Sentry.Samples.MacCatalyst.csproj]
/usr/local/share/dotnet/packs/Microsoft.MacCatalyst.Sdk/15.4.471/tools/msbuild/iOS/Xamarin.Shared.targets(2069,3): error :          [/Users/matt/Code/getsentry/sentry-dotnet/samples/Sentry.Samples.MacCatalyst/Sentry.Samples.MacCatalyst.csproj]
/usr/local/share/dotnet/packs/Microsoft.MacCatalyst.Sdk/15.4.471/tools/msbuild/iOS/Xamarin.Shared.targets(2069,3): error : Failed to codesign '/Users/matt/Code/getsentry/sentry-dotnet/samples/Sentry.Samples.MacCatalyst/bin/Debug/net6.0-maccatalyst/maccatalyst-x64/Sentry.Samples.MacCatalyst.app/Contents/Frameworks/Sentry.framework': /Users/matt/Code/getsentry/sentry-dotnet/samples/Sentry.Samples.MacCatalyst/bin/Debug/net6.0-maccatalyst/maccatalyst-x64/Sentry.Samples.MacCatalyst.app/Contents/Frameworks/Sentry.framework: code object is not signed at all [/Users/matt/Code/getsentry/sentry-dotnet/samples/Sentry.Samples.MacCatalyst/Sentry.Samples.MacCatalyst.csproj]
/usr/local/share/dotnet/packs/Microsoft.MacCatalyst.Sdk/15.4.471/tools/msbuild/iOS/Xamarin.Shared.targets(2069,3): error : In subcomponent: /Users/matt/Code/getsentry/sentry-dotnet/samples/Sentry.Samples.MacCatalyst/bin/Debug/net6.0-maccatalyst/maccatalyst-x64/Sentry.Samples.MacCatalyst.app/Contents/Frameworks/Sentry.framework/Versions/Current/Frameworks/SentryPrivate.framework [/Users/matt/Code/getsentry/sentry-dotnet/samples/Sentry.Samples.MacCatalyst/Sentry.Samples.MacCatalyst.csproj]
/usr/local/share/dotnet/packs/Microsoft.MacCatalyst.Sdk/15.4.471/tools/msbuild/iOS/Xamarin.Shared.targets(2069,3): error :  [/Users/matt/Code/getsentry/sentry-dotnet/samples/Sentry.Samples.MacCatalyst/Sentry.Samples.MacCatalyst.csproj]
/usr/local/share/dotnet/packs/Microsoft.MacCatalyst.Sdk/15.4.471/tools/msbuild/iOS/Xamarin.Shared.targets(2069,3): error :          [/Users/matt/Code/getsentry/sentry-dotnet/samples/Sentry.Samples.MacCatalyst/Sentry.Samples.MacCatalyst.csproj]
  Tool /usr/bin/codesign execution finished (exit code = 1).
          
  /Users/matt/Code/getsentry/sentry-dotnet/samples/Sentry.Samples.MacCatalyst/bin/Debug/net6.0-maccatalyst/maccatalyst-x64/Sentry.Samples.MacCatalyst.app: code object is not signed at all
  In subcomponent: /Users/matt/Code/getsentry/sentry-dotnet/samples/Sentry.Samples.MacCatalyst/bin/Debug/net6.0-maccatalyst/maccatalyst-x64/Sentry.Samples.MacCatalyst.app/Contents/Frameworks/Sentry.framework
  
/usr/local/share/dotnet/packs/Microsoft.MacCatalyst.Sdk/15.4.471/tools/msbuild/iOS/Xamarin.Shared.targets(2069,3): error : /usr/bin/codesign exited with code 1 [/Users/matt/Code/getsentry/sentry-dotnet/samples/Sentry.Samples.MacCatalyst/Sentry.Samples.MacCatalyst.csproj]
/usr/local/share/dotnet/packs/Microsoft.MacCatalyst.Sdk/15.4.471/tools/msbuild/iOS/Xamarin.Shared.targets(2069,3): error :          [/Users/matt/Code/getsentry/sentry-dotnet/samples/Sentry.Samples.MacCatalyst/Sentry.Samples.MacCatalyst.csproj]
/usr/local/share/dotnet/packs/Microsoft.MacCatalyst.Sdk/15.4.471/tools/msbuild/iOS/Xamarin.Shared.targets(2069,3): error : Failed to codesign '/Users/matt/Code/getsentry/sentry-dotnet/samples/Sentry.Samples.MacCatalyst/bin/Debug/net6.0-maccatalyst/maccatalyst-x64/Sentry.Samples.MacCatalyst.app': /Users/matt/Code/getsentry/sentry-dotnet/samples/Sentry.Samples.MacCatalyst/bin/Debug/net6.0-maccatalyst/maccatalyst-x64/Sentry.Samples.MacCatalyst.app: code object is not signed at all [/Users/matt/Code/getsentry/sentry-dotnet/samples/Sentry.Samples.MacCatalyst/Sentry.Samples.MacCatalyst.csproj]
/usr/local/share/dotnet/packs/Microsoft.MacCatalyst.Sdk/15.4.471/tools/msbuild/iOS/Xamarin.Shared.targets(2069,3): error : In subcomponent: /Users/matt/Code/getsentry/sentry-dotnet/samples/Sentry.Samples.MacCatalyst/bin/Debug/net6.0-maccatalyst/maccatalyst-x64/Sentry.Samples.MacCatalyst.app/Contents/Frameworks/Sentry.framework [/Users/matt/Code/getsentry/sentry-dotnet/samples/Sentry.Samples.MacCatalyst/Sentry.Samples.MacCatalyst.csproj]
/usr/local/share/dotnet/packs/Microsoft.MacCatalyst.Sdk/15.4.471/tools/msbuild/iOS/Xamarin.Shared.targets(2069,3): error :  [/Users/matt/Code/getsentry/sentry-dotnet/samples/Sentry.Samples.MacCatalyst/Sentry.Samples.MacCatalyst.csproj]
/usr/local/share/dotnet/packs/Microsoft.MacCatalyst.Sdk/15.4.471/tools/msbuild/iOS/Xamarin.Shared.targets(2069,3): error :          [/Users/matt/Code/getsentry/sentry-dotnet/samples/Sentry.Samples.MacCatalyst/Sentry.Samples.MacCatalyst.csproj]

Build FAILED.

I see that there are now two xcframeworks being built - Sentry.xcframework and SentryPrivate.xcframework. Are we meant to include them both in the app now? (still fails when trying that)

@mattjohnsonpint
Copy link

I was able to get it to build after figuring out how to get --deep to be passed to the codesign tool.

It basically came down to adding this extra property in the final application:

<PropertyGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">
  <CodesignExtraArgs>--deep</CodesignExtraArgs>
</PropertyGroup>

The question I have now is, what changed that required --deep ? If it's a bug in Microsoft's tooling, where they should have passed it by default, then I should report it upstream.

@brustolin
Copy link
Author

@mattjohnsonpint Thanks. This is not a bug in Microsoft's tooling. Xcode does the same. Stephan already reported this error, Im trying to figure this out.

@brustolin
Copy link
Author

@mattjohnsonpint I just pushed a fix to this problem. Is working for Unity, I believe this will also work for Maui.

@lucas-zimerman
Copy link

I'll do some integrations tests on Capacitor and then give feedback here 🙂

@mattjohnsonpint
Copy link

@brustolin - That made things worse. I cannot build the xcframework with the MacCatalyst target now at all.

Recall from getsentry/sentry-cocoa#2031 that I have to use a custom build of Carthage that supports macCatalyst as a platform (from Carthage/Carthage#3235). I build with:

carthage build --use-xcframeworks --no-skip-current --platform ios,macCatalyst

Which worked fine previously, but now gives an error:

*** xcodebuild output can be found in /var/folders/1h/m0k6xr157rdfm_g8_tmtkkdm0000gn/T/carthage-xcodebuild.dsCof2.log
*** Building scheme "Sentry" in Sentry.xcworkspace
-----> Building [iOS Device, iOS Simulator]
-----> Building [macOS]
-----> Building destination: generic/platform=iOS
-----> Building destination: generic/platform=iOS Simulator
----> MERGING /var/folders/1h/m0k6xr157rdfm_g8_tmtkkdm0000gn/T/sentry-cocoa/Sentry-iPhoneOS.xcarchive
----> MERGING /var/folders/1h/m0k6xr157rdfm_g8_tmtkkdm0000gn/T/sentry-cocoa/Sentry-iPhoneSimulator.xcarchive
-----> Building destination: generic/platform=macOS,variant=Mac Catalyst
----> MERGING /var/folders/1h/m0k6xr157rdfm_g8_tmtkkdm0000gn/T/sentry-cocoa/Sentry-MacOSX-catalyst.xcarchive
*** Building scheme "SentryPrivate" in Sentry.xcworkspace
-----> Building [macOS]
-----> Building [iOS Device, iOS Simulator]
-----> Building destination: generic/platform=macOS,variant=Mac Catalyst
----> MERGING /var/folders/1h/m0k6xr157rdfm_g8_tmtkkdm0000gn/T/sentry-cocoa/SentryPrivate-MacOSX-catalyst.xcarchive
Build Failed
        Task failed with exit code 1:
        /usr/bin/xcrun dsymutil /var/folders/1h/m0k6xr157rdfm_g8_tmtkkdm0000gn/T/sentry-cocoa/SentryPrivate-MacOSX-catalyst.xcarchive/Products/Library/Frameworks/SentryPrivate.framework/SentryPrivate -o /var/folders/1h/m0k6xr157rdfm_g8_tmtkkdm0000gn/T/sentry-cocoa/SentryPrivate-MacOSX-catalyst.xcarchive/SentryPrivate-MacOSX-catalyst.dSYM

This usually indicates that project itself failed to compile. Please check the xcodebuild log for more details: /var/folders/1h/m0k6xr157rdfm_g8_tmtkkdm0000gn/T/carthage-xcodebuild.dsCof2.log

I checked the xcodebuild log file referenced, but it doesn't show any errors.

@mattjohnsonpint
Copy link

mattjohnsonpint commented Nov 17, 2022

Also I see that one of the recent changes was to set MACH_O_TYPE = staticlib. Are we switching from dynamic to static? I have concerns, because one of the workflows for MAUI devs (called "Hot Restart") is incompatible with static libraries or frameworks and I just spend a lot of time making that work.

@brustolin
Copy link
Author

brustolin commented Nov 18, 2022

@mattjohnsonpint Sorry, I forgot about this macCatalyst case.
This is what we're trying to do:
Now we have two frameworks, Sentry and SentryPrivate.
Sentry didn't change, still dynamic library, all the same settings.
SentryPrivate is a static framework to be "incorporated" into Sentry during compilation, so after compiling Sentry we don't need to worry about SentryPrivate anymore. We still have only one final binary to use.
I dont know why your compilation process is trying to find SentryPrivate dsyms files.

I just pushed an update to make Carthage ignore SentryPrivate, this should fix the problem.

@lucas-zimerman
Copy link

@brustolin the changes are workings just fine on Capacitor

@mattjohnsonpint
Copy link

Everything works with the latest changes, and your summary makes perfect sense. Thanks!

@brustolin
Copy link
Author

Thanks everybody!!

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

No branches or pull requests

5 participants