I get "no such module" errors when trying to build after doing a "Clean Build Folder". Repeatedly trying to build eventually results in no errors.
IMPORTANT: The modules that can not be found are local packages with Swift Package Manager, i.e. not downloaded from git. I'm specifying these dependencies like this:
.package(url: "file:../CoreGraphicsExtensions", from: "0.0.0")
As seen in my /UIKitExtensions/Package.swift
file listed here:
// swift-tools-version: 5.6
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "UIKitExtensions",
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
name: "UIKitExtensions",
targets: ["UIKitExtensions"]),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
.package(url: "file:../CoreGraphicsExtensions", from: "0.0.0")
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "UIKitExtensions",
dependencies: []),
.testTarget(
name: "UIKitExtensionsTests",
dependencies: ["UIKitExtensions"]),
]
)
Here is what I see in Xcode when I am trying to build.
First build...
Second Build...
Third Build...
Fourth Build...
Fifth Build...
... finally it runs.
But there are some strange warnings about the packages not being used by any target.
How can I get this to build correctly first time after a clean build?
My workspace structure looks like this...
Two projects in the workspace. BlenderViewer has the target I'm building. BlenderViewer has 6 local SPM packages. It also imports the PhyKit project as a framework, no problems there. The SPM packages have some dependencies between each other, but nothing circular.
Everything looks fine to me...
I'm running MacOS 12.5. Xcode 13.4.1. Building for iOS 15.3.
Am I doing something wrong here?