Skip to content

Commit

Permalink
[Harness] Refactor certain class names to simplify the extraction of …
Browse files Browse the repository at this point in the history
…the RunTestTask.

The initial idea of the refactoring looked nice but as soon as we want
to get the RunTestTask out of jenkins, we have a number of naming
issues. Move the tools to not use the *Task postfix so that it is
cleaner and we can later extra the RunTestTask better.
  • Loading branch information
mandel-macaque committed Apr 13, 2020
1 parent 5e0131d commit 6002b1a
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 22 deletions.
2 changes: 0 additions & 2 deletions tests/xharness/Jenkins/Jenkins.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
using Microsoft.DotNet.XHarness.iOS.Shared;
using Microsoft.DotNet.XHarness.iOS.Shared.Hardware;
using Xharness.TestTasks;
using MSBuildTask = Xharness.Jenkins.TestTasks.MSBuildTask;
using DotNetBuildTask = Xharness.Jenkins.TestTasks.DotNetBuildTask;

namespace Xharness.Jenkins {
public class Jenkins : IResourceManager, IErrorKnowledgeBase
Expand Down
4 changes: 2 additions & 2 deletions tests/xharness/Jenkins/TestTasks/BuildProjectTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
namespace Xharness.Jenkins.TestTasks {
abstract class BuildProjectTask : BuildToolTask
{
Xharness.TestTasks.BuildProjectTask BuildProject => buildToolTask as Xharness.TestTasks.BuildProjectTask;
BuildProject BuildProject => buildToolTask as BuildProject;

public string SolutionPath {
get => BuildProject.SolutionPath;
Expand All @@ -22,7 +22,7 @@ protected BuildProjectTask (Jenkins jenkins, TestProject testProject, IProcessMa
public override bool SupportsParallelExecution => BuildProject.SupportsParallelExecution;

protected override void InitializeTool ()
=> buildToolTask = new Xharness.TestTasks.BuildProjectTask (ProcessManager, Jenkins, this, this);
=> buildToolTask = new BuildProject (ProcessManager, Jenkins, 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).
Expand Down
4 changes: 2 additions & 2 deletions tests/xharness/Jenkins/TestTasks/BuildToolTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace Xharness.Jenkins.TestTasks
{
public abstract class BuildToolTask : AppleTestTask
{
protected Xharness.TestTasks.BuildToolTask buildToolTask;
protected Xharness.TestTasks.BuildTool buildToolTask;

public IProcessManager ProcessManager { get; }

Expand Down Expand Up @@ -54,7 +54,7 @@ public override string Mode {
set => buildToolTask.Mode = value;
}

protected virtual void InitializeTool () => buildToolTask = new Xharness.TestTasks.BuildToolTask (ProcessManager);
protected virtual void InitializeTool () => buildToolTask = new Xharness.TestTasks.BuildTool (ProcessManager);
public virtual Task CleanAsync () => buildToolTask.CleanAsync ();
}
}
4 changes: 3 additions & 1 deletion tests/xharness/Jenkins/TestTasks/DotNetBuildTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
using System.Diagnostics;
using Microsoft.DotNet.XHarness.iOS.Shared.Execution;

using Xharness.TestTasks;

namespace Xharness.Jenkins.TestTasks {
class DotNetBuildTask : MSBuildTask {

Expand All @@ -23,7 +25,7 @@ public override void SetEnvironmentVariables (Process process)
}

protected override void InitializeTool () =>
buildToolTask = new Xharness.TestTasks.DotNetBuildTask (
buildToolTask = new DotNetBuild (
msbuildPath: ToolName,
processManager: ProcessManager,
resourceManager: Jenkins,
Expand Down
4 changes: 2 additions & 2 deletions tests/xharness/Jenkins/TestTasks/MSBuildTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ class MSBuildTask : BuildProjectTask
protected virtual List<string> ToolArguments =>
MSBuild.GetToolArguments (ProjectPlatform, ProjectConfiguration, ProjectFile, BuildLog);

Xharness.TestTasks.MSBuildTask MSBuild => buildToolTask as Xharness.TestTasks.MSBuildTask;
Xharness.TestTasks.MSBuild MSBuild => buildToolTask as Xharness.TestTasks.MSBuild;

public MSBuildTask (Jenkins jenkins, TestProject testProject, IProcessManager processManager)
: base (jenkins, testProject, processManager) { }

protected override void InitializeTool () =>
buildToolTask = new Xharness.TestTasks.MSBuildTask (
buildToolTask = new Xharness.TestTasks.MSBuild (
msbuildPath: ToolName,
processManager: ProcessManager,
resourceManager: Jenkins,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
using Microsoft.DotNet.XHarness.iOS.Shared.Utilities;

namespace Xharness.TestTasks {
public class BuildProjectTask : BuildToolTask {
public class BuildProject : BuildTool {
public IResourceManager ResourceManager { get; set; }
public IEnvManager EnviromentManager { get; set; }
public IEventLogger EventLogger { get; set; }

public string SolutionPath { get; set; }

public BuildProjectTask (IProcessManager processManager, IResourceManager resourceManager, IEventLogger eventLogger, IEnvManager envManager) : base (processManager)
public BuildProject (IProcessManager processManager, IResourceManager resourceManager, IEventLogger eventLogger, IEnvManager envManager) : base (processManager)
{
ResourceManager = resourceManager ?? throw new ArgumentNullException (nameof (resourceManager));
EventLogger = eventLogger ?? throw new ArgumentNullException (nameof (eventLogger));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Xharness.TestTasks {

public class BuildToolTask
public class BuildTool
{
public string TestName { get; set; }
public IProcessManager ProcessManager { get; }
Expand All @@ -14,12 +14,12 @@ public class BuildToolTask
public bool SpecifyPlatform { get; set; } = true;
public bool SpecifyConfiguration { get; set; } = true;

public BuildToolTask (IProcessManager processManager)
public BuildTool (IProcessManager processManager)
{
ProcessManager = processManager ?? throw new ArgumentNullException (nameof (processManager));
}

public BuildToolTask (IProcessManager processManager, TestPlatform platform) : this (processManager)
public BuildTool (IProcessManager processManager, TestPlatform platform) : this (processManager)
{
Platform = platform;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
using Microsoft.DotNet.XHarness.iOS.Shared.Logging;

namespace Xharness.TestTasks {
public class DotNetBuildTask : MSBuildTask {
public class DotNetBuild : MSBuild {

public DotNetBuildTask (string msbuildPath,
public DotNetBuild (string msbuildPath,
IProcessManager processManager,
IResourceManager resourceManager,
IEventLogger eventLogger,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace Xharness.TestTasks {

public class MSBuildTask : BuildProjectTask {
public class MSBuild : BuildProject {
readonly IErrorKnowledgeBase errorKnowledgeBase;
readonly string msbuildPath;

Expand All @@ -29,7 +29,7 @@ public virtual List<string> GetToolArguments (string projectPlatform, string pro
return args;
}

public MSBuildTask (string msbuildPath,
public MSBuild (string msbuildPath,
IProcessManager processManager,
IResourceManager resourceManager,
IEventLogger eventLogger,
Expand Down
8 changes: 4 additions & 4 deletions tests/xharness/xharness.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,13 @@
<Compile Include="TestTasks\IAcquiredResource.cs" />
<Compile Include="TestTasks\Resource.cs" />
<Compile Include="TestTasks\Resources.cs" />
<Compile Include="TestTasks\BuildToolTask.cs" />
<Compile Include="TestTasks\BuildProjectTask.cs" />
<Compile Include="TestTasks\BuildTool.cs" />
<Compile Include="TestTasks\BuildProject.cs" />
<Compile Include="TestTasks\IResourceManager.cs" />
<Compile Include="TestTasks\IEnvManager.cs" />
<Compile Include="TestTasks\MSBuildTask.cs" />
<Compile Include="TestTasks\MSBuild.cs" />
<Compile Include="TestTasks\IErrorKnowledgeBase.cs" />
<Compile Include="TestTasks\DotNetBuildTask.cs" />
<Compile Include="TestTasks\DotNetBuild.cs" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\..\tools\common\SdkVersions.cs">
Expand Down

1 comment on commit 6002b1a

@xamarin-release-manager
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Build was (probably) aborted

🔥 Jenkins job (on internal Jenkins) failed in stage(s) 'Install Provisioning Profiles' 🔥 : hudson.AbortException: script returned exit code 104

Build succeeded
✅ Packages:

Please sign in to comment.