2015-03-27 08:02:21 -04:00
// Copyright 1998-2015 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 ;
namespace Rocket
{
public class RocketBuild : GUBP . GUBPNodeAdder
{
static readonly string [ ] CurrentTemplates =
{
2015-05-05 14:44:22 -04:00
"FP_FirstPerson" ,
"FP_FirstPersonBP" ,
2015-03-27 08:02:21 -04:00
"TP_FirstPerson" ,
"TP_FirstPersonBP" ,
"TP_Flying" ,
"TP_FlyingBP" ,
"TP_Rolling" ,
"TP_RollingBP" ,
"TP_SideScroller" ,
"TP_SideScrollerBP" ,
"TP_ThirdPerson" ,
"TP_ThirdPersonBP" ,
"TP_TopDown" ,
"TP_TopDownBP" ,
"TP_TwinStick" ,
"TP_TwinStickBP" ,
"TP_Vehicle" ,
"TP_VehicleBP" ,
"TP_Puzzle" ,
"TP_PuzzleBP" ,
"TP_2DSideScroller" ,
"TP_2DSideScrollerBP" ,
"TP_VehicleAdv" ,
"TP_VehicleAdvBP" ,
2015-06-30 10:06:41 -04:00
2015-03-27 08:02:21 -04:00
} ;
static readonly string [ ] CurrentFeaturePacks =
{
"FP_FirstPerson" ,
"FP_FirstPersonBP" ,
"TP_Flying" ,
"TP_FlyingBP" ,
"TP_Rolling" ,
"TP_RollingBP" ,
"TP_SideScroller" ,
"TP_SideScrollerBP" ,
"TP_ThirdPerson" ,
"TP_ThirdPersonBP" ,
"TP_TopDown" ,
"TP_TopDownBP" ,
"TP_TwinStick" ,
"TP_TwinStickBP" ,
"TP_Vehicle" ,
"TP_VehicleBP" ,
"TP_Puzzle" ,
"TP_PuzzleBP" ,
"TP_2DSideScroller" ,
"TP_2DSideScrollerBP" ,
"TP_VehicleAdv" ,
"TP_VehicleAdvBP" ,
"StarterContent" ,
2015-07-13 05:47:36 -04:00
"MobileStarterContent" ,
2015-03-27 08:02:21 -04:00
} ;
public RocketBuild ( )
{
}
2015-07-07 16:34:24 -04:00
public override void AddNodes ( GUBP bp , GUBP . GUBPBranchConfig BranchConfig , UnrealTargetPlatform HostPlatform , List < UnrealTargetPlatform > ActivePlatforms )
2015-03-27 08:02:21 -04:00
{
2015-07-08 08:05:50 -04:00
if ( ! BranchConfig . BranchOptions . bNoInstalledEngine )
2015-03-27 08:02:21 -04:00
{
2015-08-11 08:14:46 -04:00
// Add the aggregate for making a rocket build
if ( ! BranchConfig . HasNode ( WaitToMakeRocketBuild . StaticGetFullName ( ) ) )
{
2015-08-12 13:58:01 -04:00
BranchConfig . AddNode ( new WaitToMakeRocketBuild ( BranchConfig ) ) ;
2015-08-11 08:14:46 -04:00
}
2015-04-10 13:56:50 -04:00
// Find all the target platforms for this host platform.
2015-03-27 08:02:21 -04:00
List < UnrealTargetPlatform > TargetPlatforms = GetTargetPlatforms ( bp , HostPlatform ) ;
2015-05-01 15:01:10 -04:00
// Remove any platforms that aren't available on this machine
2015-07-01 14:08:12 -04:00
TargetPlatforms . RemoveAll ( x = > ! ActivePlatforms . Contains ( x ) ) ;
2015-05-01 15:01:10 -04:00
2015-04-23 18:13:08 -04:00
// Get the temp directory for stripped files for this host
string StrippedDir = Path . GetFullPath ( CommandUtils . CombinePaths ( CommandUtils . CmdEnv . LocalRoot , "Engine" , "Saved" , "Rocket" , HostPlatform . ToString ( ) ) ) ;
2015-07-17 13:13:26 -04:00
// Get the temp directory for signed files for this host
string SignedDir = Path . GetFullPath ( CommandUtils . CombinePaths ( CommandUtils . CmdEnv . LocalRoot , "Engine" , "Saved" , "Rocket" , "Signed" , HostPlatform . ToString ( ) ) ) ;
2015-04-23 18:13:08 -04:00
// Strip the host platform
if ( StripRocketNode . IsRequiredForPlatform ( HostPlatform ) )
{
2015-07-07 16:34:24 -04:00
BranchConfig . AddNode ( new StripRocketToolsNode ( BranchConfig , HostPlatform , StrippedDir ) ) ;
BranchConfig . AddNode ( new StripRocketEditorNode ( BranchConfig , HostPlatform , StrippedDir ) ) ;
2015-04-23 18:13:08 -04:00
}
2015-07-17 13:13:26 -04:00
BranchConfig . AddNode ( new SignRocketToolsNode ( BranchConfig , HostPlatform , SignedDir ) ) ;
BranchConfig . AddNode ( new SignRocketEditorNode ( BranchConfig , HostPlatform , SignedDir ) ) ;
2015-04-23 18:13:08 -04:00
2015-04-28 15:47:56 -04:00
// Strip all the target platforms that are built on this host
2015-04-23 18:13:08 -04:00
foreach ( UnrealTargetPlatform TargetPlatform in TargetPlatforms )
{
2015-07-08 08:05:50 -04:00
if ( GetSourceHostPlatform ( BranchConfig . HostPlatforms , HostPlatform , TargetPlatform ) = = HostPlatform & & StripRocketNode . IsRequiredForPlatform ( TargetPlatform ) )
2015-04-23 18:13:08 -04:00
{
2015-07-08 08:05:50 -04:00
BranchConfig . AddNode ( new StripRocketMonolithicsNode ( BranchConfig , HostPlatform , TargetPlatform , StrippedDir ) ) ;
2015-04-23 18:13:08 -04:00
}
2015-07-17 13:13:26 -04:00
if ( GetSourceHostPlatform ( BranchConfig . HostPlatforms , HostPlatform , TargetPlatform ) = = HostPlatform & & SignRocketNode . IsRequiredForPlatform ( TargetPlatform ) )
{
BranchConfig . AddNode ( new SignRocketMonolithicsNode ( BranchConfig , HostPlatform , TargetPlatform , SignedDir ) ) ;
}
2015-04-23 18:13:08 -04:00
}
2015-04-10 13:56:50 -04:00
// Build the DDC
2015-07-08 08:05:50 -04:00
BranchConfig . AddNode ( new BuildDerivedDataCacheNode ( BranchConfig , HostPlatform , GetCookPlatforms ( HostPlatform , TargetPlatforms ) , CurrentFeaturePacks ) ) ;
2015-04-10 13:56:50 -04:00
// Generate a list of files that needs to be copied for each target platform
2015-07-08 08:05:50 -04:00
BranchConfig . AddNode ( new FilterRocketNode ( BranchConfig , HostPlatform , TargetPlatforms , CurrentFeaturePacks , CurrentTemplates ) ) ;
2015-04-10 13:56:50 -04:00
2015-04-25 10:33:07 -04:00
// Copy the install to the output directory
string LocalOutputDir = CommandUtils . CombinePaths ( CommandUtils . CmdEnv . LocalRoot , "LocalBuilds" , "Rocket" , CommandUtils . GetGenericPlatformName ( HostPlatform ) ) ;
2015-07-07 16:34:24 -04:00
BranchConfig . AddNode ( new GatherRocketNode ( BranchConfig , HostPlatform , TargetPlatforms , LocalOutputDir ) ) ;
2015-03-27 08:02:21 -04:00
2015-03-30 14:29:36 -04:00
// Add a node for GitHub promotions
if ( HostPlatform = = UnrealTargetPlatform . Win64 )
{
string GitConfigRelativePath = "Engine/Build/Git/UnrealBot.ini" ;
if ( CommandUtils . FileExists ( CommandUtils . CombinePaths ( CommandUtils . CmdEnv . LocalRoot , GitConfigRelativePath ) ) )
{
2015-07-08 08:05:50 -04:00
BranchConfig . AddNode ( new BuildGitPromotable ( HostPlatform , BranchConfig . HostPlatforms , GitConfigRelativePath ) ) ;
2015-03-30 14:29:36 -04:00
}
}
2015-04-23 13:26:28 -04:00
2015-05-01 19:53:59 -04:00
// Get the output directory for the build zips
string PublishedEngineDir ;
2015-07-08 08:05:50 -04:00
if ( ShouldDoSeriousThingsLikeP4CheckinAndPostToMCP ( BranchConfig ) )
2015-05-01 19:53:59 -04:00
{
2015-08-05 10:22:11 -04:00
PublishedEngineDir = CommandUtils . CombinePaths ( CommandUtils . RootBuildStorageDirectory ( ) , "Rocket" , "Automated" , GetBuildLabel ( ) , CommandUtils . GetGenericPlatformName ( HostPlatform ) ) ;
2015-05-01 19:53:59 -04:00
}
else
{
PublishedEngineDir = CommandUtils . CombinePaths ( CommandUtils . CmdEnv . LocalRoot , "LocalBuilds" , "RocketPublish" , CommandUtils . GetGenericPlatformName ( HostPlatform ) ) ;
}
2015-04-25 10:33:07 -04:00
// Publish the install to the network
2015-07-07 16:34:24 -04:00
BranchConfig . AddNode ( new PublishRocketNode ( HostPlatform , LocalOutputDir , PublishedEngineDir ) ) ;
2015-07-08 08:05:50 -04:00
BranchConfig . AddNode ( new PublishRocketSymbolsNode ( BranchConfig , HostPlatform , TargetPlatforms , PublishedEngineDir + "Symbols" ) ) ;
2015-03-27 08:02:21 -04:00
}
}
2015-04-10 13:56:50 -04:00
public static string GetBuildLabel ( )
{
return FEngineVersionSupport . FromVersionFile ( CommandUtils . CombinePaths ( CommandUtils . CmdEnv . LocalRoot , @"Engine\Source\Runtime\Launch\Resources\Version.h" ) ) . ToString ( ) ;
}
2015-05-01 15:01:10 -04:00
public static List < UnrealTargetPlatform > GetTargetPlatforms ( BuildCommand Command , UnrealTargetPlatform HostPlatform )
2015-03-27 08:02:21 -04:00
{
List < UnrealTargetPlatform > TargetPlatforms = new List < UnrealTargetPlatform > ( ) ;
2015-05-01 15:01:10 -04:00
if ( ! Command . ParseParam ( "NoTargetPlatforms" ) )
2015-03-27 08:02:21 -04:00
{
2015-04-16 11:49:34 -04:00
// Always support the host platform
2015-03-27 08:02:21 -04:00
TargetPlatforms . Add ( HostPlatform ) ;
2015-04-16 11:49:34 -04:00
// Add other target platforms for each host platform
2015-03-27 08:02:21 -04:00
if ( HostPlatform = = UnrealTargetPlatform . Win64 )
{
TargetPlatforms . Add ( UnrealTargetPlatform . Win32 ) ;
}
2015-04-16 11:49:34 -04:00
if ( HostPlatform = = UnrealTargetPlatform . Win64 | | HostPlatform = = UnrealTargetPlatform . Mac )
2015-03-27 08:02:21 -04:00
{
TargetPlatforms . Add ( UnrealTargetPlatform . Android ) ;
}
2015-04-16 11:49:34 -04:00
if ( HostPlatform = = UnrealTargetPlatform . Win64 | | HostPlatform = = UnrealTargetPlatform . Mac )
2015-03-27 08:02:21 -04:00
{
TargetPlatforms . Add ( UnrealTargetPlatform . IOS ) ;
}
2015-04-16 11:49:34 -04:00
if ( HostPlatform = = UnrealTargetPlatform . Win64 )
2015-03-27 08:02:21 -04:00
{
TargetPlatforms . Add ( UnrealTargetPlatform . Linux ) ;
}
2015-04-21 15:42:57 -04:00
if ( HostPlatform = = UnrealTargetPlatform . Win64 | | HostPlatform = = UnrealTargetPlatform . Mac )
2015-03-27 08:02:21 -04:00
{
TargetPlatforms . Add ( UnrealTargetPlatform . HTML5 ) ;
}
2015-03-27 11:34:27 -04:00
2015-04-16 11:49:34 -04:00
// Remove any platforms that aren't enabled on the command line
2015-05-01 15:01:10 -04:00
string TargetPlatformFilter = Command . ParseParamValue ( "TargetPlatforms" , null ) ;
2015-04-16 11:49:34 -04:00
if ( TargetPlatformFilter ! = null )
{
List < UnrealTargetPlatform > NewTargetPlatforms = new List < UnrealTargetPlatform > ( ) ;
foreach ( string TargetPlatformName in TargetPlatformFilter . Split ( new char [ ] { '+' } , StringSplitOptions . RemoveEmptyEntries ) )
{
UnrealTargetPlatform TargetPlatform ;
if ( ! Enum . TryParse ( TargetPlatformName , out TargetPlatform ) )
{
throw new AutomationException ( "Unknown target platform '{0}' specified on command line" ) ;
}
else if ( TargetPlatforms . Contains ( TargetPlatform ) )
{
NewTargetPlatforms . Add ( TargetPlatform ) ;
}
}
TargetPlatforms = NewTargetPlatforms ;
}
2015-03-27 08:02:21 -04:00
}
return TargetPlatforms ;
}
public static string GetCookPlatforms ( UnrealTargetPlatform HostPlatform , IEnumerable < UnrealTargetPlatform > TargetPlatforms )
{
// Always include the editor platform for cooking
List < string > CookPlatforms = new List < string > ( ) ;
CookPlatforms . Add ( Platform . Platforms [ HostPlatform ] . GetEditorCookPlatform ( ) ) ;
// Add all the target platforms
foreach ( UnrealTargetPlatform TargetPlatform in TargetPlatforms )
{
if ( TargetPlatform = = UnrealTargetPlatform . Android )
{
CookPlatforms . Add ( Platform . Platforms [ TargetPlatform ] . GetCookPlatform ( false , false , "ATC" ) ) ;
}
else
{
CookPlatforms . Add ( Platform . Platforms [ TargetPlatform ] . GetCookPlatform ( false , false , "" ) ) ;
}
}
return CommandUtils . CombineCommandletParams ( CookPlatforms . Distinct ( ) . ToArray ( ) ) ;
}
2015-07-08 08:05:50 -04:00
public static bool ShouldDoSeriousThingsLikeP4CheckinAndPostToMCP ( GUBP . GUBPBranchConfig BranchConfig )
2015-03-27 08:02:21 -04:00
{
2015-08-05 10:22:11 -04:00
return CommandUtils . P4Enabled & & CommandUtils . AllowSubmit & & ! BranchConfig . JobInfo . IsPreflight ; // we don't do serious things in a preflight
2015-03-27 08:02:21 -04:00
}
2015-07-08 08:05:50 -04:00
public static UnrealTargetPlatform GetSourceHostPlatform ( List < UnrealTargetPlatform > HostPlatforms , UnrealTargetPlatform HostPlatform , UnrealTargetPlatform TargetPlatform )
2015-03-27 08:02:21 -04:00
{
2015-07-08 08:05:50 -04:00
if ( TargetPlatform = = UnrealTargetPlatform . HTML5 & & HostPlatform = = UnrealTargetPlatform . Mac & & HostPlatforms . Contains ( UnrealTargetPlatform . Win64 ) )
2015-04-21 15:42:57 -04:00
{
return UnrealTargetPlatform . Win64 ;
}
2015-07-08 08:05:50 -04:00
if ( TargetPlatform = = UnrealTargetPlatform . Android & & HostPlatform = = UnrealTargetPlatform . Mac & & HostPlatforms . Contains ( UnrealTargetPlatform . Win64 ) )
2015-03-27 08:02:21 -04:00
{
return UnrealTargetPlatform . Win64 ;
}
2015-07-08 08:05:50 -04:00
if ( TargetPlatform = = UnrealTargetPlatform . IOS & & HostPlatform = = UnrealTargetPlatform . Win64 & & HostPlatforms . Contains ( UnrealTargetPlatform . Mac ) )
2015-03-27 08:02:21 -04:00
{
return UnrealTargetPlatform . Mac ;
}
return HostPlatform ;
}
public static bool IsCodeTargetPlatform ( UnrealTargetPlatform HostPlatform , UnrealTargetPlatform TargetPlatform )
{
if ( TargetPlatform = = UnrealTargetPlatform . Linux )
{
return false ;
}
if ( HostPlatform = = UnrealTargetPlatform . Win64 & & TargetPlatform = = UnrealTargetPlatform . IOS )
{
return false ;
}
return true ;
}
}
2015-08-11 08:14:46 -04:00
public class WaitToMakeRocketBuild : GUBP . WaitForUserInput
{
2015-08-12 13:58:01 -04:00
public WaitToMakeRocketBuild ( GUBP . GUBPBranchConfig BranchConfig )
2015-08-11 08:14:46 -04:00
{
2015-08-12 13:58:01 -04:00
foreach ( UnrealTargetPlatform HostPlatform in BranchConfig . HostPlatforms )
2015-08-11 08:14:46 -04:00
{
AddDependency ( FilterRocketNode . StaticGetFullName ( HostPlatform ) ) ;
AddDependency ( BuildDerivedDataCacheNode . StaticGetFullName ( HostPlatform ) ) ;
2015-08-12 13:58:01 -04:00
SingleTargetProperties BuildPatchTool = BranchConfig . Branch . FindProgram ( "BuildPatchTool" ) ;
if ( BuildPatchTool . Rules ! = null )
{
AddDependency ( GUBP . SingleInternalToolsNode . StaticGetFullName ( HostPlatform , BuildPatchTool ) ) ;
}
2015-08-11 08:14:46 -04:00
}
}
public static string StaticGetFullName ( )
{
return "WaitToMakeRocketBuild" ;
}
public override string GetFullName ( )
{
return StaticGetFullName ( ) ;
}
public override string GetTriggerDescText ( )
{
return "Ready to make Rocket build" ;
}
public override string GetTriggerActionText ( )
{
return "Make Rocket build" ;
}
}
2015-03-30 14:29:36 -04:00
public class BuildGitPromotable : GUBP . HostPlatformNode
{
string ConfigRelativePath ;
2015-07-08 08:05:50 -04:00
public BuildGitPromotable ( UnrealTargetPlatform HostPlatform , List < UnrealTargetPlatform > ForHostPlatforms , string InConfigRelativePath ) : base ( HostPlatform )
2015-03-30 14:29:36 -04:00
{
ConfigRelativePath = InConfigRelativePath ;
2015-07-08 08:05:50 -04:00
foreach ( UnrealTargetPlatform ForHostPlatform in ForHostPlatforms )
2015-03-30 14:29:36 -04:00
{
2015-07-08 08:05:50 -04:00
AddDependency ( GUBP . RootEditorNode . StaticGetFullName ( ForHostPlatform ) ) ;
AddDependency ( GUBP . ToolsNode . StaticGetFullName ( ForHostPlatform ) ) ;
AddDependency ( GUBP . InternalToolsNode . StaticGetFullName ( ForHostPlatform ) ) ;
2015-03-30 14:29:36 -04:00
}
}
public static string StaticGetFullName ( UnrealTargetPlatform HostPlatform )
{
return "BuildGitPromotable" + StaticGetHostPlatformSuffix ( HostPlatform ) ;
}
public override string GetFullName ( )
{
return StaticGetFullName ( HostPlatform ) ;
}
public override void DoBuild ( GUBP bp )
{
// Create a filter for all the promoted binaries
FileFilter PromotableFilter = new FileFilter ( ) ;
2015-04-10 13:56:50 -04:00
PromotableFilter . AddRuleForFiles ( AllDependencyBuildProducts , CommandUtils . CmdEnv . LocalRoot , FileFilterType . Include ) ;
PromotableFilter . ReadRulesFromFile ( CommandUtils . CombinePaths ( CommandUtils . CmdEnv . LocalRoot , ConfigRelativePath ) , "promotable" ) ;
PromotableFilter . ExcludeConfidentialFolders ( ) ;
2015-04-01 07:58:31 -04:00
2015-03-30 14:29:36 -04:00
// Copy everything that matches the filter to the promotion folder
string PromotableFolder = CommandUtils . CombinePaths ( CommandUtils . CmdEnv . LocalRoot , "Engine" , "Saved" , "GitPromotable" ) ;
CommandUtils . DeleteDirectoryContents ( PromotableFolder ) ;
2015-08-05 10:22:11 -04:00
BuildProducts = CommandUtils . ThreadedCopyFiles ( CommandUtils . CmdEnv . LocalRoot , PromotableFolder , PromotableFilter , bIgnoreSymlinks : true ) ;
2015-03-30 14:29:36 -04:00
}
}
2015-04-23 18:13:08 -04:00
public abstract class StripRocketNode : GUBP . HostPlatformNode
2015-03-27 08:02:21 -04:00
{
2015-07-07 16:34:24 -04:00
public GUBP . GUBPBranchConfig BranchConfig ;
2015-04-23 18:13:08 -04:00
public UnrealTargetPlatform TargetPlatform ;
public string StrippedDir ;
2015-04-24 20:29:44 -04:00
public List < string > NodesToStrip = new List < string > ( ) ;
2015-03-27 08:02:21 -04:00
2015-07-07 16:34:24 -04:00
public StripRocketNode ( GUBP . GUBPBranchConfig InBranchConfig , UnrealTargetPlatform InHostPlatform , UnrealTargetPlatform InTargetPlatform , string InStrippedDir ) : base ( InHostPlatform )
2015-03-27 08:02:21 -04:00
{
2015-07-07 16:34:24 -04:00
BranchConfig = InBranchConfig ;
2015-04-23 18:13:08 -04:00
TargetPlatform = InTargetPlatform ;
StrippedDir = InStrippedDir ;
2015-03-27 08:02:21 -04:00
}
2015-04-23 18:13:08 -04:00
public override abstract string GetFullName ( ) ;
2015-03-27 08:02:21 -04:00
2015-04-24 20:29:44 -04:00
public void AddNodeToStrip ( string NodeName )
{
NodesToStrip . Add ( NodeName ) ;
AddDependency ( NodeName ) ;
}
2015-04-23 18:13:08 -04:00
public static bool IsRequiredForPlatform ( UnrealTargetPlatform Platform )
2015-03-27 08:02:21 -04:00
{
2015-04-28 15:47:56 -04:00
return Platform ! = UnrealTargetPlatform . HTML5 ;
2015-03-27 08:02:21 -04:00
}
2015-04-10 13:56:50 -04:00
public override void DoBuild ( GUBP bp )
2015-03-27 08:02:21 -04:00
{
2015-04-10 13:56:50 -04:00
BuildProducts = new List < string > ( ) ;
2015-03-27 08:02:21 -04:00
2015-04-10 13:56:50 -04:00
string InputDir = Path . GetFullPath ( CommandUtils . CmdEnv . LocalRoot ) ;
string RulesFileName = CommandUtils . CombinePaths ( CommandUtils . CmdEnv . LocalRoot , "Engine" , "Build" , "InstalledEngineFilters.ini" ) ;
2015-04-23 18:13:08 -04:00
// Read the filter for files on this platform
FileFilter StripFilter = new FileFilter ( ) ;
StripFilter . ReadRulesFromFile ( RulesFileName , "StripSymbols." + TargetPlatform . ToString ( ) , HostPlatform . ToString ( ) ) ;
// Apply the filter to the build products
List < string > SourcePaths = new List < string > ( ) ;
List < string > TargetPaths = new List < string > ( ) ;
2015-04-24 20:29:44 -04:00
foreach ( string NodeToStrip in NodesToStrip )
2015-03-27 08:02:21 -04:00
{
2015-07-07 16:34:24 -04:00
GUBP . GUBPNode Node = BranchConfig . FindNode ( NodeToStrip ) ;
2015-04-24 20:29:44 -04:00
foreach ( string DependencyBuildProduct in Node . BuildProducts )
2015-03-30 09:19:45 -04:00
{
2015-04-24 20:29:44 -04:00
string RelativePath = CommandUtils . StripBaseDirectory ( Path . GetFullPath ( DependencyBuildProduct ) , InputDir ) ;
if ( StripFilter . Matches ( RelativePath ) )
{
SourcePaths . Add ( CommandUtils . CombinePaths ( InputDir , RelativePath ) ) ;
TargetPaths . Add ( CommandUtils . CombinePaths ( StrippedDir , RelativePath ) ) ;
}
2015-03-30 09:19:45 -04:00
}
2015-03-27 08:02:21 -04:00
}
2015-04-23 18:13:08 -04:00
// Strip the files and add them to the build products
StripSymbols ( TargetPlatform , SourcePaths . ToArray ( ) , TargetPaths . ToArray ( ) ) ;
BuildProducts . AddRange ( TargetPaths ) ;
2015-04-10 13:56:50 -04:00
SaveRecordOfSuccessAndAddToBuildProducts ( ) ;
2015-03-27 08:02:21 -04:00
}
2015-03-27 11:34:27 -04:00
2015-04-10 13:56:50 -04:00
public static void StripSymbols ( UnrealTargetPlatform TargetPlatform , string [ ] SourceFileNames , string [ ] TargetFileNames )
2015-03-27 11:34:27 -04:00
{
2015-04-27 12:53:24 -04:00
IUEBuildPlatform Platform = UEBuildPlatform . GetBuildPlatform ( TargetPlatform ) ;
IUEToolChain ToolChain = UEToolChain . GetPlatformToolChain ( Platform . GetCPPTargetPlatform ( TargetPlatform ) ) ;
for ( int Idx = 0 ; Idx < SourceFileNames . Length ; Idx + + )
2015-03-27 11:34:27 -04:00
{
2015-04-27 12:53:24 -04:00
CommandUtils . CreateDirectory ( Path . GetDirectoryName ( TargetFileNames [ Idx ] ) ) ;
2015-08-20 09:37:11 -04:00
CommandUtils . Log ( "Stripping symbols: {0} -> {1}" , SourceFileNames [ Idx ] , TargetFileNames [ Idx ] ) ;
2015-04-27 12:53:24 -04:00
ToolChain . StripSymbols ( SourceFileNames [ Idx ] , TargetFileNames [ Idx ] ) ;
2015-03-27 11:34:27 -04:00
}
}
2015-03-27 08:02:21 -04:00
}
2015-04-23 18:13:08 -04:00
public class StripRocketToolsNode : StripRocketNode
{
2015-07-07 16:34:24 -04:00
public StripRocketToolsNode ( GUBP . GUBPBranchConfig InBranchConfig , UnrealTargetPlatform InHostPlatform , string InStrippedDir )
: base ( InBranchConfig , InHostPlatform , InHostPlatform , InStrippedDir )
2015-04-23 18:13:08 -04:00
{
2015-04-24 20:29:44 -04:00
AddNodeToStrip ( GUBP . ToolsForCompileNode . StaticGetFullName ( HostPlatform ) ) ;
AddNodeToStrip ( GUBP . ToolsNode . StaticGetFullName ( HostPlatform ) ) ;
2015-04-23 18:13:08 -04:00
AgentSharingGroup = "ToolsGroup" + StaticGetHostPlatformSuffix ( InHostPlatform ) ;
}
public static string StaticGetFullName ( UnrealTargetPlatform InHostPlatform )
{
return "Strip" + GUBP . ToolsNode . StaticGetFullName ( InHostPlatform ) ;
}
public override string GetFullName ( )
{
return StaticGetFullName ( HostPlatform ) ;
}
}
public class StripRocketEditorNode : StripRocketNode
{
2015-07-07 16:34:24 -04:00
public StripRocketEditorNode ( GUBP . GUBPBranchConfig InBranchConfig , UnrealTargetPlatform InHostPlatform , string InStrippedDir )
: base ( InBranchConfig , InHostPlatform , InHostPlatform , InStrippedDir )
2015-04-23 18:13:08 -04:00
{
2015-04-24 20:29:44 -04:00
AddNodeToStrip ( GUBP . RootEditorNode . StaticGetFullName ( HostPlatform ) ) ;
2015-04-23 18:13:08 -04:00
AgentSharingGroup = "Editor" + StaticGetHostPlatformSuffix ( HostPlatform ) ;
}
2015-06-03 08:16:59 -04:00
public override float Priority ( )
{
return 1000000.0f ;
}
2015-04-23 18:13:08 -04:00
public static string StaticGetFullName ( UnrealTargetPlatform InHostPlatform )
{
return "Strip" + GUBP . RootEditorNode . StaticGetFullName ( InHostPlatform ) ;
}
public override string GetFullName ( )
{
return StaticGetFullName ( HostPlatform ) ;
}
}
public class StripRocketMonolithicsNode : StripRocketNode
{
BranchInfo . BranchUProject Project ;
bool bIsCodeTargetPlatform ;
2015-07-08 08:05:50 -04:00
public StripRocketMonolithicsNode ( GUBP . GUBPBranchConfig InBranchConfig , UnrealTargetPlatform InHostPlatform , UnrealTargetPlatform InTargetPlatform , string InStrippedDir ) : base ( InBranchConfig , InHostPlatform , InTargetPlatform , InStrippedDir )
2015-04-23 18:13:08 -04:00
{
2015-07-08 08:05:50 -04:00
Project = InBranchConfig . Branch . BaseEngineProject ;
2015-04-28 15:47:56 -04:00
bIsCodeTargetPlatform = RocketBuild . IsCodeTargetPlatform ( InHostPlatform , InTargetPlatform ) ;
2015-04-23 18:13:08 -04:00
2015-07-07 16:34:24 -04:00
GUBP . GUBPNode Node = InBranchConfig . FindNode ( GUBP . GamePlatformMonolithicsNode . StaticGetFullName ( HostPlatform , Project , InTargetPlatform , Precompiled : bIsCodeTargetPlatform ) ) ;
2015-04-24 20:25:23 -04:00
if ( String . IsNullOrEmpty ( Node . AgentSharingGroup ) )
{
2015-07-08 08:05:50 -04:00
Node . AgentSharingGroup = BranchConfig . Branch . BaseEngineProject . GameName + "_MonolithicsGroup_" + InTargetPlatform + StaticGetHostPlatformSuffix ( InHostPlatform ) ;
2015-04-24 20:25:23 -04:00
}
2015-04-24 20:29:44 -04:00
AddNodeToStrip ( Node . GetFullName ( ) ) ;
2015-04-23 18:13:08 -04:00
2015-04-24 20:25:23 -04:00
AgentSharingGroup = Node . AgentSharingGroup ;
2015-04-23 18:13:08 -04:00
}
2015-04-24 12:36:57 -04:00
public override string GetDisplayGroupName ( )
{
return Project . GameName + "_Monolithics" + ( bIsCodeTargetPlatform ? "_Precompiled" : "" ) ;
}
2015-04-23 18:13:08 -04:00
public static string StaticGetFullName ( UnrealTargetPlatform InHostPlatform , BranchInfo . BranchUProject InProject , UnrealTargetPlatform InTargetPlatform , bool bIsCodeTargetPlatform )
{
string Name = InProject . GameName + "_" + InTargetPlatform + "_Mono" ;
if ( bIsCodeTargetPlatform )
{
Name + = "_Precompiled" ;
}
return Name + "_Strip" + StaticGetHostPlatformSuffix ( InHostPlatform ) ;
}
public override string GetFullName ( )
{
return StaticGetFullName ( HostPlatform , Project , TargetPlatform , bIsCodeTargetPlatform ) ;
}
}
2015-07-17 13:13:26 -04:00
public abstract class SignRocketNode : GUBP . HostPlatformNode
{
public GUBP . GUBPBranchConfig BranchConfig ;
public UnrealTargetPlatform TargetPlatform ;
public string SignedDir ;
public List < string > NodesToSign = new List < string > ( ) ;
public SignRocketNode ( GUBP . GUBPBranchConfig InBranchConfig , UnrealTargetPlatform InHostPlatform , UnrealTargetPlatform InTargetPlatform , string InSignedDir )
: base ( InHostPlatform )
{
BranchConfig = InBranchConfig ;
TargetPlatform = InTargetPlatform ;
SignedDir = InSignedDir ;
}
public override abstract string GetFullName ( ) ;
public void AddNodeToSign ( string NodeName )
{
NodesToSign . Add ( NodeName ) ;
AddDependency ( NodeName ) ;
}
public static bool IsRequiredForPlatform ( UnrealTargetPlatform Platform )
{
return Platform = = UnrealTargetPlatform . Mac | | Platform = = UnrealTargetPlatform . Win64 | | Platform = = UnrealTargetPlatform . Win32 ;
}
public override void DoBuild ( GUBP bp )
{
BuildProducts = new List < string > ( ) ;
string InputDir = Path . GetFullPath ( CommandUtils . CmdEnv . LocalRoot ) ;
// Read the filter for files on this platform
FileFilter SignFilter = new FileFilter ( ) ;
if ( HostPlatform = = UnrealTargetPlatform . Mac )
{
SignFilter . AddRule ( "*.dylib" ) ;
SignFilter . AddRule ( "*.app" ) ;
}
else
{
SignFilter . AddRule ( "*.exe" ) ;
SignFilter . AddRule ( "*.dll" ) ;
}
// Apply the filter to the build products
List < string > SourcePaths = new List < string > ( ) ;
List < string > TargetPaths = new List < string > ( ) ;
foreach ( string NodeToSign in NodesToSign )
{
GUBP . GUBPNode Node = BranchConfig . FindNode ( NodeToSign ) ;
foreach ( string DependencyBuildProduct in Node . BuildProducts )
{
string RelativePath = CommandUtils . StripBaseDirectory ( Path . GetFullPath ( DependencyBuildProduct ) , InputDir ) ;
if ( SignFilter . Matches ( RelativePath ) )
{
SourcePaths . Add ( CommandUtils . CombinePaths ( InputDir , RelativePath ) ) ;
TargetPaths . Add ( CommandUtils . CombinePaths ( SignedDir , RelativePath ) ) ;
}
}
}
// Strip the files and add them to the build products
SignFiles ( bp , SourcePaths . ToArray ( ) , TargetPaths . ToArray ( ) ) ;
BuildProducts . AddRange ( TargetPaths ) ;
SaveRecordOfSuccessAndAddToBuildProducts ( ) ;
}
public void SignFiles ( GUBP bp , string [ ] SourceFileNames , string [ ] TargetFileNames )
{
// copy the files from source to target
for ( int Idx = 0 ; Idx < SourceFileNames . Length ; Idx + + )
{
CommandUtils . CreateDirectory ( Path . GetDirectoryName ( TargetFileNames [ Idx ] ) ) ;
2015-08-20 09:37:11 -04:00
CommandUtils . Log ( "Signing code: {0} -> {1}" , SourceFileNames [ Idx ] , TargetFileNames [ Idx ] ) ;
2015-07-17 13:13:26 -04:00
CommandUtils . CopyFile ( SourceFileNames [ Idx ] , TargetFileNames [ Idx ] ) ;
}
// Sign everything we built
CodeSign . SignMultipleIfEXEOrDLL ( bp , TargetFileNames . ToList ( ) ) ;
}
}
public class SignRocketToolsNode : SignRocketNode
{
public SignRocketToolsNode ( GUBP . GUBPBranchConfig InBranchConfig , UnrealTargetPlatform InHostPlatform , string InSignedDir )
: base ( InBranchConfig , InHostPlatform , InHostPlatform , InSignedDir )
{
AddNodeToSign ( GUBP . ToolsForCompileNode . StaticGetFullName ( HostPlatform ) ) ;
AddNodeToSign ( GUBP . ToolsNode . StaticGetFullName ( HostPlatform ) ) ;
AddDependency ( StripRocketToolsNode . StaticGetFullName ( HostPlatform ) ) ;
AgentSharingGroup = "ToolsGroup" + StaticGetHostPlatformSuffix ( InHostPlatform ) ;
}
public static string StaticGetFullName ( UnrealTargetPlatform InHostPlatform )
{
return "Sign" + GUBP . ToolsNode . StaticGetFullName ( InHostPlatform ) ;
}
public override string GetFullName ( )
{
return StaticGetFullName ( HostPlatform ) ;
}
}
public class SignRocketEditorNode : SignRocketNode
{
public SignRocketEditorNode ( GUBP . GUBPBranchConfig InBranchConfig , UnrealTargetPlatform InHostPlatform , string InSignedDir )
: base ( InBranchConfig , InHostPlatform , InHostPlatform , InSignedDir )
{
AddNodeToSign ( GUBP . RootEditorNode . StaticGetFullName ( HostPlatform ) ) ;
AddDependency ( StripRocketEditorNode . StaticGetFullName ( HostPlatform ) ) ;
AgentSharingGroup = "Editor" + StaticGetHostPlatformSuffix ( HostPlatform ) ;
}
public override float Priority ( )
{
return 1000000.0f ;
}
public static string StaticGetFullName ( UnrealTargetPlatform InHostPlatform )
{
return "Sign" + GUBP . RootEditorNode . StaticGetFullName ( InHostPlatform ) ;
}
public override string GetFullName ( )
{
return StaticGetFullName ( HostPlatform ) ;
}
}
public class SignRocketMonolithicsNode : SignRocketNode
{
BranchInfo . BranchUProject Project ;
bool bIsCodeTargetPlatform ;
public SignRocketMonolithicsNode ( GUBP . GUBPBranchConfig InBranchConfig , UnrealTargetPlatform InHostPlatform , UnrealTargetPlatform InTargetPlatform , string InSignedDir )
: base ( InBranchConfig , InHostPlatform , InTargetPlatform , InSignedDir )
{
Project = InBranchConfig . Branch . BaseEngineProject ;
bIsCodeTargetPlatform = RocketBuild . IsCodeTargetPlatform ( InHostPlatform , InTargetPlatform ) ;
GUBP . GUBPNode Node = InBranchConfig . FindNode ( GUBP . GamePlatformMonolithicsNode . StaticGetFullName ( HostPlatform , Project , InTargetPlatform , Precompiled : bIsCodeTargetPlatform ) ) ;
if ( String . IsNullOrEmpty ( Node . AgentSharingGroup ) )
{
Node . AgentSharingGroup = BranchConfig . Branch . BaseEngineProject . GameName + "_MonolithicsGroup_" + InTargetPlatform + StaticGetHostPlatformSuffix ( InHostPlatform ) ;
}
AddNodeToSign ( Node . GetFullName ( ) ) ;
string StripNode = StripRocketMonolithicsNode . StaticGetFullName ( HostPlatform , BranchConfig . Branch . BaseEngineProject , TargetPlatform , RocketBuild . IsCodeTargetPlatform ( HostPlatform , TargetPlatform ) ) ;
AddDependency ( StripNode ) ;
AgentSharingGroup = Node . AgentSharingGroup ;
}
public override string GetDisplayGroupName ( )
{
return Project . GameName + "_Monolithics" + ( bIsCodeTargetPlatform ? "_Precompiled" : "" ) ;
}
public static string StaticGetFullName ( UnrealTargetPlatform InHostPlatform , BranchInfo . BranchUProject InProject , UnrealTargetPlatform InTargetPlatform , bool bIsCodeTargetPlatform )
{
string Name = InProject . GameName + "_" + InTargetPlatform + "_Mono" ;
if ( bIsCodeTargetPlatform )
{
Name + = "_Precompiled" ;
}
return Name + "_Sign" + StaticGetHostPlatformSuffix ( InHostPlatform ) ;
}
public override string GetFullName ( )
{
return StaticGetFullName ( HostPlatform , Project , TargetPlatform , bIsCodeTargetPlatform ) ;
}
}
2015-04-10 13:56:50 -04:00
public class FilterRocketNode : GUBP . HostPlatformNode
2015-03-27 08:02:21 -04:00
{
2015-07-07 16:34:24 -04:00
GUBP . GUBPBranchConfig BranchConfig ;
2015-04-10 13:56:50 -04:00
List < UnrealTargetPlatform > SourceHostPlatforms ;
List < UnrealTargetPlatform > TargetPlatforms ;
string [ ] CurrentFeaturePacks ;
string [ ] CurrentTemplates ;
public readonly string DepotManifestPath ;
2015-04-26 18:28:11 -04:00
public Dictionary < string , string > StrippedNodeManifestPaths = new Dictionary < string , string > ( ) ;
2015-07-17 13:13:26 -04:00
public Dictionary < string , string > SignedNodeManifestPaths = new Dictionary < string , string > ( ) ;
2015-03-27 08:02:21 -04:00
2015-07-08 08:05:50 -04:00
public FilterRocketNode ( GUBP . GUBPBranchConfig InBranchConfig , UnrealTargetPlatform InHostPlatform , List < UnrealTargetPlatform > InTargetPlatforms , string [ ] InCurrentFeaturePacks , string [ ] InCurrentTemplates )
2015-03-27 08:02:21 -04:00
: base ( InHostPlatform )
{
2015-07-07 16:34:24 -04:00
BranchConfig = InBranchConfig ;
2015-04-10 13:56:50 -04:00
TargetPlatforms = new List < UnrealTargetPlatform > ( InTargetPlatforms ) ;
CurrentFeaturePacks = InCurrentFeaturePacks ;
CurrentTemplates = InCurrentTemplates ;
2015-04-26 18:28:11 -04:00
DepotManifestPath = CommandUtils . CombinePaths ( CommandUtils . CmdEnv . LocalRoot , "Engine" , "Saved" , "Rocket" , HostPlatform . ToString ( ) , "Filter.txt" ) ;
2015-03-27 08:02:21 -04:00
2015-04-10 13:56:50 -04:00
// Add the editor
2015-03-27 08:02:21 -04:00
AddDependency ( GUBP . VersionFilesNode . StaticGetFullName ( ) ) ;
AddDependency ( GUBP . ToolsForCompileNode . StaticGetFullName ( HostPlatform ) ) ;
AddDependency ( GUBP . RootEditorNode . StaticGetFullName ( HostPlatform ) ) ;
AddDependency ( GUBP . ToolsNode . StaticGetFullName ( HostPlatform ) ) ;
2015-04-28 15:47:56 -04:00
// Add all the monolithic builds from their appropriate source host platform
2015-04-23 18:13:08 -04:00
foreach ( UnrealTargetPlatform TargetPlatform in TargetPlatforms )
2015-04-10 13:56:50 -04:00
{
2015-07-08 08:05:50 -04:00
UnrealTargetPlatform SourceHostPlatform = RocketBuild . GetSourceHostPlatform ( BranchConfig . HostPlatforms , HostPlatform , TargetPlatform ) ;
2015-04-28 15:47:56 -04:00
bool bIsCodeTargetPlatform = RocketBuild . IsCodeTargetPlatform ( SourceHostPlatform , TargetPlatform ) ;
2015-07-08 08:05:50 -04:00
AddDependency ( GUBP . GamePlatformMonolithicsNode . StaticGetFullName ( SourceHostPlatform , BranchConfig . Branch . BaseEngineProject , TargetPlatform , Precompiled : bIsCodeTargetPlatform ) ) ;
2015-04-28 15:47:56 -04:00
}
2015-04-23 18:13:08 -04:00
2015-04-28 15:47:56 -04:00
// Also add stripped symbols for all the target platforms that require it
List < string > StrippedNodeNames = new List < string > ( ) ;
foreach ( UnrealTargetPlatform TargetPlatform in TargetPlatforms )
{
2015-04-23 18:13:08 -04:00
if ( StripRocketNode . IsRequiredForPlatform ( TargetPlatform ) )
{
2015-07-08 08:05:50 -04:00
UnrealTargetPlatform SourceHostPlatform = RocketBuild . GetSourceHostPlatform ( BranchConfig . HostPlatforms , HostPlatform , TargetPlatform ) ;
string StripNode = StripRocketMonolithicsNode . StaticGetFullName ( SourceHostPlatform , BranchConfig . Branch . BaseEngineProject , TargetPlatform , RocketBuild . IsCodeTargetPlatform ( SourceHostPlatform , TargetPlatform ) ) ;
2015-04-23 18:13:08 -04:00
AddDependency ( StripNode ) ;
2015-04-26 18:28:11 -04:00
StrippedNodeNames . Add ( StripNode ) ;
2015-04-23 18:13:08 -04:00
}
2015-04-10 13:56:50 -04:00
}
2015-07-17 13:13:26 -04:00
// Also add signed node for all the target platforms that require it
List < string > SignedNodeNames = new List < string > ( ) ;
foreach ( UnrealTargetPlatform TargetPlatform in TargetPlatforms )
{
if ( SignRocketNode . IsRequiredForPlatform ( TargetPlatform ) )
{
UnrealTargetPlatform SourceHostPlatform = RocketBuild . GetSourceHostPlatform ( BranchConfig . HostPlatforms , HostPlatform , TargetPlatform ) ;
string SignNode = SignRocketMonolithicsNode . StaticGetFullName ( SourceHostPlatform , BranchConfig . Branch . BaseEngineProject , TargetPlatform , RocketBuild . IsCodeTargetPlatform ( SourceHostPlatform , TargetPlatform ) ) ;
AddDependency ( SignNode ) ;
SignedNodeNames . Add ( SignNode ) ;
}
}
2015-04-10 13:56:50 -04:00
// Add win64 tools on Mac, to get the win64 build of UBT, UAT and IPP
2015-07-08 08:05:50 -04:00
if ( HostPlatform = = UnrealTargetPlatform . Mac & & BranchConfig . HostPlatforms . Contains ( UnrealTargetPlatform . Win64 ) )
2015-03-27 08:02:21 -04:00
{
2015-04-10 13:56:50 -04:00
AddDependency ( GUBP . ToolsNode . StaticGetFullName ( UnrealTargetPlatform . Win64 ) ) ;
2015-03-27 08:02:21 -04:00
AddDependency ( GUBP . ToolsForCompileNode . StaticGetFullName ( UnrealTargetPlatform . Win64 ) ) ;
}
2015-04-10 13:56:50 -04:00
// Add all the feature packs
2015-07-08 08:05:50 -04:00
AddDependency ( GUBP . MakeFeaturePacksNode . StaticGetFullName ( GUBP . MakeFeaturePacksNode . GetDefaultBuildPlatform ( BranchConfig . HostPlatforms ) ) ) ;
2015-04-10 13:56:50 -04:00
// Find all the host platforms we need
2015-07-08 08:05:50 -04:00
SourceHostPlatforms = TargetPlatforms . Select ( x = > RocketBuild . GetSourceHostPlatform ( BranchConfig . HostPlatforms , HostPlatform , x ) ) . Distinct ( ) . ToList ( ) ;
2015-04-10 13:56:50 -04:00
if ( ! SourceHostPlatforms . Contains ( HostPlatform ) )
{
SourceHostPlatforms . Add ( HostPlatform ) ;
}
2015-04-23 18:13:08 -04:00
// Add the stripped host platforms
if ( StripRocketNode . IsRequiredForPlatform ( HostPlatform ) )
2015-04-10 13:56:50 -04:00
{
2015-04-23 18:13:08 -04:00
AddDependency ( StripRocketToolsNode . StaticGetFullName ( HostPlatform ) ) ;
2015-04-26 18:28:11 -04:00
StrippedNodeNames . Add ( StripRocketToolsNode . StaticGetFullName ( HostPlatform ) ) ;
2015-04-23 18:13:08 -04:00
AddDependency ( StripRocketEditorNode . StaticGetFullName ( HostPlatform ) ) ;
2015-04-26 18:28:11 -04:00
StrippedNodeNames . Add ( StripRocketEditorNode . StaticGetFullName ( HostPlatform ) ) ;
}
2015-07-17 13:13:26 -04:00
// Add the signed host platforms
if ( SignRocketNode . IsRequiredForPlatform ( HostPlatform ) )
{
AddDependency ( SignRocketToolsNode . StaticGetFullName ( HostPlatform ) ) ;
SignedNodeNames . Add ( SignRocketToolsNode . StaticGetFullName ( HostPlatform ) ) ;
AddDependency ( SignRocketEditorNode . StaticGetFullName ( HostPlatform ) ) ;
SignedNodeNames . Add ( SignRocketEditorNode . StaticGetFullName ( HostPlatform ) ) ;
}
2015-04-26 18:28:11 -04:00
// Set all the stripped manifest paths
foreach ( string StrippedNodeName in StrippedNodeNames )
{
StrippedNodeManifestPaths . Add ( StrippedNodeName , Path . Combine ( Path . GetDirectoryName ( DepotManifestPath ) , "Filter_" + StrippedNodeName + ".txt" ) ) ;
2015-04-10 13:56:50 -04:00
}
2015-07-17 13:13:26 -04:00
// Set all the signed manifest paths
foreach ( string SignedNodeName in SignedNodeNames )
{
SignedNodeManifestPaths . Add ( SignedNodeName , Path . Combine ( Path . GetDirectoryName ( DepotManifestPath ) , "Filter_" + SignedNodeName + ".txt" ) ) ;
}
2015-03-27 08:02:21 -04:00
}
2015-07-08 08:05:50 -04:00
public override int CISFrequencyQuantumShift ( GUBP . GUBPBranchConfig BranchConfig )
2015-03-27 08:02:21 -04:00
{
2015-07-08 08:05:50 -04:00
return base . CISFrequencyQuantumShift ( BranchConfig ) + 2 ;
2015-03-27 08:02:21 -04:00
}
public static string StaticGetFullName ( UnrealTargetPlatform InHostPlatform )
{
2015-04-10 13:56:50 -04:00
return "FilterRocket" + StaticGetHostPlatformSuffix ( InHostPlatform ) ;
2015-03-27 08:02:21 -04:00
}
public override string GetFullName ( )
{
return StaticGetFullName ( HostPlatform ) ;
}
public override void DoBuild ( GUBP bp )
{
2015-04-26 18:28:11 -04:00
BuildProducts = new List < string > ( ) ;
2015-03-27 08:02:21 -04:00
FileFilter Filter = new FileFilter ( ) ;
// Include all the editor products
2015-07-07 16:34:24 -04:00
AddRuleForBuildProducts ( Filter , BranchConfig , GUBP . ToolsForCompileNode . StaticGetFullName ( HostPlatform ) , FileFilterType . Include ) ;
AddRuleForBuildProducts ( Filter , BranchConfig , GUBP . RootEditorNode . StaticGetFullName ( HostPlatform ) , FileFilterType . Include ) ;
AddRuleForBuildProducts ( Filter , BranchConfig , GUBP . ToolsNode . StaticGetFullName ( HostPlatform ) , FileFilterType . Include ) ;
2015-03-27 08:02:21 -04:00
2015-04-27 12:57:52 -04:00
// Include win64 tools on Mac, to get the win64 build of UBT, UAT and IPP
2015-07-08 08:05:50 -04:00
if ( HostPlatform = = UnrealTargetPlatform . Mac & & BranchConfig . HostPlatforms . Contains ( UnrealTargetPlatform . Win64 ) )
2015-04-27 12:57:52 -04:00
{
2015-07-07 16:34:24 -04:00
AddRuleForBuildProducts ( Filter , BranchConfig , GUBP . ToolsNode . StaticGetFullName ( UnrealTargetPlatform . Win64 ) , FileFilterType . Include ) ;
AddRuleForBuildProducts ( Filter , BranchConfig , GUBP . ToolsForCompileNode . StaticGetFullName ( UnrealTargetPlatform . Win64 ) , FileFilterType . Include ) ;
2015-04-27 12:57:52 -04:00
}
2015-04-20 13:43:49 -04:00
// Include the editor headers
2015-04-27 12:57:52 -04:00
UnzipAndAddRuleForHeaders ( GUBP . RootEditorNode . StaticGetArchivedHeadersPath ( HostPlatform ) , Filter , FileFilterType . Include ) ;
2015-04-20 13:43:49 -04:00
2015-03-27 08:02:21 -04:00
// Include the build dependencies for every code platform
2015-04-28 15:47:56 -04:00
foreach ( UnrealTargetPlatform TargetPlatform in TargetPlatforms )
2015-03-27 08:02:21 -04:00
{
2015-04-28 15:47:56 -04:00
if ( RocketBuild . IsCodeTargetPlatform ( HostPlatform , TargetPlatform ) )
{
2015-07-08 08:05:50 -04:00
UnrealTargetPlatform SourceHostPlatform = RocketBuild . GetSourceHostPlatform ( BranchConfig . HostPlatforms , HostPlatform , TargetPlatform ) ;
string FileListPath = GUBP . GamePlatformMonolithicsNode . StaticGetBuildDependenciesPath ( SourceHostPlatform , BranchConfig . Branch . BaseEngineProject , TargetPlatform ) ;
2015-04-28 15:47:56 -04:00
Filter . AddRuleForFiles ( UnrealBuildTool . Utils . ReadClass < UnrealBuildTool . ExternalFileList > ( FileListPath ) . FileNames , CommandUtils . CmdEnv . LocalRoot , FileFilterType . Include ) ;
2015-07-08 08:05:50 -04:00
UnzipAndAddRuleForHeaders ( GUBP . GamePlatformMonolithicsNode . StaticGetArchivedHeadersPath ( SourceHostPlatform , BranchConfig . Branch . BaseEngineProject , TargetPlatform ) , Filter , FileFilterType . Include ) ;
2015-04-28 15:47:56 -04:00
}
2015-03-27 08:02:21 -04:00
}
// Add the monolithic binaries
2015-04-28 15:47:56 -04:00
foreach ( UnrealTargetPlatform TargetPlatform in TargetPlatforms )
2015-03-27 08:02:21 -04:00
{
2015-07-08 08:05:50 -04:00
UnrealTargetPlatform SourceHostPlatform = RocketBuild . GetSourceHostPlatform ( BranchConfig . HostPlatforms , HostPlatform , TargetPlatform ) ;
2015-04-28 15:47:56 -04:00
bool bIsCodeTargetPlatform = RocketBuild . IsCodeTargetPlatform ( SourceHostPlatform , TargetPlatform ) ;
2015-07-08 08:05:50 -04:00
AddRuleForBuildProducts ( Filter , BranchConfig , GUBP . GamePlatformMonolithicsNode . StaticGetFullName ( SourceHostPlatform , BranchConfig . Branch . BaseEngineProject , TargetPlatform , Precompiled : bIsCodeTargetPlatform ) , FileFilterType . Include ) ;
2015-03-27 08:02:21 -04:00
}
// Include the feature packs
foreach ( string CurrentFeaturePack in CurrentFeaturePacks )
{
2015-07-08 08:05:50 -04:00
BranchInfo . BranchUProject Project = BranchConfig . Branch . FindGameChecked ( CurrentFeaturePack ) ;
2015-04-10 13:56:50 -04:00
Filter . AddRuleForFile ( GUBP . MakeFeaturePacksNode . GetOutputFile ( Project ) , CommandUtils . CmdEnv . LocalRoot , FileFilterType . Include ) ;
2015-03-27 08:02:21 -04:00
}
// Include all the templates
foreach ( string Template in CurrentTemplates )
{
2015-07-08 08:05:50 -04:00
BranchInfo . BranchUProject Project = BranchConfig . Branch . FindGameChecked ( Template ) ;
2015-04-24 12:56:26 -04:00
Filter . Include ( "/" + Utils . StripBaseDirectory ( Path . GetDirectoryName ( Project . FilePath ) , CommandUtils . CmdEnv . LocalRoot ) . Replace ( '\\' , '/' ) + "/..." ) ;
2015-03-27 08:02:21 -04:00
}
2015-04-10 13:56:50 -04:00
// Include all the standard rules
2015-03-27 08:02:21 -04:00
string RulesFileName = CommandUtils . CombinePaths ( CommandUtils . CmdEnv . LocalRoot , "Engine" , "Build" , "InstalledEngineFilters.ini" ) ;
2015-04-10 13:56:50 -04:00
Filter . ReadRulesFromFile ( RulesFileName , "CopyEditor" , HostPlatform . ToString ( ) ) ;
Filter . ReadRulesFromFile ( RulesFileName , "CopyTargetPlatforms" , HostPlatform . ToString ( ) ) ;
2015-03-27 08:02:21 -04:00
// Custom rules for each target platform
foreach ( UnrealTargetPlatform TargetPlaform in TargetPlatforms )
{
2015-03-27 11:34:27 -04:00
string SectionName = String . Format ( "CopyTargetPlatform.{0}" , TargetPlaform . ToString ( ) ) ;
2015-04-10 13:56:50 -04:00
Filter . ReadRulesFromFile ( RulesFileName , SectionName , HostPlatform . ToString ( ) ) ;
2015-03-27 08:02:21 -04:00
}
// Add the final exclusions for legal reasons.
2015-04-10 13:56:50 -04:00
Filter . ExcludeConfidentialPlatforms ( ) ;
Filter . ExcludeConfidentialFolders ( ) ;
2015-03-27 08:02:21 -04:00
2015-04-10 13:56:50 -04:00
// Run the filter on the stripped symbols, and remove those files from the copy filter
2015-04-26 18:28:11 -04:00
List < string > AllStrippedFiles = new List < string > ( ) ;
foreach ( KeyValuePair < string , string > StrippedNodeManifestPath in StrippedNodeManifestPaths )
2015-03-27 11:34:27 -04:00
{
2015-04-26 18:28:11 -04:00
List < string > StrippedFiles = new List < string > ( ) ;
2015-07-07 16:34:24 -04:00
StripRocketNode StripNode = ( StripRocketNode ) BranchConfig . FindNode ( StrippedNodeManifestPath . Key ) ;
2015-04-10 13:56:50 -04:00
foreach ( string BuildProduct in StripNode . BuildProducts )
{
if ( Utils . IsFileUnderDirectory ( BuildProduct , StripNode . StrippedDir ) )
{
string RelativePath = CommandUtils . StripBaseDirectory ( Path . GetFullPath ( BuildProduct ) , StripNode . StrippedDir ) ;
if ( Filter . Matches ( RelativePath ) )
{
StrippedFiles . Add ( RelativePath ) ;
2015-04-26 18:28:11 -04:00
AllStrippedFiles . Add ( RelativePath ) ;
2015-04-10 13:56:50 -04:00
Filter . Exclude ( "/" + RelativePath ) ;
}
}
}
2015-04-26 18:28:11 -04:00
WriteManifest ( StrippedNodeManifestPath . Value , StrippedFiles ) ;
BuildProducts . Add ( StrippedNodeManifestPath . Value ) ;
2015-03-27 11:34:27 -04:00
}
2015-04-10 13:56:50 -04:00
2015-07-17 13:13:26 -04:00
// Run the filter on the signed code, and remove those files from the copy filter
List < string > AllSignedFiles = new List < string > ( ) ;
foreach ( KeyValuePair < string , string > SignedNodeManifestPath in SignedNodeManifestPaths )
{
List < string > SignedFiles = new List < string > ( ) ;
SignRocketNode SignNode = ( SignRocketNode ) BranchConfig . FindNode ( SignedNodeManifestPath . Key ) ;
foreach ( string BuildProduct in SignNode . BuildProducts )
{
if ( Utils . IsFileUnderDirectory ( BuildProduct , SignNode . SignedDir ) )
{
string RelativePath = CommandUtils . StripBaseDirectory ( Path . GetFullPath ( BuildProduct ) , SignNode . SignedDir ) ;
if ( Filter . Matches ( RelativePath ) )
{
SignedFiles . Add ( RelativePath ) ;
AllSignedFiles . Add ( RelativePath ) ;
Filter . Exclude ( "/" + RelativePath ) ;
}
}
}
WriteManifest ( SignedNodeManifestPath . Value , SignedFiles ) ;
BuildProducts . Add ( SignedNodeManifestPath . Value ) ;
}
2015-04-10 13:56:50 -04:00
// Write the filtered list of depot files to disk, removing any symlinks
2015-08-05 10:22:11 -04:00
List < string > DepotFiles = Filter . ApplyToDirectory ( CommandUtils . CmdEnv . LocalRoot , true ) ;
2015-04-10 13:56:50 -04:00
WriteManifest ( DepotManifestPath , DepotFiles ) ;
2015-04-26 18:28:11 -04:00
BuildProducts . Add ( DepotManifestPath ) ;
2015-04-10 13:56:50 -04:00
// Sort the list of output files
SortedDictionary < string , bool > SortedFiles = new SortedDictionary < string , bool > ( StringComparer . InvariantCultureIgnoreCase ) ;
foreach ( string DepotFile in DepotFiles )
{
SortedFiles . Add ( DepotFile , false ) ;
}
2015-04-26 18:28:11 -04:00
foreach ( string StrippedFile in AllStrippedFiles )
2015-04-10 13:56:50 -04:00
{
SortedFiles . Add ( StrippedFile , true ) ;
}
// Write the list to the log
2015-08-20 09:37:11 -04:00
CommandUtils . Log ( "Files to be included in Rocket build:" ) ;
2015-04-10 13:56:50 -04:00
foreach ( KeyValuePair < string , bool > SortedFile in SortedFiles )
{
2015-08-20 09:37:11 -04:00
CommandUtils . Log ( " {0}{1}" , SortedFile . Key , SortedFile . Value ? " (stripped)" : "" ) ;
2015-04-10 13:56:50 -04:00
}
2015-03-27 08:02:21 -04:00
}
2015-07-07 16:34:24 -04:00
static void AddRuleForBuildProducts ( FileFilter Filter , GUBP . GUBPBranchConfig BranchConfig , string NodeName , FileFilterType Type )
2015-03-27 08:02:21 -04:00
{
2015-07-07 16:34:24 -04:00
GUBP . GUBPNode Node = BranchConfig . FindNode ( NodeName ) ;
2015-04-10 13:56:50 -04:00
if ( Node = = null )
{
throw new AutomationException ( "Couldn't find node '{0}'" , NodeName ) ;
}
Filter . AddRuleForFiles ( Node . BuildProducts , CommandUtils . CmdEnv . LocalRoot , Type ) ;
2015-08-28 06:22:07 -04:00
AddRuleForRuntimeDependencies ( Filter , Node . BuildProducts , Type ) ;
}
2015-09-01 04:48:32 -04:00
/ * *
* Searches for receipts in a list of build products so that any Runtime Dependencies can be added from them
* /
public static void AddRuleForRuntimeDependencies ( FileFilter Filter , List < string > BuildProducts , FileFilterType Type )
2015-08-28 06:22:07 -04:00
{
HashSet < string > RuntimeDependencyPaths = new HashSet < string > ( ) ;
string EnginePath = CommandUtils . CombinePaths ( CommandUtils . CmdEnv . LocalRoot , "Engine" ) ;
// Search for receipts in the Build Products
foreach ( string BuildProduct in BuildProducts )
{
if ( BuildProduct . EndsWith ( ".target" ) )
{
// Read the receipt
TargetReceipt Receipt ;
if ( ! TargetReceipt . TryRead ( BuildProduct , out Receipt ) )
{
//throw new AutomationException("Missing or invalid target receipt ({0})", BuildProduct);
continue ;
}
// Convert the paths to absolute
2015-09-03 08:47:24 -04:00
Receipt . ExpandPathVariables ( new DirectoryReference ( EnginePath ) , new DirectoryReference ( EnginePath ) ) ;
2015-08-28 06:22:07 -04:00
foreach ( var RuntimeDependency in Receipt . RuntimeDependencies )
{
RuntimeDependencyPaths . Add ( RuntimeDependency . Path ) ;
}
}
}
// Add rules for runtime dependencies if we found any
if ( RuntimeDependencyPaths . Count > 0 )
{
Filter . AddRuleForFiles ( RuntimeDependencyPaths , CommandUtils . CmdEnv . LocalRoot , Type ) ;
}
2015-03-27 08:02:21 -04:00
}
2015-04-20 13:43:49 -04:00
static void UnzipAndAddRuleForHeaders ( string ZipFileName , FileFilter Filter , FileFilterType Type )
{
IEnumerable < string > FileNames = CommandUtils . UnzipFiles ( ZipFileName , CommandUtils . CmdEnv . LocalRoot ) ;
Filter . AddRuleForFiles ( FileNames , CommandUtils . CmdEnv . LocalRoot , FileFilterType . Include ) ;
}
2015-04-10 13:56:50 -04:00
public static void WriteManifest ( string FileName , IEnumerable < string > Files )
2015-03-27 08:02:21 -04:00
{
2015-04-10 13:56:50 -04:00
CommandUtils . CreateDirectory ( Path . GetDirectoryName ( FileName ) ) ;
CommandUtils . WriteAllLines ( FileName , Files . ToArray ( ) ) ;
}
}
2015-04-25 10:33:07 -04:00
public class GatherRocketNode : GUBP . HostPlatformNode
2015-04-10 13:56:50 -04:00
{
2015-07-07 16:34:24 -04:00
GUBP . GUBPBranchConfig BranchConfig ;
2015-04-10 13:56:50 -04:00
public readonly string OutputDir ;
2015-04-20 13:43:49 -04:00
public List < UnrealTargetPlatform > CodeTargetPlatforms ;
2015-04-10 13:56:50 -04:00
2015-07-07 16:34:24 -04:00
public GatherRocketNode ( GUBP . GUBPBranchConfig InBranchConfig , UnrealTargetPlatform HostPlatform , List < UnrealTargetPlatform > InCodeTargetPlatforms , string InOutputDir ) : base ( HostPlatform )
2015-04-10 13:56:50 -04:00
{
2015-07-07 16:34:24 -04:00
BranchConfig = InBranchConfig ;
2015-04-10 13:56:50 -04:00
OutputDir = InOutputDir ;
2015-04-20 13:43:49 -04:00
CodeTargetPlatforms = new List < UnrealTargetPlatform > ( InCodeTargetPlatforms ) ;
2015-04-10 13:56:50 -04:00
AddDependency ( FilterRocketNode . StaticGetFullName ( HostPlatform ) ) ;
2015-04-20 11:08:45 -04:00
AddDependency ( BuildDerivedDataCacheNode . StaticGetFullName ( HostPlatform ) ) ;
2015-08-11 08:14:46 -04:00
AddDependency ( WaitToMakeRocketBuild . StaticGetFullName ( ) ) ;
2015-04-25 10:33:07 -04:00
AgentSharingGroup = "RocketGroup" + StaticGetHostPlatformSuffix ( HostPlatform ) ;
2015-04-10 13:56:50 -04:00
}
public static string StaticGetFullName ( UnrealTargetPlatform HostPlatform )
{
2015-04-25 10:33:07 -04:00
return "GatherRocket" + StaticGetHostPlatformSuffix ( HostPlatform ) ;
2015-03-27 08:02:21 -04:00
}
public override string GetFullName ( )
{
return StaticGetFullName ( HostPlatform ) ;
}
2015-04-10 13:56:50 -04:00
public override void DoBuild ( GUBP bp )
{
CommandUtils . DeleteDirectoryContents ( OutputDir ) ;
2015-04-20 13:43:49 -04:00
// Extract the editor headers
2015-04-27 22:28:19 -04:00
CommandUtils . UnzipFiles ( GUBP . RootEditorNode . StaticGetArchivedHeadersPath ( HostPlatform ) , CommandUtils . CmdEnv . LocalRoot ) ;
2015-04-20 13:43:49 -04:00
// Extract all the headers for code target platforms
foreach ( UnrealTargetPlatform CodeTargetPlatform in CodeTargetPlatforms )
{
2015-07-08 08:05:50 -04:00
UnrealTargetPlatform SourceHostPlatform = RocketBuild . GetSourceHostPlatform ( BranchConfig . HostPlatforms , HostPlatform , CodeTargetPlatform ) ;
string ZipFileName = GUBP . GamePlatformMonolithicsNode . StaticGetArchivedHeadersPath ( SourceHostPlatform , BranchConfig . Branch . BaseEngineProject , CodeTargetPlatform ) ;
2015-04-20 13:43:49 -04:00
CommandUtils . UnzipFiles ( ZipFileName , CommandUtils . CmdEnv . LocalRoot ) ;
}
2015-04-10 13:56:50 -04:00
// Copy the depot files to the output directory
2015-07-07 16:34:24 -04:00
FilterRocketNode FilterNode = ( FilterRocketNode ) BranchConfig . FindNode ( FilterRocketNode . StaticGetFullName ( HostPlatform ) ) ;
2015-04-10 13:56:50 -04:00
CopyManifestFilesToOutput ( FilterNode . DepotManifestPath , CommandUtils . CmdEnv . LocalRoot , OutputDir ) ;
2015-04-26 18:28:11 -04:00
// Copy the stripped files to the output directory
foreach ( KeyValuePair < string , string > StrippedManifestPath in FilterNode . StrippedNodeManifestPaths )
{
2015-07-07 16:34:24 -04:00
StripRocketNode StripNode = ( StripRocketNode ) BranchConfig . FindNode ( StrippedManifestPath . Key ) ;
2015-04-26 18:28:11 -04:00
CopyManifestFilesToOutput ( StrippedManifestPath . Value , StripNode . StrippedDir , OutputDir ) ;
}
2015-04-10 13:56:50 -04:00
2015-07-17 13:13:26 -04:00
// Copy the signed files to the output directory
foreach ( KeyValuePair < string , string > SignedManifestPath in FilterNode . SignedNodeManifestPaths )
{
SignRocketNode SignNode = ( SignRocketNode ) BranchConfig . FindNode ( SignedManifestPath . Key ) ;
CopyManifestFilesToOutput ( SignedManifestPath . Value , SignNode . SignedDir , OutputDir ) ;
}
2015-04-20 11:08:45 -04:00
// Copy the DDC to the output directory
2015-07-07 16:34:24 -04:00
BuildDerivedDataCacheNode DerivedDataCacheNode = ( BuildDerivedDataCacheNode ) BranchConfig . FindNode ( BuildDerivedDataCacheNode . StaticGetFullName ( HostPlatform ) ) ;
2015-04-20 11:08:45 -04:00
CopyManifestFilesToOutput ( DerivedDataCacheNode . SavedManifestPath , DerivedDataCacheNode . SavedDir , OutputDir ) ;
2015-05-15 10:23:40 -04:00
// Write the Rocket.txt file with the
string RocketFile = CommandUtils . CombinePaths ( OutputDir , "Engine/Build/Rocket.txt" ) ;
CommandUtils . WriteAllText ( RocketFile , "-installedengine -rocket" ) ;
2015-04-15 15:00:33 -04:00
2015-04-10 13:56:50 -04:00
// Create a dummy build product
BuildProducts = new List < string > ( ) ;
SaveRecordOfSuccessAndAddToBuildProducts ( ) ;
}
static void CopyManifestFilesToOutput ( string ManifestPath , string InputDir , string OutputDir )
{
// Read the files from the manifest
2015-08-20 09:37:11 -04:00
CommandUtils . Log ( "Reading manifest: '{0}'" , ManifestPath ) ;
2015-04-10 13:56:50 -04:00
string [ ] Files = CommandUtils . ReadAllLines ( ManifestPath ) . Select ( x = > x . Trim ( ) ) . Where ( x = > x . Length > 0 ) . ToArray ( ) ;
// Create lists of source and target files
2015-08-20 09:37:11 -04:00
CommandUtils . Log ( "Preparing file lists..." ) ;
2015-08-05 10:22:11 -04:00
var SourceFiles = Files . Select ( x = > CommandUtils . CombinePaths ( InputDir , x ) ) . ToList ( ) ;
var TargetFiles = Files . Select ( x = > CommandUtils . CombinePaths ( OutputDir , x ) ) . ToList ( ) ;
2015-04-10 13:56:50 -04:00
// Copy everything
CommandUtils . ThreadedCopyFiles ( SourceFiles , TargetFiles ) ;
}
2015-03-27 08:02:21 -04:00
}
2015-04-25 10:33:07 -04:00
public class PublishRocketNode : GUBP . HostPlatformNode
{
string LocalDir ;
string PublishDir ;
public PublishRocketNode ( UnrealTargetPlatform HostPlatform , string InLocalDir , string InPublishDir ) : base ( HostPlatform )
{
LocalDir = InLocalDir ;
PublishDir = InPublishDir ;
AddDependency ( GatherRocketNode . StaticGetFullName ( HostPlatform ) ) ;
AgentSharingGroup = "RocketGroup" + StaticGetHostPlatformSuffix ( HostPlatform ) ;
}
public static string StaticGetFullName ( UnrealTargetPlatform HostPlatform )
{
return "PublishRocket" + StaticGetHostPlatformSuffix ( HostPlatform ) ;
}
public override string GetFullName ( )
{
return StaticGetFullName ( HostPlatform ) ;
}
public override void DoBuild ( GUBP bp )
{
2015-05-01 19:53:59 -04:00
// Create a zip file containing the install
string FullZipFileName = Path . Combine ( CommandUtils . CmdEnv . LocalRoot , "FullInstall" + StaticGetHostPlatformSuffix ( HostPlatform ) + ".zip" ) ;
2015-08-20 09:37:11 -04:00
CommandUtils . Log ( "Creating {0}..." , FullZipFileName ) ;
2015-05-01 19:53:59 -04:00
CommandUtils . ZipFiles ( FullZipFileName , LocalDir , new FileFilter ( FileFilterType . Include ) ) ;
2015-04-25 10:33:07 -04:00
2015-05-01 19:53:59 -04:00
// Create a filter for the files we need just to run the editor
FileFilter EditorFilter = new FileFilter ( FileFilterType . Include ) ;
EditorFilter . Exclude ( "/Engine/Binaries/..." ) ;
EditorFilter . Include ( "/Engine/Binaries/DotNET/..." ) ;
EditorFilter . Include ( "/Engine/Binaries/ThirdParty/..." ) ;
EditorFilter . Include ( "/Engine/Binaries/" + HostPlatform . ToString ( ) + "/..." ) ;
EditorFilter . Exclude ( "/Engine/Binaries/.../*.lib" ) ;
EditorFilter . Exclude ( "/Engine/Binaries/.../*.a" ) ;
EditorFilter . Exclude ( "/Engine/Extras/..." ) ;
EditorFilter . Exclude ( "/Engine/Source/.../Private/..." ) ;
EditorFilter . Exclude ( "/FeaturePacks/..." ) ;
EditorFilter . Exclude ( "/Samples/..." ) ;
EditorFilter . Exclude ( "/Templates/..." ) ;
EditorFilter . Exclude ( "*.pdb" ) ;
// Create a zip file containing the editor install
string EditorZipFileName = Path . Combine ( CommandUtils . CmdEnv . LocalRoot , "EditorInstall" + StaticGetHostPlatformSuffix ( HostPlatform ) + ".zip" ) ;
2015-08-20 09:37:11 -04:00
CommandUtils . Log ( "Creating {0}..." , EditorZipFileName ) ;
2015-05-01 19:53:59 -04:00
CommandUtils . ZipFiles ( EditorZipFileName , LocalDir , EditorFilter ) ;
// Copy the files to their final location
2015-08-20 09:37:11 -04:00
CommandUtils . Log ( "Copying files to {0}" , PublishDir ) ;
2015-07-22 15:21:40 -04:00
InternalUtils . Robust_CopyFile ( FullZipFileName , Path . Combine ( PublishDir , Path . GetFileName ( FullZipFileName ) ) ) ;
InternalUtils . Robust_CopyFile ( EditorZipFileName , Path . Combine ( PublishDir , Path . GetFileName ( EditorZipFileName ) ) ) ;
2015-05-01 19:53:59 -04:00
CommandUtils . DeleteFile ( FullZipFileName ) ;
CommandUtils . DeleteFile ( EditorZipFileName ) ;
// Save a record of success
2015-04-25 10:33:07 -04:00
BuildProducts = new List < string > ( ) ;
SaveRecordOfSuccessAndAddToBuildProducts ( ) ;
}
}
public class PublishRocketSymbolsNode : GUBP . HostPlatformNode
2015-04-10 13:56:50 -04:00
{
2015-07-08 08:05:50 -04:00
GUBP . GUBPBranchConfig BranchConfig ;
2015-04-10 13:56:50 -04:00
string SymbolsOutputDir ;
2015-07-08 08:05:50 -04:00
public PublishRocketSymbolsNode ( GUBP . GUBPBranchConfig InBranchConfig , UnrealTargetPlatform HostPlatform , IEnumerable < UnrealTargetPlatform > TargetPlatforms , string InSymbolsOutputDir ) : base ( HostPlatform )
2015-04-10 13:56:50 -04:00
{
2015-07-08 08:05:50 -04:00
BranchConfig = InBranchConfig ;
2015-04-10 13:56:50 -04:00
SymbolsOutputDir = InSymbolsOutputDir ;
AddDependency ( GUBP . ToolsForCompileNode . StaticGetFullName ( HostPlatform ) ) ;
AddDependency ( GUBP . RootEditorNode . StaticGetFullName ( HostPlatform ) ) ;
AddDependency ( GUBP . ToolsNode . StaticGetFullName ( HostPlatform ) ) ;
2015-08-11 08:14:46 -04:00
AddDependency ( WaitToMakeRocketBuild . StaticGetFullName ( ) ) ;
2015-04-10 13:56:50 -04:00
foreach ( UnrealTargetPlatform TargetPlatform in TargetPlatforms )
{
2015-07-08 08:05:50 -04:00
if ( HostPlatform = = RocketBuild . GetSourceHostPlatform ( BranchConfig . HostPlatforms , HostPlatform , TargetPlatform ) )
2015-04-28 15:47:56 -04:00
{
bool bIsCodeTargetPlatform = RocketBuild . IsCodeTargetPlatform ( HostPlatform , TargetPlatform ) ;
2015-07-08 08:05:50 -04:00
AddDependency ( GUBP . GamePlatformMonolithicsNode . StaticGetFullName ( HostPlatform , BranchConfig . Branch . BaseEngineProject , TargetPlatform , Precompiled : bIsCodeTargetPlatform ) ) ;
2015-04-28 15:47:56 -04:00
}
2015-04-10 13:56:50 -04:00
}
2015-04-25 10:33:07 -04:00
AgentSharingGroup = "RocketGroup" + StaticGetHostPlatformSuffix ( HostPlatform ) ;
2015-04-10 13:56:50 -04:00
}
public static string StaticGetFullName ( UnrealTargetPlatform HostPlatform )
{
2015-04-25 10:33:07 -04:00
return "PublishRocketSymbols" + StaticGetHostPlatformSuffix ( HostPlatform ) ;
2015-04-10 13:56:50 -04:00
}
public override string GetFullName ( )
{
return StaticGetFullName ( HostPlatform ) ;
}
public override void DoBuild ( GUBP bp )
{
2015-07-08 08:05:50 -04:00
if ( RocketBuild . ShouldDoSeriousThingsLikeP4CheckinAndPostToMCP ( BranchConfig ) )
2015-04-10 13:56:50 -04:00
{
2015-04-25 10:33:07 -04:00
// Make a lookup for all the known debug extensions, and filter all the dependency build products against that
HashSet < string > DebugExtensions = new HashSet < string > ( Platform . Platforms . Values . SelectMany ( x = > x . GetDebugFileExtentions ( ) ) . Distinct ( ) . ToArray ( ) , StringComparer . InvariantCultureIgnoreCase ) ;
foreach ( string InputFileName in AllDependencyBuildProducts )
2015-04-10 13:56:50 -04:00
{
2015-04-25 10:33:07 -04:00
string Extension = Path . GetExtension ( InputFileName ) ;
2015-05-18 10:03:36 -04:00
if ( DebugExtensions . Contains ( Extension ) | | Extension = = ".exe" | | Extension = = ".dll" ) // Need all windows build products for crash reporter
2015-04-25 10:33:07 -04:00
{
string OutputFileName = CommandUtils . MakeRerootedFilePath ( InputFileName , CommandUtils . CmdEnv . LocalRoot , SymbolsOutputDir ) ;
2015-07-22 15:21:40 -04:00
InternalUtils . Robust_CopyFile ( InputFileName , OutputFileName ) ;
2015-04-25 10:33:07 -04:00
}
2015-04-10 13:56:50 -04:00
}
}
// Add a dummy build product
BuildProducts = new List < string > ( ) ;
SaveRecordOfSuccessAndAddToBuildProducts ( ) ;
}
}
public class BuildDerivedDataCacheNode : GUBP . HostPlatformNode
2015-03-27 08:02:21 -04:00
{
2015-07-08 08:05:50 -04:00
GUBP . GUBPBranchConfig BranchConfig ;
2015-03-27 08:02:21 -04:00
string TargetPlatforms ;
string [ ] ProjectNames ;
2015-04-20 11:08:45 -04:00
public readonly string SavedDir ;
public readonly string SavedManifestPath ;
2015-03-27 08:02:21 -04:00
2015-07-08 08:05:50 -04:00
public BuildDerivedDataCacheNode ( GUBP . GUBPBranchConfig InBranchConfig , UnrealTargetPlatform InHostPlatform , string InTargetPlatforms , string [ ] InProjectNames )
2015-03-27 08:02:21 -04:00
: base ( InHostPlatform )
{
2015-07-08 08:05:50 -04:00
BranchConfig = InBranchConfig ;
2015-03-27 08:02:21 -04:00
TargetPlatforms = InTargetPlatforms ;
ProjectNames = InProjectNames ;
2015-04-20 11:08:45 -04:00
SavedDir = CommandUtils . CombinePaths ( CommandUtils . CmdEnv . LocalRoot , "Engine" , "Saved" , "Rocket" , HostPlatform . ToString ( ) ) ;
SavedManifestPath = CommandUtils . CombinePaths ( SavedDir , "DerivedDataCacheManifest.txt" ) ;
2015-03-27 08:02:21 -04:00
2015-04-10 13:56:50 -04:00
AddDependency ( GUBP . RootEditorNode . StaticGetFullName ( HostPlatform ) ) ;
2015-05-12 19:21:10 -04:00
AddDependency ( GUBP . ToolsNode . StaticGetFullName ( HostPlatform ) ) ;
2015-03-27 08:02:21 -04:00
}
public static string StaticGetFullName ( UnrealTargetPlatform InHostPlatform )
{
2015-04-10 13:56:50 -04:00
return "BuildDerivedDataCache" + StaticGetHostPlatformSuffix ( InHostPlatform ) ;
2015-03-27 08:02:21 -04:00
}
2015-07-08 08:05:50 -04:00
public override int CISFrequencyQuantumShift ( GUBP . GUBPBranchConfig BranchConfig )
2015-03-27 08:02:21 -04:00
{
2015-07-08 08:05:50 -04:00
return base . CISFrequencyQuantumShift ( BranchConfig ) + 2 ;
2015-03-27 08:02:21 -04:00
}
public override string GetFullName ( )
{
return StaticGetFullName ( HostPlatform ) ;
}
public override void DoBuild ( GUBP bp )
{
2015-04-20 11:08:45 -04:00
CommandUtils . CreateDirectory ( SavedDir ) ;
2015-03-27 08:02:21 -04:00
BuildProducts = new List < string > ( ) ;
2015-04-20 11:08:45 -04:00
List < string > ManifestFiles = new List < string > ( ) ;
2015-04-16 11:59:12 -04:00
if ( ! bp . ParseParam ( "NoDDC" ) )
2015-03-27 08:02:21 -04:00
{
2015-05-12 19:21:10 -04:00
// Find all the projects we're interested in
List < BranchInfo . BranchUProject > Projects = new List < BranchInfo . BranchUProject > ( ) ;
2015-04-10 13:56:50 -04:00
foreach ( string ProjectName in ProjectNames )
2015-03-27 08:02:21 -04:00
{
2015-07-08 08:05:50 -04:00
BranchInfo . BranchUProject Project = BranchConfig . Branch . FindGameChecked ( ProjectName ) ;
2015-04-10 13:56:50 -04:00
if ( ! Project . Properties . bIsCodeBasedProject )
{
2015-05-12 19:21:10 -04:00
Projects . Add ( Project ) ;
2015-04-10 13:56:50 -04:00
}
2015-03-27 08:02:21 -04:00
}
2015-04-16 11:54:50 -04:00
2015-05-12 19:21:10 -04:00
// Filter out the files we need to build DDC. Removing confidential folders can affect DDC keys, so we want to be sure that we're making DDC with a build that can use it.
FileFilter Filter = new FileFilter ( FileFilterType . Exclude ) ;
Filter . AddRuleForFiles ( AllDependencyBuildProducts , CommandUtils . CmdEnv . LocalRoot , FileFilterType . Include ) ;
2015-09-01 04:48:32 -04:00
FilterRocketNode . AddRuleForRuntimeDependencies ( Filter , AllDependencyBuildProducts , FileFilterType . Include ) ;
2015-05-12 19:21:10 -04:00
Filter . ReadRulesFromFile ( CommandUtils . CombinePaths ( CommandUtils . CmdEnv . LocalRoot , "Engine" , "Build" , "InstalledEngineFilters.ini" ) , "CopyEditor" , HostPlatform . ToString ( ) ) ;
Filter . Exclude ( "/Engine/Build/..." ) ;
Filter . Exclude ( "/Engine/Extras/..." ) ;
Filter . Exclude ( "/Engine/DerivedDataCache/..." ) ;
Filter . Exclude ( "/Samples/..." ) ;
Filter . Exclude ( "/Templates/..." ) ;
2015-08-12 10:05:08 -04:00
Filter . Include ( "/Templates/TemplateResources/..." ) ;
2015-05-12 19:21:10 -04:00
Filter . Exclude ( ".../Source/..." ) ;
Filter . Exclude ( ".../Intermediate/..." ) ;
Filter . ExcludeConfidentialPlatforms ( ) ;
Filter . ExcludeConfidentialFolders ( ) ;
Filter . Include ( "/Engine/Build/NotForLicensees/EpicInternal.txt" ) ;
Filter . Include ( "/Engine/Binaries/.../*DDCUtils*" ) ; // Make sure we can use the shared DDC!
// Copy everything to a temporary directory
string TempDir = CommandUtils . CombinePaths ( CommandUtils . CmdEnv . LocalRoot , "LocalBuilds" , "RocketDDC" , CommandUtils . GetGenericPlatformName ( HostPlatform ) ) ;
CommandUtils . DeleteDirectoryContents ( TempDir ) ;
CommandUtils . ThreadedCopyFiles ( CommandUtils . CmdEnv . LocalRoot , TempDir , Filter , true ) ;
// Get paths to everything within the temporary directory
string EditorExe = CommandUtils . GetEditorCommandletExe ( TempDir , HostPlatform ) ;
string RelativePakPath = "Engine/DerivedDataCache/Compressed.ddp" ;
string OutputPakFile = CommandUtils . CombinePaths ( TempDir , RelativePakPath ) ;
string OutputCsvFile = Path . ChangeExtension ( OutputPakFile , ".csv" ) ;
// Generate DDC for all the non-code projects. We don't necessarily have editor DLLs for the code projects, but they should be the same as their blueprint counterparts.
List < string > ProjectPakFiles = new List < string > ( ) ;
foreach ( BranchInfo . BranchUProject Project in Projects )
{
2015-08-20 09:37:11 -04:00
CommandUtils . Log ( "Generating DDC data for {0} on {1}" , Project . GameName , TargetPlatforms ) ;
2015-05-12 19:21:10 -04:00
CommandUtils . DDCCommandlet ( Project . FilePath , EditorExe , null , TargetPlatforms , "-fill -DDC=CreateInstalledEnginePak -ProjectOnly" ) ;
string ProjectPakFile = CommandUtils . CombinePaths ( Path . GetDirectoryName ( OutputPakFile ) , String . Format ( "Compressed-{0}.ddp" , Project . GameName ) ) ;
CommandUtils . DeleteFile ( ProjectPakFile ) ;
CommandUtils . RenameFile ( OutputPakFile , ProjectPakFile ) ;
string ProjectCsvFile = Path . ChangeExtension ( ProjectPakFile , ".csv" ) ;
CommandUtils . DeleteFile ( ProjectCsvFile ) ;
CommandUtils . RenameFile ( OutputCsvFile , ProjectCsvFile ) ;
ProjectPakFiles . Add ( Path . GetFileName ( ProjectPakFile ) ) ;
}
2015-04-16 11:54:50 -04:00
// Generate DDC for the editor, and merge all the other PAK files in
2015-08-20 09:37:11 -04:00
CommandUtils . Log ( "Generating DDC data for engine content on {0}" , TargetPlatforms ) ;
2015-04-16 11:54:50 -04:00
CommandUtils . DDCCommandlet ( null , EditorExe , null , TargetPlatforms , "-fill -DDC=CreateInstalledEnginePak " + CommandUtils . MakePathSafeToUseWithCommandLine ( "-MergePaks=" + String . Join ( "+" , ProjectPakFiles ) ) ) ;
2015-04-20 11:08:45 -04:00
// Copy the DDP file to the output path
string SavedPakFile = CommandUtils . CombinePaths ( SavedDir , RelativePakPath ) ;
CommandUtils . CopyFile ( OutputPakFile , SavedPakFile ) ;
BuildProducts . Add ( SavedPakFile ) ;
// Add the pak file to the list of files to copy
ManifestFiles . Add ( RelativePakPath ) ;
2015-03-27 08:02:21 -04:00
}
2015-04-20 11:08:45 -04:00
CommandUtils . WriteAllLines ( SavedManifestPath , ManifestFiles . ToArray ( ) ) ;
BuildProducts . Add ( SavedManifestPath ) ;
2015-04-10 13:56:50 -04:00
SaveRecordOfSuccessAndAddToBuildProducts ( ) ;
2015-03-27 08:02:21 -04:00
}
public override float Priority ( )
{
return base . Priority ( ) + 55.0f ;
}
}
}