Add a dedicated target for SDK mocks to avoid type name conflicts on the generated code.
This commit is contained in:
@@ -54,7 +54,7 @@ import {{ import }}
|
||||
{% call methodThrowableErrorDeclaration method %}
|
||||
{% endif %}
|
||||
{% if not method.isInitializer %}
|
||||
var {% call swiftifyMethodName method.selectorName %}UnderlyingCallsCount = 0
|
||||
{% call accessLevel method.accessLevel %}var {% call swiftifyMethodName method.selectorName %}UnderlyingCallsCount = 0
|
||||
{% call accessLevel method.accessLevel %}{% call staticSpecifier method %}var {% call swiftifyMethodName method.selectorName %}CallsCount: Int {
|
||||
get {
|
||||
if Thread.isMainThread {
|
||||
@@ -96,7 +96,7 @@ import {{ import }}
|
||||
{% endif %}
|
||||
{% if not method.returnTypeName.isVoid and not method.isInitializer %}
|
||||
|
||||
var {% call swiftifyMethodName method.selectorName %}UnderlyingReturnValue: {{ '(' if method.returnTypeName.isClosure and not method.isOptionalReturnType }}{{ method.returnTypeName }}{{ ')' if method.returnTypeName.isClosure and not method.isOptionalReturnType }}{{ '!' if not method.isOptionalReturnType }}
|
||||
{% call accessLevel method.accessLevel %}var {% call swiftifyMethodName method.selectorName %}UnderlyingReturnValue: {{ '(' if method.returnTypeName.isClosure and not method.isOptionalReturnType }}{{ method.returnTypeName }}{{ ')' if method.returnTypeName.isClosure and not method.isOptionalReturnType }}{{ '!' if not method.isOptionalReturnType }}
|
||||
{% call accessLevel method.accessLevel %}{% call staticSpecifier method %}var {% call swiftifyMethodName method.selectorName %}ReturnValue: {{ '(' if method.returnTypeName.isClosure and not method.isOptionalReturnType }}{{ method.returnTypeName }}{{ ')' if method.returnTypeName.isClosure and not method.isOptionalReturnType }}{{ '!' if not method.isOptionalReturnType }} {
|
||||
get {
|
||||
if Thread.isMainThread {
|
||||
@@ -224,7 +224,7 @@ import {{ import }}
|
||||
{% for type in types.classes %}{% if type.name != "AutoMockable" %}{% if type.accessLevel == "open" %}
|
||||
{% call accessLevel type.accessLevel %}class {{ type.name | replace:"Protocol","" }}SDKMock: MatrixRustSDK.{{ type.name }}, @unchecked Sendable {
|
||||
{% if type.accessLevel == "open" %}
|
||||
init() {
|
||||
public init() {
|
||||
super.init(noHandle: .init())
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ struct GenerateSDKMocks: AsyncParsableCommand {
|
||||
|
||||
/// Generates the SDK mocks using Sourcery.
|
||||
func generateSDKMocks(ffiPath: String) throws {
|
||||
try Zsh.run(command: "sourcery --sources \(ffiPath) --templates Tools/Sourcery/SDKAutoMockable.stencil --output ElementX/Sources/Mocks/Generated/SDKGeneratedMocks.swift")
|
||||
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.
|
||||
|
||||
Reference in New Issue
Block a user