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.28.0 #1988

Merged
merged 7 commits into from
Oct 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Unreleased

- Update bundled Android SDK to version 6.5.0 ([#1984](https://github.com/getsentry/sentry-dotnet/pull/1984))
- Update bundled Cocoa SDK to version 7.28.0 ([#1988](https://github.com/getsentry/sentry-dotnet/pull/1988))

## Fixes

Expand Down
Binary file removed lib/Sentry.xcframework.7.24.1.custombuild.zip
Binary file not shown.
Binary file added lib/Sentry.xcframework.7.28.0.custombuild.zip
Binary file not shown.
209 changes: 208 additions & 1 deletion src/Sentry.Bindings.Cocoa/ApiDefinition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using Foundation;
using ObjCRuntime;

namespace SentryCocoa;
namespace Sentry.CocoaSdk;

[Static]
[Internal]
Expand Down Expand Up @@ -94,6 +94,21 @@ interface PrivateSentrySdkOnly
[Export ("setSdkName:andVersionString:")]
void SetSdkName (string sdkName, string versionString);

// +(void)setSdkName:(NSString * _Nonnull)sdkName;
[Static]
[Export ("setSdkName:")]
void SetSdkName (string sdkName);

// +(NSString * _Nonnull)getSdkName;
[Static]
[Export ("getSdkName")]
string SdkName { get; }

// +(NSString * _Nonnull)getSdkVersionString;
[Static]
[Export ("getSdkVersionString")]
string SdkVersionString { get; }

// @property (copy, nonatomic, class) SentryOnAppStartMeasurementAvailable _Nullable onAppStartMeasurementAvailable;
[Static]
[NullAllowed, Export ("onAppStartMeasurementAvailable", ArgumentSemantic.Copy)]
Expand Down Expand Up @@ -337,6 +352,10 @@ interface SentryClient
// -(void)captureEnvelope:(SentryEnvelope * _Nonnull)envelope __attribute__((swift_name("capture(envelope:)")));
[Export ("captureEnvelope:")]
void CaptureEnvelope (SentryEnvelope envelope);

// -(void)flush:(NSTimeInterval)timeout __attribute__((swift_name("flush(timeout:)")));
[Export ("flush:")]
void Flush (double timeout);
}

// @interface SentryCrashExceptionApplication : NSObject
Expand Down Expand Up @@ -993,6 +1012,10 @@ interface SentryOptions
// @property (assign, nonatomic) BOOL enableAutoBreadcrumbTracking;
[Export ("enableAutoBreadcrumbTracking")]
bool EnableAutoBreadcrumbTracking { get; set; }

// @property (retain, nonatomic) NSArray * _Nonnull tracePropagationTargets;
[Export ("tracePropagationTargets", ArgumentSemantic.Retain)]
NSObject[] TracePropagationTargets { get; set; }
}

// @protocol SentryIntegrationProtocol <NSObject>
Expand Down Expand Up @@ -1146,6 +1169,16 @@ interface SentrySpan : SentrySerializable
[Export ("removeTagForKey:")]
void RemoveTagForKey (string key);

// @required -(void)setMeasurement:(NSString * _Nonnull)name value:(NSNumber * _Nonnull)value __attribute__((swift_name("setMeasurement(name:value:)")));
[Abstract]
[Export ("setMeasurement:value:")]
void SetMeasurement (string name, NSNumber value);

// @required -(void)setMeasurement:(NSString * _Nonnull)name value:(NSNumber * _Nonnull)value unit:(SentryMeasurementUnit * _Nonnull)unit __attribute__((swift_name("setMeasurement(name:value:unit:)")));
[Abstract]
[Export ("setMeasurement:value:unit:")]
void SetMeasurement (string name, NSNumber value, SentryMeasurementUnit unit);

// @required -(void)finish;
[Abstract]
[Export ("finish")]
Expand Down Expand Up @@ -1283,6 +1316,10 @@ interface SentryHub
// -(void)captureEnvelope:(SentryEnvelope * _Nonnull)envelope __attribute__((swift_name("capture(envelope:)")));
[Export ("captureEnvelope:")]
void CaptureEnvelope (SentryEnvelope envelope);

// -(void)flush:(NSTimeInterval)timeout __attribute__((swift_name("flush(timeout:)")));
[Export ("flush:")]
void Flush (double timeout);
}

// @interface SentryId : NSObject
Expand All @@ -1308,6 +1345,167 @@ interface SentryId
SentryId Empty { get; }
}

