2014-12-07 19:09:38 -05:00
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
2014-12-06 19:14:20 -05:00
using System ;
2015-01-16 08:17:31 -05:00
using System.IO ;
2014-10-28 14:53:23 -04:00
using System.Collections.Generic ;
using System.Linq ;
using System.Text ;
using AutomationTool ;
using UnrealBuildTool ;
[Help("Builds common tools used by the engine which are not part of typical editor or game builds. Useful when syncing source-only on GitHub.")]
[Help("platforms=<X>+<Y>+...", "Specifies on or more platforms to build for (defaults to the current host platform)")]
[Help("manifest=<Path>", "Writes a manifest of all the build products to the given path")]
public class BuildCommonTools : BuildCommand
{
public override void ExecuteBuild ( )
{
Log ( "************************* BuildCommonTools" ) ;
// Get the list of platform names
2014-11-03 07:43:43 -05:00
string [ ] PlatformNames = ParseParamValue ( "platforms" , BuildHostPlatform . Current . Platform . ToString ( ) ) . Split ( '+' ) ;
2014-10-28 14:53:23 -04:00
// Parse the platforms
List < UnrealBuildTool . UnrealTargetPlatform > Platforms = new List < UnrealTargetPlatform > ( ) ;
foreach ( string PlatformName in PlatformNames )
{
UnrealBuildTool . UnrealTargetPlatform Platform ;
2015-03-27 08:45:02 -04:00
if ( ! UnrealBuildTool . UnrealTargetPlatform . TryParse ( PlatformName , true , out Platform ) )
2014-10-28 14:53:23 -04:00
{
throw new AutomationException ( "Unknown platform specified on command line - '{0}' - valid platforms are {1}" , PlatformName , String . Join ( "/" , Enum . GetNames ( typeof ( UnrealBuildTool . UnrealTargetPlatform ) ) ) ) ;
}
Platforms . Add ( Platform ) ;
}
2014-12-19 16:11:13 -05:00
// Add all the platforms if specified
if ( ParseParam ( "allplatforms" ) )
{
foreach ( UnrealTargetPlatform Platform in Enum . GetValues ( typeof ( UnrealTargetPlatform ) ) )
{
if ( ! Platforms . Contains ( Platform ) )
{
Platforms . Add ( Platform ) ;
}
}
}
2014-10-28 14:53:23 -04:00
// Get the agenda
2014-12-19 16:11:13 -05:00
List < string > ExtraBuildProducts = new List < string > ( ) ;
UE4Build . BuildAgenda Agenda = MakeAgenda ( Platforms . ToArray ( ) , ExtraBuildProducts ) ;
2014-10-28 14:53:23 -04:00
// Build everything. We don't want to touch version files for GitHub builds -- these are "programmer builds" and won't have a canonical build version
UE4Build Builder = new UE4Build ( this ) ;
Builder . Build ( Agenda , InDeleteBuildProducts : true , InUpdateVersionFiles : false ) ;
2014-11-10 15:13:54 -05:00
// Add UAT and UBT to the build products
Builder . AddUATFilesToBuildProducts ( ) ;
Builder . AddUBTFilesToBuildProducts ( ) ;
2014-12-19 16:11:13 -05:00
// Add all the extra build products
foreach ( string ExtraBuildProduct in ExtraBuildProducts )
{
Builder . AddBuildProduct ( ExtraBuildProduct ) ;
}
2014-10-28 14:53:23 -04:00
// Make sure all the build products exist
UE4Build . CheckBuildProducts ( Builder . BuildProductFiles ) ;
// Write the manifest if needed
string ManifestPath = ParseParamValue ( "manifest" ) ;
if ( ManifestPath ! = null )
{
2015-01-16 08:17:31 -05:00
SortedSet < string > Files = new SortedSet < string > ( ) ;
2014-10-28 14:53:23 -04:00
foreach ( string BuildProductFile in Builder . BuildProductFiles )
{
2015-01-16 08:17:31 -05:00
Files . Add ( BuildProductFile ) ;
2014-10-28 14:53:23 -04:00
}
2015-01-16 08:17:31 -05:00
File . WriteAllLines ( ManifestPath , Files . ToArray ( ) ) ;
2014-10-28 14:53:23 -04:00
}
}
2014-12-19 16:11:13 -05:00
public static UE4Build . BuildAgenda MakeAgenda ( UnrealBuildTool . UnrealTargetPlatform [ ] Platforms , List < string > ExtraBuildProducts )
2014-10-28 14:53:23 -04:00
{
// Create the build agenda
UE4Build . BuildAgenda Agenda = new UE4Build . BuildAgenda ( ) ;
2014-11-10 15:13:54 -05:00
2014-10-28 14:53:23 -04:00
// C# binaries
Agenda . SwarmProject = @"Engine\Source\Programs\UnrealSwarm\UnrealSwarm.sln" ;
2014-11-17 09:31:36 -05:00
Agenda . DotNetProjects . Add ( @"Engine/Source/Editor/SwarmInterface/DotNET/SwarmInterface.csproj" ) ;
2014-10-28 14:53:23 -04:00
Agenda . DotNetProjects . Add ( @"Engine/Source/Programs/DotNETCommon/DotNETUtilities/DotNETUtilities.csproj" ) ;
2014-11-03 07:43:43 -05:00
Agenda . DotNetProjects . Add ( @"Engine/Source/Programs/RPCUtility/RPCUtility.csproj" ) ;
2014-10-28 14:53:23 -04:00
Agenda . DotNetProjects . Add ( @"Engine/Source/Programs/UnrealControls/UnrealControls.csproj" ) ;
// Windows binaries
if ( Platforms . Contains ( UnrealBuildTool . UnrealTargetPlatform . Win64 ) )
{
2014-11-11 17:18:45 -05:00
Agenda . AddTarget ( "CrashReportClient" , UnrealBuildTool . UnrealTargetPlatform . Win64 , UnrealBuildTool . UnrealTargetConfiguration . Development ) ;
Agenda . AddTarget ( "CrashReportClient" , UnrealBuildTool . UnrealTargetPlatform . Win32 , UnrealBuildTool . UnrealTargetConfiguration . Development ) ;
2014-10-28 14:53:23 -04:00
Agenda . AddTarget ( "UnrealHeaderTool" , UnrealBuildTool . UnrealTargetPlatform . Win64 , UnrealBuildTool . UnrealTargetConfiguration . Development ) ;
Agenda . AddTarget ( "UnrealPak" , UnrealBuildTool . UnrealTargetPlatform . Win64 , UnrealBuildTool . UnrealTargetConfiguration . Development ) ;
Agenda . AddTarget ( "UnrealLightmass" , UnrealBuildTool . UnrealTargetPlatform . Win64 , UnrealBuildTool . UnrealTargetConfiguration . Development ) ;
Agenda . AddTarget ( "ShaderCompileWorker" , UnrealBuildTool . UnrealTargetPlatform . Win64 , UnrealBuildTool . UnrealTargetConfiguration . Development ) ;
Agenda . AddTarget ( "UnrealVersionSelector" , UnrealBuildTool . UnrealTargetPlatform . Win64 , UnrealBuildTool . UnrealTargetConfiguration . Shipping ) ;
Agenda . AddTarget ( "BootstrapPackagedGame" , UnrealBuildTool . UnrealTargetPlatform . Win64 , UnrealBuildTool . UnrealTargetConfiguration . Shipping ) ;
Agenda . AddTarget ( "BootstrapPackagedGame" , UnrealBuildTool . UnrealTargetPlatform . Win32 , UnrealBuildTool . UnrealTargetConfiguration . Shipping ) ;
2015-01-14 12:20:30 -05:00
Agenda . AddTarget ( "UnrealCEFSubProcess" , UnrealBuildTool . UnrealTargetPlatform . Win64 , UnrealBuildTool . UnrealTargetConfiguration . Development ) ;
2015-01-16 06:24:57 -05:00
Agenda . AddTarget ( "UnrealCEFSubProcess" , UnrealBuildTool . UnrealTargetPlatform . Win32 , UnrealBuildTool . UnrealTargetConfiguration . Development ) ;
2014-10-28 14:53:23 -04:00
}
// Mac binaries
if ( Platforms . Contains ( UnrealBuildTool . UnrealTargetPlatform . Mac ) )
{
2014-11-11 17:18:45 -05:00
Agenda . AddTarget ( "CrashReportClient" , UnrealBuildTool . UnrealTargetPlatform . Mac , UnrealBuildTool . UnrealTargetConfiguration . Development , InAddArgs : "-CopyAppBundleBackToDevice" ) ;
2014-10-28 14:53:23 -04:00
Agenda . AddTarget ( "UnrealPak" , UnrealBuildTool . UnrealTargetPlatform . Mac , UnrealBuildTool . UnrealTargetConfiguration . Development , InAddArgs : "-CopyAppBundleBackToDevice" ) ;
Agenda . AddTarget ( "UnrealLightmass" , UnrealBuildTool . UnrealTargetPlatform . Mac , UnrealBuildTool . UnrealTargetConfiguration . Development , InAddArgs : "-CopyAppBundleBackToDevice" ) ;
Agenda . AddTarget ( "ShaderCompileWorker" , UnrealBuildTool . UnrealTargetPlatform . Mac , UnrealBuildTool . UnrealTargetConfiguration . Development , InAddArgs : "-CopyAppBundleBackToDevice" ) ;
Agenda . AddTarget ( "UE4EditorServices" , UnrealBuildTool . UnrealTargetPlatform . Mac , UnrealBuildTool . UnrealTargetConfiguration . Development , InAddArgs : "-CopyAppBundleBackToDevice" ) ;
2015-01-14 12:20:30 -05:00
Agenda . AddTarget ( "UnrealCEFSubProcess" , UnrealBuildTool . UnrealTargetPlatform . Mac , UnrealBuildTool . UnrealTargetConfiguration . Development , InAddArgs : "-CopyAppBundleBackToDevice" ) ;
2014-10-28 14:53:23 -04:00
}
2014-11-25 17:54:24 -05:00
2014-12-19 16:11:13 -05:00
// iOS binaries
if ( Platforms . Contains ( UnrealBuildTool . UnrealTargetPlatform . IOS ) )
{
Agenda . DotNetProjects . Add ( @"Engine/Source/Programs/iOS/iPhonePackager/iPhonePackager.csproj" ) ;
ExtraBuildProducts . Add ( CommandUtils . CombinePaths ( CommandUtils . CmdEnv . LocalRoot , @"Engine/Binaries/DotNET/iOS/iPhonePackager.exe" ) ) ;
Agenda . DotNetProjects . Add ( @"Engine/Source/Programs/iOS/DeploymentServer/DeploymentServer.csproj" ) ;
ExtraBuildProducts . Add ( CommandUtils . CombinePaths ( CommandUtils . CmdEnv . LocalRoot , @"Engine/Binaries/DotNET/iOS/DeploymentServer.exe" ) ) ;
Agenda . DotNetProjects . Add ( @"Engine/Source/Programs/iOS/DeploymentInterface/DeploymentInterface.csproj" ) ;
ExtraBuildProducts . Add ( CommandUtils . CombinePaths ( CommandUtils . CmdEnv . LocalRoot , @"Engine/Binaries/DotNET/iOS/DeploymentInterface.dll" ) ) ;
Agenda . DotNetProjects . Add ( @"Engine/Source/Programs/iOS/MobileDeviceInterface/MobileDeviceInterface.csproj" ) ;
ExtraBuildProducts . Add ( CommandUtils . CombinePaths ( CommandUtils . CmdEnv . LocalRoot , @"Engine/Binaries/DotNET/iOS/MobileDeviceInterface.dll" ) ) ;
}
2014-11-25 17:54:24 -05:00
// PS4 binaries
if ( Platforms . Contains ( UnrealBuildTool . UnrealTargetPlatform . PS4 ) )
{
Agenda . AddTarget ( "PS4MapFileUtil" , UnrealBuildTool . UnrealTargetPlatform . Win64 , UnrealBuildTool . UnrealTargetConfiguration . Development ) ;
2015-01-13 14:29:49 -05:00
Agenda . DotNetProjects . Add ( CommandUtils . CombinePaths ( CommandUtils . CmdEnv . LocalRoot , @"Engine/Source/Programs/PS4/PS4DevKitUtil/PS4DevKitUtil.csproj" ) ) ;
ExtraBuildProducts . Add ( CommandUtils . CombinePaths ( CommandUtils . CmdEnv . LocalRoot , @"Engine/Binaries/DotNET/PS4/PS4DevKitUtil.exe" ) ) ;
2014-11-25 17:54:24 -05:00
}
2014-11-10 15:13:54 -05:00
2014-12-11 13:09:41 -05:00
// Xbox One binaries
if ( Platforms . Contains ( UnrealBuildTool . UnrealTargetPlatform . XboxOne ) )
{
Agenda . AddTarget ( "XboxOnePDBFileUtil" , UnrealBuildTool . UnrealTargetPlatform . Win64 , UnrealBuildTool . UnrealTargetConfiguration . Development ) ;
}
2015-02-20 04:41:01 -05:00
// HTML5 binaries
if ( Platforms . Contains ( UnrealBuildTool . UnrealTargetPlatform . HTML5 ) )
{
2015-02-23 14:09:05 -05:00
Agenda . DotNetProjects . Add ( @"Engine/Source/Programs/HTML5/HTML5LaunchHelper/HTML5LaunchHelper.csproj" ) ;
2015-02-23 14:21:57 -05:00
ExtraBuildProducts . Add ( CommandUtils . CombinePaths ( CommandUtils . CmdEnv . LocalRoot , @"Engine/Binaries/DotNET/HTML5LaunchHelper.exe" ) ) ;
2015-02-20 04:41:01 -05:00
}
2014-12-11 13:09:41 -05:00
2014-10-28 14:53:23 -04:00
return Agenda ;
}
}