Skip to content

Commit 510cd2c

Browse files
committed
RUM-7285 Add api-surface step to Lint stage
1 parent 004ca93 commit 510cd2c

File tree

3 files changed

+56
-13
lines changed

3 files changed

+56
-13
lines changed

.gitlab-ci.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,17 @@ Lint:
9191
- make clean repo-setup ENV=ci
9292
- make lint license-check
9393
- make rum-models-verify sr-models-verify
94+
- make api-surface ENV=ci
95+
- if ! diff api-surface-swift api-surface-swift-generated; then
96+
echo "❌ Swift API surface mismatch";
97+
echo "👉 Run \`make api-surface\` locally to update \`api-surface-swift\` and commit the changes.";
98+
exit 1;
99+
fi
100+
- if ! diff api-surface-objc api-surface-objc-generated; then
101+
echo "❌ Objective-C API surface mismatch";
102+
echo "👉 Run \`make api-surface\` locally to update \`api-surface-objc\` and commit the changes.";
103+
exit 1;
104+
fi
94105

95106
Unit Tests (iOS):
96107
stage: test

Makefile

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,9 +356,21 @@ sr-snapshot-tests-open:
356356
@$(ECHO_TITLE) "make sr-snapshot-tests-open"
357357
./tools/sr-snapshot-test.sh --open-project
358358

359+
# Define default paths for API output files
360+
SWIFT_OUTPUT_PATH ?= api-surface-swift
361+
OBJC_OUTPUT_PATH ?= api-surface-objc
362+
363+
# Use different paths when running in CI
364+
ifeq ($(ENV),ci)
365+
SWIFT_OUTPUT_PATH := api-surface-swift-generated
366+
OBJC_OUTPUT_PATH := api-surface-objc-generated
367+
endif
368+
359369
# Generate api-surface files for Datadog and DatadogObjc.
360370
api-surface:
371+
@echo "ENV variable is set to: $(ENV)"
361372
@echo "Generating api-surface-swift"
373+
@echo "SWIFT_OUTPUT_PATH: $(SWIFT_OUTPUT_PATH)"
362374
@cd tools/api-surface && \
363375
swift run api-surface spm \
364376
--path ../../ \
@@ -369,15 +381,16 @@ api-surface:
369381
--library-name DatadogCrashReporting \
370382
--library-name DatadogWebViewTracking \
371383
--library-name DatadogSessionReplay \
372-
> ../../api-surface-swift && \
384+
> ../../$(SWIFT_OUTPUT_PATH) && \
373385
cd -
374386

375387
@echo "Generating api-surface-objc"
388+
@echo "OBJC_OUTPUT_PATH: $(OBJC_OUTPUT_PATH)"
376389
@cd tools/api-surface && \
377390
swift run api-surface spm \
378391
--path ../../ \
379392
--library-name DatadogObjc \
380-
> ../../api-surface-objc && \
393+
> ../../$(OBJC_OUTPUT_PATH) && \
381394
cd -
382395

383396
# Generate Datadog monitors terraform definition for E2E tests:

