Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MetricKit] Add support for Xcode 13 beta4. #12326

Merged
merged 6 commits into from
Aug 4, 2021
Merged
Show file tree
Hide file tree
Changes from 2 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
6 changes: 2 additions & 4 deletions src/MetricKit/MXMetricManager.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#if IOS
using System;

using CoreFoundation;
Expand All @@ -9,11 +8,10 @@ namespace MetricKit {

public partial class MXMetricManager {

public static OSLog MakeLogHandle (NSString category)
public static CoreFoundation.OSLog MakeLogHandle (NSString category)
{
var ptr = _MakeLogHandle (category);
return new OSLog (ptr, owns: true);
return new CoreFoundation.OSLog (ptr, owns: true);
}
}
}
#endif
1 change: 1 addition & 0 deletions src/frameworks.sources
Original file line number Diff line number Diff line change
Expand Up @@ -1979,6 +1979,7 @@ MAC_FRAMEWORKS = \
Metal \
MetalKit \
MetalPerformanceShaders \
MetricKit \
MLCompute \
MobileCoreServices \
ModelIO \
Expand Down
64 changes: 47 additions & 17 deletions src/metrickit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ interface MXUnitAveragePixelLuminance : NSUnit {
MXUnitAveragePixelLuminance Apl { get; }
}

[NoWatch, NoTV, NoMac, iOS (13,0)]
[NoWatch, NoTV, Mac (12,0), iOS (13,0)]
[BaseType (typeof(NSObject))]
interface MXHistogramBucket<UnitType> : NSSecureCoding
where UnitType : NSUnit {
Expand All @@ -101,7 +101,7 @@ interface MXHistogramBucket<UnitType> : NSSecureCoding
nuint BucketCount { get; }
}

