Home iOS Development ios – SPM dependency between a number of packages

ios – SPM dependency between a number of packages

0

[ad_1]

I am attempting to create SPM hierarchy the place some packages have dependecies on different, like this:
Bundle A is Core bundle the place I additionally added dependencies to some exterior libraries and the place I hold most of my native code:

let bundle = Bundle(
    identify: "Core",
    platforms: [
      .iOS(.v14)
    ],
    merchandise: [
        // Products define the executables and libraries a package produces, and make them visible to other packages.
        .library(
            name: "Core",
            targets: ["Core"]),
    ],
    dependencies: [
      .package(url: "https://github.com/mxcl/PromiseKit", .exact("6.13.1")),
      .package(url: "https://github.com/PromiseKit/Foundation.git", from: "3.0.0"),
    ],
    targets: [
        .target(
            name: "Core",
            dependencies: [
                           .product(name: "PMKFoundation", package: "Foundation"),
                           "PromiseKit",
                          ]),
        .testTarget(
            identify: "CoreTests",
            dependencies: ["Core"]),
    ]
)

Then I’ve bundle B, which has dependency on native bundle A, this bundle has solely few lessons nevertheless it ought to have entry to exterior dependencies utilized by Core bundle:

let bundle = Bundle(
    identify: "Package_B",
    platforms: [
      .iOS(.v14)
    ],
    merchandise: [
        .library(
            name: "Package_B",
            targets: ["Package_B"]),
    ],
    dependencies: [
      .package(path: "../Core"),
    ],
    targets: [
        .target(
            name: "Package_B",
            dependencies: [
              "Core",
              "PromiseKit",
            ]),
        .testTarget(
            identify: "Package_BTests",
            dependencies: ["Package_B"]),
    ]
)

And Bundle C which has dependency on bundle B – it ought to has entry to code from bundle B, to code from Core bundle and to exterior dependencies from Core bundle:

let bundle = Bundle(
    identify: "Package_C",
    merchandise: [
        .library(
            name: "Package_C",
            targets: ["Package_C"]),
    ],
    dependencies: [
      .package(path: "../Package_B"),
      .package(url: "https://github.com/ZipArchive/ZipArchive.git", from: "2.2.0"),
    ],
    targets: [
        .target(
            name: "Package_C",
            dependencies: ["Core","Package_B", "PromiseKit", "ZipArchive"]),
        .testTarget(
            identify: "Package_CTests",
            dependencies: ["Package_C"]),
    ]
)

Downside which I’ve is that for begin Package_B is displaying error in xcode:

x-xcode-log://7C2F67D1-F6A1-4BE1-8E94-DC7E769241AD product 'PromiseKit' required by bundle 'Package_B' goal 'Package_B' not discovered.

I can add this line to Package_B dependency nevertheless it won’t clear up the difficulty:

.bundle(url: "https://github.com/mxcl/PromiseKit", .actual("6.13.1")),

I can then attempt to compile the code however I received antoher errors like:

No such module 'PromiseKit'
No such module 'Core'

After I’m attempting to Import these modules

Has anybody has some concept easy methods to create a tree of dependecies between native packages which could be later utilized in a number of tasks?

[ad_2]