1
- # Reference: https://github.com/xamarin/xamarin-macios/blob/main/docs/website/binding_types_reference_guide.md
2
-
3
1
Set-StrictMode - Version Latest
4
2
$ErrorActionPreference = ' Stop'
5
3
@@ -117,6 +115,41 @@ $Text = $Text -replace '\bpublic\b', 'internal'
117
115
# Remove static CFunctions class
118
116
$Text = $Text -replace ' (?ms)\nstatic class CFunctions.*?}\n' , ' '
119
117
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
+
120
153
# Add header and output file
121
154
$Text = " $Header `n`n $Text "
122
155
$Text | Out-File " $BindingsPath /$File "
@@ -147,9 +180,6 @@ $Text = $Text -replace '\bISentrySerializable\b', 'SentrySerializable'
147
180
# Remove INSCopying due to https://github.com/xamarin/xamarin-macios/issues/17130
148
181
$Text = $Text -replace ' : INSCopying,' , ' :' -replace ' \s?[:,] INSCopying' , ' '
149
182
150
- # Remove iOS attributes like [iOS (13, 0)]
151
- $Text = $Text -replace ' \[iOS \(13, 0\)\]\n?' , ' '
152
-
153
183
# Fix delegate argument names
154
184
$Text = $Text -replace ' (NSError) arg\d' , ' $1 error'
155
185
$Text = $Text -replace ' (NSHttpUrlResponse) arg\d' , ' $1 response'
@@ -191,7 +221,7 @@ $Text = $Text -replace '\[Static\]\s*\[Internal\]\s*partial\s+interface\s+Consta
191
221
192
222
# Update MethodToProperty translations
193
223
$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'
195
225
$Text = $Text -replace ' \[Verify \(MethodToProperty\)\]\n\s*(.+) \{ get; \}' , ' $1();'
196
226
197
227
# Allow weakly typed NSArray
@@ -204,7 +234,7 @@ $Text = $Text -replace '(DEPRECATED_MSG_ATTRIBUTE\()\n\s*', '$1'
204
234
# Remove default IsEqual implementation (already implemented by NSObject)
205
235
$Text = $Text -replace ' (?ms)\n?^ *// [^\n]*isEqual:.*?$.*?;\n' , ' '
206
236
207
- # Replace obsolete platform availability attributes
237
+ # Replace obsolete platform avaialbility attributes
208
238
$Text = $Text -replace ' ([\[,] )MacCatalyst \(' , ' $1Introduced (PlatformName.MacCatalyst, '
209
239
$Text = $Text -replace ' ([\[,] )Mac \(' , ' $1Introduced (PlatformName.MacOSX, '
210
240
$Text = $Text -replace ' ([\[,] )iOS \(' , ' $1Introduced (PlatformName.iOS, '
@@ -217,6 +247,7 @@ $Text = $Text -replace '(?m)(^\s*\/\/[^\r\n]*$\s*\[Export \("serialize"\)\]$\s*)
217
247
218
248
$Text = $Text -replace ' .*SentryEnvelope .*?[\s\S]*?\n\n' , ' '
219
249
$Text = $Text -replace ' .*typedef.*SentryOnAppStartMeasurementAvailable.*?[\s\S]*?\n\n' , ' '
250
+ $Text = $Text -replace ' \n.*SentryReplayBreadcrumbConverter.*?[\s\S]*?\);\n' , ' '
220
251
221
252
$propertiesToRemove = @ (
222
253
' SentryAppStartMeasurement' ,
@@ -231,6 +262,41 @@ foreach ($property in $propertiesToRemove) {
231
262
$Text = $Text -replace " \n.*property.*$property .*?[\s\S]*?\}\n" , ' '
232
263
}
233
264
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 "
234
300
235
301
# Add header and output file
236
302
$Text = " $Header `n`n $Text "
0 commit comments