2022-08-10 16:03:37 +00:00
// Copyright Epic Games, Inc. All Rights Reserved.
using System.Collections.Generic ;
- Fixed various issues with making Mac/IOS builds that can be uploaded to AppStore in Xcode
* Missing ThinApp.sh
* Missing some quotes around a variable in GenerateUniversalDSYM.sh
* Correctly filter out the stub .app's and such when copying the Staged data directory into the .app
* Disabled the Mac's Sign To Run Locally option by default, as that causes Xcode's Validation/Upload to not have the team name embedded in it, causing a hassle while pushing up to AppStore/TestFlight
* Fixed the PRODUCT_NAME for BP projects
* Made CrashReportClient be a sandboxed app that inherits from parent
* Fix Hybrid apps to check all platforms before in the project generator, so that if a project needs a temp target for IOS (via a plugin)
* For hybrid projects, don't append Game to the end of the Game target names, as that is the default, and it makes for better named products
* Disabled the LoginFlow module from OnlineFramework plugin - this was causing issues with having CEF and EpicWebHelper embedded into a sandboxed .app, and LoginFlow isn't seemingly actually used by anything
#jira UE-196297,UE-196299,UE-196296,UE-196300,UE-196295
#rb adam.kinge
[CL 28463729 by josh adams in ue5-main branch]
2023-10-04 13:25:29 -04:00
using System.Linq ;
2024-04-03 12:22:43 -04:00
using System.Text ;
2022-08-10 16:03:37 +00:00
using EpicGames.Core ;
using Microsoft.Extensions.Logging ;
namespace UnrealBuildTool
{
/// <summary>
/// Stores all the registered platform project generators
/// </summary>
class PlatformProjectGeneratorCollection
{
Dictionary < UnrealTargetPlatform , PlatformProjectGenerator > ProjectGeneratorDictionary = new Dictionary < UnrealTargetPlatform , PlatformProjectGenerator > ( ) ;
- Fixed various issues with making Mac/IOS builds that can be uploaded to AppStore in Xcode
* Missing ThinApp.sh
* Missing some quotes around a variable in GenerateUniversalDSYM.sh
* Correctly filter out the stub .app's and such when copying the Staged data directory into the .app
* Disabled the Mac's Sign To Run Locally option by default, as that causes Xcode's Validation/Upload to not have the team name embedded in it, causing a hassle while pushing up to AppStore/TestFlight
* Fixed the PRODUCT_NAME for BP projects
* Made CrashReportClient be a sandboxed app that inherits from parent
* Fix Hybrid apps to check all platforms before in the project generator, so that if a project needs a temp target for IOS (via a plugin)
* For hybrid projects, don't append Game to the end of the Game target names, as that is the default, and it makes for better named products
* Disabled the LoginFlow module from OnlineFramework plugin - this was causing issues with having CEF and EpicWebHelper embedded into a sandboxed .app, and LoginFlow isn't seemingly actually used by anything
#jira UE-196297,UE-196299,UE-196296,UE-196300,UE-196295
#rb adam.kinge
[CL 28463729 by josh adams in ue5-main branch]
2023-10-04 13:25:29 -04:00
/// <summary>
/// Returns the list of platforms that have been registered in this collection
/// </summary>
/// <returns>Registered platforms</returns>
public List < UnrealTargetPlatform > GetRegisteredPlatforms ( )
{
return ProjectGeneratorDictionary . Keys . ToList ( ) ;
}
2022-08-10 16:03:37 +00:00
/// <summary>
/// Register the given platforms UEPlatformProjectGenerator instance
/// </summary>
/// <param name="InPlatform"> The UnrealTargetPlatform to register with</param>
/// <param name="InProjectGenerator">The UEPlatformProjectGenerator instance to use for the InPlatform</param>
/// <param name="Logger">Logger for output</param>
public void RegisterPlatformProjectGenerator ( UnrealTargetPlatform InPlatform , PlatformProjectGenerator InProjectGenerator , ILogger Logger )
{
// Make sure the build platform is legal
UEBuildPlatform ? BuildPlatform ;
2023-05-30 18:38:07 -04:00
if ( UEBuildPlatform . TryGetBuildPlatform ( InPlatform , out BuildPlatform ) )
2022-08-10 16:03:37 +00:00
{
if ( ProjectGeneratorDictionary . ContainsKey ( InPlatform ) = = true )
{
Logger . LogInformation ( "RegisterPlatformProjectGenerator Warning: Registering project generator {Generator} for {Platform} when it is already set to {ExistingGenerator}" ,
InProjectGenerator . ToString ( ) , InPlatform . ToString ( ) , ProjectGeneratorDictionary [ InPlatform ] . ToString ( ) ) ;
ProjectGeneratorDictionary [ InPlatform ] = InProjectGenerator ;
}
else
{
ProjectGeneratorDictionary . Add ( InPlatform , InProjectGenerator ) ;
}
}
else
{
Logger . LogDebug ( "Skipping project file generator registration for {Platform} due to no valid BuildPlatform." , InPlatform . ToString ( ) ) ;
}
}
/// <summary>
/// Retrieve the UEPlatformProjectGenerator instance for the given TargetPlatform
/// </summary>
/// <param name="InPlatform"> The UnrealTargetPlatform being built</param>
/// <param name="bInAllowFailure"> If true, do not throw an exception and return null</param>
/// <returns>UEPlatformProjectGenerator The instance of the project generator</returns>
public PlatformProjectGenerator ? GetPlatformProjectGenerator ( UnrealTargetPlatform InPlatform , bool bInAllowFailure = false )
{
if ( ProjectGeneratorDictionary . ContainsKey ( InPlatform ) = = true )
{
return ProjectGeneratorDictionary [ InPlatform ] ;
}
if ( bInAllowFailure = = true )
{
return null ;
}
throw new BuildException ( "GetPlatformProjectGenerator: No PlatformProjectGenerator found for {Platform}" , InPlatform . ToString ( ) ) ;
}
/// <summary>
/// Allow various platform project generators to generate stub projects if required
/// </summary>
/// <param name="InGenerator"></param>
/// <param name="InTargetName"></param>
/// <param name="InTargetFilepath"></param>
/// <param name="InTargetRules"></param>
/// <param name="InPlatforms"></param>
/// <param name="InConfigurations"></param>
/// <returns></returns>
public bool GenerateGameProjectStubs ( ProjectFileGenerator InGenerator , string InTargetName , string InTargetFilepath , TargetRules InTargetRules ,
List < UnrealTargetPlatform > InPlatforms , List < UnrealTargetConfiguration > InConfigurations )
{
foreach ( KeyValuePair < UnrealTargetPlatform , PlatformProjectGenerator > Entry in ProjectGeneratorDictionary )
{
PlatformProjectGenerator ProjGen = Entry . Value ;
ProjGen . GenerateGameProjectStub ( InGenerator , InTargetName , InTargetFilepath , InTargetRules , InPlatforms , InConfigurations ) ;
}
return true ;
}
/// <summary>
/// Allow various platform project generators to generate any special project properties if required
/// </summary>
/// <param name="InPlatform"></param>
/// <param name="Configuration"></param>
/// <param name="TargetType"></param>
/// <param name="VCProjectFileContent"></param>
/// <param name="RootDirectory"></param>
/// <param name="TargetFilePath"></param>
/// <returns></returns>
public bool GenerateGamePlatformSpecificProperties ( UnrealTargetPlatform InPlatform , UnrealTargetConfiguration Configuration , TargetType TargetType , StringBuilder VCProjectFileContent , DirectoryReference RootDirectory , FileReference TargetFilePath )
{
if ( ProjectGeneratorDictionary . ContainsKey ( InPlatform ) = = true )
{
ProjectGeneratorDictionary [ InPlatform ] . GenerateGameProperties ( Configuration , VCProjectFileContent , TargetType , RootDirectory , TargetFilePath ) ;
}
return true ;
}
public bool PlatformRequiresVSUserFileGeneration ( List < UnrealTargetPlatform > InPlatforms , List < UnrealTargetConfiguration > InConfigurations )
{
bool bRequiresVSUserFileGeneration = false ;
foreach ( KeyValuePair < UnrealTargetPlatform , PlatformProjectGenerator > Entry in ProjectGeneratorDictionary )
{
if ( InPlatforms . Contains ( Entry . Key ) )
{
PlatformProjectGenerator ProjGen = Entry . Value ;
bRequiresVSUserFileGeneration | = ProjGen . RequiresVSUserFileGeneration ( ) ;
}
}
return bRequiresVSUserFileGeneration ;
}
}
}