newrelic / newrelic-ios-agent-spm

This repository hosts the Swift Package Manager deployment of the iOS agent
Apache License 2.0
15 stars 9 forks source link

New Relic cannot be used in another swift package as a dependency #44

Open darwinmorocho-deuna opened 4 months ago

darwinmorocho-deuna commented 4 months ago

I am trying to use new relic in my swift package. This is my Package.swift file

let package = Package(
    name: "DeunaSDK",
    platforms: [
           .iOS(.v11)  // This specifies that the package is compatible with iOS 13 and later versions
       ],
    products: [
        // Products define the executables and libraries a package produces, making them visible to other packages.
        .library(
            name: "DeunaSDK",
            targets: ["DeunaSDK"]),
    ],
    dependencies: [
        // Dependencies declare other packages that this package depends on.
        .package(url: "https://github.com/DUNA-E-Commmerce/deuna-ios-client", .upToNextMajor(from: "1.0.0")),
        .package(url: "https://github.com/newrelic/newrelic-ios-agent-spm", .upToNextMajor(from: "7.4.9")),
    ],
    targets: [
        // Targets are the basic building blocks of a package, defining a module or a test suite.
        // Targets can depend on other targets in this package and products from dependencies.
        .target(
            name: "DeunaSDK", 
            dependencies: ["deuna-ios-client","NewRelic" ], // NewRelic is not detected
            path: "Sources/DeunaSDK"),
        .testTarget(
            name: "DeunaSDKTests",
            dependencies: ["DeunaSDK"]),
    ]
)

The problem is solved if I use the name parameter (Deprecated)

 .package(name:"newRelic", url: "https://github.com/newrelic/newrelic-ios-agent-spm", .upToNextMajor(from: "7.4.9")),
cdillard-NewRelic commented 2 months ago

Thank you for bringing this to our attention. I will investigate what can be done from the agent side to better document the solution you found or fix from our side.