Skip to content

Commit

Permalink
apacheGH-42213: [Swift] Use "--warnings-as-errors" only on CI (apache…
Browse files Browse the repository at this point in the history
…#42214)

### Rationale for this change
Downstream clients are getting a conflicting options error when building with the "-warnings-as-errors" swift option. 

### What changes are included in this PR?
This PR disables the "-warnings-as-errors" swift options by default and enables them for CI builds only.  The Swift CI script will enable the options in the Package.swift files before running the build.

* GitHub Issue: apache#42213

Lead-authored-by: Alva Bandy <abandy@live.com>
Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
  • Loading branch information
abandy and kou authored Jun 22, 2024
1 parent 3fe4df3 commit 4a54950
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
4 changes: 4 additions & 0 deletions ci/scripts/swift_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,14 @@ popd

source_dir=${1}/swift/Arrow
pushd ${source_dir}
sed 's/\/\/ build://g' Package.swift > Package.swift.build
mv Package.swift.build Package.swift
swift test
popd

source_dir=${1}/swift/ArrowFlight
pushd ${source_dir}
sed 's/\/\/ build://g' Package.swift > Package.swift.build
mv Package.swift.build Package.swift
swift test
popd
7 changes: 4 additions & 3 deletions swift/Arrow/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ let package = Package(
name: "ArrowC",
path: "Sources/ArrowC",
swiftSettings: [
.unsafeFlags(["-warnings-as-errors"])
// build: .unsafeFlags(["-warnings-as-errors"])
]

),
.target(
name: "Arrow",
Expand All @@ -56,14 +57,14 @@ let package = Package(
.product(name: "Atomics", package: "swift-atomics")
],
swiftSettings: [
.unsafeFlags(["-warnings-as-errors"])
// build: .unsafeFlags(["-warnings-as-errors"])
]
),
.testTarget(
name: "ArrowTests",
dependencies: ["Arrow", "ArrowC"],
swiftSettings: [
.unsafeFlags(["-warnings-as-errors"])
// build: .unsafeFlags(["-warnings-as-errors"])
]
)
]
Expand Down
4 changes: 2 additions & 2 deletions swift/ArrowFlight/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ let package = Package(
.product(name: "SwiftProtobuf", package: "swift-protobuf")
],
swiftSettings: [
.unsafeFlags(["-warnings-as-errors"])
// build: .unsafeFlags(["-warnings-as-errors"])
]
),
.testTarget(
name: "ArrowFlightTests",
dependencies: ["ArrowFlight"],
swiftSettings: [
.unsafeFlags(["-warnings-as-errors"])
// build: .unsafeFlags(["-warnings-as-errors"])
]
)
]
Expand Down

0 comments on commit 4a54950

Please sign in to comment.