Skip to content

Commit

Permalink
DotNetHelper: fix IsMonoRuntime being initialized before extracting t…
Browse files Browse the repository at this point in the history
…he sdk. (#15646)
  • Loading branch information
tmds authored Mar 14, 2023
1 parent 223e47f commit b672d91
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ internal class DotNetHelper
{
private static readonly object s_lockObj = new();

private static bool IsMonoRuntime { get; } = DetermineIsMonoRuntime();
public static string DotNetPath { get; } = Path.Combine(Config.DotNetDirectory, "dotnet");
public static string LogsDirectory { get; } = Path.Combine(Directory.GetCurrentDirectory(), "logs");
public static string PackagesDirectory { get; } = Path.Combine(Directory.GetCurrentDirectory(), "packages");
public static string ProjectsDirectory { get; } = Path.Combine(Directory.GetCurrentDirectory(), $"projects-{DateTime.Now:yyyyMMddHHmmssffff}");

private ITestOutputHelper OutputHelper { get; }
private bool IsMonoRuntime { get; }

public DotNetHelper(ITestOutputHelper outputHelper)
{
Expand All @@ -38,6 +38,7 @@ public DotNetHelper(ITestOutputHelper outputHelper)
Directory.CreateDirectory(Config.DotNetDirectory);
ExecuteHelper.ExecuteProcessValidateExitCode("tar", $"xzf {Config.SdkTarballPath} -C {Config.DotNetDirectory}", outputHelper);
}
IsMonoRuntime = DetermineIsMonoRuntime(Config.DotNetDirectory);

if (!Directory.Exists(ProjectsDirectory))
{
Expand Down Expand Up @@ -234,10 +235,8 @@ private static string GetBinLogOption(string projectName, string command, string
return $"/bl:{Path.Combine(LogsDirectory, $"{fileName}.binlog")}";
}

private static bool DetermineIsMonoRuntime()
private static bool DetermineIsMonoRuntime(string dotnetRoot)
{
string dotnetRoot = Config.DotNetDirectory;

string sharedFrameworkRoot = Path.Combine(dotnetRoot, "shared", "Microsoft.NETCore.App");
if (!Directory.Exists(sharedFrameworkRoot))
{
Expand Down

0 comments on commit b672d91

Please sign in to comment.