Hi! I'm currently developing a swift package for the first time. I was trying to setup CI to run my tests but ran into an error locally. I can run my tests just fine in Xcode, but when using the xcodebuild
command line tool I get this error: "error: Build input file cannot be found:" Here's some additional info that may be useful.
Command
xcodebuild test -scheme Project -destination 'platform=macOS,arch=arm64' | xcpretty -s
Full output
--- xcodebuild: WARNING: Using the first of multiple matching destinations:
{ platform:macOS, arch:arm64, id:00006000-001658C63C23801E }
{ platform:macOS, arch:arm64, variant:Mac Catalyst, id:00006000-001658C63C23801E }
{ platform:macOS, arch:arm64, variant:DriverKit, id:00006000-001658C63C23801E }
❌ error: Build input file cannot be found: '/path/to/Project/Sources/Project/main.swift'. Did you forget to declare this file as an output of a script phase or custom build rule which produces it? (in target 'Project from project 'Project')
❌ error: Build input file cannot be found: '/path/to/Project/Sources/PRoject/main.swift'. Did you forget to declare this file as an output of a script phase or custom build rule which produces it? (in target 'Project from project 'Project')
Testing failed:
Build input file cannot be found: '/path/to/Project/Sources/Project/main.swift'. Did you forget to declare this file as an output of a script phase or custom build rule which produces it?
Testing cancelled because the build failed.
** TEST FAILED **
The following build commands failed:
SwiftDriver\ Compilation\ Requirements Project normal arm64 com.apple.xcode.tools.swift.compiler (in target 'Project' from project 'Project')
SwiftDriver\ Compilation Project normal arm64 com.apple.xcode.tools.swift.compiler (in target 'Project' from project 'Project')
(2 failures)
Package.swift
// swift-tools-version: 5.7
import PackageDescription
let package = Package(
name: "Project",
platforms: [
.macOS(.v12)
],
dependencies: [
.package(url: "https://github.com/apple/swift-syntax.git", exact: "0.50700.1"),
.package(url: "https://github.com/apple/swift-argument-parser.git", from: "1.2.1")
],
targets: [
.executableTarget(
name: "Project",
dependencies: [
.product(name: "SwiftSyntax", package: "swift-syntax"),
.product(name: "ArgumentParser", package: "swift-argument-parser")
]
),
.testTarget(
name: "ProjectTests",
dependencies: ["Project"]),
]
)