2022-08-10 16:03:37 +00:00
// Copyright Epic Games, Inc. All Rights Reserved.
using System ;
using System.Collections.Generic ;
using System.Linq ;
using System.Text ;
using System.IO ;
using AutomationTool ;
using UnrealBuildTool ;
using System.Text.RegularExpressions ;
using EpicGames.Core ;
public class TVOSPlatform : IOSPlatform
{
public TVOSPlatform ( )
: base ( UnrealTargetPlatform . TVOS )
{
TargetIniPlatformType = UnrealTargetPlatform . IOS ;
}
2022-12-12 17:46:48 -05:00
public override bool PrepForUATPackageOrDeploy ( UnrealTargetConfiguration Config , FileReference ProjectFile , string InProjectName , DirectoryReference InProjectDirectory , FileReference Executable , DirectoryReference InEngineDir , bool bForDistribution , string CookFlavor , bool bIsDataDeploy , bool bCreateStubIPA , bool bIsUEGame )
2022-08-10 16:03:37 +00:00
{
2022-12-12 17:46:48 -05:00
string TargetName = Path . GetFileNameWithoutExtension ( Executable . FullName ) . Split ( "-" . ToCharArray ( ) ) [ 0 ] ;
2022-08-10 16:03:37 +00:00
FileReference TargetReceiptFileName ;
if ( bIsUEGame )
{
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
TargetReceiptFileName = TargetReceipt . GetDefaultPath ( InEngineDir , "UnrealGame" , UnrealTargetPlatform . TVOS , Config , null ) ;
2022-08-10 16:03:37 +00:00
}
else
{
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
TargetReceiptFileName = TargetReceipt . GetDefaultPath ( InProjectDirectory , TargetName , UnrealTargetPlatform . TVOS , Config , null ) ;
2022-08-10 16:03:37 +00:00
}
2022-12-12 17:46:48 -05:00
return TVOSExports . PrepForUATPackageOrDeploy ( Config , ProjectFile , InProjectName , InProjectDirectory , Executable , InEngineDir , bForDistribution , CookFlavor , bIsDataDeploy , bCreateStubIPA , TargetReceiptFileName , Log . Logger ) ;
2022-08-10 16:03:37 +00:00
}
public override void GetProvisioningData ( FileReference InProject , bool bDistribution , out string MobileProvision , out string SigningCertificate , out string Team , out bool bAutomaticSigning )
{
TVOSExports . GetProvisioningData ( InProject , bDistribution , out MobileProvision , out SigningCertificate , out Team , out bAutomaticSigning ) ;
}
2022-10-20 13:07:40 -04:00
public override bool DeployGeneratePList ( FileReference ProjectFile , UnrealTargetConfiguration Config , DirectoryReference ProjectDirectory , bool bIsUEGame , string GameName , bool bIsClient , string ProjectName , DirectoryReference InEngineDir , DirectoryReference AppDirectory , string InExecutablePath )
2022-08-10 16:03:37 +00:00
{
string TargetName = Path . GetFileNameWithoutExtension ( InExecutablePath ) . Split ( "-" . ToCharArray ( ) ) [ 0 ] ;
FileReference TargetReceiptFileName ;
if ( bIsUEGame )
{
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
TargetReceiptFileName = TargetReceipt . GetDefaultPath ( InEngineDir , "UnrealGame" , UnrealTargetPlatform . TVOS , Config , null ) ;
2022-08-10 16:03:37 +00:00
}
else
{
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
TargetReceiptFileName = TargetReceipt . GetDefaultPath ( ProjectDirectory , TargetName , UnrealTargetPlatform . TVOS , Config , null ) ;
2022-08-10 16:03:37 +00:00
}
2022-10-20 13:07:40 -04:00
return TVOSExports . GeneratePList ( ProjectFile , Config , ProjectDirectory , bIsUEGame , GameName , bIsClient , ProjectName , InEngineDir , AppDirectory , TargetReceiptFileName , Log . Logger ) ;
2022-08-10 16:03:37 +00:00
}
public override string GetCookPlatform ( bool bDedicatedServer , bool bIsClientOnly )
{
return bIsClientOnly ? "TVOSClient" : "TVOS" ;
}
public override void GetFilesToDeployOrStage ( ProjectParams Params , DeploymentContext SC )
{
// if (UnrealBuildTool.BuildHostPlatform.Current.Platform != UnrealTargetPlatform.Mac)
{
// copy the icons/launch screens from the engine
{
FileReference SourcePath = FileReference . Combine ( SC . LocalRoot , "Engine" , "Binaries" , "TVOS" , "AssetCatalog" , "Assets.car" ) ;
if ( FileReference . Exists ( SourcePath ) )
{
SC . StageFile ( StagedFileType . SystemNonUFS , SourcePath , new StagedFileReference ( "Assets.car" ) ) ;
}
}
// copy any additional framework assets that will be needed at runtime
{
DirectoryReference SourcePath = DirectoryReference . Combine ( ( SC . IsCodeBasedProject ? SC . ProjectRoot : SC . EngineRoot ) , "Intermediate" , "TVOS" , "FrameworkAssets" ) ;
if ( DirectoryReference . Exists ( SourcePath ) )
{
SC . StageFiles ( StagedFileType . SystemNonUFS , SourcePath , StageFilesSearch . AllDirectories , StagedDirectoryReference . Root ) ;
}
}
// copy the icons/launch screens from the game (may stomp the engine copies)
{
FileReference SourcePath = FileReference . Combine ( SC . ProjectRoot , "Binaries" , "TVOS" , "AssetCatalog" , "Assets.car" ) ;
if ( FileReference . Exists ( SourcePath ) )
{
SC . StageFile ( StagedFileType . SystemNonUFS , SourcePath , new StagedFileReference ( "Assets.car" ) ) ;
}
}
// copy the plist (only if code signing, as it's protected by the code sign blob in the executable and can't be modified independently)
if ( GetCodeSignDesirability ( Params ) )
{
// this would be FooClient when making a client-only build
string TargetName = SC . StageExecutables [ 0 ] . Split ( "-" . ToCharArray ( ) ) [ 0 ] ;
DirectoryReference SourcePath = DirectoryReference . Combine ( ( SC . IsCodeBasedProject ? SC . ProjectRoot : SC . EngineRoot ) , "Intermediate" , "TVOS" ) ;
FileReference TargetPListFile = FileReference . Combine ( SourcePath , ( SC . IsCodeBasedProject ? TargetName : "UnrealGame" ) + "-Info.plist" ) ;
// if (!File.Exists(TargetPListFile))
{
// ensure the plist, entitlements, and provision files are properly copied
Console . WriteLine ( "CookPlat {0}, this {1}" , GetCookPlatform ( false , false ) , ToString ( ) ) ;
if ( ! SC . IsCodeBasedProject )
{
UnrealBuildTool . PlatformExports . SetRemoteIniPath ( SC . ProjectRoot . FullName ) ;
}
if ( SC . StageTargetConfigurations . Count ! = 1 )
{
throw new AutomationException ( "iOS is currently only able to package one target configuration at a time, but StageTargetConfigurations contained {0} configurations" , SC . StageTargetConfigurations . Count ) ;
}
var TargetConfiguration = SC . StageTargetConfigurations [ 0 ] ;
2023-08-24 10:22:47 -04:00
DirectoryReference ProjectRoot = SC . ProjectRoot ;
// keep old logic for BP projects with legacy
if ( ! AppleExports . UseModernXcode ( SC . RawProjectPath ) & & ! SC . IsCodeBasedProject )
{
ProjectRoot = DirectoryReference . Combine ( SC . LocalRoot , "Engine" ) ;
}
DeployGeneratePList (
2022-08-10 16:03:37 +00:00
SC . RawProjectPath ,
TargetConfiguration ,
2023-08-24 10:22:47 -04:00
ProjectRoot ,
2022-08-10 16:03:37 +00:00
! SC . IsCodeBasedProject ,
2023-01-31 01:15:57 -05:00
( SC . IsCodeBasedProject ? TargetName : "UnrealGame" ) ,
2022-08-10 16:03:37 +00:00
Params . Client ,
SC . ShortProjectName ,
SC . EngineRoot ,
DirectoryReference . Combine ( ( SC . IsCodeBasedProject ? SC . ProjectRoot : SC . EngineRoot ) ,
"Binaries" ,
"TVOS" ,
"Payload" ,
( SC . IsCodeBasedProject ? SC . ShortProjectName : "UnrealGame" ) + ".app" ) ,
2022-10-20 13:07:40 -04:00
SC . StageExecutables [ 0 ] ) ;
2022-08-10 16:03:37 +00:00
}
2023-08-24 10:22:47 -04:00
// copy the udebugsymbols if they exist
2022-08-10 16:03:37 +00:00
{
2023-08-24 10:22:47 -04:00
ConfigHierarchy PlatformGameConfig ;
bool bIncludeSymbols = false ;
if ( Params . EngineConfigs . TryGetValue ( SC . StageTargetPlatform . PlatformType , out PlatformGameConfig ) )
2022-08-10 16:03:37 +00:00
{
2023-08-24 10:22:47 -04:00
PlatformGameConfig . GetBool ( "/Script/IOSRuntimeSettings.IOSRuntimeSettings" , "bGenerateCrashReportSymbols" , out bIncludeSymbols ) ;
}
if ( bIncludeSymbols )
{
FileReference SymbolFileName = FileReference . Combine ( ( SC . IsCodeBasedProject ? SC . ProjectRoot : SC . EngineRoot ) , "Binaries" , "TVOS" , SC . StageExecutables [ 0 ] + ".udebugsymbols" ) ;
if ( FileReference . Exists ( SymbolFileName ) )
{
SC . StageFile ( StagedFileType . NonUFS , SymbolFileName , new StagedFileReference ( ( Params . ShortProjectName + ".udebugsymbols" ) . ToLowerInvariant ( ) ) ) ;
}
2022-08-10 16:03:37 +00:00
}
}
2023-08-24 10:22:47 -04:00
if ( ! AppleExports . UseModernXcode ( SC . RawProjectPath ) )
{
// copy the plist to the stage dir
SC . StageFile ( StagedFileType . SystemNonUFS , TargetPListFile , new StagedFileReference ( "Info.plist" ) ) ;
}
}
}
2022-08-10 16:03:37 +00:00
// copy the movies from the project
{
StageMovieFiles ( DirectoryReference . Combine ( SC . EngineRoot , "Content" , "Movies" ) , SC ) ;
StageMovieFiles ( DirectoryReference . Combine ( SC . ProjectRoot , "Content" , "Movies" ) , SC ) ;
}
{
// Stage any *.metallib files as NonUFS.
// Get the final output directory for cooked data
DirectoryReference CookOutputDir ;
if ( ! String . IsNullOrEmpty ( Params . CookOutputDir ) )
{
CookOutputDir = DirectoryReference . Combine ( new DirectoryReference ( Params . CookOutputDir ) , SC . CookPlatform ) ;
}
else if ( Params . CookInEditor )
{
CookOutputDir = DirectoryReference . Combine ( SC . ProjectRoot , "Saved" , "EditorCooked" , SC . CookPlatform ) ;
}
else
{
CookOutputDir = DirectoryReference . Combine ( SC . ProjectRoot , "Saved" , "Cooked" , SC . CookPlatform ) ;
}
if ( DirectoryReference . Exists ( CookOutputDir ) )
{
List < FileReference > CookedFiles = DirectoryReference . EnumerateFiles ( CookOutputDir , "*.metallib" , SearchOption . AllDirectories ) . ToList ( ) ;
foreach ( FileReference CookedFile in CookedFiles )
{
SC . StageFile ( StagedFileType . NonUFS , CookedFile , new StagedFileReference ( CookedFile . MakeRelativeTo ( CookOutputDir ) ) ) ;
}
}
}
}
}