Skip to content

Commit 5f69992

Browse files
committed
Fixes bazel breaking due to new project structure
Address warnings within the library
1 parent 25a0911 commit 5f69992

File tree

19 files changed

+37
-19
lines changed

19 files changed

+37
-19
lines changed

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import PackageDescription
2020
let package = Package(
2121
name: "FlatBuffers",
2222
platforms: [
23-
.iOS(.v11),
23+
.iOS(.v12),
2424
.macOS(.v10_14),
2525
],
2626
products: [

grpc/examples/swift/Greeter/Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import PackageDescription
2020
let package = Package(
2121
name: "Greeter",
2222
platforms: [
23-
.iOS(.v11),
23+
.iOS(.v12),
2424
.macOS(.v10_14),
2525
],
2626
dependencies: [

swift/BUILD.bazel

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,21 @@
11
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")
22

3+
swift_library(
4+
name = "FlexBuffers",
5+
srcs = glob([
6+
"Sources/FlexBuffers/**/*.swift",
7+
"Sources/Common/*.swift",
8+
]),
9+
module_name = "FlexBuffers",
10+
visibility = ["//visibility:public"],
11+
)
12+
313
swift_library(
414
name = "swift",
5-
srcs = glob(["Sources/FlatBuffers/*.swift"]),
15+
srcs = glob([
16+
"Sources/FlatBuffers/*.swift",
17+
"Sources/Common/*.swift",
18+
]),
619
module_name = "FlatBuffers",
720
visibility = ["//visibility:public"],
821
)

swift/Sources/Common/Int+extension.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ extension Int {
2222
///
2323
/// This is used since the UnsafeMutableRawPointer will face issues when writing/reading
2424
/// if the buffer alignment exceeds that actual size of the buffer
25+
@inline(__always)
2526
public var convertToPowerofTwo: Int {
2627
guard self > 0 else { return 1 }
2728
var n = UInt32(self)

swift/Sources/FlatBuffers/ByteBuffer.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
* limitations under the License.
1515
*/
1616

17-
import Common
1817
import Foundation
1918

2019
/// `ByteBuffer` is the interface that stores the data for a `Flatbuffers` object
@@ -294,7 +293,7 @@ public struct ByteBuffer {
294293
}
295294
assert(index < _storage.capacity, "Write index is out of writing bound")
296295
assert(index >= 0, "Writer index should be above zero")
297-
_ = withUnsafePointer(to: value) { ptr in
296+
withUnsafePointer(to: value) { ptr in
298297
_storage.withUnsafeRawPointer {
299298
memcpy(
300299
$0.advanced(by: index),

swift/Sources/FlatBuffers/Constants.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
* limitations under the License.
1515
*/
1616

17+
#if canImport(Common)
1718
@_exported import Common
19+
#endif
1820
import Foundation
1921

2022
/// Type aliases

swift/Sources/FlatBuffers/FlatBufferBuilder.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
* limitations under the License.
1515
*/
1616

17-
import Common
1817
import Foundation
1918

2019
/// ``FlatBufferBuilder`` builds a `FlatBuffer` through manipulating its internal state.

swift/Sources/FlatBuffers/Table.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
* limitations under the License.
1515
*/
1616

17-
import Common
1817
import Foundation
1918

2019
/// `Table` is a Flatbuffers object that can read,

0 commit comments

Comments
 (0)