mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
Run SwiftFormat.
This commit is contained in:
@@ -6,14 +6,14 @@ struct GenerateSDKMocks: AsyncParsableCommand {
|
||||
enum GenerateSDKMocksError: Error {
|
||||
case invalidFileUrl
|
||||
}
|
||||
|
||||
|
||||
static let configuration = CommandConfiguration(abstract: "A tool to setup the mocks for the Matrix Rust SDK")
|
||||
|
||||
|
||||
@Argument(help: "The argument to specify a branch of the SDK. Use `local` to use your local version")
|
||||
var version: String
|
||||
|
||||
|
||||
private var fileURLFormat = "https://raw.githubusercontent.com/element-hq/matrix-rust-components-swift/%@/Sources/MatrixRustSDK/matrix_sdk_ffi.swift"
|
||||
|
||||
|
||||
func run() async throws {
|
||||
if version == "local" {
|
||||
try generateSDKMocks(ffiPath: "\(URL.sdkDirectory.path)/bindings/apple/generated/swift")
|
||||
@@ -23,12 +23,12 @@ struct GenerateSDKMocks: AsyncParsableCommand {
|
||||
try FileManager.default.removeItem(atPath: path)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Generates the SDK mocks using Sourcery.
|
||||
func generateSDKMocks(ffiPath: String) throws {
|
||||
try Zsh.run(command: "sourcery --sources \(ffiPath) --templates Tools/Sourcery/SDKAutoMockable.stencil --output SDKMocks/Sources/Generated/SDKGeneratedMocks.swift")
|
||||
}
|
||||
|
||||
|
||||
/// Downloads the specified version of the `matrix_sdk_ffi.swift` file and returns the path to the downloaded file.
|
||||
func downloadSDK(version: String) async throws -> String {
|
||||
let fileURLString = String(format: fileURLFormat, version)
|
||||
|
||||
Reference in New Issue
Block a user