grpc / grpc-swift

The Swift language implementation of gRPC.
Apache License 2.0
2.05k stars 420 forks source link

Unable to use into generated ***ClientProtocol into Test Target #1526

Open adriantabirta opened 2 years ago

adriantabirta commented 2 years ago

Describe the bug

Got: Missing required module 'CNIOAtomics'

Hard: MacBook M1 Soft: latest Xcode version on Ventura, swift version 5.7.1, grpc-swift(1.10.0) in SPM package,

SPM package here

To reproduce

Steps to reproduce the bug you've found:

  1. Create simple Xcode project and add package as dependency
  2. Try to use GeneratedServiceClientProtocol to create RideServiceClientProtocolMock into test target
  3. Got error/s

Expected behaviour

I want to use generated client protocol to create mock classes for testing.

Additional information

Is there a way to forward correctly dependencies like grpc-swift -> my SPM package -> Xcode (especially test target)? Notice: Mocking is working on application target, am I doing something wrong?

Lukasa commented 1 year ago

This seems like an Xcode issue: does this build correctly otherwise?

adriantabirta commented 1 year ago

This seems like an Xcode issue: does this build correctly otherwise?

otherwise how?

Only solution I found it is to add grpc-swift as package dep to Xcode project test target. So basically I import 2 times and got this in terminal when I run tests:

objc[49542]: Class _TtC6NIOTLS37ApplicationProtocolNegotiationHandler is implemented in both 
/Users/at/Library/Developer/XCTestDevices/65FB8BD5-AA7E-4B86-B3E4-CCE03D12DD29/data/Containers/Bundle/Application/7FD92C43-7416-4761-8FBC-ED400AD7407E/OpenTaxi.app/OpenTaxi (0x10129aca8)
and /Users/at/Library/Developer/XCTestDevices/65FB8BD5-AA7E-4B86-B3E4-CCE03D12DD29/data/Containers/Bundle/Application/7FD92C43-7416-4761-8FBC-ED400AD7407E/OpenTaxi.app/PlugIns/OpenTaxiTests.xctest/OpenTaxiTests (0x10e05ed30).
 One of the two will be used. Which one is undefined.
Lukasa commented 1 year ago

Yeah, I think this will require filing a report using Feedback Assistant or asking for help on the Apple Developer Forums. This issue appears to be with Xcode, not with grpc-swift.