-
Notifications
You must be signed in to change notification settings - Fork 578
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
294 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
91 changes: 91 additions & 0 deletions
91
wire-tests-swift/src/main/swift/module_one/SwiftModuleOneMessage.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
// Code generated by Wire protocol buffer compiler, do not edit. | ||
// Source: squareup.protos.kotlin.swift_module_one.SwiftModuleOneMessage in swift_module_one.proto | ||
import Foundation | ||
import Wire | ||
|
||
public struct SwiftModuleOneMessage { | ||
|
||
public var name: String? | ||
public var unknownFields: Foundation.Data = .init() | ||
|
||
public init(configure: (inout Self) -> Swift.Void = { _ in }) { | ||
configure(&self) | ||
} | ||
|
||
} | ||
|
||
#if WIRE_INCLUDE_MEMBERWISE_INITIALIZER | ||
extension SwiftModuleOneMessage { | ||
|
||
@_disfavoredOverload | ||
@available(*, deprecated) | ||
public init(name: Swift.String? = nil) { | ||
self.name = name | ||
} | ||
|
||
} | ||
#endif | ||
|
||
#if !WIRE_REMOVE_EQUATABLE | ||
extension SwiftModuleOneMessage : Equatable { | ||
} | ||
#endif | ||
|
||
#if !WIRE_REMOVE_HASHABLE | ||
extension SwiftModuleOneMessage : Hashable { | ||
} | ||
#endif | ||
|
||
#if swift(>=5.5) | ||
extension SwiftModuleOneMessage : Sendable { | ||
} | ||
#endif | ||
|
||
extension SwiftModuleOneMessage : ProtoMessage { | ||
|
||
public static func protoMessageTypeURL() -> Swift.String { | ||
return "type.googleapis.com/squareup.protos.kotlin.swift_module_one.SwiftModuleOneMessage" | ||
} | ||
|
||
} | ||
|
||
extension SwiftModuleOneMessage : Proto2Codable { | ||
|
||
public init(from protoReader: Wire.ProtoReader) throws { | ||
var name: Swift.String? = nil | ||
|
||
let token = try protoReader.beginMessage() | ||
while let tag = try protoReader.nextTag(token: token) { | ||
switch tag { | ||
case 1: name = try protoReader.decode(Swift.String.self) | ||
default: try protoReader.readUnknownField(tag: tag) | ||
} | ||
} | ||
self.unknownFields = try protoReader.endMessage(token: token) | ||
|
||
self.name = name | ||
} | ||
|
||
public func encode(to protoWriter: Wire.ProtoWriter) throws { | ||
try protoWriter.encode(tag: 1, value: self.name) | ||
try protoWriter.writeUnknownFields(unknownFields) | ||
} | ||
|
||
} | ||
|
||
#if !WIRE_REMOVE_CODABLE | ||
extension SwiftModuleOneMessage : Codable { | ||
|
||
public init(from decoder: Swift.Decoder) throws { | ||
let container = try decoder.container(keyedBy: Wire.StringLiteralCodingKeys.self) | ||
self.name = try container.decodeIfPresent(Swift.String.self, forKey: "name") | ||
} | ||
|
||
public func encode(to encoder: Swift.Encoder) throws { | ||
var container = encoder.container(keyedBy: Wire.StringLiteralCodingKeys.self) | ||
|
||
try container.encodeIfPresent(self.name, forKey: "name") | ||
} | ||
|
||
} | ||
#endif |
104 changes: 104 additions & 0 deletions
104
wire-tests-swift/src/main/swift/module_two/SwiftModuleTwoMessage.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
// Code generated by Wire protocol buffer compiler, do not edit. | ||
// Source: squareup.protos.kotlin.swift_module_two.SwiftModuleTwoMessage in swift_module_two.proto | ||
import Foundation | ||
import Wire | ||
import module_one | ||
|
||
public struct SwiftModuleTwoMessage { | ||
|
||
public var name: String? | ||
public var module_one_names: [SwiftModuleOneMessage] = [] | ||
public var unknownFields: Foundation.Data = .init() | ||
|
||
public init(configure: (inout Self) -> Swift.Void = { _ in }) { | ||
configure(&self) | ||
} | ||
|
||
} | ||
|
||
#if WIRE_INCLUDE_MEMBERWISE_INITIALIZER | ||
extension SwiftModuleTwoMessage { | ||
|
||
@_disfavoredOverload | ||
@available(*, deprecated) | ||
public init(name: Swift.String? = nil, module_one_names: [module_one.SwiftModuleOneMessage] = []) { | ||
self.name = name | ||
self.module_one_names = module_one_names | ||
} | ||
|
||
} | ||
#endif | ||
|
||
#if !WIRE_REMOVE_EQUATABLE | ||
extension SwiftModuleTwoMessage : Equatable { | ||
} | ||
#endif | ||
|
||
#if !WIRE_REMOVE_HASHABLE | ||
extension SwiftModuleTwoMessage : Hashable { | ||
} | ||
#endif | ||
|
||
#if swift(>=5.5) | ||
extension SwiftModuleTwoMessage : Sendable { | ||
} | ||
#endif | ||
|
||
extension SwiftModuleTwoMessage : ProtoMessage { | ||
|
||
public static func protoMessageTypeURL() -> Swift.String { | ||
return "type.googleapis.com/squareup.protos.kotlin.swift_module_two.SwiftModuleTwoMessage" | ||
} | ||
|
||
} | ||
|
||
extension SwiftModuleTwoMessage : Proto2Codable { | ||
|
||
public init(from protoReader: Wire.ProtoReader) throws { | ||
var name: Swift.String? = nil | ||
var module_one_names: [module_one.SwiftModuleOneMessage] = [] | ||
|
||
let token = try protoReader.beginMessage() | ||
while let tag = try protoReader.nextTag(token: token) { | ||
switch tag { | ||
case 1: name = try protoReader.decode(Swift.String.self) | ||
case 2: try protoReader.decode(into: &module_one_names) | ||
default: try protoReader.readUnknownField(tag: tag) | ||
} | ||
} | ||
self.unknownFields = try protoReader.endMessage(token: token) | ||
|
||
self.name = name | ||
self.module_one_names = module_one_names | ||
} | ||
|
||
public func encode(to protoWriter: Wire.ProtoWriter) throws { | ||
try protoWriter.encode(tag: 1, value: self.name) | ||
try protoWriter.encode(tag: 2, value: self.module_one_names) | ||
try protoWriter.writeUnknownFields(unknownFields) | ||
} | ||
|
||
} | ||
|
||
#if !WIRE_REMOVE_CODABLE | ||
extension SwiftModuleTwoMessage : Codable { | ||
|
||
public init(from decoder: Swift.Decoder) throws { | ||
let container = try decoder.container(keyedBy: Wire.StringLiteralCodingKeys.self) | ||
self.name = try container.decodeIfPresent(Swift.String.self, forKey: "name") | ||
self.module_one_names = try container.decodeProtoArray(module_one.SwiftModuleOneMessage.self, firstOfKeys: "moduleOneNames", "module_one_names") | ||
} | ||
|
||
public func encode(to encoder: Swift.Encoder) throws { | ||
var container = encoder.container(keyedBy: Wire.StringLiteralCodingKeys.self) | ||
let preferCamelCase = encoder.protoKeyNameEncodingStrategy == .camelCase | ||
let includeDefaults = encoder.protoDefaultValuesEncodingStrategy == .include | ||
|
||
try container.encodeIfPresent(self.name, forKey: "name") | ||
if includeDefaults || !self.module_one_names.isEmpty { | ||
try container.encodeProtoArray(self.module_one_names, forKey: preferCamelCase ? "moduleOneNames" : "module_one_names") | ||
} | ||
} | ||
|
||
} | ||
#endif |
22 changes: 22 additions & 0 deletions
22
wire-tests/src/commonTest/proto/kotlin/swift_module_one.proto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* Copyright 2023 Square Inc. | ||
* | ||
* Licensed 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. | ||
*/ | ||
syntax = "proto2"; | ||
|
||
package squareup.protos.kotlin.swift_module_one; | ||
|
||
message SwiftModuleOneMessage { | ||
optional string name = 1; | ||
} |
25 changes: 25 additions & 0 deletions
25
wire-tests/src/commonTest/proto/kotlin/swift_module_two.proto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* Copyright 2023 Square Inc. | ||
* | ||
* Licensed 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. | ||
*/ | ||
syntax = "proto2"; | ||
|
||
package squareup.protos.kotlin.swift_module_two; | ||
|
||
import "swift_module_one.proto"; | ||
|
||
message SwiftModuleTwoMessage { | ||
optional string name = 1; | ||
repeated squareup.protos.kotlin.swift_module_one.SwiftModuleOneMessage module_one_names = 2; | ||
} |
29 changes: 29 additions & 0 deletions
29
wire-tests/src/commonTest/proto/kotlin/swift_modules_manifest.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# | ||
# Copyright 2023 Square Inc. | ||
# | ||
# Licensed 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. | ||
#/ | ||
|
||
# Used between swift_module1.proto and swift_module2.proto | ||
|
||
--- | ||
module_one: | ||
roots: | ||
- squareup.protos.kotlin.swift_module_one.SwiftModuleOneMessage | ||
prunes: | ||
- google.protobuf.* | ||
module_two: | ||
roots: | ||
- squareup.protos.kotlin.swift_module_two.SwiftModuleTwoMessage | ||
dependencies: | ||
- module_one |