Skip to content

Commit

Permalink
Code quality improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
tamasvajk committed Nov 14, 2023
1 parent b455b2c commit 5b38ba8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion csharp/autobuilder/Semmle.Autobuild.Shared/BuildActions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ bool IBuildActions.IsRunningOnAppleSilicon()

try
{
var res = thisBuildActions.RunProcess("sysctl", "machdep.cpu.brand_string", workingDirectory: null, env: null, out var stdOut);
thisBuildActions.RunProcess("sysctl", "machdep.cpu.brand_string", workingDirectory: null, env: null, out var stdOut);
return stdOut?.Any(s => s?.ToLowerInvariant().Contains("apple") == true) ?? false;
}
catch (Exception)
Expand Down
8 changes: 3 additions & 5 deletions csharp/autobuilder/Semmle.Autobuild.Shared/MsBuildRule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,12 @@ internal static class MsBuildCommandExtensions
/// <returns></returns>
public static CommandBuilder MsBuildCommand(this CommandBuilder cmdBuilder, IAutobuilder<AutobuildOptionsShared> builder)
{
var IsRunningOnAppleSiliconMac = builder.Actions.IsMacOs() && builder.Actions.IsRunningOnAppleSilicon();

// mono doesn't ship with `msbuild` on Arm-based Macs, but we can fall back to
// msbuild that ships with `dotnet` which can be invoked with `dotnet msbuild`
// perhaps we should do this on all platforms?
return IsRunningOnAppleSiliconMac ?
cmdBuilder.RunCommand("dotnet").Argument("msbuild") :
cmdBuilder.RunCommand("msbuild");
return builder.Actions.IsRunningOnAppleSilicon()
? cmdBuilder.RunCommand("dotnet").Argument("msbuild")
: cmdBuilder.RunCommand("msbuild");
}
}

Expand Down

0 comments on commit 5b38ba8

Please sign in to comment.