private static CpuInfo Load() { if (RuntimeInformation.IsMacOSX()) { string content = ProcessHelper.RunAndReadOutput("sysctl", "-a"); return(SysctlCpuInfoParser.ParseOutput(content)); } return(null); }
protected static string GetPortableRuntimeIdentifier() { // Microsoft.DotNet.PlatformAbstractions.RuntimeEnvironment.GetRuntimeIdentifier() // returns win10-x64, we want the simpler form win-x64 // the values taken from https://docs.microsoft.com/en-us/dotnet/core/rid-catalog#macos-rids string osPart = RuntimeInformation.IsWindows() ? "win" : (RuntimeInformation.IsMacOSX() ? "osx" : "linux"); return($"{osPart}-{RuntimeEnvironment.RuntimeArchitecture}"); }
internal static string GetPortableRuntimeIdentifier() { // Microsoft.DotNet.PlatformAbstractions.RuntimeEnvironment.GetRuntimeIdentifier() // returns win10-x64, we want the simpler form win-x64 // the values taken from https://docs.microsoft.com/en-us/dotnet/core/rid-catalog#macos-rids string osPart = RuntimeInformation.IsWindows() ? "win" : (RuntimeInformation.IsMacOSX() ? "osx" : "linux"); string architecture = #if NETSTANDARD RuntimeEnvironment.RuntimeArchitecture; #else System.Runtime.InteropServices.RuntimeInformation.ProcessArchitecture.ToString().ToLowerInvariant(); #endif return($"{osPart}-{architecture}"); }
// This method is as work around because the MonoAOTCompilerTask // does not generate files with the right names. // In the future it may have an option to write .so/.dylib files, // and we can get rid of this method. public void RenameSharedLibaries(GenerateResult generateResult, ILogger logger) { string[] publishDirFiles = Directory.GetFiles(generateResult.ArtifactsPaths.BuildArtifactsDirectoryPath, ".dll.o"); string sharedObjectExtension = ""; if (RuntimeInformation.IsMacOSX()) { sharedObjectExtension = "dylib"; } else if (RuntimeInformation.IsLinux()) { sharedObjectExtension = "so"; } foreach (string fileName in publishDirFiles) { string newFileName = Path.ChangeExtension(fileName, sharedObjectExtension); logger.WriteLine($"RenameSharedLibraries: Moving ${fileName} to {newFileName}"); File.Move(fileName, newFileName); } }