@@ -95,7 +95,7 @@ class DiscoveryImpl(system: ActorSystem, services: Map[String, Service], sdkName
95
95
val grpcClients = GrpcClients (system)
96
96
// pass the deployed name of the service on to GrpcClients for cross component calls
97
97
if (in.internalProxyHostname.isEmpty) {
98
- // for backward compatibiliy with proxy 1.0.14 or older
98
+ // for backward compatibility with proxy 1.0.14 or older
99
99
grpcClients.setProxyHostname(in.proxyHostname)
100
100
} else {
101
101
grpcClients.setProxyHostname(in.internalProxyHostname)
@@ -250,10 +250,17 @@ class DiscoveryImpl(system: ActorSystem, services: Map[String, Service], sdkName
250
250
object DiscoveryImpl {
251
251
252
252
private [impl] def fileDescriptorSet (services : Iterable [Service ], userDescPath : String , log : Logger ) = {
253
- val descriptorsWithSource = loadDescriptorsWithSource(userDescPath, log)
253
+
254
+ val descriptors = loadFileDescriptors(userDescPath, log)
255
+
254
256
val allDescriptors =
255
257
AnySupport .flattenDescriptors(services.flatMap(s => s.descriptor.getFile +: s.additionalDescriptors).toSeq)
258
+
256
259
val builder = DescriptorProtos .FileDescriptorSet .newBuilder()
260
+
261
+ val descriptorsWithSource = descriptors.filter { case (_, proto) =>
262
+ proto.hasSourceCodeInfo
263
+ }
257
264
allDescriptors.values.foreach { fd =>
258
265
val proto = fd.toProto
259
266
// We still use the descriptor as passed in by the user, but if we have one that we've read from the
@@ -264,16 +271,14 @@ object DiscoveryImpl {
264
271
builder.addFile(protoWithSource)
265
272
}
266
273
// include 'kalix_policy.proto' with ACL defaults for entire Kalix service if the file exists
267
- descriptorsWithSource
274
+ descriptors
268
275
.collect { case (file, proto) if file.endsWith(" kalix_policy.proto" ) => proto }
269
276
.foreach(defaultPolicy => builder.addFile(defaultPolicy))
270
277
271
278
builder.build()
272
279
}
273
280
274
- private [impl] def loadDescriptorsWithSource (
275
- path : String ,
276
- log : Logger ): Map [String , DescriptorProtos .FileDescriptorProto ] =
281
+ private [impl] def loadFileDescriptors (path : String , log : Logger ): Map [String , DescriptorProtos .FileDescriptorProto ] =
277
282
// Special case for disabled, this allows the user to disable attempting to load the descriptor, which means
278
283
// they won't get the great big warning below if it doesn't exist.
279
284
if (path == " disabled" ) {
@@ -307,9 +312,7 @@ object DiscoveryImpl {
307
312
.parseFrom(stream)
308
313
.getFileList
309
314
.asScala
310
- .collect {
311
- case file if file.hasSourceCodeInfo => file.getName -> file
312
- }
315
+ .map { case file => file.getName -> file }
313
316
.toMap
314
317
} catch {
315
318
case NonFatal (e) =>
0 commit comments