Automated rollback of commit
*** Reason for rollback ***
Performance regression in nightly on yt-web b/211971772
*** Original change description ***
Use literals for format flags in proto_common call.
This should save some memory allocations.
@@ -66,12 +66,11 @@ public class ProtoCompileActionBuilder {
private final ProtoInfo protoInfo;
private final FilesToRunProvider protoCompiler;
private final String progressMessage;
+ private final String langPrefix;
private final Iterable<Artifact> outputs;
private Iterable<Artifact> inputs;
private FilesToRunProvider langPlugin;
- private String langPluginFormat;
private Supplier<String> langPluginParameter;
- private String langPluginParameterFormat;
private boolean hasServices;
private Iterable<String> additionalCommandLineArguments;
private Iterable<FilesToRunProvider> additionalTools;
@@ -88,10 +87,8 @@ public class ProtoCompileActionBuilder {
return this;
}
- public ProtoCompileActionBuilder setLangPlugin(
- FilesToRunProvider langPlugin, String langPluginFormat) {
+ public ProtoCompileActionBuilder setLangPlugin(FilesToRunProvider langPlugin) {
this.langPlugin = langPlugin;
- this.langPluginFormat = langPluginFormat;
return this;
}
@@ -100,10 +97,8 @@ public class ProtoCompileActionBuilder {
return this;
}
- public ProtoCompileActionBuilder setLangPluginParameter(
- Supplier<String> langPluginParameter, String langPluginParameterFormat) {
+ public ProtoCompileActionBuilder setLangPluginParameter(Supplier<String> langPluginParameter) {
this.langPluginParameter = langPluginParameter;
- this.langPluginParameterFormat = langPluginParameterFormat;
return this;
}
@@ -128,10 +123,12 @@ public class ProtoCompileActionBuilder {
ProtoInfo protoInfo,
FilesToRunProvider protoCompiler,
String progressMessage,
+ String langPrefix,
Iterable<Artifact> outputs) {
this.protoInfo = protoInfo;
this.protoCompiler = protoCompiler;
this.progressMessage = progressMessage;
+ this.langPrefix = langPrefix;
this.outputs = outputs;
this.mnemonic = DEFAULT_MNEMONIC;
}
@@ -175,11 +172,14 @@ public class ProtoCompileActionBuilder {
if (langPlugin != null && langPlugin.getExecutable() != null) {
// We pass a separate langPlugin as there are plugins that cannot be overridden
// and thus we have to deal with "$xx_plugin" and "xx_plugin".
- additionalArgs.add(Tuple.of(langPlugin.getExecutable(), langPluginFormat));
+ additionalArgs.add(
+ Tuple.of(
+ langPlugin.getExecutable(), String.format("--plugin=protoc-gen-%s=%%s", langPrefix)));
}
if (langPluginParameter != null) {
- additionalArgs.add(Tuple.of(langPluginParameter.get(), langPluginParameterFormat));
+ additionalArgs.add(
+ Tuple.of(langPluginParameter.get(), String.format("--%s_out=%%s", langPrefix)));
}
if (!hasServices) {
