Skip to content

Commit 56f497d

Browse files
committed
change to array
1 parent 09fdc4e commit 56f497d

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

PluginExamples/Sources/CustomProtoPath/swift-protobuf-config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"Main.proto"
88
],
99
"visibility": "public",
10-
"protoPath": "protos"
10+
"protoPaths": ["protos"]
1111
}
1212
]
1313
}

Plugins/SwiftProtobufPlugin/plugin.swift

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ struct SwiftProtobufPlugin {
8686
var implementationOnlyImports: Bool?
8787
/// Whether import statements should be preceded with visibility.
8888
var useAccessLevelOnImports: Bool?
89-
/// Overrides the path to look for protobuf files
90-
var protoPath: String?
89+
/// Overrides the paths to look for protobuf files
90+
var protoPaths: [String]?
9191
}
9292

9393
/// The path to the `protoc` binary.
@@ -173,15 +173,16 @@ struct SwiftProtobufPlugin {
173173
"--swift_out=\(outputDirectory)",
174174
]
175175

176-
let protoDirectory =
177-
if let protoPath = invocation.protoPath {
178-
directory.appending(protoPath)
179-
} else {
180-
directory
181-
}
182176

183-
protocArgs.append("-I")
184-
protocArgs.append("\(protoDirectory)")
177+
if let protoPaths = invocation.protoPaths {
178+
for protoPath in protoPaths {
179+
protocArgs.append("-I")
180+
protocArgs.append("\(directory.appending(protoPath))")
181+
}
182+
} else {
183+
protocArgs.append("-I")
184+
protocArgs.append("\(directory)")
185+
}
185186

186187
// Add the visibility if it was set
187188
if let visibility = invocation.visibility {

0 commit comments

Comments
 (0)