Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Moved static StructsAndEnums to csharp file
  • Loading branch information
jamescrosswell committed Apr 10, 2025
commit 35519a83e07418d4f73e022201cba2e3cd8461d9
88 changes: 0 additions & 88 deletions scripts/generate-cocoa-bindings.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -117,94 +117,6 @@ $Text = $Text -replace '\bpublic\b', 'internal'
# Remove static CFunctions class
$Text = $Text -replace '(?ms)\nstatic class CFunctions.*?}\n', ''

# This enum resides in the Sentry-Swift.h
# Appending it here so we don't need to import and create bindings for the entire header
$SentryFeedbackSource = @'
[Native]
internal enum SentryFeedbackSource : long
{
Unknown = 0,
User = 1,
System = 2,
Other = 3
}
'@

# This enum resides in the Sentry-Swift.h
# Appending it here so we don't need to import and create bindings for the entire header
$SentryLevel = @'

[Native]
internal enum SentryLevel : ulong
{
None = 0,
Debug = 1,
Info = 2,
Warning = 3,
Error = 4,
Fatal = 5
}
'@

# This enum resides in the Sentry-Swift.h
# Appending it here so we don't need to import and create bindings for the entire header
$SentryTransactionNameSource = @'

[Native]
internal enum SentryTransactionNameSource : long
{
Custom = 0,
Url = 1,
Route = 2,
View = 3,
Component = 4,
Task = 5
}
'@

# This enum resides in the Sentry-Swift.h
# Appending it here so we don't need to import and create bindings for the entire header
$SentryReplayQuality = @'
[Native]
internal enum SentryReplayQuality : long
{
Low = 0,
Medium = 1,
High = 2
}
'@

# This enum resides in the Sentry-Swift.h
# Appending it here so we don't need to import and create bindings for the entire header
$SentryReplayType = @'
[Native]
internal enum SentryReplayType : long
{
Session = 0,
Buffer = 1
}
'@

# This enum resides in the Sentry-Swift.h
# Appending it here so we don't need to import and create bindings for the entire header
$SentryRRWebEventType = @'
[Native]
internal enum SentryRRWebEventType : long
{
None = 0,
Touch = 3,
Meta = 4,
Custom = 5
}
'@

$Text += "`n$SentryFeedbackSource"
$Text += "`n$SentryLevel"
$Text += "`n$SentryTransactionNameSource"
$Text += "`n$SentryReplayQuality"
$Text += "`n$SentryReplayType"
$Text += "`n$SentryRRWebEventType"

# Add header and output file
$Text = "$Header`n`n$Text"
$Text | Out-File "$BindingsPath/$File"
Expand Down
1 change: 1 addition & 0 deletions src/Sentry.Bindings.Cocoa/Sentry.Bindings.Cocoa.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
<ObjcBindingApiDefinition Include="PrivateApiDefinitions.cs" />
<ObjcBindingApiDefinition Include="SwiftApiDefinitions.cs" />
<ObjcBindingCoreSource Include="StructsAndEnums.cs" />
<ObjcBindingCoreSource Include="SwiftStructsAndEnums.cs" />
<NativeReference Include="$(SentryCocoaFramework)" Kind="Framework" />

<!-- Use a separate readme file in the nuget. -->
Expand Down
51 changes: 0 additions & 51 deletions src/Sentry.Bindings.Cocoa/StructsAndEnums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,54 +66,3 @@ internal enum SentrySpanStatus : ulong
OutOfRange,
DataLoss
}
[Native]
internal enum SentryFeedbackSource : long
{
Unknown = 0,
User = 1,
System = 2,
Other = 3
}

[Native]
internal enum SentryLevel : ulong
{
None = 0,
Debug = 1,
Info = 2,
Warning = 3,
Error = 4,
Fatal = 5
}

[Native]
internal enum SentryTransactionNameSource : long
{
Custom = 0,
Url = 1,
Route = 2,
View = 3,
Component = 4,
Task = 5
}
[Native]
internal enum SentryReplayQuality : long
{
Low = 0,
Medium = 1,
High = 2
}
[Native]
internal enum SentryReplayType : long
{
Session = 0,
Buffer = 1
}
[Native]
internal enum SentryRRWebEventType : long
{
None = 0,
Touch = 3,
Meta = 4,
Custom = 5
}
3 changes: 2 additions & 1 deletion src/Sentry.Bindings.Cocoa/SwiftApiDefinitions.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* This file defines Xamarin iOS API contracts for the members we need from Sentry-Swift.h
* This file defines iOS API contracts for the members we need from Sentry-Swift.h
* Note that we are **not** using Objective Sharpie to generate contracts (instead they're maintained manually).
*/
using System;
using Foundation;
Expand Down
65 changes: 65 additions & 0 deletions src/Sentry.Bindings.Cocoa/SwiftStructsAndEnums.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
* This file defines iOS API contracts for enums we need from Sentry-Swift.h.
* Note that we are **not** using Objective Sharpie to generate these contracts (instead they're maintained manually).
*/
using System.Runtime.InteropServices;
using Foundation;
using ObjCRuntime;
using Sentry;

namespace Sentry.CocoaSdk;

[Native]
internal enum SentryFeedbackSource : long
{
Unknown = 0,
User = 1,
System = 2,
Other = 3
}

[Native]
internal enum SentryLevel : ulong
{
None = 0,
Debug = 1,
Info = 2,
Warning = 3,
Error = 4,
Fatal = 5
}

[Native]
internal enum SentryReplayQuality : long
{
Low = 0,
Medium = 1,
High = 2
}

[Native]
internal enum SentryReplayType : long
{
Session = 0,
Buffer = 1
}

[Native]
internal enum SentryRRWebEventType : long
{
None = 0,
Touch = 3,
Meta = 4,
Custom = 5
}

[Native]
internal enum SentryTransactionNameSource : long
{
Custom = 0,
Url = 1,
Route = 2,
View = 3,
Component = 4,
Task = 5
}
Loading