diff --git a/src/signals/path-matchers.ts b/src/signals/path-matchers.ts index 5d306063a9..061864d64b 100644 --- a/src/signals/path-matchers.ts +++ b/src/signals/path-matchers.ts @@ -79,7 +79,8 @@ function isGeneratedFileFrom(parts: NormalizedPath): boolean { // the Kotlin plugin emits `.pb.kt`, the Java plugin emits `.pb.java`, the C# plugin emits `.pb.cs`, the Rust plugin emits `.pb.rs`, // 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`, the Scala plugin emits `.pb.scala`, and the Objective-C plugin emits - // `.pbobjc.{h,m}` plus gRPC `.pbrpc.{h,m}` service stubs. Swift gRPC emits sibling `.grpc.swift` + // `.pbobjc.{h,m}` plus gRPC `.pbrpc.{h,m}` service stubs (some layouts spell these + // `.pb.objc.{h,m}` instead). Swift gRPC emits sibling `.grpc.swift` // service stubs; grpc-kotlin emits sibling `*GrpcKt.kt` coroutine service stubs; grpc-java emits // sibling `*Grpc.java` service stubs; grpc-dotnet emits sibling `*Grpc.cs` service stubs; the Dart // gRPC plugin emits sibling `.pbgrpc.dart` service stubs. @@ -91,6 +92,8 @@ function isGeneratedFileFrom(parts: NormalizedPath): boolean { /grpc\.cs$/.test(norm) || /\.pbgrpc\.dart$/.test(norm) || /\.pbobjc\.(h|m)$/.test(norm) || + /\.pb\.objc\.(h|m)$/.test(norm) || + /\.pb\.m$/.test(norm) || /\.pbrpc\.(h|m)$/.test(norm) || // Python protobuf: message stubs are `*_pb2.py[i]`; the gRPC plugin emits sibling // `*_pb2_grpc.py[i]` service stubs, which are the same machine-generated output. diff --git a/test/unit/path-matchers.test.ts b/test/unit/path-matchers.test.ts index 973ff17e18..37989681d1 100644 --- a/test/unit/path-matchers.test.ts +++ b/test/unit/path-matchers.test.ts @@ -210,6 +210,16 @@ describe("isGeneratedFile", () => { expect(classifyChangedFile("gen/service_pb.d.ts")).toBe("generated"); }); + it("matches alternate Objective-C protobuf spellings alongside pbobjc output", () => { + expect(isGeneratedFile("proto/foo.pb.objc.h")).toBe(true); + expect(isGeneratedFile("proto/messages.pb.objc.m")).toBe(true); + expect(isGeneratedFile("proto/messages.pb.m")).toBe(true); + expect(isGeneratedFile("src/App.m")).toBe(false); + expect(isGeneratedFile("src/App.h")).toBe(false); + expect(classifyChangedFile("proto/foo.pb.objc.h")).toBe("generated"); + expect(classifyChangedFile("proto/messages.pb.m")).toBe("generated"); + }); + it("matches Swift protobuf, Dart freezed/retrofit, C# designer/XAML, and Objective-C protoc output", () => { for (const path of [ "proto/messages.pb.swift", @@ -546,6 +556,8 @@ describe("classifyChangedFile", () => { ["gen/GreeterGrpcKt.kt", "generated"], ["gen/GreeterGrpc.java", "generated"], ["proto/messages.pb.java", "generated"], + ["proto/foo.pb.objc.h", "generated"], + ["proto/messages.pb.m", "generated"], ["gen/GreeterGrpc.cs", "generated"], ["lib/foo.pbgrpc.dart", "generated"], ["gen/service_grpc_pb.js", "generated"],