// @interface SentryMeasurementUnit : NSObject <NSCopying>
[BaseType (typeof(NSObject))]
[DisableDefaultCtor]
[Internal]
interface SentryMeasurementUnit // : INSCopying
{
// -(instancetype _Nonnull)initWithUnit:(NSString * _Nonnull)unit;
[Export ("initWithUnit:")]
NativeHandle Constructor (string unit);

// @property (readonly, copy) NSString * _Nonnull unit;
[Export ("unit")]
string Unit { get; }

// @property (readonly, copy, class) SentryMeasurementUnit * _Nonnull none;
[Static]
[Export ("none", ArgumentSemantic.Copy)]
SentryMeasurementUnit None { get; }
}

// @interface SentryMeasurementUnitDuration : SentryMeasurementUnit
[BaseType (typeof(SentryMeasurementUnit))]
[DisableDefaultCtor]
[Internal]
interface SentryMeasurementUnitDuration
{
// @property (readonly, copy, class) SentryMeasurementUnitDuration * _Nonnull nanosecond;
[Static]
[Export ("nanosecond", ArgumentSemantic.Copy)]
SentryMeasurementUnitDuration Nanosecond { get; }

// @property (readonly, copy, class) SentryMeasurementUnitDuration * _Nonnull microsecond;
[Static]
[Export ("microsecond", ArgumentSemantic.Copy)]
SentryMeasurementUnitDuration Microsecond { get; }

// @property (readonly, copy, class) SentryMeasurementUnitDuration * _Nonnull millisecond;
[Static]
[Export ("millisecond", ArgumentSemantic.Copy)]
SentryMeasurementUnitDuration Millisecond { get; }

// @property (readonly, copy, class) SentryMeasurementUnitDuration * _Nonnull second;
[Static]
[Export ("second", ArgumentSemantic.Copy)]
SentryMeasurementUnitDuration Second { get; }

// @property (readonly, copy, class) SentryMeasurementUnitDuration * _Nonnull minute;
[Static]
[Export ("minute", ArgumentSemantic.Copy)]
SentryMeasurementUnitDuration Minute { get; }

// @property (readonly, copy, class) SentryMeasurementUnitDuration * _Nonnull hour;
[Static]
[Export ("hour", ArgumentSemantic.Copy)]
SentryMeasurementUnitDuration Hour { get; }

// @property (readonly, copy, class) SentryMeasurementUnitDuration * _Nonnull day;
[Static]
[Export ("day", ArgumentSemantic.Copy)]
SentryMeasurementUnitDuration Day { get; }

// @property (readonly, copy, class) SentryMeasurementUnitDuration * _Nonnull week;
[Static]
[Export ("week", ArgumentSemantic.Copy)]
SentryMeasurementUnitDuration Week { get; }
}

// @interface SentryMeasurementUnitInformation : SentryMeasurementUnit
[BaseType (typeof(SentryMeasurementUnit))]
[DisableDefaultCtor]
[Internal]
interface SentryMeasurementUnitInformation
{
// @property (readonly, copy, class) SentryMeasurementUnitInformation * _Nonnull bit;
[Static]
[Export ("bit", ArgumentSemantic.Copy)]
SentryMeasurementUnitInformation Bit { get; }

// @property (readonly, copy, class) SentryMeasurementUnitInformation * _Nonnull byte;
[Static]
[Export ("byte", ArgumentSemantic.Copy)]
SentryMeasurementUnitInformation Byte { get; }

// @property (readonly, copy, class) SentryMeasurementUnitInformation * _Nonnull kilobyte;
[Static]
[Export ("kilobyte", ArgumentSemantic.Copy)]
SentryMeasurementUnitInformation Kilobyte { get; }

// @property (readonly, copy, class) SentryMeasurementUnitInformation * _Nonnull kibibyte;
[Static]
[Export ("kibibyte", ArgumentSemantic.Copy)]
SentryMeasurementUnitInformation Kibibyte { get; }

// @property (readonly, copy, class) SentryMeasurementUnitInformation * _Nonnull megabyte;
[Static]
[Export ("megabyte", ArgumentSemantic.Copy)]
SentryMeasurementUnitInformation Megabyte { get; }

// @property (readonly, copy, class) SentryMeasurementUnitInformation * _Nonnull mebibyte;
[Static]
[Export ("mebibyte", ArgumentSemantic.Copy)]
SentryMeasurementUnitInformation Mebibyte { get; }

// @property (readonly, copy, class) SentryMeasurementUnitInformation * _Nonnull gigabyte;
[Static]
[Export ("gigabyte", ArgumentSemantic.Copy)]
SentryMeasurementUnitInformation Gigabyte { get; }

// @property (readonly, copy, class) SentryMeasurementUnitInformation * _Nonnull gibibyte;
[Static]
[Export ("gibibyte", ArgumentSemantic.Copy)]
SentryMeasurementUnitInformation Gibibyte { get; }

// @property (readonly, copy, class) SentryMeasurementUnitInformation * _Nonnull terabyte;
[Static]
[Export ("terabyte", ArgumentSemantic.Copy)]
SentryMeasurementUnitInformation Terabyte { get; }

// @property (readonly, copy, class) SentryMeasurementUnitInformation * _Nonnull tebibyte;
[Static]
[Export ("tebibyte", ArgumentSemantic.Copy)]
SentryMeasurementUnitInformation Tebibyte { get; }

// @property (readonly, copy, class) SentryMeasurementUnitInformation * _Nonnull petabyte;
[Static]
[Export ("petabyte", ArgumentSemantic.Copy)]
SentryMeasurementUnitInformation Petabyte { get; }

// @property (readonly, copy, class) SentryMeasurementUnitInformation * _Nonnull pebibyte;
[Static]
[Export ("pebibyte", ArgumentSemantic.Copy)]
SentryMeasurementUnitInformation Pebibyte { get; }

// @property (readonly, copy, class) SentryMeasurementUnitInformation * _Nonnull exabyte;
[Static]
[Export ("exabyte", ArgumentSemantic.Copy)]
SentryMeasurementUnitInformation Exabyte { get; }

// @property (readonly, copy, class) SentryMeasurementUnitInformation * _Nonnull exbibyte;
[Static]
[Export ("exbibyte", ArgumentSemantic.Copy)]
SentryMeasurementUnitInformation Exbibyte { get; }
}

