[xharness] Always use nuget to restore nugets, and always use xibuild to run nuget. (#8845)
This commit is contained in:
Родитель
75341a9f20
Коммит
8917f2224b
|
@ -25,10 +25,5 @@ namespace Xharness.Jenkins.TestTasks {
|
||||||
|
|
||||||
protected override void InitializeTool ()
|
protected override void InitializeTool ()
|
||||||
=> buildToolTask = new BuildProject (Jenkins.Harness.XIBuildPath, ProcessManager, ResourceManager, this, this);
|
=> 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 ()) {
|
using (var resource = await ResourceManager.NugetResource.AcquireExclusiveAsync ()) {
|
||||||
// we do not want to use xibuild on solutions, we will have some failures with Mac Full
|
// 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);
|
throw new FileNotFoundException ("Could not find the solution whose nugets to restore.", projectPath);
|
||||||
|
|
||||||
using (var nuget = new Process ()) {
|
using (var nuget = new Process ()) {
|
||||||
nuget.StartInfo.FileName = useXIBuild && !isSolution ? msbuildPath:
|
nuget.StartInfo.FileName = msbuildPath;
|
||||||
"/Library/Frameworks/Mono.framework/Versions/Current/Commands/nuget";
|
|
||||||
var args = new List<string> ();
|
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);
|
args.Add (projectPath);
|
||||||
if (useXIBuild && !isSolution)
|
args.Add ("-Verbosity");
|
||||||
args.Add ("/verbosity:detailed");
|
|
||||||
else {
|
|
||||||
args.Add ("-verbosity");
|
|
||||||
args.Add ("detailed");
|
args.Add ("detailed");
|
||||||
}
|
|
||||||
nuget.StartInfo.Arguments = StringUtils.FormatArguments (args);
|
nuget.StartInfo.Arguments = StringUtils.FormatArguments (args);
|
||||||
EnviromentManager.SetEnvironmentVariables (nuget);
|
EnviromentManager.SetEnvironmentVariables (nuget);
|
||||||
EventLogger.LogEvent (log, "Restoring nugets for {0} ({1}) on path {2}", TestName, Mode, projectPath);
|
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
|
// 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).
|
// (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)
|
if (!RestoreNugets)
|
||||||
return TestExecutingResult.Ignored;
|
return TestExecutingResult.Ignored;
|
||||||
|
@ -107,7 +105,7 @@ namespace Microsoft.DotNet.XHarness.iOS.Shared.Tasks {
|
||||||
if (SolutionPath == null) {
|
if (SolutionPath == null) {
|
||||||
var references = GetNestedReferenceProjects (TestProject.Path);
|
var references = GetNestedReferenceProjects (TestProject.Path);
|
||||||
foreach (var referenceProject in references) {
|
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) {
|
if (execResult == TestExecutingResult.TimedOut) {
|
||||||
return execResult;
|
return execResult;
|
||||||
}
|
}
|
||||||
|
@ -115,7 +113,7 @@ namespace Microsoft.DotNet.XHarness.iOS.Shared.Tasks {
|
||||||
}
|
}
|
||||||
|
|
||||||
// restore for the main project/solution]
|
// 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;
|
BuildLog = buildLog;
|
||||||
(TestExecutingResult ExecutionResult, (string HumanMessage, string IssueLink)? KnownFailure) result = (TestExecutingResult.NotStarted, ((string HumanMessage, string IssueLink)?) null);
|
(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 ()) {
|
using (var xbuild = new Process ()) {
|
||||||
xbuild.StartInfo.FileName = msbuildPath;
|
xbuild.StartInfo.FileName = msbuildPath;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче