Skip to content

Commit

Permalink
fix: Register event annotations when loading event message descriptor (
Browse files Browse the repository at this point in the history
…#1958)

This ensures that annotated event templates are found in the descriptor set passed to --event-message-descriptor-set

Closes #1934
  • Loading branch information
SanjayVas authored Dec 6, 2024
1 parent b24c6a5 commit 5d59eec
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package org.wfanet.measurement.loadtest.dataprovider
import com.google.protobuf.DescriptorProtos
import com.google.protobuf.Descriptors
import com.google.protobuf.DynamicMessage
import com.google.protobuf.ExtensionRegistry
import com.google.protobuf.Message
import com.google.protobuf.TypeRegistry
import java.io.File
Expand Down Expand Up @@ -175,7 +176,9 @@ class SyntheticGeneratorEdpSimulatorRunner : EdpSimulatorRunner() {
files: Iterable<File>
): List<DescriptorProtos.FileDescriptorSet> {
return files.map { file ->
file.inputStream().use { input -> DescriptorProtos.FileDescriptorSet.parseFrom(input) }
file.inputStream().use { input ->
DescriptorProtos.FileDescriptorSet.parseFrom(input, EXTENSION_REGISTRY)
}
}
}

Expand All @@ -198,6 +201,11 @@ class SyntheticGeneratorEdpSimulatorRunner : EdpSimulatorRunner() {
TestEvent.getDescriptor().file)
.asIterable()

private val EXTENSION_REGISTRY =
ExtensionRegistry.newInstance()
.also { EventAnnotationsProto.registerAllExtensions(it) }
.unmodifiable

init {
check(TestEvent.getDescriptor().fullName == TEST_EVENT_MESSAGE_TYPE)
check(
Expand Down

0 comments on commit 5d59eec

Please sign in to comment.