// @interface SentryMeasurementUnitFraction : SentryMeasurementUnit
[BaseType (typeof(SentryMeasurementUnit))]
[DisableDefaultCtor]
[Internal]
interface SentryMeasurementUnitFraction
{
// @property (readonly, copy, class) SentryMeasurementUnitFraction * _Nonnull ratio;
[Static]
[Export ("ratio", ArgumentSemantic.Copy)]
SentryMeasurementUnitFraction Ratio { get; }

// @property (readonly, copy, class) SentryMeasurementUnitFraction * _Nonnull percent;
[Static]
[Export ("percent", ArgumentSemantic.Copy)]
SentryMeasurementUnitFraction Percent { get; }
}

// @interface SentryMechanism : NSObject <SentrySerializable>
[BaseType (typeof(NSObject))]
[DisableDefaultCtor]
Expand Down Expand Up @@ -1564,6 +1762,11 @@ interface SentrySdk
[Export ("crash")]
void Crash ();

// +(void)flush:(NSTimeInterval)timeout __attribute__((swift_name("flush(timeout:)")));
[Static]
[Export ("flush:")]
void Flush (double timeout);

// +(void)close;
[Static]
[Export ("close")]
Expand Down Expand Up @@ -2006,6 +2209,10 @@ interface SentryUser : SentrySerializable //, INSCopying
[NullAllowed, Export ("ipAddress")]
string IpAddress { get; set; }

// @property (copy, atomic) NSString * _Nullable segment;
[NullAllowed, Export ("segment")]
string Segment { get; set; }

