I want to ensure that the main & test source of my macOS-only SwiftPM project (on GitHub at mas) builds via swift
, xcodebuild
& Xcode.
For builds of clean clones of the main branch (i.e. no locally edited files, no existing .build
or .swiftpm
folders, etc.):
The swift
command line below builds main & test fine:
swift build --build-tests
The xcodebuild
command line below doesn't seem to run the SwiftPM MASBuildToolPlugin
(which generates a Swift file necessary for the build), which is setup for the project in Package.swift
, so neither main nor test build:
xcodebuild -scheme MAS -destination "platform=macOS,arch=$(arch),variant=macos"
How can I get xcodebuild
to run my MASBuildToolPlugin
, or to run an equivalent?
In Xcode, building main works fine, so Xcode must run the SwiftPM MASBuildToolPlugin
. Building test, however, fails with the following error:
No such module 'MAS'
If I capitalize the name of the executable in the following line in Package.swift
from:
products: [.executable(name: "mas", targets: ["MAS"])],
to:
products: [.executable(name: "MAS", targets: ["MAS"])],
Then Xcode can compile the tests. That, however, sets the generated executable file's name to MAS
, but I want it to be mas
.
How can I use MAS
for the package/module/target/etc. names in the source, but generate an executable file named mas
?
I obviously can rename the executable after it has been generated by running mv MAS mas
, but would the upper-case name be incorrectly used anywhere inside the executable? I assume not. Also, I'd prefer to setup my project properly, instead of using a file renaming hack.