use process architecture instead of OS architecture

pull/18467/head
Jan Tattermusch 6 years ago
parent 8665e94b11
commit 7d489f6a44
  1. 14
      src/csharp/Grpc.Tools/Common.cs

@ -60,7 +60,7 @@ namespace Grpc.Tools
: RuntimeInformation.IsOSPlatform(OSPlatform.OSX) ? OsKind.MacOsX
: OsKind.Unknown;
switch (RuntimeInformation.OSArchitecture)
switch (RuntimeInformation.ProcessArchitecture)
{
case Architecture.X86: Cpu = CpuKind.X86; break;
case Architecture.X64: Cpu = CpuKind.X64; break;
@ -86,17 +86,7 @@ namespace Grpc.Tools
}
// Hope we are not building on ARM under Xamarin!
Cpu = Environment.Is64BitOperatingSystem ? CpuKind.X64 : CpuKind.X86;
// See https://github.com/grpc/grpc/issues/18543
// Problem: Is64BitOperatingSystem returns "true" inside a 32-bit docker container.
// Workaround: Mono is 64-bit by default on linux, so we get around
// this by assuming 32-bit mono linux process means
// we should invoke 32-bit version of protoc.
if (Os == OsKind.Linux && !Environment.Is64BitProcess)
{
Cpu = CpuKind.X86;
}
Cpu = Environment.Is64BitProcess ? CpuKind.X64 : CpuKind.X86;
#endif
}
};

Loading…
Cancel
Save