2019-12-26 23:01:54 -05:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
2018-12-14 11:21:22 -05:00
|
|
|
|
2018-09-25 10:11:35 -04:00
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Text.RegularExpressions;
|
|
|
|
|
using System.Threading.Tasks;
|
2020-12-21 23:07:37 -04:00
|
|
|
using EpicGames.Core;
|
2018-09-25 10:11:35 -04:00
|
|
|
using UnrealBuildTool;
|
2023-03-08 12:43:35 -05:00
|
|
|
using Microsoft.Extensions.Logging;
|
2018-09-25 10:11:35 -04:00
|
|
|
|
|
|
|
|
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;
|
2019-05-24 11:51:54 -04:00
|
|
|
if (!UnrealTargetPlatform.TryParse(PlatformParam, out Platform))
|
2018-09-25 10:11:35 -04:00
|
|
|
{
|
|
|
|
|
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);
|
2018-09-25 10:11:35 -04:00
|
|
|
|
|
|
|
|
// 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);
|
2018-09-25 10:11:35 -04:00
|
|
|
if(!FileReference.Exists(ReceiptFile))
|
|
|
|
|
{
|
|
|
|
|
throw new AutomationException("FortniteEditor receipt not found ({0})", ReceiptFile);
|
|
|
|
|
}
|
|
|
|
|
|
2023-03-08 12:43:35 -05:00
|
|
|
Logger.LogInformation("Found {ReceiptFile}", ReceiptFile);
|
2018-09-25 10:11:35 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|