From 078be68c887b9742ec34e5036219c42323c4c5a5 Mon Sep 17 00:00:00 2001 From: Alva Bandy Date: Wed, 19 Jun 2024 21:25:09 -0400 Subject: [PATCH] Add CI specific Package files for building with warnings as errors --- ci/scripts/swift_test.sh | 4 ++ swift/Arrow/Package.swift | 13 +---- swift/Arrow/Package.swift.build | 70 +++++++++++++++++++++++++++ swift/ArrowFlight/Package.swift | 8 +-- swift/ArrowFlight/Package.swift.build | 61 +++++++++++++++++++++++ 5 files changed, 138 insertions(+), 18 deletions(-) create mode 100644 swift/Arrow/Package.swift.build create mode 100644 swift/ArrowFlight/Package.swift.build diff --git a/ci/scripts/swift_test.sh b/ci/scripts/swift_test.sh index b523e3891d93c..fa898bd571c6f 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} +mv Package.swift Package.swift.ignore +mv Package.swift.build Package.swift swift test popd source_dir=${1}/swift/ArrowFlight pushd ${source_dir} +mv Package.swift Package.swift.ignore +mv Package.swift.build Package.swift swift test popd diff --git a/swift/Arrow/Package.swift b/swift/Arrow/Package.swift index 6944d7b910656..ba6a4ae8916e6 100644 --- a/swift/Arrow/Package.swift +++ b/swift/Arrow/Package.swift @@ -44,27 +44,18 @@ let package = Package( targets: [ .target( name: "ArrowC", - path: "Sources/ArrowC", - swiftSettings: [ - .unsafeFlags(["-warnings-as-errors"]) - ] + path: "Sources/ArrowC" ), .target( name: "Arrow", dependencies: ["ArrowC", .product(name: "FlatBuffers", package: "flatbuffers"), .product(name: "Atomics", package: "swift-atomics") - ], - swiftSettings: [ - .unsafeFlags(["-warnings-as-errors"]) ] ), .testTarget( name: "ArrowTests", - dependencies: ["Arrow", "ArrowC"], - swiftSettings: [ - .unsafeFlags(["-warnings-as-errors"]) - ] + dependencies: ["Arrow", "ArrowC"] ) ] ) diff --git a/swift/Arrow/Package.swift.build b/swift/Arrow/Package.swift.build new file mode 100644 index 0000000000000..6944d7b910656 --- /dev/null +++ b/swift/Arrow/Package.swift.build @@ -0,0 +1,70 @@ +// swift-tools-version:5.7 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +import PackageDescription + +let package = Package( + name: "Arrow", + platforms: [ + .macOS(.v10_14) + ], + products: [ + .library( + name: "Arrow", + targets: ["Arrow"]) + ], + dependencies: [ + // The latest version of flatbuffers v23.5.26 was built in May 26, 2023 + // and therefore doesn't include the unaligned buffer swift changes. + // This can be changed back to using the tag once a new version of + // flatbuffers has been released. + .package(url: "https://github.com/google/flatbuffers.git", branch: "master"), + .package( + url: "https://github.com/apple/swift-atomics.git", + .upToNextMajor(from: "1.2.0") // or `.upToNextMinor + ) + ], + targets: [ + .target( + name: "ArrowC", + path: "Sources/ArrowC", + swiftSettings: [ + .unsafeFlags(["-warnings-as-errors"]) + ] + ), + .target( + name: "Arrow", + dependencies: ["ArrowC", + .product(name: "FlatBuffers", package: "flatbuffers"), + .product(name: "Atomics", package: "swift-atomics") + ], + swiftSettings: [ + .unsafeFlags(["-warnings-as-errors"]) + ] + ), + .testTarget( + name: "ArrowTests", + dependencies: ["Arrow", "ArrowC"], + swiftSettings: [ + .unsafeFlags(["-warnings-as-errors"]) + ] + ) + ] +) diff --git a/swift/ArrowFlight/Package.swift b/swift/ArrowFlight/Package.swift index f4d6485d1bb28..cf275ab2031a4 100644 --- a/swift/ArrowFlight/Package.swift +++ b/swift/ArrowFlight/Package.swift @@ -45,17 +45,11 @@ let package = Package( .product(name: "Arrow", package: "Arrow"), .product(name: "GRPC", package: "grpc-swift"), .product(name: "SwiftProtobuf", package: "swift-protobuf") - ], - swiftSettings: [ - .unsafeFlags(["-warnings-as-errors"]) ] ), .testTarget( name: "ArrowFlightTests", - dependencies: ["ArrowFlight"], - swiftSettings: [ - .unsafeFlags(["-warnings-as-errors"]) - ] + dependencies: ["ArrowFlight"] ) ] ) diff --git a/swift/ArrowFlight/Package.swift.build b/swift/ArrowFlight/Package.swift.build new file mode 100644 index 0000000000000..f4d6485d1bb28 --- /dev/null +++ b/swift/ArrowFlight/Package.swift.build @@ -0,0 +1,61 @@ +// swift-tools-version:5.7 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +import PackageDescription + +let package = Package( + name: "ArrowFlight", + platforms: [ + .macOS(.v10_15) + ], + products: [ + // Products define the executables and libraries a package produces, making them visible to other packages. + .library( + name: "ArrowFlight", + targets: ["ArrowFlight"]) + ], + dependencies: [ + .package(url: "https://github.com/grpc/grpc-swift.git", from: "1.15.0"), + .package(url: "https://github.com/apple/swift-protobuf.git", from: "1.6.0"), + .package(path: "../Arrow") + ], + targets: [ + // Targets are the basic building blocks of a package, defining a module or a test suite. + // Targets can depend on other targets in this package and products from dependencies. + .target( + name: "ArrowFlight", + dependencies: [ + .product(name: "Arrow", package: "Arrow"), + .product(name: "GRPC", package: "grpc-swift"), + .product(name: "SwiftProtobuf", package: "swift-protobuf") + ], + swiftSettings: [ + .unsafeFlags(["-warnings-as-errors"]) + ] + ), + .testTarget( + name: "ArrowFlightTests", + dependencies: ["ArrowFlight"], + swiftSettings: [ + .unsafeFlags(["-warnings-as-errors"]) + ] + ) + ] +)