From 7b92668922b13a429c9974a8954828de90d87c86 Mon Sep 17 00:00:00 2001 From: "Brian M. Carr" Date: Mon, 18 May 2026 12:10:43 -0500 Subject: [PATCH] Prevent plugin failure on use of protoc "Features" --- .../kotlin/com/engine/protoc/util/recorder/Main.kt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/recorder/src/main/kotlin/com/engine/protoc/util/recorder/Main.kt b/recorder/src/main/kotlin/com/engine/protoc/util/recorder/Main.kt index d0d6f38..4c6cc19 100644 --- a/recorder/src/main/kotlin/com/engine/protoc/util/recorder/Main.kt +++ b/recorder/src/main/kotlin/com/engine/protoc/util/recorder/Main.kt @@ -7,6 +7,17 @@ public fun main() { PluginProtos .CodeGeneratorResponse .newBuilder() + /* protoc fails compilation if a plugin does not support all features in the current fileset. + * since this plugin's job is to pass _all_ information directly to disk, we should always support all features. + * note: this does not use "options" to control which features to support for 2 reasons: + * 1. using an option would require this plugin to parse the input + * 2. we want customers of the plugin to be able to set their options to be passed to their plugins, and using our own options interferes with that goal. + */ + .setSupportedFeatures( + PluginProtos.CodeGeneratorResponse.Feature.entries.fold(0L) { acc, feature -> + acc.or(feature.number.toLong()) + }, + ) .addFile( PluginProtos.CodeGeneratorResponse.File.newBuilder().apply { name = "code-generator-request.binpb"