[NoWatch, NoTV, NoMac, iOS (13,0)]
[NoWatch, NoTV, Mac (12,0), iOS (13,0)]
[BaseType (typeof(NSObject))]
interface MXHistogram<UnitType> : NSSecureCoding
where UnitType : NSUnit {
Expand All @@ -119,7 +119,7 @@ interface MXCellularConditionMetric {
MXHistogram<MXUnitSignalBars> HistogrammedCellularConditionTime { get; }
}

[NoWatch, NoTV, NoMac, iOS (13,0)]
[NoWatch, NoTV, Mac (12,0), iOS (13,0)]
[BaseType (typeof(NSObject))]
interface MXMetaData : NSSecureCoding {
[Export ("regionFormat", ArgumentSemantic.Strong)]
Expand All @@ -137,6 +137,7 @@ interface MXMetaData : NSSecureCoding {
[Export ("JSONRepresentation")]
NSData JsonRepresentation { get; }

#if !MONOMAC
[Internal]
[Deprecated (PlatformName.iOS, 14,0)]
[Export ("DictionaryRepresentation")]
Expand All @@ -147,6 +148,10 @@ interface MXMetaData : NSSecureCoding {
[MacCatalyst (14,0)]
[Export ("dictionaryRepresentation")]
NSDictionary _DictionaryRepresentation14 { get; }
#else
[Export ("dictionaryRepresentation")]
NSDictionary DictionaryRepresentation { get; }
#endif

[iOS (14,0)]
[MacCatalyst (14,0)]
Expand Down Expand Up @@ -232,7 +237,7 @@ interface MXDiskIOMetric {
NSMeasurement<NSUnitInformationStorage> CumulativeLogicalWrites { get; }
}

[NoWatch, NoTV, NoMac, iOS (13,0)]
[NoWatch, NoTV, Mac (12,0), iOS (13,0)]
[BaseType (typeof(NSObject))]
[DisableDefaultCtor]
interface MXAverage<UnitType> : NSSecureCoding
Expand Down Expand Up @@ -278,6 +283,11 @@ interface MXSignpostIntervalData : NSSecureCoding {

[NullAllowed, Export ("cumulativeLogicalWrites", ArgumentSemantic.Strong)]
NSMeasurement<NSUnitInformationStorage> CumulativeLogicalWrites { get; }

[NullAllowed]
[NoWatch, NoTV, NoMac, iOS (15,0), NoMacCatalyst]
[Export ("cumulativeHitchTimeRatio", ArgumentSemantic.Strong)]
NSMeasurement<NSUnit> CumulativeHitchTimeRatio { get; }
}

[NoWatch, NoTV, NoMac, iOS (13,0)]
Expand Down Expand Up @@ -311,39 +321,51 @@ interface MXMetricPayload : NSSecureCoding {
[Export ("timeStampEnd", ArgumentSemantic.Strong)]
NSDate TimeStampEnd { get; }

[NoMac]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: not needed, there's a [NoMac] on the type-level

[NullAllowed, Export ("cpuMetrics", ArgumentSemantic.Strong)]
MXCpuMetric CpuMetrics { get; }

[NoMac]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: not needed, there's a [NoMac] on the type-level

[NullAllowed, Export ("gpuMetrics", ArgumentSemantic.Strong)]
MXGpuMetric GpuMetrics { get; }

[NoMac]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: not needed, there's a [NoMac] on the type-level

[NullAllowed, Export ("cellularConditionMetrics", ArgumentSemantic.Strong)]
MXCellularConditionMetric CellularConditionMetrics { get; }

[NoMac]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: not needed, there's a [NoMac] on the type-level

[NullAllowed, Export ("applicationTimeMetrics", ArgumentSemantic.Strong)]
MXAppRunTimeMetric ApplicationTimeMetrics { get; }

[NoMac]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: not needed, there's a [NoMac] on the type-level

[NullAllowed, Export ("locationActivityMetrics", ArgumentSemantic.Strong)]
MXLocationActivityMetric LocationActivityMetrics { get; }

[NoMac]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: not needed, there's a [NoMac] on the type-level

[NullAllowed, Export ("networkTransferMetrics", ArgumentSemantic.Strong)]
MXNetworkTransferMetric NetworkTransferMetrics { get; }

[NoMac]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: not needed, there's a [NoMac] on the type-level

[NullAllowed, Export ("applicationLaunchMetrics", ArgumentSemantic.Strong)]
MXAppLaunchMetric ApplicationLaunchMetrics { get; }

[NoMac]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: not needed, there's a [NoMac] on the type-level

[NullAllowed, Export ("applicationResponsivenessMetrics", ArgumentSemantic.Strong)]
MXAppResponsivenessMetric ApplicationResponsivenessMetrics { get; }

[NoMac]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: not needed, there's a [NoMac] on the type-level

[NullAllowed, Export ("diskIOMetrics", ArgumentSemantic.Strong)]
MXDiskIOMetric DiskIOMetrics { get; }

[NoMac]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: not needed, there's a [NoMac] on the type-level

[NullAllowed, Export ("memoryMetrics", ArgumentSemantic.Strong)]
MXMemoryMetric MemoryMetrics { get; }

[NoMac]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: not needed, there's a [NoMac] on the type-level

[NullAllowed, Export ("displayMetrics", ArgumentSemantic.Strong)]
MXDisplayMetric DisplayMetrics { get; }

[NoMac]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: not needed, there's a [NoMac] on the type-level

[NullAllowed, Export ("signpostMetrics", ArgumentSemantic.Strong)]
MXSignpostMetric[] SignpostMetrics { get; }

Expand All @@ -352,7 +374,7 @@ interface MXMetricPayload : NSSecureCoding {

[Export ("JSONRepresentation")]
NSData JsonRepresentation { get; }

#if !MONOMAC
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: not needed, there's a [NoMac] on the type-level

[Internal]
[Deprecated (PlatformName.iOS, 14,0)]
[Export ("DictionaryRepresentation")]
Expand All @@ -363,24 +385,29 @@ interface MXMetricPayload : NSSecureCoding {
[MacCatalyst (14,0)]
[Export ("dictionaryRepresentation")]
NSDictionary _DictionaryRepresentation14 { get; }
#else
[Export ("dictionaryRepresentation")]
NSDictionary DictionaryRepresentation { get; }
#endif

[iOS (14,0)]
[NoMac, iOS (14,0)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: not needed, there's a [NoMac] on the type-level

[MacCatalyst (14,0)]
[NullAllowed]
[Export ("animationMetrics", ArgumentSemantic.Strong)]
MXAnimationMetric AnimationMetrics { get; }

[iOS (14,0)]
[NoMac, iOS (14,0)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: not needed, there's a [NoMac] on the type-level

[MacCatalyst (14,0)]
[NullAllowed]
[Export ("applicationExitMetrics", ArgumentSemantic.Strong)]
MXAppExitMetric ApplicationExitMetrics { get; }
}

[NoWatch, NoTV, NoMac, iOS (13,0)]
[NoWatch, NoTV, Mac (12,0), iOS (13,0)]
[BaseType (typeof(NSObject))]
[DisableDefaultCtor]
interface MXMetricManager {
[NoMac]
[Export ("pastPayloads", ArgumentSemantic.Strong)]
MXMetricPayload[] PastPayloads { get; }

Expand All @@ -407,10 +434,13 @@ interface MXMetricManager {

interface IMXMetricManagerSubscriber { }

[NoWatch, NoTV, NoMac, iOS (13,0)]
[NoWatch, NoTV, Mac (12,0), iOS (13,0)]
[Protocol]
interface MXMetricManagerSubscriber {
#if !XAMCORE_4
mandel-macaque marked this conversation as resolved.
Show resolved Hide resolved
[Abstract]
#endif
[NoMac]
[Export ("didReceiveMetricPayloads:")]
void DidReceiveMetricPayloads (MXMetricPayload[] payloads);

Expand Down Expand Up @@ -508,7 +538,7 @@ interface MXForegroundExitData : NSSecureCoding {
nuint CumulativeAppWatchdogExitCount { get; }
}

[NoWatch, NoTV, NoMac]
[NoWatch, NoTV, Mac (12,0)]
[iOS (14,0)]
[MacCatalyst (14,0)]
[BaseType (typeof (NSObject))]
Expand All @@ -519,7 +549,7 @@ interface MXCallStackTree : NSSecureCoding {
NSData JsonRepresentation { get; }
}

[NoWatch, NoTV, NoMac]
[NoWatch, NoTV, Mac (12,0)]
[iOS (14,0)]
[MacCatalyst (14,0)]
[BaseType (typeof (MXDiagnostic), Name = "MXCPUExceptionDiagnostic")]
Expand All @@ -536,7 +566,7 @@ interface MXCpuExceptionDiagnostic {
NSMeasurement<NSUnitDuration> TotalSampledTime { get; }
}

[NoWatch, NoTV, NoMac]
[NoWatch, NoTV, Mac (12,0)]
[iOS (14,0)]
[MacCatalyst (14,0)]
[BaseType (typeof (MXDiagnostic))]
Expand Down Expand Up @@ -568,7 +598,7 @@ interface MXCrashDiagnostic {
NSNumber Signal { get; }
}

[NoWatch, NoTV, NoMac]
[NoWatch, NoTV, Mac (12,0)]
[iOS (14,0)]
[MacCatalyst (14,0)]
[BaseType (typeof (NSObject))]
Expand All @@ -588,7 +618,7 @@ interface MXDiagnostic : NSSecureCoding {
NSDictionary DictionaryRepresentation { get; }
}

[NoWatch, NoTV, NoMac]
[NoWatch, NoTV, Mac (12,0)]
[iOS (14,0)]
[MacCatalyst (14,0)]
[BaseType (typeof (NSObject))]
Expand Down Expand Up @@ -620,7 +650,7 @@ interface MXDiagnosticPayload : NSSecureCoding {
NSDictionary DictionaryRepresentation { get; }
}

[NoWatch, NoTV, NoMac]
[NoWatch, NoTV, Mac (12,0)]
[iOS (14,0)]
[MacCatalyst (14,0)]
[BaseType (typeof (MXDiagnostic))]
Expand All @@ -634,7 +664,7 @@ interface MXDiskWriteExceptionDiagnostic {
NSMeasurement<NSUnitInformationStorage> TotalWritesCaused { get; }
}

[NoWatch, NoTV, NoMac]
[NoWatch, NoTV, Mac (12,0)]
[iOS (14,0)]
[MacCatalyst (14,0)]
[BaseType (typeof (MXDiagnostic))]
Expand All @@ -647,4 +677,4 @@ interface MXHangDiagnostic {
[Export ("hangDuration", ArgumentSemantic.Strong)]
NSMeasurement<NSUnitDuration> HangDuration { get; }
}
}
}
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Added for xamcore
mandel-macaque marked this conversation as resolved.
Show resolved Hide resolved
!incorrect-protocol-member! MXMetricManagerSubscriber::didReceiveMetricPayloads: is OPTIONAL and should NOT be abstract
!missing-selector! MXSignpostIntervalData::cumulativeHitchTimeRatio not bound
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Added for xamcore
mandel-macaque marked this conversation as resolved.
Show resolved Hide resolved
!incorrect-protocol-member! MXMetricManagerSubscriber::didReceiveMetricPayloads: is OPTIONAL and should NOT be abstract
!missing-selector! MXSignpostIntervalData::cumulativeHitchTimeRatio not bound
59 changes: 0 additions & 59 deletions tests/xtro-sharpie/macOS-MetricKit.todo

This file was deleted.

1 change: 1 addition & 0 deletions tools/common/Frameworks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ public static Frameworks MacFrameworks {
{ "AdServices", "AdServices", 11,1 },

{ "Chip", "CHIP", 12, 0 },
{ "MetricKit", 12, 0 },
};
}
return mac_frameworks;
Expand Down