Skip to content

Commit 295076a

Browse files
committed
up to 6.0
1 parent aebeb5c commit 295076a

29 files changed

+466
-556
lines changed

ApiParser/Package.swift

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,28 @@
1-
// swift-tools-version:5.4
1+
// swift-tools-version:6.0
22
// The swift-tools-version declares the minimum version of Swift required to build this package.
33

44
import PackageDescription
55

66
let package = Package(
77
name: "ApiParser",
88
platforms: [
9-
.macOS(SupportedPlatform.MacOSVersion.v10_12)
9+
.macOS(SupportedPlatform.MacOSVersion.v10_13)
1010
],
1111
products: [
1212
.executable(name: "ApiParser", targets: ["ApiParser"])
1313
],
1414
dependencies: [
15-
.package(name: "SwiftRegularExpression", url: "https://github.com/nerzh/swift-regular-expression.git", .upToNextMajor(from: "0.2.4")),
16-
.package(name: "swift-argument-parser", url: "https://github.com/apple/swift-argument-parser", .upToNextMinor(from: "0.4.3")),
17-
.package(name: "FileUtils", url: "https://github.com/nerzh/SwiftFileUtils", .upToNextMinor(from: "1.3.0")),
15+
.package(url: "https://github.com/nerzh/swift-regular-expression.git", .upToNextMajor(from: "0.2.4")),
16+
.package(url: "https://github.com/apple/swift-argument-parser", .upToNextMinor(from: "0.4.3")),
17+
.package(url: "https://github.com/nerzh/SwiftFileUtils", .upToNextMinor(from: "1.3.0")),
1818
],
1919
targets: [
2020
.executableTarget(
2121
name: "ApiParser",
2222
dependencies: [
23-
.product(name: "SwiftRegularExpression", package: "SwiftRegularExpression"),
23+
.product(name: "SwiftRegularExpression", package: "swift-regular-expression"),
2424
.product(name: "ArgumentParser", package: "swift-argument-parser"),
25-
.product(name: "FileUtils", package: "FileUtils"),
25+
.product(name: "FileUtils", package: "SwiftFileUtils"),
2626
]),
27-
],
28-
swiftLanguageVersions: [
29-
SwiftVersion.v5
3027
]
3128
)

ApiParser/Sources/ApiParser/CodeGenerator.swift

Lines changed: 3 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ class CodeGenerator {
9292
}
9393

9494

