UPDATE: I gave it a couple of days, with no answers, so I will be starting to modify the repos, in an effort to fix the problem (I'll get it, eventually).
I am absolutely sure that "I'm not holding it right," but there's no way for me to diagnose the issue.
I have also made a similar post on the Swift Forums.
I have this package, which is consumed by this package, which is, in turn, consumed by this app. The first package is also consumed by this package, which is also consumed by the app. That chain works fine, but is also a great deal simpler.
The issue is that I get an error inside the RVS_BlueThoth package during the BlueVanClef build.
The error is consistent with the RVS_Generic_Swift_Toolbox package not building in the RVS_BlueThoth package build (the module is not available), but I can't figure out why. There is nothing but a blank serialized diagnostics file for one of the files that consumes the RVS_Generic_Swift_Toolbox module, and no other errors, other than the file isn't there.
If I build the RVS_BlueThoth package independently, I have no issues, but including it in the BlueVanClef app consistently reports this error.
Like I said, I am sure that the problem is mine. I just can't figure out how to get to it.
Thanks for any help!
(For example, is there any diagnostic utility available for SPM?)
Here's a diagram of the dependencies:
Note the dotted line between RVS_BlueThoth and RVS_Persistent_Prefs. That's because the dependency is only for test harnesses, and is not used by Blue Van Clef.
Here are the various Package.swift Files:
// swift-tools-version:5.2
import PackageDescription
let package = Package(
name: "RVS_Generic_Swift_Toolbox",
platforms: [
.iOS(.v11),
.tvOS(.v11),
.macOS(.v10_14),
.watchOS(.v5)
],
products: [
.library(
name: "RVS-Generic-Swift-Toolbox",
type: .dynamic,
targets: ["RVS_Generic_Swift_Toolbox"])
],
targets: [
.target(
name: "RVS_Generic_Swift_Toolbox",
path: "./src")
]
)
RVS_Persistent_Prefs (This one works):
// swift-tools-version:5.2
import PackageDescription
let package = Package(
name: "RVS_Persistent_Prefs",
platforms: [
.iOS(.v11),
.tvOS(.v11),
.macOS(.v10_14),
.watchOS(.v5)
],
products: [
.library(
name: "RVS-Persistent-Prefs",
type: .dynamic,
targets: ["RVS_Persistent_Prefs"])
],
dependencies: [
.package(
url: "git@github.com:RiftValleySoftware/RVS_Generic_Swift_Toolbox.git",
from: "1.2.1"
)
],
targets: [
.target(
name: "RVS_Persistent_Prefs",
path: "./src")
]
)
RVS_BlueThoth (This one does not work):
// swift-tools-version:5.2
import PackageDescription
let package = Package(
name: "RVS_BlueThoth",
platforms: [
.iOS(.v11),
.tvOS(.v11),
.macOS(.v10_14),
.watchOS(.v5)
],
products: [
.library(
name: "RVS-BlueThoth",
type: .dynamic,
targets: ["RVS_BlueThoth"]
)
],
dependencies: [
.package(
url: "git@github.com:RiftValleySoftware/RVS_Generic_Swift_Toolbox.git",
from: "1.2.1"
),
.package(
url: "git@github.com:RiftValleySoftware/RVS_PersistentPrefs.git",
from: "1.1.1"
)
],
targets: [
.target(
name: "RVS_BlueThoth",
path: "./src/Source"
)
]
)
OK. Solved. Finally.
I was, indeed, "holding it wrong," but it was not easy to tell.
The best way to debug was to cd
to the package directory, and do a swift build
. That helped me to see the errors as they happened (They were not reflected in the Xcode logs).
The issue was that I needed to do the dependency in TWO places. I had it only in one. Now that I look back on it, it was a fairly natural structure, but was complicated by the fact that I needed to rename the product of the dependency to use dashes, instead of underscores.
This was fixed by changing the RVS_BlueThoth Package.swift file to like so:
// swift-tools-version:5.2
import PackageDescription
let package = Package(
name: "RVS_BlueThoth",
platforms: [
.iOS(.v11),
.tvOS(.v11),
.macOS(.v10_14),
.watchOS(.v5)
],
products: [
.library(name: "RVS-BlueThoth", type: .dynamic, targets: ["RVS_BlueThoth"])
],
dependencies: [
.package(name: "RVS_Generic_Swift_Toolbox", url: "git@github.com:RiftValleySoftware/RVS_Generic_Swift_Toolbox.git", from: "1.2.1")
],
targets: [
.target(
name: "RVS_BlueThoth",
dependencies: [.product(name: "RVS-Generic-Swift-Toolbox", package: "RVS_Generic_Swift_Toolbox")],
path: "./src/Source"
)
]
)
The money shot was this line:
dependencies: [.product(name: "RVS-Generic-Swift-Toolbox", package: "RVS_Generic_Swift_Toolbox")]
Note that the name
argument is "RVS-Generic-Swift-Toolbox"
, NOT "RVS_Generic_Swift_Toolbox"
, but the package name had the underscores (I probably could do without the name
argument in the global dependency list).
That is because I had to swap underscores for dashes in order to get the app to be accepted by the App Store.
I was also able to simplify the dependency chain a bit, because some dependencies were only required for test harnesses.
UPDATE: I wanted to mention that the thing that made it for me, was the error response from the swift build
command. It was awesome. It actually had the code that I needed to use. It was that response that showed me that I need to use dashes, mixed with underscores. That was not something that I was understanding.