1- # Reference: https://github.com/xamarin/xamarin-macios/blob/main/docs/website/binding_types_reference_guide.md
2-
31Set-StrictMode - Version Latest
42$ErrorActionPreference = ' Stop'
53
@@ -117,6 +115,41 @@ $Text = $Text -replace '\bpublic\b', 'internal'
117115# Remove static CFunctions class
118116$Text = $Text -replace ' (?ms)\nstatic class CFunctions.*?}\n' , ' '
119117
118+ # This enum resides in the Sentry-Swift.h
119+ # Appending it here so we don't need to import and create bindings for the entire header
120+ $SentryLevel = @'
121+
122+ [Native]
123+ internal enum SentryLevel : ulong
124+ {
125+ None = 0,
126+ Debug = 1,
127+ Info = 2,
128+ Warning = 3,
129+ Error = 4,
130+ Fatal = 5
131+ }
132+ '@
133+
134+ # This enum resides in the Sentry-Swift.h
135+ # Appending it here so we don't need to import and create bindings for the entire header
136+ $SentryTransactionNameSource = @'
137+
138+ [Native]
139+ internal enum SentryTransactionNameSource : long
140+ {
141+ Custom = 0,
142+ Url = 1,
143+ Route = 2,
144+ View = 3,
145+ Component = 4,
146+ Task = 5
147+ }
148+ '@
149+
150+ $Text += " `n $SentryLevel "
151+ $Text += " `n $SentryTransactionNameSource "
152+
120153# Add header and output file
121154$Text = " $Header `n`n $Text "
122155$Text | Out-File " $BindingsPath /$File "
@@ -147,9 +180,6 @@ $Text = $Text -replace '\bISentrySerializable\b', 'SentrySerializable'
147180# Remove INSCopying due to https://github.com/xamarin/xamarin-macios/issues/17130
148181$Text = $Text -replace ' : INSCopying,' , ' :' -replace ' \s?[:,] INSCopying' , ' '
149182
150- # Remove iOS attributes like [iOS (13, 0)]
151- $Text = $Text -replace ' \[iOS \(13, 0\)\]\n?' , ' '
152-
153183# Fix delegate argument names
154184$Text = $Text -replace ' (NSError) arg\d' , ' $1 error'
155185$Text = $Text -replace ' (NSHttpUrlResponse) arg\d' , ' $1 response'
@@ -191,7 +221,7 @@ $Text = $Text -replace '\[Static\]\s*\[Internal\]\s*partial\s+interface\s+Consta
191221
192222# Update MethodToProperty translations
193223$Text = $Text -replace ' (Export \("get\w+"\)\]\n)\s*\[Verify \(MethodToProperty\)\]\n(.+ \{ get; \})' , ' $1$2'
194- $Text = $Text -replace ' \[Verify \(MethodToProperty\)\]\n\s*(.+ (?:Hash|Value|DefaultIntegrations|AppStartMeasurementWithSpans|BaggageHttpHeader ) \{ get; \})' , ' $1'
224+ $Text = $Text -replace ' \[Verify \(MethodToProperty\)\]\n\s*(.+ (?:Hash|Value|DefaultIntegrations) \{ get; \})' , ' $1'
195225$Text = $Text -replace ' \[Verify \(MethodToProperty\)\]\n\s*(.+) \{ get; \}' , ' $1();'
196226
197227# Allow weakly typed NSArray
@@ -204,7 +234,7 @@ $Text = $Text -replace '(DEPRECATED_MSG_ATTRIBUTE\()\n\s*', '$1'
204234# Remove default IsEqual implementation (already implemented by NSObject)
205235$Text = $Text -replace ' (?ms)\n?^ *// [^\n]*isEqual:.*?$.*?;\n' , ' '
206236
207- # Replace obsolete platform availability attributes
237+ # Replace obsolete platform avaialbility attributes
208238$Text = $Text -replace ' ([\[,] )MacCatalyst \(' , ' $1Introduced (PlatformName.MacCatalyst, '
209239$Text = $Text -replace ' ([\[,] )Mac \(' , ' $1Introduced (PlatformName.MacOSX, '
210240$Text = $Text -replace ' ([\[,] )iOS \(' , ' $1Introduced (PlatformName.iOS, '
@@ -217,6 +247,7 @@ $Text = $Text -replace '(?m)(^\s*\/\/[^\r\n]*$\s*\[Export \("serialize"\)\]$\s*)
217247
218248$Text = $Text -replace ' .*SentryEnvelope .*?[\s\S]*?\n\n' , ' '
219249$Text = $Text -replace ' .*typedef.*SentryOnAppStartMeasurementAvailable.*?[\s\S]*?\n\n' , ' '
250+ $Text = $Text -replace ' \n.*SentryReplayBreadcrumbConverter.*?[\s\S]*?\);\n' , ' '
220251
221252$propertiesToRemove = @ (
222253 ' SentryAppStartMeasurement' ,
@@ -231,6 +262,41 @@ foreach ($property in $propertiesToRemove) {
231262 $Text = $Text -replace " \n.*property.*$property .*?[\s\S]*?\}\n" , ' '
232263}
233264
265+ # This interface resides in the Sentry-Swift.h
266+ # Appending it here so we don't need to import and create bindings for the entire header
267+ $SentryId = @'
268+
269+ // @interface SentryId : NSObject
270+ [BaseType (typeof(NSObject), Name = "_TtC6Sentry8SentryId")]
271+ [Internal]
272+ interface SentryId
273+ {
274+ // @property (nonatomic, strong, class) SentryId * _Nonnull empty;
275+ [Static]
276+ [Export ("empty", ArgumentSemantic.Strong)]
277+ SentryId Empty { get; set; }
278+
279+ // @property (readonly, copy, nonatomic) NSString * _Nonnull sentryIdString;
280+ [Export ("sentryIdString")]
281+ string SentryIdString { get; }
282+
283+ // -(instancetype _Nonnull)initWithUuid:(NSUUID * _Nonnull)uuid __attribute__((objc_designated_initializer));
284+ [Export ("initWithUuid:")]
285+ [DesignatedInitializer]
286+ NativeHandle Constructor (NSUuid uuid);
287+
288+ // -(instancetype _Nonnull)initWithUUIDString:(NSString * _Nonnull)uuidString __attribute__((objc_designated_initializer));
289+ [Export ("initWithUUIDString:")]
290+ [DesignatedInitializer]
291+ NativeHandle Constructor (string uuidString);
292+
293+ // @property (readonly, nonatomic) NSUInteger hash;
294+ [Export ("hash")]
295+ nuint Hash { get; }
296+ }
297+ '@
298+
299+ $Text += " `n $SentryId "
234300
235301# Add header and output file
236302$Text = " $Header `n`n $Text "
0 commit comments