Skip to content

Commit f94d044

Browse files
committed
Move -warnings-as-errors flag from Package.swift to Justfile
This is to work around the fact that Xcode always passes the incompatible -suppress-warnings flag when building the library automatically from the Xcode GUI. While it's possible to suppress this behaviour with xcodebuild on the command line using an -xcconfig option, there's no evident way to get the Xcode *GUI* to avoid setting -suppress-warnings when doing a Build or Run action, short of extensive build configuration which I want to avoid.
1 parent 1751bcd commit f94d044

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// swift-tools-version:5.9
22
import PackageDescription
33

4-
let COMPILER_FLAGS = ["-diagnostic-style=llvm", "-warnings-as-errors"]
4+
let COMPILER_FLAGS = ["-diagnostic-style=llvm"] // See Justfile for more '-Xswiftc' flags
55

66
let package = Package(
77
name: "EmacsOpen",

justfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ format:
1111

1212
build-cli-release:
1313
@echo "Building CLI..."
14-
swift build --configuration release --product emacsopen
14+
# Note: define -warning-as-errors here, not in Package.swift, because Xcode will always pass the
15+
# incompatible -suppress-warnings flag when building the library automatically from the Xcode GUI.
16+
swift build --configuration release --product emacsopen -Xswiftc -warnings-as-errors
1517

1618
build-app-release:
1719
@echo "Building App using Xcode..."

0 commit comments

Comments
 (0)