diff --git a/src/signals/path-matchers.ts b/src/signals/path-matchers.ts index ecca17a4d4..104ee26e1c 100644 --- a/src/signals/path-matchers.ts +++ b/src/signals/path-matchers.ts @@ -56,11 +56,13 @@ function isGeneratedFileFrom(parts: NormalizedPath): boolean { // the Elixir plugin emits `.pb.ex`, the Erlang gpb plugin emits `.pb.erl` / `.pb.hrl`, the Crystal // plugin emits `.pb.cr`, the Haskell plugin emits `.pb.hs`, and the Objective-C plugin emits // `.pbobjc.{h,m}` plus gRPC `.pbrpc.{h,m}` service stubs. Swift gRPC emits sibling `.grpc.swift` - // service stubs; grpc-kotlin emits sibling `*GrpcKt.kt` coroutine service stubs. + // service stubs; grpc-kotlin emits sibling `*GrpcKt.kt` coroutine service stubs; grpc-java emits + // sibling `*Grpc.java` service stubs. // `.pb.dart`/`.pb.kt`/`.pb.cs` (the `.pb` infix keeps hand-written sources from matching). /\.pb\.(go|ts|js|cc|h|swift|dart|kt|cs|rs|ex|erl|hrl|cr|hs)$/.test(norm) || /\.grpc\.swift$/.test(norm) || /grpckt\.kt$/.test(norm) || + /grpc\.java$/.test(norm) || /\.pbobjc\.(h|m)$/.test(norm) || /\.pbrpc\.(h|m)$/.test(norm) || // Python protobuf: message stubs are `*_pb2.py[i]`; the gRPC plugin emits sibling diff --git a/test/unit/path-matchers.test.ts b/test/unit/path-matchers.test.ts index 3643fd2453..3d9cb9dd5b 100644 --- a/test/unit/path-matchers.test.ts +++ b/test/unit/path-matchers.test.ts @@ -144,6 +144,12 @@ describe("isGeneratedFile", () => { expect(classifyChangedFile("gen/GreeterGrpcKt.kt")).toBe("generated"); }); + it("matches Java gRPC service stubs alongside the other protoc plugins", () => { + expect(isGeneratedFile("gen/GreeterGrpc.java")).toBe(true); + expect(isGeneratedFile("src/Greeter.java")).toBe(false); + expect(classifyChangedFile("gen/GreeterGrpc.java")).toBe("generated"); + }); + it("matches JavaScript and TypeScript grpc-node protobuf stubs alongside the other protoc plugins", () => { expect(isGeneratedFile("gen/service_pb.js")).toBe(true); expect(isGeneratedFile("gen/service_grpc_pb.js")).toBe(true); @@ -488,6 +494,7 @@ describe("classifyChangedFile", () => { ["gen/service_pb.nim", "generated"], ["gen/service_pb.lua", "generated"], ["gen/GreeterGrpcKt.kt", "generated"], + ["gen/GreeterGrpc.java", "generated"], ["gen/service_grpc_pb.js", "generated"], ["gen/service_pb.d.ts", "generated"], ["vendor/lib.go", "vendored"],