mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
Generating SDK Mocks through the usage of swift run tools generate-sdk-mocks (#982)
* basic implementation, that works for now only with the local SDK * replaced a handmade mock with a generated mock
This commit is contained in:
@@ -26,10 +26,7 @@ struct BuildSDK: ParsableCommand {
|
||||
|
||||
@Option(help: "The profile to use when building the SDK. Omit this option to build in debug mode.")
|
||||
var profile: Profile = .debug
|
||||
|
||||
private var parentDirectoryURL: URL { Utilities.projectDirectoryURL.deletingLastPathComponent() }
|
||||
private var sdkDirectoryURL: URL { parentDirectoryURL.appendingPathComponent("matrix-rust-sdk") }
|
||||
|
||||
|
||||
enum Error: LocalizedError {
|
||||
case rustupOutputFailure
|
||||
case missingRustTargets([String])
|
||||
@@ -81,14 +78,14 @@ struct BuildSDK: ParsableCommand {
|
||||
|
||||
/// Clones the Rust SDK if a copy isn't found in the parent directory.
|
||||
func cloneSDKIfNeeded() throws {
|
||||
guard !FileManager.default.fileExists(atPath: sdkDirectoryURL.path) else { return }
|
||||
try Utilities.zsh("git clone https://github.com/matrix-org/matrix-rust-sdk", workingDirectoryURL: parentDirectoryURL)
|
||||
guard !FileManager.default.fileExists(atPath: Utilities.sdkDirectoryURL.path) else { return }
|
||||
try Utilities.zsh("git clone https://github.com/matrix-org/matrix-rust-sdk", workingDirectoryURL: Utilities.parentDirectoryURL)
|
||||
}
|
||||
|
||||
/// Checkout the specified branch of the SDK if supplied.
|
||||
func checkoutBranchIfSupplied() throws {
|
||||
guard let branch else { return }
|
||||
try Utilities.zsh("git checkout \(branch)", workingDirectoryURL: sdkDirectoryURL)
|
||||
try Utilities.zsh("git checkout \(branch)", workingDirectoryURL: Utilities.sdkDirectoryURL)
|
||||
}
|
||||
|
||||
/// Build the Rust SDK as an XCFramework with the debug profile.
|
||||
@@ -98,7 +95,7 @@ struct BuildSDK: ParsableCommand {
|
||||
if let target {
|
||||
buildCommand.append(" --only-target \(target.rawValue)")
|
||||
}
|
||||
try Utilities.zsh(buildCommand, workingDirectoryURL: sdkDirectoryURL)
|
||||
try Utilities.zsh(buildCommand, workingDirectoryURL: Utilities.sdkDirectoryURL)
|
||||
}
|
||||
|
||||
/// Update the Xcode project to use the build of the SDK.
|
||||
|
||||
Reference in New Issue
Block a user