95-
var result: String = "\(swiftStruct.accessType) struct \(swiftStruct.name): \(swiftStruct.parents.joined(separator: ", ")) {\n"
95+
var result: String = "\(swiftStruct.accessType) struct \(swiftStruct.name): \(swiftStruct.parents.joined(separator: ", ")), @unchecked Sendable {\n"
9696
for property in swiftStruct.properties {
9797
if let summary: String = property.summary { result.append("\(tab)/// \(checkComment(summary))\n") }
9898
if let descr: String = property.description { result.append("\(tab)/// \(checkComment(descr))\n") }
@@ -119,16 +119,6 @@ class CodeGenerator {
119119
return result
120120
}
121121

122-
// public func decode_message_body(_ payload: TSDKParamsOfDecodeMessageBody,
123-
// _ handler: @escaping (TSDKBindingResponse<TSDKDecodedMessageBody, TSDKClientError>) throws -> Void
124-
// ) throws {
125-
// let method: String = "decode_message_body"
126-
// try binding.requestLibraryAsync(methodName(module, method), payload, { (requestId, params, responseType, finished) in
127-
// var response: TSDKBindingResponse<TSDKDecodedMessageBody, TSDKClientError> = .init()
128-
// response.update(requestId, params, responseType, finished)
129-
// try handler(response)
130-
// })
131-
// }
132122
private func generateFunction(_ swiftFunction: SDKSwiftFunction) -> String {
133123
var result: String = .init()
134124
if let summary = swiftFunction.summary { result.append("\(tab)/// \(checkComment(summary))\n") }
@@ -138,7 +128,7 @@ class CodeGenerator {
138128
result.append("_ \(parameter.name): \(parameter.type), ")
139129
}
140130
let resultType: String = swiftFunction.willReturn.type == "Void" ? "\(libPrefix)NoneResult" : swiftFunction.willReturn.type
141-
result.append("_ handler: @escaping (TSDKBindingResponse<\(resultType), \(libPrefix)ClientError>) throws -> Void\n\(tab)) throws {\n")
131+
result.append("_ handler: @escaping @Sendable (TSDKBindingResponse<\(resultType), \(libPrefix)ClientError>) throws -> Void\n\(tab)) throws {\n")
142132
let methodName: String = swiftFunction.name == "initialize" ? "init" : swiftFunction.name
143133
result.append("\(tab)\(tab)let method: String = \"\(methodName)\"\n")
144134
if swiftFunction.params.isEmpty {
@@ -155,27 +145,6 @@ class CodeGenerator {
155145
return result
156146
}
157147

158-
// public func get_endpoints() async throws -> TSDKResultOfGetEndpoints {
159-
// try await withCheckedThrowingContinuation { continuation in
160-
// do {
161-
// let method: String = "get_endpoints"
162-
// try binding.requestLibraryAsync(methodName(module, method), "") { (requestId, params, responseType, finished) in
163-
// var response: TSDKBindingResponse<TSDKResultOfGetEndpoints, TSDKClientError> = .init()
164-
// response.update(requestId, params, responseType, finished)
165-
// if let error = response.error {
166-
// continuation.resume(throwing: error)
167-
// } else if let result = response.result {
168-
// continuation.resume(returning: result)
169-
// } else {
170-
// continuation.resume(throwing: TSDKClientError("Nothing for return"))
171-
// }
172-
// }
173-
// } catch {
174-
// continuation.resume(throwing: error)
175-
// }
176-
// }
177-
// }
178-
179148
private func generateAsyncAwaitFunction(_ swiftFunction: SDKSwiftFunction) -> String {
180149
var result: String = .init()
181150
if let summary = swiftFunction.summary { result.append("\(tab)/// \(checkComment(summary))\n") }
@@ -296,7 +265,7 @@ extension CodeGenerator {
296265
var swiftStruct = swiftStruct
297266
swiftStruct.parents.append("LocalizedError")
298267

299-
var result: String = "\(swiftStruct.accessType) struct \(swiftStruct.name): \(swiftStruct.parents.joined(separator: ", ")) {\n"
268+
var result: String = "\(swiftStruct.accessType) struct \(swiftStruct.name): \(swiftStruct.parents.joined(separator: ", ")), @unchecked Sendable {\n"
300269
for property in swiftStruct.properties {
301270
if let summary: String = property.summary { result.append("\(tab)/// \(checkComment(summary))\n") }
302271
if let descr: String = property.description { result.append("\(tab)/// \(checkComment(descr))\n") }

ApiParser/Sources/ApiParser/Settings.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import Foundation
99

10-
var libPrefix: String = "TSDK"
11-
var libEnumPostfix: String = "EnumTypes"
12-
var defaultEnumParents: [String] = ["String", "Codable"]
13-
var defaultStructTypeParents: [String] = ["Codable"]
10+
let libPrefix: String = "TSDK"
11+
let libEnumPostfix: String = "EnumTypes"
12+
let defaultEnumParents: [String] = ["String", "Codable"]
13+
let defaultStructTypeParents: [String] = ["Codable"]

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:5.8
1+
// swift-tools-version:6.0
22
// The swift-tools-version declares the minimum version of Swift required to build this package.
33

44
import PackageDescription

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
--->
1010

1111
[![SPM](https://img.shields.io/badge/swift-package%20manager-green)](https://swift.org/package-manager/)
12-
[![SPM](https://img.shields.io/badge/SDK%20VERSION-1.44.2-orange)](https://github.com/tonlabs/ever-sdk)
12+
[![SPM](https://img.shields.io/badge/SDK%20VERSION-1.49.2-orange)](https://github.com/tonlabs/ever-sdk)
1313

1414
Swift is a strongly typed language that has long been used not only for iOS development. Apple is actively promoting it to new platforms and today it can be used for almost any task. Thanks to this, this implementation provides the work of TVM (toncoin, everscale, venom, gosh) SDK on many platforms at once, including the native one for mobile phones. Let me remind you that swift can also be built for android.
1515

0 commit comments

Comments
 (0)