[xharness] Always use nuget to restore nugets, and always use xibuild to run nuget. (#8845)

This commit is contained in:
Rolf Bjarne Kvinge 2020-06-15 09:17:02 +02:00 коммит произвёл GitHub
Родитель 75341a9f20
Коммит 8917f2224b
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 12 добавлений и 19 удалений

Просмотреть файл

@ -25,10 +25,5 @@ namespace Xharness.Jenkins.TestTasks {
protected override void InitializeTool ()
=> buildToolTask = new BuildProject (Jenkins.Harness.XIBuildPath, ProcessManager, ResourceManager, this, this);
// This method must be called with the desktop resource acquired
// (which is why it takes an IAcquiredResources as a parameter without using it in the function itself).
protected async Task RestoreNugetsAsync (ILog log, IAcquiredResource resource, bool useXIBuild = false) =>
ExecutionResult = await BuildProject.RestoreNugetsAsync (log, resource, useXIBuild);
}
}

Просмотреть файл

@ -37,7 +37,7 @@ namespace Microsoft.DotNet.XHarness.iOS.Shared.Tasks {
}
}
async Task<TestExecutingResult> RestoreNugetsAsync (string projectPath, ILog log, bool useXIBuild = false)
async Task<TestExecutingResult> RestoreNugetsAsync (string projectPath, ILog log)
{
using (var resource = await ResourceManager.NugetResource.AcquireExclusiveAsync ()) {
// we do not want to use xibuild on solutions, we will have some failures with Mac Full
@ -46,17 +46,15 @@ namespace Microsoft.DotNet.XHarness.iOS.Shared.Tasks {
throw new FileNotFoundException ("Could not find the solution whose nugets to restore.", projectPath);
using (var nuget = new Process ()) {
nuget.StartInfo.FileName = useXIBuild && !isSolution ? msbuildPath:
"/Library/Frameworks/Mono.framework/Versions/Current/Commands/nuget";
nuget.StartInfo.FileName = msbuildPath;
var args = new List<string> ();
args.Add ((useXIBuild && !isSolution ? "/" : "") + "restore"); // diff param depending on the tool
args.Add ("-t");
args.Add ("--");
args.Add ("/Library/Frameworks/Mono.framework/Versions/Current/Commands/nuget");
args.Add ("restore");
args.Add (projectPath);
if (useXIBuild && !isSolution)
args.Add ("/verbosity:detailed");
else {
args.Add ("-verbosity");
args.Add ("detailed");
}
args.Add ("-Verbosity");
args.Add ("detailed");
nuget.StartInfo.Arguments = StringUtils.FormatArguments (args);
EnviromentManager.SetEnvironmentVariables (nuget);
EventLogger.LogEvent (log, "Restoring nugets for {0} ({1}) on path {2}", TestName, Mode, projectPath);
@ -94,7 +92,7 @@ namespace Microsoft.DotNet.XHarness.iOS.Shared.Tasks {
// This method must be called with the desktop resource acquired
// (which is why it takes an IAcquiredResources as a parameter without using it in the function itself).
public async Task<TestExecutingResult> RestoreNugetsAsync (ILog log, IAcquiredResource resource, bool useXIBuild = false)
public async Task<TestExecutingResult> RestoreNugetsAsync (ILog log, IAcquiredResource resource)
{
if (!RestoreNugets)
return TestExecutingResult.Ignored;
@ -107,7 +105,7 @@ namespace Microsoft.DotNet.XHarness.iOS.Shared.Tasks {
if (SolutionPath == null) {
var references = GetNestedReferenceProjects (TestProject.Path);
foreach (var referenceProject in references) {
var execResult = await RestoreNugetsAsync (referenceProject, log, useXIBuild); // do the replace in case we use win paths
var execResult = await RestoreNugetsAsync (referenceProject, log); // do the replace in case we use win paths
if (execResult == TestExecutingResult.TimedOut) {
return execResult;
}
@ -115,7 +113,7 @@ namespace Microsoft.DotNet.XHarness.iOS.Shared.Tasks {
}
// restore for the main project/solution]
return await RestoreNugetsAsync (SolutionPath ?? TestProject.Path, log, useXIBuild);
return await RestoreNugetsAsync (SolutionPath ?? TestProject.Path, log);
}
}
}

Просмотреть файл

@ -49,7 +49,7 @@ namespace Microsoft.DotNet.XHarness.iOS.Shared.Tasks {
{
BuildLog = buildLog;
(TestExecutingResult ExecutionResult, (string HumanMessage, string IssueLink)? KnownFailure) result = (TestExecutingResult.NotStarted, ((string HumanMessage, string IssueLink)?) null);
await RestoreNugetsAsync (buildLog, resource, useXIBuild: true);
await RestoreNugetsAsync (buildLog, resource);
using (var xbuild = new Process ()) {
xbuild.StartInfo.FileName = msbuildPath;