2022-01-11 15:15:59 -05:00
|
|
|
// Copyright 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;
|
2020-12-21 23:07:37 -04:00
|
|
|
using EpicGames.Core;
|
2023-03-08 12:43:35 -05:00
|
|
|
using Microsoft.Extensions.Logging;
|
2015-01-07 16:45:01 -05:00
|
|
|
|
|
|
|
|
namespace AutomationScripts.Automation
|
|
|
|
|
{
|
|
|
|
|
public class ListMobileDevices : BuildCommand
|
|
|
|
|
{
|
|
|
|
|
public override void ExecuteBuild()
|
|
|
|
|
{
|
2023-03-08 12:43:35 -05:00
|
|
|
Logger.LogInformation("======= ListMobileDevices - Start =======");
|
2015-01-07 16:45:01 -05:00
|
|
|
|
|
|
|
|
var GlobalParams = new ProjectParams(
|
|
|
|
|
Command: this,
|
2022-01-11 15:15:59 -05:00
|
|
|
RawProjectPath: new FileReference(@"D:\UE\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.");
|
|
|
|
|
}
|
|
|
|
|
|
2023-03-08 12:43:35 -05:00
|
|
|
Logger.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)
|
|
|
|
|
{
|
2023-03-08 12:43:35 -05:00
|
|
|
Logger.LogInformation("Device:{PlatformName}:{DeviceName}", PlatformName, DeviceName);
|
2015-01-07 16:45:01 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
throw new AutomationException("No {0} devices", PlatformName);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|