dd-sdk-ios
dd-sdk-ios copied to clipboard
Setup Datadog with SPM as a binaryTarget
Describe the issue
Hello,
I would like to setup Datadog as a binaryTarget. My framework has the following package :
let package = Package(
name: "WireAnalytics",
platforms: [.iOS(.v15), .macOS(.v12)],
products: [
.library(name: "WireAnalytics", targets: ["WireAnalytics"]),
.library(name: "WireDatadog", targets: ["WireDatadog"])
],
targets: [
.target(
name: "WireAnalytics",
dependencies: resolveWireAnalyticsDependencies()
),
.target(
name: "WireDatadog",
dependencies: [
.target(name: "Datadog")
]
),
.binaryTarget(
name: "Datadog",
url: "https://github.com/DataDog/dd-sdk-ios/releases/download/2.18.0/Datadog.xcframework.zip",
checksum: "f912efbb162e822f830dd5f82de15b444af564b4df2c23cf3a08621c63252e0b"
)
]
)
func resolveWireAnalyticsDependencies() -> [Target.Dependency] {
// You can enable/disable Datadog for debugging by overriding the boolean.
if hasEnvironmentVariable("ENABLE_DATADOG", "true") {
["WireDatadog"]
} else {
[]
}
}
The issue I get is that when i try importing one of the module like (import DatadogCore) the compiler doesn't find the module.
Any idea how to expose these modules when using the XCFramework directly?
Reproduction steps
use the Package.swift definied in description
Device Information
No response
SDK version
2.18.0
Integration Methods
SPM
Xcode Version
Xcode 15.4
Swift Version
No response
MacOS Version
No response
Deployment Target
No response
Other relevant information
No response
Hi @netbe
I did some testing and it seems like some SPM limitation where it can't understand the xcframeworks which are nested inside a zip.
I unzipped and put beside the Package.swift and able to link them through binary targets.
That said, I would not recommend this approach of mixing xcframekwork and SPM as you will lead to other unknown problem (eg module scframeowtability, swift version etc). Hence, we provide support for CP, Carthage, xcf and SPM and keep the integration simple and not mix-match.
Also, what's the intent behind the current approach of using binary target in SPM?
Hi, I'm closing this issue as there hasn't been any recent activity. Feel free to reopen it if the problem persists or if you have any further questions.