2020-06-23 18:40:00 -04:00
// Copyright 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 ;
2020-12-21 23:07:37 -04:00
using EpicGames.Core ;
2014-10-28 14:53:23 -04:00
[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 ( )
{
2018-08-14 18:32:34 -04:00
LogInformation ( "************************* BuildCommonTools" ) ;
2014-10-28 14:53:23 -04:00
2019-05-03 08:03:23 -04:00
List < UnrealTargetPlatform > Platforms = new List < UnrealTargetPlatform > ( ) ;
2014-10-28 14:53:23 -04:00
2014-12-19 16:11:13 -05:00
// Add all the platforms if specified
2019-05-03 08:03:23 -04:00
if ( ParseParam ( "allplatforms" ) )
2014-12-19 16:11:13 -05:00
{
2019-05-03 08:03:23 -04:00
Platforms = UnrealTargetPlatform . GetValidPlatforms ( ) . ToList ( ) ;
}
else
{
// Get the list of platform names
string [ ] PlatformNames = ParseParamValue ( "platforms" , BuildHostPlatform . Current . Platform . ToString ( ) ) . Split ( '+' ) ;
// Parse the platforms
foreach ( string PlatformName in PlatformNames )
2014-12-19 16:11:13 -05:00
{
2019-05-03 08:03:23 -04:00
UnrealBuildTool . UnrealTargetPlatform Platform ;
if ( ! UnrealTargetPlatform . TryParse ( PlatformName , out Platform ) )
2014-12-19 16:11:13 -05:00
{
2019-05-03 08:03:23 -04:00
throw new AutomationException ( "Unknown platform specified on command line - '{0}' - valid platforms are {1}" , PlatformName , String . Join ( "/" , UnrealTargetPlatform . GetValidPlatformNames ( ) ) ) ;
2014-12-19 16:11:13 -05:00
}
2019-05-03 08:03:23 -04:00
Platforms . Add ( Platform ) ;
2014-12-19 16:11:13 -05:00
}
}
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 ) ;
2016-04-28 14:13:21 -04:00
Builder . Build ( Agenda , InUpdateVersionFiles : false ) ;
2014-10-28 14:53:23 -04:00
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 ( ) ;
2017-08-21 15:05:19 -04:00
2014-10-28 14:53:23 -04:00
// C# binaries
2018-08-22 11:12:02 -04:00
Agenda . SwarmAgentProject = @"Engine\Source\Programs\UnrealSwarm\SwarmAgent.sln" ;
Agenda . SwarmCoordinatorProject = @"Engine\Source\Programs\UnrealSwarm\SwarmCoordinator.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" ) ;
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 ) ;
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 ) ;
2021-03-09 01:37:10 -04:00
Agenda . AddTarget ( "EpicWebHelper" , UnrealBuildTool . UnrealTargetPlatform . Win64 , 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" ) ;
2021-01-06 18:21:17 -04:00
Agenda . AddTarget ( "UnrealEditorServices" , UnrealBuildTool . UnrealTargetPlatform . Mac , UnrealBuildTool . UnrealTargetConfiguration . Development , InAddArgs : "-CopyAppBundleBackToDevice" ) ;
2021-03-09 01:37:10 -04:00
Agenda . AddTarget ( "EpicWebHelper" , UnrealBuildTool . UnrealTargetPlatform . Mac , UnrealBuildTool . UnrealTargetConfiguration . Development , InAddArgs : "-CopyAppBundleBackToDevice" ) ;
2014-10-28 14:53:23 -04:00
}
2014-11-25 17:54:24 -05:00
2015-10-28 08:58:16 -04:00
// Linux binaries
if ( Platforms . Contains ( UnrealBuildTool . UnrealTargetPlatform . Linux ) )
{
Agenda . AddTarget ( "CrashReportClient" , UnrealBuildTool . UnrealTargetPlatform . Linux , UnrealBuildTool . UnrealTargetConfiguration . Development ) ;
2021-03-09 01:37:10 -04:00
Agenda . AddTarget ( "EpicWebHelper" , UnrealBuildTool . UnrealTargetPlatform . Linux , UnrealBuildTool . UnrealTargetConfiguration . Development ) ;
2015-10-28 08:58:16 -04: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/MobileDeviceInterface/MobileDeviceInterface.csproj" ) ;
ExtraBuildProducts . Add ( CommandUtils . CombinePaths ( CommandUtils . CmdEnv . LocalRoot , @"Engine/Binaries/DotNET/iOS/MobileDeviceInterface.dll" ) ) ;
}
2020-02-12 13:27:19 -05:00
// Platform extensions
foreach ( UnrealBuildTool . UnrealTargetPlatform UBTPlatform in Platforms )
{
AutomationTool . Platform AutomationPlatform = Platform . GetPlatform ( UBTPlatform ) ;
AutomationPlatform . MakeAgenda ( Agenda , ExtraBuildProducts ) ;
}
2014-10-28 14:53:23 -04:00
return Agenda ;
}
}
2015-07-02 17:08:22 -04:00
public class ZipProjectUp : BuildCommand
{
2017-08-21 15:05:19 -04:00
public override void ExecuteBuild ( )
{
// Get Directories
string ProjectDirectory = ParseParamValue ( "project" , "" ) ;
string InstallDirectory = ParseParamValue ( "install" , "" ) ;
ProjectDirectory = Path . GetDirectoryName ( ProjectDirectory ) ;
2015-07-22 17:27:55 -04:00
2018-08-14 18:32:34 -04:00
LogInformation ( "Started zipping project up" ) ;
LogInformation ( "Project directory: {0}" , ProjectDirectory ) ;
LogInformation ( "Install directory: {0}" , InstallDirectory ) ;
LogInformation ( "Packaging up the project..." ) ;
2015-07-02 17:08:22 -04:00
2017-08-21 15:05:19 -04:00
// Setup filters
FileFilter Filter = new FileFilter ( ) ;
Filter . Include ( "/Config/..." ) ;
Filter . Include ( "/Content/..." ) ;
2019-10-04 13:11:45 -04:00
Filter . Include ( "/Plugins/..." ) ;
Filter . Exclude ( "/Plugins/.../Intermediate/..." ) ;
Filter . Exclude ( "/Plugins/.../Binaries/..." ) ;
2017-08-21 15:05:19 -04:00
Filter . Include ( "/Source/..." ) ;
Filter . Include ( "*.uproject" ) ;
2015-07-02 17:08:22 -04:00
2017-08-21 15:05:19 -04:00
ZipFiles ( new FileReference ( InstallDirectory ) , new DirectoryReference ( ProjectDirectory ) , Filter ) ;
2015-07-02 17:08:22 -04:00
2018-08-14 18:32:34 -04:00
LogInformation ( "Completed zipping project up" ) ;
2017-08-21 15:05:19 -04:00
}
}