api-surface-swift

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,24 @@ public struct SpanEvent: Encodable
284284
public let applicationVersion: String
285285
public let networkConnectionInfo: NetworkConnectionInfo?
286286
public let mobileCarrierInfo: CarrierInfo?
287+
public struct DeviceInfo: Codable
288+
public enum DeviceType: String, Codable
289+
case mobile = "mobile"
290+
case tablet = "tablet"
291+
case tv = "tv"
292+
case other = "other"
293+
public let brand: String
294+
public let name: String
295+
public let model: String
296+
public let architecture: String
297+
public let type: DeviceType
298+
public let deviceInfo: DeviceInfo
299+
public struct OperatingSystemInfo: Codable
300+
public let name: String
301+
public let version: String
302+
public let build: String?
303+
public let versionMajor: String
304+
public let osInfo: OperatingSystemInfo
287305
public struct UserInfo
288306
public let id: String?
289307
public let name: String?
@@ -2094,11 +2112,11 @@ public typealias WireframeID = NodeID
20942112
public class SessionReplayWireframesBuilder
20952113
public struct FontOverride
20962114
public init(size: CGFloat?)
2097-
public func createShapeWireframe(id: WireframeID,frame: CGRect,clip: SRContentClip? = nil,borderColor: CGColor? = nil,borderWidth: CGFloat? = nil,backgroundColor: CGColor? = nil,cornerRadius: CGFloat? = nil,opacity: CGFloat? = nil) -> SRWireframe
2098-
public func createImageWireframe(id: WireframeID,resource: SessionReplayResource,frame: CGRect,mimeType: String = "png",clip: SRContentClip? = nil,borderColor: CGColor? = nil,borderWidth: CGFloat? = nil,backgroundColor: CGColor? = nil,cornerRadius: CGFloat? = nil,opacity: CGFloat? = nil) -> SRWireframe
2099-
public func createTextWireframe(id: WireframeID,frame: CGRect,text: String,textFrame: CGRect? = nil,textAlignment: SRTextPosition.Alignment? = nil,clip: SRContentClip? = nil,textColor: CGColor? = nil,font: UIFont? = nil,fontOverride: FontOverride? = nil,fontScalingEnabled: Bool = false,borderColor: CGColor? = nil,borderWidth: CGFloat? = nil,backgroundColor: CGColor? = nil,cornerRadius: CGFloat? = nil,opacity: CGFloat? = nil) -> SRWireframe
2100-
public func createPlaceholderWireframe(id: Int64,frame: CGRect,label: String,clip: SRContentClip? = nil) -> SRWireframe
2101-
public func visibleWebViewWireframe(id: Int,frame: CGRect,clip: SRContentClip? = nil,borderColor: CGColor? = nil,borderWidth: CGFloat? = nil,backgroundColor: CGColor? = nil,cornerRadius: CGFloat? = nil,opacity: CGFloat? = nil) -> SRWireframe
2115+
public func createShapeWireframe(id: WireframeID,frame: CGRect,clip: CGRect,borderColor: CGColor? = nil,borderWidth: CGFloat? = nil,backgroundColor: CGColor? = nil,cornerRadius: CGFloat? = nil,opacity: CGFloat? = nil) -> SRWireframe
2116+
public func createImageWireframe(id: WireframeID,resource: SessionReplayResource,frame: CGRect,clip: CGRect,mimeType: String = "png",borderColor: CGColor? = nil,borderWidth: CGFloat? = nil,backgroundColor: CGColor? = nil,cornerRadius: CGFloat? = nil,opacity: CGFloat? = nil) -> SRWireframe
2117+
public func createTextWireframe(id: WireframeID,frame: CGRect,clip: CGRect,text: String,textFrame: CGRect? = nil,textAlignment: SRTextPosition.Alignment? = nil,textColor: CGColor? = nil,font: UIFont? = nil,fontOverride: FontOverride? = nil,fontScalingEnabled: Bool = false,borderColor: CGColor? = nil,borderWidth: CGFloat? = nil,backgroundColor: CGColor? = nil,cornerRadius: CGFloat? = nil,opacity: CGFloat? = nil) -> SRWireframe
2118+
public func createPlaceholderWireframe(id: Int64,frame: CGRect,clip: CGRect,label: String) -> SRWireframe
2119+
public func visibleWebViewWireframe(id: Int,frame: CGRect,clip: CGRect,borderColor: CGColor? = nil,borderWidth: CGFloat? = nil,backgroundColor: CGColor? = nil,cornerRadius: CGFloat? = nil,opacity: CGFloat? = nil) -> SRWireframe
21022120
public func hiddenWebViewWireframes() -> [SRWireframe]
21032121
[?] extension SRContentClip
21042122
public static func create(bottom: Int64?,left: Int64?,right: Int64?,top: Int64?) -> SRContentClip
@@ -2138,12 +2156,13 @@ public protocol SessionReplayResource
21382156
func calculateIdentifier() -> String
21392157
func calculateData() -> Data
21402158
public struct SessionReplayViewAttributes: Equatable
2141-
public let frame: CGRect
2142-
public let backgroundColor: CGColor?
2143-
public let layerBorderColor: CGColor?
2144-
public let layerBorderWidth: CGFloat
2145-
public let layerCornerRadius: CGFloat
2146-
public let alpha: CGFloat
2159+
public internal(set) var frame: CGRect
2160+
public internal(set) var clip: CGRect
2161+
public internal(set) var backgroundColor: CGColor?
2162+
public internal(set) var layerBorderColor: CGColor?
2163+
public internal(set) var layerBorderWidth: CGFloat
2164+
public internal(set) var layerCornerRadius: CGFloat
2165+
public internal(set) var alpha: CGFloat
21472166
public protocol SessionReplayNodeSemantics
21482167
static var importance: Int
21492168
var subtreeStrategy: SessionReplayNodeSubtreeStrategy

0 commit comments

Comments
 (0)