Files
eric mcdaniel 391d5185c3 Turnkey: Turnkey and editor support for controlling auto software update modes on platform devices
- this change just adds support to Turnkey and the editor UI to expose this support for supported platforms
  - follow on changes will be required to support the feature on a given platform

- Turnkey now tracks the auto software update mode per device
  - unknown/enable/disable
    - will be unknown for devices which do not support auto software updates or platforms which have not yet implemented support
- new UAT platform method SetDeviceAutoSoftwareUpdateMode() must be implemented for supporting platforms
- new Turnkey command DeviceAutoSoftwareUpdates for changing auto software update state on a device
- edtior exposes this functionality under the device entries in the platforms menu
  - devices which support auto software updates will expose an "Enable auto software updates" check box item in their Sdk Info menu
    - toggling this checkbox changes the auto software update policy on the device

#rb David.Harvey, Wojciech.Krywult
#jira UE-160691
#preflight 64012d69d249add4a205fe9c, 64078e72aa0042333551c821

[CL 24552009 by eric mcdaniel in ue5-main branch]
2023-03-07 19:11:50 -05:00

52 lines
1.6 KiB
C#

// Copyright Epic Games, Inc. All Rights Reserved.
using System;
using System.Collections.Generic;
using AutomationTool;
using UnrealBuildTool;
namespace Turnkey.Commands
{
class DeviceAutoSoftwareUpdates : TurnkeyCommand
{
protected override CommandGroup Group => CommandGroup.Sdk;
protected override void Execute(string[] CommandOptions)
{
// Are we enabling or disabling auto updates on the devices?
bool bUnattended = TurnkeyUtils.ParseParam("Unattended", CommandOptions);
string EnableArg = TurnkeyUtils.ParseParamValue("Enable", null, CommandOptions);
bool bEnableAutoSoftwareUpdates = false;
if (string.IsNullOrEmpty(EnableArg))
{
if (bUnattended)
{
TurnkeyUtils.Log("Error: Desired state of device auto software updates must be specified via -Enable=true/false");
return;
}
else
{
bEnableAutoSoftwareUpdates = TurnkeyUtils.ReadInputInt("Enable device auto software updates?", new List<string> { "Disable", "Enable" }, false) != 0;
}
}
else
{
bEnableAutoSoftwareUpdates = EnableArg.Equals("true", StringComparison.InvariantCultureIgnoreCase);
}
// Get list of devices
List<UnrealTargetPlatform> PlatformsWithSdks = TurnkeyManifest.GetPlatformsWithSdks();
List<DeviceInfo> ChosenDevices = TurnkeyUtils.GetDevicesFromCommandLineOrUser(CommandOptions, PlatformsWithSdks);
// Set the auto updates mode on each device
foreach (DeviceInfo Device in ChosenDevices)
{
AutomationTool.Platform AutomationPlatform = Platform.GetPlatform(Device.Platform);
AutomationPlatform.SetDeviceAutoSoftwareUpdateMode(Device, bEnableAutoSoftwareUpdates);
}
}
}
}