// @property (atomic, strong) NSDictionary<NSString *,id> * _Nullable data;
[NullAllowed, Export ("data", ArgumentSemantic.Strong)]
NSDictionary<NSString, NSObject> Data { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion src/Sentry.Bindings.Cocoa/Sentry.Bindings.Cocoa.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</ItemGroup>

<PropertyGroup>
<SentryCocoaSdkVersion>7.24.1</SentryCocoaSdkVersion>
<SentryCocoaSdkVersion>7.28.0</SentryCocoaSdkVersion>
<SentryCocoaSdkDirectory>$(BaseIntermediateOutputPath)sdks\Sentry\Cocoa\$(SentryCocoaSdkVersion)\</SentryCocoaSdkDirectory>
<SentryCocoaFramework>$(SentryCocoaSdkDirectory)Carthage\Build\Sentry.xcframework</SentryCocoaFramework>

Expand Down
43 changes: 26 additions & 17 deletions src/Sentry.Bindings.Cocoa/StructsAndEnums.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using ObjCRuntime;

namespace SentryCocoa;
namespace Sentry.CocoaSdk;

[Native]
internal enum SentryLogLevel : long
Expand All @@ -25,21 +25,21 @@ internal enum SentryLevel : ulong
[Native]
internal enum SentryPermissionStatus : long
{
Unknown = 0,
Granted,
Partial,
Denied
Unknown = 0,
Granted,
Partial,
Denied
}

[Native]
internal enum SentryTransactionNameSource : long
{
Custom = 0,
Url,
Route,
View,
Component,
Task
Custom = 0,
Url,
Route,
View,
Component,
Task
}

[Native]
Expand All @@ -66,12 +66,21 @@ internal enum SentryError : long

// internal static class CFunctions
// {
// // extern NSError * _Nullable NSErrorFromSentryError (SentryError error, NSString * _Nonnull description) __attribute__((visibility("default")));
// [DllImport ("__Internal")]
// [Verify (PlatformInvoke)]
// [Internal]
// [return: NullAllowed]
// static extern NSError NSErrorFromSentryError (SentryError error, NSString description);
// // extern NSError * _Nullable NSErrorFromSentryError (SentryError error, NSString * _Nonnull description) __attribute__((visibility("default")));
// [DllImport ("__Internal")]
// [Verify (PlatformInvoke)]
// [return: NullAllowed]
// static extern NSError NSErrorFromSentryError (SentryError error, NSString description);

// // extern NSString * _Nonnull nameForSentrySampleDecision (SentrySampleDecision decision);
// [DllImport ("__Internal")]
// [Verify (PlatformInvoke)]
// static extern NSString nameForSentrySampleDecision (SentrySampleDecision decision);

// // extern NSString * _Nonnull nameForSentrySpanStatus (SentrySpanStatus status);
// [DllImport ("__Internal")]
// [Verify (PlatformInvoke)]
// static extern NSString nameForSentrySpanStatus (SentrySpanStatus status);
// }

[Native]
Expand Down
24 changes: 24 additions & 0 deletions src/Sentry.Bindings.Cocoa/howtobuild.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Due to https://github.com/getsentry/sentry-cocoa/issues/2031, we can't use the pre-built release of the Sentry-Cocoa SDK, or our build will fail due to lack of MacCatalyst output.

To workaround, we need a custom build of Carthage, that has https://github.com/Carthage/Carthage/pull/3235 applied.
- Clone the https://github.com/NachoSoto/Carthage fork, and switch to the xcframework-catalyst branch
- run `make install` to install, which builds Carthage and installs it locally to `/usr/local/bin/carthage`.
- See https://github.com/Carthage/Carthage/blob/master/CONTRIBUTING.md#get-started

Now go clone the https://github.com/getsentry/sentry-cocoa repo and do the following:
- Checkout the version tag that you are building. Example: `git checkout 7.28.0`
- Run `make init`, per https://github.com/getsentry/sentry-cocoa/blob/master/CONTRIBUTING.md#setting-up-an-environment
- Modify the `makefile`, editing the `build-xcframework` section to the following:
```
build-xcframework:
@echo "--> Carthage: creating Sentry xcframework"
/usr/local/bin/carthage build --use-xcframeworks --no-skip-current --platform ios
/usr/local/bin/carthage build --use-xcframeworks --no-skip-current --platform macCatalyst
ditto -c -k -X --rsrc --keepParent Carthage Sentry.xcframework.zip
```
- Run `make build-xcframework`
- Copy the resulting `Sentry.xcframework.zip` into the `sentry-dotnet` project at the `/lib` folder root
- Rename it to include the version number (ex: `Sentry.xcframework.7.28.0.custombuild.zip), and delete the prior version zip.
- Edit `Sentry.Bindings.Cocoa.csproj` to update `SentryCocoaSdkVersion`
- If needed, update `StructsAndEnums.cs` and `ApiDefinition.cs` (see `sharpie.md` for details).
- Run `dotnet build Sentry.Bindings.Cocoa.csproj` and resolve any warnings/errors before trying to use in the rest of the solution.
1 change: 1 addition & 0 deletions src/Sentry.Bindings.Cocoa/sharpie.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ However, the files are not purely auto-generated. Several modifications have be

- Everything has been made internal, either via the `internal` keyword, or the `[Internal]` binding attribute.
- Named delegates have been replaced with `Func<T>` or `Action<T>` to work around https://github.com/xamarin/xamarin-macios/issues/15299
- `INSCopying` interfaces have been commented out, to resolve nullability error
- Items that Sharpie marked with `[Verify]` have been resolved, except for:
- `NSErrorFromSentryError` and its containing class has been commented out, as we aren't using it presently and it needs verification

Expand Down
Loading