Skip to content
Open
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
- Bump Java SDK from v8.28.0 to v8.29.0 ([#4817](https://github.com/getsentry/sentry-dotnet/pull/4817))
- [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#8290)
- [diff](https://github.com/getsentry/sentry-java/compare/8.28.0...8.29.0)
- Bump Cocoa SDK from v8.57.3 to v9.2.0 ([#4781](https://github.com/getsentry/sentry-dotnet/pull/4781))
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/main/CHANGELOG.md#920)
- [diff](https://github.com/getsentry/sentry-cocoa/compare/8.57.3...9.2.0)

## 6.0.0

Expand Down
2 changes: 1 addition & 1 deletion modules/sentry-cocoa.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
version = 8.57.3
version = 9.2.0
repo = https://github.com/getsentry/sentry-cocoa

This comment was marked as outdated.

4 changes: 2 additions & 2 deletions scripts/generate-cocoa-bindings.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ foreach ($file in $filesToPatch)
Write-Host "File not found: $file"
}
}
$privateHeaderFile = "$PrivateHeadersPath/PrivatesHeader.h"
$privateHeaderFile = "$HeadersPath/PrivatesHeader.h"
if (Test-Path $privateHeaderFile)
{
$content = Get-Content -Path $privateHeaderFile -Raw
Expand Down Expand Up @@ -169,7 +169,7 @@ sharpie bind -sdk $iPhoneSdkVersion `
-scope "$CocoaSdkPath" `
"$HeadersPath/Sentry.h" `
"$HeadersPath/Sentry-Swift.h" `
"$PrivateHeadersPath/PrivateSentrySDKOnly.h" `
"$HeadersPath/PrivateSentrySDKOnly.h" `
-o $BindingsPath `
-c -Wno-objc-property-no-attribute `
-F"$iPhoneSdkPath/System/Library/SubFrameworks" # needed for UIUtilities.framework in Xcode 26+
Expand Down
68 changes: 61 additions & 7 deletions scripts/patch-cocoa-bindings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@
.WithAttribute("SentryBeforeBreadcrumbCallback", "return: NullAllowed")
.WithAttribute("SentryBeforeSendEventCallback", "return: NullAllowed")
.WithAttribute("SentryTracesSamplerCallback", "return: NullAllowed")
// Fix nullable return attributes
.RemoveAttribute("PrivateSentrySDKOnly", "CaptureScreenshots", "NullAllowed")
.RemoveAttribute("PrivateSentrySDKOnly", "CaptureViewHierarchy", "NullAllowed")
.WithAttribute("PrivateSentrySDKOnly", "CaptureScreenshots", "return: NullAllowed")
.WithAttribute("PrivateSentrySDKOnly", "CaptureViewHierarchy", "return: NullAllowed")
// For PrivateApiDefinitions.cs
.WithModifier("SentryScope", "partial")
// error CS0246: The type or namespace name 'iOS' could not be found
Expand All @@ -84,24 +89,28 @@
.RemoveMethod("Sentry*", "IsEqual")
// error CS0246: The type or namespace name '_NSZone' could not be found
.RemoveMethod("Sentry*", "CopyWithZone")
// error CS0111: Type 'SentryAttribute' already defines a member called 'Constructor' with the same parameter types
.RemoveMethod("SentryLog", "SetAttribute")
// SentryEnvelope* is not whitelisted
.RemoveMethod("PrivateSentrySDKOnly", "CaptureEnvelope")
.RemoveMethod("PrivateSentrySDKOnly", "EnvelopeWithData")
.RemoveMethod("PrivateSentrySDKOnly", "StoreEnvelope")
// deprecated
.RemoveMethod("Sentry*", "CaptureUserFeedback")
// SentryLoggerDelegate and SentryCurrentDateProvider are not whitelisted
.RemoveMethod("SentryLogger", "Constructor")
// SentryAppStartMeasurement is not whitelisted
.RemoveDelegate("SentryOnAppStartMeasurementAvailable")
// deprecated
// unused
.RemoveDelegate("SentryUserFeedbackConfigurationBlock")
// error CS0114: 'SentryXxx.Description' hides inherited member 'NSObject.Description'.
.RemoveProperty("Sentry*", "Description")
// SentryAppStartMeasurement is not whitelisted
.RemoveProperty("PrivateSentrySDKOnly", "*AppStartMeasurement*")
// SentryStructuredLogAttribute is not whitelisted
.RemoveProperty("SentryLog", "Attributes")
// deprecated
// Minimize SentryDependencyContainer
.RemoveMethod("SentryDependencyContainer", "*")
.KeepProperties("SentryDependencyContainer", "SharedInstance", "DebugImageProvider")
// SentryUserFeedbackConfiguration is not whitelisted
.RemoveProperty("SentryOptions", "ConfigureUserFeedback")
.RemoveProperty("SentryOptions", "UserFeedbackConfiguration")
.KeepInterfaces(
"ISentryRRWebEvent",
"PrivateSentrySDKOnly",
Expand All @@ -111,6 +120,7 @@
"SentryClient",
"SentryDebugImageProvider",
"SentryDebugMeta",
"SentryDependencyContainer",
"SentryDsn",
"SentryEvent",
"SentryException",
Expand All @@ -129,6 +139,7 @@
"SentryMeasurementUnitFraction",
"SentryMeasurementUnitInformation",
"SentryMechanism",
"SentryMechanismContext",
"SentryMechanismMeta",
"SentryMessage",
"SentryNSError",
Expand Down Expand Up @@ -159,7 +170,9 @@
)
// Rename and retarget the experimental options property
.RenameProperty("SentryOptions", "_swiftExperimentalOptions", "Experimental")
.ChangePropertyType("SentryOptions", "Experimental", "SentryExperimentalOptions");
.ChangePropertyType("SentryOptions", "Experimental", "SentryExperimentalOptions")
// error CS0311: The type 'SentryXxx' cannot be used as type parameter 'TValue' in the generic type or method 'NSDictionary<TKey, TValue>'.
.ChangeGenericTypeArgument("NSDictionary", "Sentry*", "NSObject");

var formatted = CodeFormatter.Format(nodes, new AdhocWorkspace());
File.WriteAllText(args[0], formatted.ToFullString() + "\n");
Expand Down Expand Up @@ -219,6 +232,19 @@ public static CompilationUnitSyntax RemoveAttribute(
.RemoveByPredicate<AttributeListSyntax>(node => node.Attributes.Count == 0);
}

public static CompilationUnitSyntax RemoveAttribute(
this CompilationUnitSyntax root,
string type,
string name,
string attribute)
{
return root.RemoveByPredicate<AttributeSyntax>(node =>
node.Name.Matches(attribute) &&
node.Parent?.Parent is MethodDeclarationSyntax method &&
method.Identifier.Matches(name) &&
method.HasParent(type));
}

public static CompilationUnitSyntax RemoveBaseType(
this CompilationUnitSyntax root,
string name)
Expand Down Expand Up @@ -275,6 +301,18 @@ public static CompilationUnitSyntax WithAttribute(
return root.ReplaceNodes(nodes, (node, _) => node.WithAttribute(attribute));
}

public static CompilationUnitSyntax WithAttribute(
this CompilationUnitSyntax root,
string type,
string name,
string attribute)
{
var nodes = root.DescendantNodes()
.OfType<MethodDeclarationSyntax>()
.Where(node => node.Identifier.Matches(name) && node.HasParent(type) && !node.HasAttribute(attribute));
return root.ReplaceNodes(nodes, (node, _) => node.WithAttribute(attribute));
}

public static CompilationUnitSyntax AsInternal(
this CompilationUnitSyntax root,
string name,
Expand Down Expand Up @@ -417,6 +455,22 @@ public static CompilationUnitSyntax ChangePropertyType(
return root.ReplaceNodes(nodes, (node, _) => node.WithType(SyntaxFactory.ParseTypeName(newType)));
}

public static CompilationUnitSyntax ChangeGenericTypeArgument(
this CompilationUnitSyntax root,
string type,
string from,
string to)
{
var nodes = root.DescendantNodes()
.OfType<GenericNameSyntax>()
.Where(node => node.Identifier.Matches(type) && node.TypeArgumentList.Arguments.Any(arg => arg.Matches(from)));

return root.ReplaceNodes(nodes, (node, _) =>
{
var args = node.TypeArgumentList.Arguments.Select(arg => arg.Matches(from) ? SyntaxFactory.ParseTypeName(to) : arg);
return node.WithTypeArgumentList(node.TypeArgumentList.WithArguments(SyntaxFactory.SeparatedList(args)));
});
}
}

internal static class SyntaxNodeExtensions
Expand Down
Loading
Loading