Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DotNetHelper: fix IsMonoRuntime being initialized before extracting the sdk. #15646

Merged
merged 1 commit into from
Mar 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
tmds marked this conversation as resolved.
Show resolved Hide resolved
{
string dotnetRoot = Config.DotNetDirectory;

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