Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always include the 'SwiftProtobuf' import in generated code #16

Merged
merged 1 commit into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Sources/GRPCProtobufCodeGen/ProtobufCodeGenParser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ extension ProtobufCodeGenParser {
file: FileDescriptor
) -> [Dependency] {
var codeDependencies: [Dependency] = [
.init(module: "GRPCProtobuf", accessLevel: .internal)
Dependency(module: "GRPCProtobuf", accessLevel: .internal),
Dependency(module: "SwiftProtobuf", accessLevel: self.accessLevel),
]
// Adding as dependencies the modules containing generated code or types for
// '.proto' files imported in the '.proto' file we are parsing.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ struct ProtobufCodeGenParserTests {
@Test("Dependencies")
func dependencies() {
let expected: [GRPCCodeGen.Dependency] = [
.init(module: "GRPCProtobuf", accessLevel: .internal) // Always an internal import
.init(module: "GRPCProtobuf", accessLevel: .internal), // Always an internal import
.init(module: "SwiftProtobuf", accessLevel: .internal),
]
#expect(self.codeGen.dependencies == expected)
}
Expand Down Expand Up @@ -173,7 +174,8 @@ struct ProtobufCodeGenParserTests {
@Test("Dependencies")
func dependencies() {
let expected: [GRPCCodeGen.Dependency] = [
.init(module: "GRPCProtobuf", accessLevel: .internal) // Always an internal import
.init(module: "GRPCProtobuf", accessLevel: .internal), // Always an internal import
.init(module: "SwiftProtobuf", accessLevel: .internal),
]
#expect(self.codeGen.dependencies == expected)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ struct ProtobufCodeGeneratorTests: UsesDescriptorSet {

import GRPCCore
import GRPCProtobuf
import SwiftProtobuf

// MARK: - test.TestService

Expand Down
Loading