Skip to content

Commit

Permalink
Revert "Merge branch 'core_data_migration'" (#175)
Browse files Browse the repository at this point in the history
Co-authored-by: Ariel Demarco <ariel.demarco@embrace.io>
  • Loading branch information
NachoEmbrace and ArielDemarco authored Feb 6, 2025
1 parent 0eeb747 commit 9faecc3
Show file tree
Hide file tree
Showing 144 changed files with 5,812 additions and 2,863 deletions.
6 changes: 6 additions & 0 deletions EmbraceIO.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,14 @@ Pod::Spec.new do |spec|
storage.vendored_frameworks = "xcframeworks/EmbraceStorageInternal.xcframework"
storage.dependency "EmbraceIO/EmbraceCommonInternal"
storage.dependency "EmbraceIO/EmbraceSemantics"
storage.dependency "EmbraceIO/GRDB"
end

spec.subspec 'EmbraceUploadInternal' do |upload|
upload.vendored_frameworks = "xcframeworks/EmbraceUploadInternal.xcframework"
upload.dependency "EmbraceIO/EmbraceCommonInternal"
upload.dependency "EmbraceIO/EmbraceOTelInternal"
upload.dependency "EmbraceIO/GRDB"
end

spec.subspec 'EmbraceCrashlyticsSupport' do |cs|
Expand Down Expand Up @@ -108,6 +110,10 @@ Pod::Spec.new do |spec|
otelSdk.dependency "EmbraceIO/OpenTelemetryApi"
end

spec.subspec 'GRDB' do |grdb|
grdb.vendored_frameworks = "xcframeworks/GRDB.xcframework"
end

spec.subspec 'KSCrash' do |kscrash|
kscrash.dependency "EmbraceIO/KSCrashCore"
kscrash.dependency "EmbraceIO/KSCrashRecording"
Expand Down
9 changes: 9 additions & 0 deletions Package.resolved
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
{
"pins" : [
{
"identity" : "grdb.swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/groue/GRDB.swift.git",
"state" : {
"revision" : "dd6b98ce04eda39aa22f066cd421c24d7236ea8a",
"version" : "6.29.1"
}
},
{
"identity" : "grpc-swift",
"kind" : "remoteSourceControl",
Expand Down
23 changes: 14 additions & 9 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import PackageDescription

let packageSettings = PackageSettings(
productTypes: [
"GRDB": .framework,
"KSCrash": .framework,
"OpenTelemetrySdk": .framework,
"OpenTelemetryApi": .framework
Expand Down Expand Up @@ -36,6 +37,10 @@ let package = Package(
.package(
url: "https://github.com/open-telemetry/opentelemetry-swift",
exact: "1.13.0"
),
.package(
url: "https://github.com/groue/GRDB.swift",
.upToNextMinor(from: "6.29.1")
)
],
targets: [
Expand All @@ -57,7 +62,8 @@ let package = Package(
"EmbraceIO",
"EmbraceCore",
"EmbraceCrash",
"TestSupport"
"TestSupport",
.product(name: "GRDB", package: "GRDB.swift")
]
),

Expand Down Expand Up @@ -85,7 +91,8 @@ let package = Package(
dependencies: [
"EmbraceCore",
"TestSupport",
"TestSupportObjc"
"TestSupportObjc",
.product(name: "GRDB", package: "GRDB.swift")
],
resources: [
.copy("Mocks/")
Expand All @@ -94,10 +101,7 @@ let package = Package(

// common --------------------------------------------------------------------
.target(
name: "EmbraceCommonInternal",
dependencies: [
.product(name: "OpenTelemetrySdk", package: "opentelemetry-swift")
]
name: "EmbraceCommonInternal"
),
.testTarget(
name: "EmbraceCommonInternalTests",
Expand Down Expand Up @@ -186,8 +190,8 @@ let package = Package(
name: "EmbraceStorageInternal",
dependencies: [
"EmbraceCommonInternal",
"EmbraceCoreDataInternal",
"EmbraceSemantics"
"EmbraceSemantics",
.product(name: "GRDB", package: "GRDB.swift")
]
),
.testTarget(
Expand All @@ -204,7 +208,8 @@ let package = Package(
dependencies: [
"EmbraceCommonInternal",
"EmbraceOTelInternal",
"EmbraceCoreDataInternal"
"EmbraceCoreDataInternal",
.product(name: "GRDB", package: "GRDB.swift")
]
),
.testTarget(
Expand Down
6 changes: 4 additions & 2 deletions Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,8 @@ let project = Project(
dependencies: [
.target(name: "EmbraceCommonInternal"),
.target(name: "EmbraceSemantics"),
.external(name: "OpenTelemetryApi")
.external(name: "OpenTelemetryApi"),
.external(name: "GRDB")
],
settings: .settings(base: [
"SKIP_INSTALL": "NO",
Expand All @@ -167,7 +168,8 @@ let project = Project(
sources: ["Sources/EmbraceUploadInternal/**"],
dependencies: [
.target(name: "EmbraceCommonInternal"),
.target(name: "EmbraceOTelInternal")
.target(name: "EmbraceOTelInternal"),
.external(name: "GRDB")
],
settings: .settings(base: [
"SKIP_INSTALL": "NO",
Expand Down
28 changes: 0 additions & 28 deletions Sources/EmbraceCommonInternal/Storage/Model/EmbraceLog.swift

This file was deleted.

This file was deleted.

49 changes: 0 additions & 49 deletions Sources/EmbraceCommonInternal/Storage/Model/EmbraceMetadata.swift

This file was deleted.

30 changes: 0 additions & 30 deletions Sources/EmbraceCommonInternal/Storage/Model/EmbraceSession.swift

This file was deleted.

26 changes: 0 additions & 26 deletions Sources/EmbraceCommonInternal/Storage/Model/EmbraceSpan.swift

This file was deleted.

4 changes: 2 additions & 2 deletions Sources/EmbraceCore/Capture/CaptureServices.swift
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ final class CaptureServices {
}

@objc func onSessionStart(notification: Notification) {
if let session = notification.object as? EmbraceSession {
crashReporter?.currentSessionId = session.idRaw
if let session = notification.object as? SessionRecord {
crashReporter?.currentSessionId = session.id.toString
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class NetworkPayloadCaptureHandler {
active = true
rulesTriggeredMap.removeAll()

currentSessionId = (notification.object as? EmbraceSession)?.id
currentSessionId = (notification.object as? SessionRecord)?.id
}

@objc func onSessionEnd() {
Expand Down
20 changes: 13 additions & 7 deletions Sources/EmbraceCore/Capture/ResourceCaptureService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,18 @@ class ResourceCaptureService: CaptureService {

extension EmbraceStorage: ResourceCaptureServiceHandler {
func addResource(key: String, value: AttributeValue) {
_ = addMetadata(
key: key,
value: value.description,
type: .requiredResource,
lifespan: .process,
lifespanId: ProcessIdentifier.current.hex
)
do {
_ = try addMetadata(
MetadataRecord(
key: key,
value: value,
type: .requiredResource,
lifespan: .process,
lifespanId: ProcessIdentifier.current.hex
)
)
} catch {
Embrace.logger.error("Failed to capture resource: \(error.localizedDescription)")
}
}
}
2 changes: 1 addition & 1 deletion Sources/EmbraceCore/Embrace.swift
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ To start the SDK you first need to configure it using an `Embrace.Options` insta
return nil
}

return sessionController.currentSession?.idRaw
return sessionController.currentSession?.id.toString
}

/// Returns the current device identifier.
Expand Down
4 changes: 2 additions & 2 deletions Sources/EmbraceCore/Internal/Embrace+Setup.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ extension Embrace {
partitionId: partitionId,
appGroupId: options.appGroupId
) {
let storageMechanism: StorageMechanism = .onDisk(name: "EmbraceStorage", baseURL: storageUrl)
let storageOptions = EmbraceStorage.Options(storageMechanism: storageMechanism)
let storageOptions = EmbraceStorage.Options(baseUrl: storageUrl, fileName: "db.sqlite")
let storage = try EmbraceStorage(options: storageOptions, logger: Embrace.logger)
try storage.performMigration()
return storage
} else {
throw EmbraceSetupError.failedStorageCreation(partitionId: partitionId, appGroupId: options.appGroupId)
Expand Down
Loading

0 comments on commit 9faecc3

Please sign in to comment.