Skip to content

Commit 35519a8

Browse files
Moved static StructsAndEnums to csharp file
1 parent da1f152 commit 35519a8

File tree

5 files changed

+68
-140
lines changed

5 files changed

+68
-140
lines changed

scripts/generate-cocoa-bindings.ps1

Lines changed: 0 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -117,94 +117,6 @@ $Text = $Text -replace '\bpublic\b', 'internal'
117117
# Remove static CFunctions class
118118
$Text = $Text -replace '(?ms)\nstatic class CFunctions.*?}\n', ''
119119

120-
# This enum resides in the Sentry-Swift.h
121-
# Appending it here so we don't need to import and create bindings for the entire header
122-
$SentryFeedbackSource = @'
123-
[Native]
124-
internal enum SentryFeedbackSource : long
125-
{
126-
Unknown = 0,
127-
User = 1,
128-
System = 2,
129-
Other = 3
130-
}
131-
'@
132-
133-
# This enum resides in the Sentry-Swift.h
134-
# Appending it here so we don't need to import and create bindings for the entire header
135-
$SentryLevel = @'
136-
137-
[Native]
138-
internal enum SentryLevel : ulong
139-
{
140-
None = 0,
141-
Debug = 1,
142-
Info = 2,
143-
Warning = 3,
144-
Error = 4,
145-
Fatal = 5
146-
}
147-
'@
148-
149-
# This enum resides in the Sentry-Swift.h
150-
# Appending it here so we don't need to import and create bindings for the entire header
151-
$SentryTransactionNameSource = @'
152-
153-
[Native]
154-
internal enum SentryTransactionNameSource : long
155-
{
156-
Custom = 0,
157-
Url = 1,
158-
Route = 2,
159-
View = 3,
160-
Component = 4,
161-
Task = 5
162-
}
163-
'@
164-
165-
# This enum resides in the Sentry-Swift.h
166-
# Appending it here so we don't need to import and create bindings for the entire header
167-
$SentryReplayQuality = @'
168-
[Native]
169-
internal enum SentryReplayQuality : long
170-
{
171-
Low = 0,
172-
Medium = 1,
173-
High = 2
174-
}
175-
'@
176-
177-
# This enum resides in the Sentry-Swift.h
178-
# Appending it here so we don't need to import and create bindings for the entire header
179-
$SentryReplayType = @'
180-
[Native]
181-
internal enum SentryReplayType : long
182-
{
183-
Session = 0,
184-
Buffer = 1
185-
}
186-
'@
187-
188-
# This enum resides in the Sentry-Swift.h
189-
# Appending it here so we don't need to import and create bindings for the entire header
190-
$SentryRRWebEventType = @'
191-
[Native]
192-
internal enum SentryRRWebEventType : long
193-
{
194-
None = 0,
195-
Touch = 3,
196-
Meta = 4,
197-
Custom = 5
198-
}
199-
'@
200-
201-
$Text += "`n$SentryFeedbackSource"
202-
$Text += "`n$SentryLevel"
203-
$Text += "`n$SentryTransactionNameSource"
204-
$Text += "`n$SentryReplayQuality"
205-
$Text += "`n$SentryReplayType"
206-
$Text += "`n$SentryRRWebEventType"
207-
208120
# Add header and output file
209121
$Text = "$Header`n`n$Text"
210122
$Text | Out-File "$BindingsPath/$File"

src/Sentry.Bindings.Cocoa/Sentry.Bindings.Cocoa.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
<ObjcBindingApiDefinition Include="PrivateApiDefinitions.cs" />
3434
<ObjcBindingApiDefinition Include="SwiftApiDefinitions.cs" />
3535
<ObjcBindingCoreSource Include="StructsAndEnums.cs" />
36+
<ObjcBindingCoreSource Include="SwiftStructsAndEnums.cs" />
3637
<NativeReference Include="$(SentryCocoaFramework)" Kind="Framework" />
3738

3839
<!-- Use a separate readme file in the nuget. -->

src/Sentry.Bindings.Cocoa/StructsAndEnums.cs

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -66,54 +66,3 @@ internal enum SentrySpanStatus : ulong
6666
OutOfRange,
6767
DataLoss
6868
}
69-
[Native]
70-
internal enum SentryFeedbackSource : long
71-
{
72-
Unknown = 0,
73-
User = 1,
74-
System = 2,
75-
Other = 3
76-
}
77-
78-
[Native]
79-
internal enum SentryLevel : ulong
80-
{
81-
None = 0,
82-
Debug = 1,
83-
Info = 2,
84-
Warning = 3,
85-
Error = 4,
86-
Fatal = 5
87-
}
88-
89-
[Native]
90-
internal enum SentryTransactionNameSource : long
91-
{
92-
Custom = 0,
93-
Url = 1,
94-
Route = 2,
95-
View = 3,
96-
Component = 4,
97-
Task = 5
98-
}
99-
[Native]
100-
internal enum SentryReplayQuality : long
101-
{
102-
Low = 0,
103-
Medium = 1,
104-
High = 2
105-
}
106-
[Native]
107-
internal enum SentryReplayType : long
108-
{
109-
Session = 0,
110-
Buffer = 1
111-
}
112-
[Native]
113-
internal enum SentryRRWebEventType : long
114-
{
115-
None = 0,
116-
Touch = 3,
117-
Meta = 4,
118-
Custom = 5
119-
}

src/Sentry.Bindings.Cocoa/SwiftApiDefinitions.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/*
2-
* This file defines Xamarin iOS API contracts for the members we need from Sentry-Swift.h
2+
* This file defines iOS API contracts for the members we need from Sentry-Swift.h
3+
* Note that we are **not** using Objective Sharpie to generate contracts (instead they're maintained manually).
34
*/
45
using System;
56
using Foundation;
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/*
2+
* This file defines iOS API contracts for enums we need from Sentry-Swift.h.
3+
* Note that we are **not** using Objective Sharpie to generate these contracts (instead they're maintained manually).
4+
*/
5+
using System.Runtime.InteropServices;
6+
using Foundation;
7+
using ObjCRuntime;
8+
using Sentry;
9+
10+
namespace Sentry.CocoaSdk;
11+
12+
[Native]
13+
internal enum SentryFeedbackSource : long
14+
{
15+
Unknown = 0,
16+
User = 1,
17+
System = 2,
18+
Other = 3
19+
}
20+
21+
[Native]
22+
internal enum SentryLevel : ulong
23+
{
24+
None = 0,
25+
Debug = 1,
26+
Info = 2,
27+
Warning = 3,
28+
Error = 4,
29+
Fatal = 5
30+
}
31+
32+
[Native]
33+
internal enum SentryReplayQuality : long
34+
{
35+
Low = 0,
36+
Medium = 1,
37+
High = 2
38+
}
39+
40+
[Native]
41+
internal enum SentryReplayType : long
42+
{
43+
Session = 0,
44+
Buffer = 1
45+
}
46+
47+
[Native]
48+
internal enum SentryRRWebEventType : long
49+
{
50+
None = 0,
51+
Touch = 3,
52+
Meta = 4,
53+
Custom = 5
54+
}
55+
56+
[Native]
57+
internal enum SentryTransactionNameSource : long
58+
{
59+
Custom = 0,
60+
Url = 1,
61+
Route = 2,
62+
View = 3,
63+
Component = 4,
64+
Task = 5
65+
}

0 commit comments

Comments
 (0)