Files
UnrealEngineUWP/Engine/Source/Programs/AutomationTool/Scripts/CheckTargetExists.cs

83 lines
2.6 KiB
C#
Raw Normal View History

// Copyright Epic Games, Inc. All Rights Reserved.
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using EpicGames.Core;
using UnrealBuildTool;
using Microsoft.Extensions.Logging;
namespace AutomationTool
{
[Help("Checks that the given target exists, by looking for the relevant receipt.")]
[Help("-Target", "Name of the target to check")]
[Help("-Platform", "Platform the target was built for")]
[Help("-Configuration", "Configuration for the target")]
[Help("-Architecture", "Architecture that the target was built for")]
[Help("-Project", "Path to the project containing the target")]
class CheckTargetExists : BuildCommand
{
public override void ExecuteBuild()
{
// Parse the target name
string Target = ParseParamValue("Target");
if(Target == null)
{
throw new AutomationException("Missing -Target=... argument");
}
// Parse the platform
string PlatformParam = ParseParamValue("Platform");
if(PlatformParam == null)
{
throw new AutomationException("Missing -Platform=... argument");
}
UnrealTargetPlatform Platform;
if (!UnrealTargetPlatform.TryParse(PlatformParam, out Platform))
{
throw new AutomationException("Invalid platform '{0}'", PlatformParam);
}
// Parse the configuration
string ConfigurationParam = ParseParamValue("Configuration");
if(ConfigurationParam == null)
{
throw new AutomationException("Missing -Configuration=... argument");
}
UnrealTargetConfiguration Configuration;
if(!Enum.TryParse(ConfigurationParam, true, out Configuration))
{
throw new AutomationException("Invalid configuration '{0}'", ConfigurationParam);
}
// Parse the project
string Project = ParseParamValue("Project");
if(Project != null && !File.Exists(Project))
{
throw new AutomationException("Specified project file '{0}' was not found", Project);
}
// Parse the architecture
UnrealArch/UnrealArchitectures changes - Creates the UnrealArchitectures class, which wraps a list of UnrealArch objects - UnrealArch is a single architecture, expandable enum-like struct - There is no more concept of "no/default architecture", there is always a valid active architecture when building - Most uses of "string Architecture" are replaced with one of the two above, depending if multiple architectures are supported or not - UnrealArch has some platform-extensions for platform-specific naming (like Linux adds in LinuxName that turns, for instance, Arm64 -> aarch64-unknown-linux-gnueabi, which is used in folder names, etc) - UnrealArch has bIsX64 which can be used determine intel instruction set (as opposed to arm) - TargetRules class has an "Architecture" accessor that will return a single architecture if the active architectures is a single architecture, or throw an exception if multiple. This is useful in a majority of the cases where a paltform can only have a single architecture active in TargetRules (microsoft platforms, for instance, will create separate targets when compiling multiple architectures at once) - Added UnrealArchitectureConfig class, which contains all the architecture information for a platform (what architectures are supported, what ones are currently active for given project, etc) #preflight 63c81fb5b065224750a1759e #rb mike.fricker,roman.dzieciol,joe.kirchoff,dmytro.vovk,brandon.schaefer [various parts] #p4v-preflight-copy 23562471 [CL 23829977 by josh adams in ue5-main branch]
2023-01-24 09:30:28 -05:00
UnrealArchitectures Architectures = UnrealArchitectures.FromString(ParseParamValue("Architecture"), Platform);
// Check the receipt exists
DirectoryReference ProjectDir = null;
if(Project != null)
{
ProjectDir = new FileReference(Project).Directory;
}
UnrealArch/UnrealArchitectures changes - Creates the UnrealArchitectures class, which wraps a list of UnrealArch objects - UnrealArch is a single architecture, expandable enum-like struct - There is no more concept of "no/default architecture", there is always a valid active architecture when building - Most uses of "string Architecture" are replaced with one of the two above, depending if multiple architectures are supported or not - UnrealArch has some platform-extensions for platform-specific naming (like Linux adds in LinuxName that turns, for instance, Arm64 -> aarch64-unknown-linux-gnueabi, which is used in folder names, etc) - UnrealArch has bIsX64 which can be used determine intel instruction set (as opposed to arm) - TargetRules class has an "Architecture" accessor that will return a single architecture if the active architectures is a single architecture, or throw an exception if multiple. This is useful in a majority of the cases where a paltform can only have a single architecture active in TargetRules (microsoft platforms, for instance, will create separate targets when compiling multiple architectures at once) - Added UnrealArchitectureConfig class, which contains all the architecture information for a platform (what architectures are supported, what ones are currently active for given project, etc) #preflight 63c81fb5b065224750a1759e #rb mike.fricker,roman.dzieciol,joe.kirchoff,dmytro.vovk,brandon.schaefer [various parts] #p4v-preflight-copy 23562471 [CL 23829977 by josh adams in ue5-main branch]
2023-01-24 09:30:28 -05:00
FileReference ReceiptFile = TargetReceipt.GetDefaultPath(ProjectDir, Target, Platform, Configuration, Architectures);
if(!FileReference.Exists(ReceiptFile))
{
throw new AutomationException("FortniteEditor receipt not found ({0})", ReceiptFile);
}
Logger.LogInformation("Found {ReceiptFile}", ReceiptFile);
}
}
}