From 4a54950b3df34d90380959b40b6f85cb7801892c Mon Sep 17 00:00:00 2001 From: abandy Date: Sat, 22 Jun 2024 19:49:08 -0400 Subject: [PATCH] GH-42213: [Swift] Use "--warnings-as-errors" only on CI (#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: #42213 Lead-authored-by: Alva Bandy Co-authored-by: Sutou Kouhei Signed-off-by: Sutou Kouhei --- ci/scripts/swift_test.sh | 4 ++++ swift/Arrow/Package.swift | 7 ++++--- swift/ArrowFlight/Package.swift | 4 ++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/ci/scripts/swift_test.sh b/ci/scripts/swift_test.sh index b523e3891d93c..aba90f31e50d5 100755 --- a/ci/scripts/swift_test.sh +++ b/ci/scripts/swift_test.sh @@ -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 diff --git a/swift/Arrow/Package.swift b/swift/Arrow/Package.swift index 6944d7b910656..85407ea1b96b8 100644 --- a/swift/Arrow/Package.swift +++ b/swift/Arrow/Package.swift @@ -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", @@ -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"]) ] ) ] diff --git a/swift/ArrowFlight/Package.swift b/swift/ArrowFlight/Package.swift index f4d6485d1bb28..8366ccceb7a59 100644 --- a/swift/ArrowFlight/Package.swift +++ b/swift/ArrowFlight/Package.swift @@ -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"]) ] ) ]