2019-01-02 14:54:39 -05:00
|
|
|
// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
|
2016-01-07 04:39:47 -05:00
|
|
|
|
|
|
|
|
using System.Collections.Generic;
|
2015-01-07 16:45:01 -05:00
|
|
|
using AutomationTool;
|
|
|
|
|
using UnrealBuildTool;
|
2017-08-31 12:08:38 -04:00
|
|
|
using Tools.DotNETCommon;
|
2015-01-07 16:45:01 -05:00
|
|
|
|
|
|
|
|
namespace AutomationScripts.Automation
|
|
|
|
|
{
|
|
|
|
|
public class ListMobileDevices : BuildCommand
|
|
|
|
|
{
|
|
|
|
|
public override void ExecuteBuild()
|
|
|
|
|
{
|
2018-08-14 18:32:34 -04:00
|
|
|
LogInformation("======= ListMobileDevices - Start =======");
|
2015-01-07 16:45:01 -05:00
|
|
|
|
|
|
|
|
var GlobalParams = new ProjectParams(
|
|
|
|
|
Command: this,
|
2015-09-26 14:41:15 -04:00
|
|
|
RawProjectPath: new FileReference(@"D:\UE-Main\UE4\Samples\Games\TappyChicken\TappyChicken.uproject")
|
2015-01-07 16:45:01 -05:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (ParseParam("android"))
|
|
|
|
|
{
|
2016-07-19 19:13:01 -04:00
|
|
|
GetConnectedDevices(GlobalParams, Platform.GetPlatform(UnrealTargetPlatform.Android));
|
2015-01-07 16:45:01 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (ParseParam("ios"))
|
|
|
|
|
{
|
|
|
|
|
throw new AutomationException("iOS is not yet implemented.");
|
|
|
|
|
}
|
|
|
|
|
|
2018-08-14 18:32:34 -04:00
|
|
|
LogInformation("======= ListMobileDevices - Done ========");
|
2015-01-07 16:45:01 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
{
|
2018-08-14 18:32:34 -04:00
|
|
|
LogInformation("Device:{0}:{1}", PlatformName, DeviceName);
|
2015-01-07 16:45:01 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
throw new AutomationException("No {0} devices", PlatformName);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|