Files
UnrealEngineUWP/Engine/Source/Programs/AutomationTool/Scripts/ListMobileDevices.Automation.cs
Thomas Sarkanen 8ba3c4c087 Merging //UE4/Dev-Main to Dev-Anim (//UE4/Dev-Anim) @ CL 4643671
#rb none
#jira none

[CL 4665410 by Thomas Sarkanen in Dev-Anim branch]
2018-12-17 06:31:16 -05:00

55 lines
1.3 KiB
C#

// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
using System.Collections.Generic;
using AutomationTool;
using UnrealBuildTool;
using Tools.DotNETCommon;
namespace AutomationScripts.Automation
{
public class ListMobileDevices : BuildCommand
{
public override void ExecuteBuild()
{
LogInformation("======= ListMobileDevices - Start =======");
var GlobalParams = new ProjectParams(
Command: this,
RawProjectPath: new FileReference(@"D:\UE-Main\UE4\Samples\Games\TappyChicken\TappyChicken.uproject")
);
if (ParseParam("android"))
{
GetConnectedDevices(GlobalParams, Platform.GetPlatform(UnrealTargetPlatform.Android));
}
if (ParseParam("ios"))
{
throw new AutomationException("iOS is not yet implemented.");
}
LogInformation("======= ListMobileDevices - Done ========");
}
private static void GetConnectedDevices(ProjectParams Params, Platform TargetPlatform)
{
var PlatformName = TargetPlatform.PlatformType.ToString();
List<string> ConnectedDevices;
TargetPlatform.GetConnectedDevices(Params, out ConnectedDevices);
try
{
foreach (var DeviceName in ConnectedDevices)
{
LogInformation("Device:{0}:{1}", PlatformName, DeviceName);
}
}
catch
{
throw new AutomationException("No {0} devices", PlatformName);
}
}
}
}