This is an automated email from the ASF dual-hosted git repository.
chaokunyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/fory.git
The following commit(s) were added to refs/heads/main by this push:
new 6977c82a0 feat(swift): make fory swift usable as deps (#3462)
6977c82a0 is described below
commit 6977c82a08de9058398da843df2cfcf19db9d67e
Author: Shawn Yang <[email protected]>
AuthorDate: Tue Mar 10 16:48:01 2026 +0800
feat(swift): make fory swift usable as deps (#3462)
## Why?
## What does this PR do?
## Related issues
#3349
## Does this PR introduce any user-facing change?
- [ ] Does this PR introduce any public API change?
- [ ] Does this PR introduce any binary protocol compatibility change?
## Benchmark
---
.spi.yml | 24 +++++++++++++++++++
Package.swift | 52 +++++++++++++++++++++++++++++++++++++++++
benchmarks/swift/Package.swift | 4 ++--
benchmarks/swift/fory-swift-dep | 1 -
swift/README.md | 13 ++++++++---
5 files changed, 88 insertions(+), 6 deletions(-)
diff --git a/.spi.yml b/.spi.yml
new file mode 100644
index 000000000..9d32d7888
--- /dev/null
+++ b/.spi.yml
@@ -0,0 +1,24 @@
+# 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.
+
+version: 1
+builder:
+ configs:
+ - platform: macos-spm
+ swift_version: "6.0"
+ documentation_targets:
+ - Fory
diff --git a/Package.swift b/Package.swift
new file mode 100644
index 000000000..168daefc1
--- /dev/null
+++ b/Package.swift
@@ -0,0 +1,52 @@
+// swift-tools-version: 6.0
+import CompilerPluginSupport
+import PackageDescription
+
+let package = Package(
+ name: "fory",
+ platforms: [
+ .macOS(.v13),
+ .iOS(.v16)
+ ],
+ products: [
+ .library(
+ name: "Fory",
+ targets: ["Fory"]
+ ),
+ .executable(
+ name: "ForyXlangTests",
+ targets: ["ForyXlangTests"]
+ )
+ ],
+ dependencies: [
+ .package(url: "https://github.com/swiftlang/swift-syntax.git", from:
"600.0.0")
+ ],
+ targets: [
+ .macro(
+ name: "ForyMacro",
+ dependencies: [
+ .product(name: "SwiftCompilerPlugin", package: "swift-syntax"),
+ .product(name: "SwiftSyntax", package: "swift-syntax"),
+ .product(name: "SwiftSyntaxBuilder", package: "swift-syntax"),
+ .product(name: "SwiftSyntaxMacros", package: "swift-syntax")
+ ],
+ path: "swift/Sources/ForyMacro"
+ ),
+ .target(
+ name: "Fory",
+ dependencies: ["ForyMacro"],
+ path: "swift/Sources",
+ exclude: ["ForyMacro"]
+ ),
+ .executableTarget(
+ name: "ForyXlangTests",
+ dependencies: ["Fory"],
+ path: "swift/Tests/ForyXlangTests"
+ ),
+ .testTarget(
+ name: "ForyTests",
+ dependencies: ["Fory"],
+ path: "swift/Tests/ForyTests"
+ )
+ ]
+)
diff --git a/benchmarks/swift/Package.swift b/benchmarks/swift/Package.swift
index 55a7fda77..0341e8b0f 100644
--- a/benchmarks/swift/Package.swift
+++ b/benchmarks/swift/Package.swift
@@ -30,7 +30,7 @@ let package = Package(
),
],
dependencies: [
- .package(name: "fory-swift", path: "./fory-swift-dep"),
+ .package(name: "fory", path: "../.."),
.package(url: "https://github.com/apple/swift-protobuf.git", from:
"1.35.0"),
.package(url: "https://github.com/Flight-School/MessagePack.git",
from: "1.2.4"),
],
@@ -46,7 +46,7 @@ let package = Package(
.executableTarget(
name: "SwiftBenchmark",
dependencies: [
- .product(name: "Fory", package: "fory-swift"),
+ .product(name: "Fory", package: "fory"),
"SwiftBenchmarkProto",
.product(name: "MessagePack", package: "MessagePack"),
],
diff --git a/benchmarks/swift/fory-swift-dep b/benchmarks/swift/fory-swift-dep
deleted file mode 120000
index eea483b6c..000000000
--- a/benchmarks/swift/fory-swift-dep
+++ /dev/null
@@ -1 +0,0 @@
-../../swift
\ No newline at end of file
diff --git a/swift/README.md b/swift/README.md
index 7f51298ee..0822f2d67 100644
--- a/swift/README.md
+++ b/swift/README.md
@@ -1,6 +1,7 @@
# Apache Fory™ Swift
[](https://github.com/apache/fory/blob/main/LICENSE)
+[](https://swiftpackageindex.com/apache/fory)
**Apache Fory™** is a blazing-fast multi-language serialization framework.
@@ -32,7 +33,7 @@ The Swift implementation provides high-performance object
graph serialization wi
```swift
dependencies: [
- .package(url: "https://github.com/apache/fory.git", branch: "main")
+ .package(url: "https://github.com/apache/fory.git", from: "0.1.0")
],
targets: [
.target(
@@ -44,7 +45,13 @@ targets: [
]
```
-### 2. Basic serialization
+### 2. API documentation
+
+Swift Package Index documentation for the Swift target:
+
+<https://swiftpackageindex.com/apache/fory/main/documentation/fory>
+
+### 3. Basic serialization
```swift
import Fory
@@ -65,7 +72,7 @@ let output: User = try fory.deserialize(data)
assert(input == output)
```
-### 3. Buffer-oriented APIs
+### 4. Buffer-oriented APIs
```swift
var out = Data()
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]