You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#rnx #preflight 64767efb4b1ead7c7f428c7a [CL 25693857 by joe kirchoff in ue5-main branch]
49 lines
1.6 KiB
C#
49 lines
1.6 KiB
C#
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
namespace UnrealBuildTool
|
|
{
|
|
/// <summary>
|
|
/// Attribute which can be applied to a TargetRules-dervied class to indicate which platforms it supports
|
|
/// </summary>
|
|
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
|
|
public class SupportedPlatformGroupsAttribute : SupportedPlatformsAttribute
|
|
{
|
|
/// <summary>
|
|
/// Initialize the attribute with a list of platform groups
|
|
/// </summary>
|
|
/// <param name="PlatformGroups">Variable-length array of platform group arguments</param>
|
|
public SupportedPlatformGroupsAttribute(params string[] PlatformGroups) : base(GetPlatformsForGroups(PlatformGroups))
|
|
{
|
|
}
|
|
|
|
private static string[] GetPlatformsForGroups(params string[] PlatformGroups)
|
|
{
|
|
HashSet<UnrealTargetPlatform> SupportedPlatforms = new();
|
|
try
|
|
{
|
|
foreach (string Name in PlatformGroups)
|
|
{
|
|
if (UnrealPlatformGroup.TryParse(Name, out UnrealPlatformGroup Group))
|
|
{
|
|
SupportedPlatforms.UnionWith(UnrealTargetPlatform.GetValidPlatforms().Where(x => x.IsInGroup(Group)));
|
|
continue;
|
|
}
|
|
throw new BuildException(String.Format("The platform group name {0} is not a valid platform group name. Valid names are ({1})", Name,
|
|
String.Join(",", UnrealPlatformGroup.GetValidGroupNames())));
|
|
}
|
|
}
|
|
catch (BuildException Ex)
|
|
{
|
|
EpicGames.Core.ExceptionUtils.AddContext(Ex, $"while parsing a SupportedPlatformGroups attribute '{String.Join(',', PlatformGroups)}'");
|
|
throw;
|
|
}
|
|
|
|
return SupportedPlatforms.Select(x => x.ToString()).ToArray();
|
|
}
|
|
}
|
|
}
|