Skip to content

Commit

Permalink
Merge pull request #1682 from alexanderankin
Browse files Browse the repository at this point in the history
* pr/1682:
  Polish "Use @generated=omit when configuring gRPC plugins"
  Use @generated=omit when configuring gRPC plugins

Closes gh-1682
  • Loading branch information
mhalbritter committed Dec 19, 2024
2 parents b1205e8 + 3f286a8 commit 99374c1
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ protected void customizeExtensions(GradleExtensionContainer extensions) {
protobuf.nested("plugins", (plugins) -> plugins.nested("grpc",
(grpc) -> grpc.attribute("artifact", quote("io.grpc:protoc-gen-grpc-java"))));
protobuf.nested("generateProtoTasks", (generateProtoTasks) -> generateProtoTasks.nested("all()*.plugins",
(plugins) -> plugins.nested("grpc", (grpc) -> grpc.invoke("option", quote("jakarta_omit")))));
(plugins) -> plugins.nested("grpc", (grpc) -> {
grpc.invoke("option", quote("jakarta_omit"));
grpc.invoke("option", quote("@generated=omit"));
})));
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,11 @@ protected void customizeExtensions(GradleExtensionContainer extensions) {
protobuf.importType("com.google.protobuf.gradle.id");
protobuf.nested("plugins", (plugins) -> plugins.nested("id(\"grpc\")",
(grpc) -> grpc.attribute("artifact", quote("io.grpc:protoc-gen-grpc-java"))));
protobuf.nested("generateProtoTasks",
(generateProtoTasks) -> generateProtoTasks.nested("all().forEach",
(forEach) -> forEach.nested("it.plugins", (plugins) -> plugins.nested("id(\"grpc\")",
(grpc) -> grpc.invoke("option", quote("jakarta_omit"))))));
protobuf.nested("generateProtoTasks", (generateProtoTasks) -> generateProtoTasks.nested("all().forEach",
(forEach) -> forEach.nested("it.plugins", (plugins) -> plugins.nested("id(\"grpc\")", (grpc) -> {
grpc.invoke("option", quote("jakarta_omit"));
grpc.invoke("option", quote("@generated=omit"));
}))));
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,10 @@ private void addProtobufPlugin(MavenPluginContainer plugins, VersionProperty pro
});
plugin.execution("compile", (execution) -> {
execution.goal("compile").goal("compile-custom");
execution.configuration((configuration) -> configuration.add("pluginParameter", "jakarta_omit"));
execution.configuration((configuration) -> {
configuration.add("pluginParameter", "jakarta_omit");
configuration.add("pluginParameter", "@generated=omit");
});
});
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ void shouldAddGrpcPluginAndConfigurationForGradleGroovy() {
all()*.plugins {
grpc {
option 'jakarta_omit'
option '@generated=omit'
}
}
}
Expand Down Expand Up @@ -105,6 +106,7 @@ void shouldAddGrpcPluginAndConfigurationForGradleKotlin() {
it.plugins {
id("grpc") {
option("jakarta_omit")
option("@generated=omit")
}
}
}
Expand Down Expand Up @@ -159,6 +161,7 @@ void shouldAddProtobufPluginForMaven() {
</goals>
<configuration>
<pluginParameter>jakarta_omit</pluginParameter>
<pluginParameter>@generated=omit</pluginParameter>
</configuration>
</execution>
</executions>
Expand Down

0 comments on commit 99374c1

Please sign in to comment.