虚幻4 使用脚本编译自己的工程

工程文件

\Engine\Source\Programs\AutomationTool\AutomationTool_Mono.sln

    public static void Build(BuildCommand Command, ProjectParams Params, int WorkingCL = -1, ProjectBuildTargets TargetMask = ProjectBuildTargets.All)
	{
		Params.ValidateAndLog();

		if (!Params.Build)
		{
			return;
		}

		Log("********** BUILD COMMAND STARTED **********");

		var UE4Build = new UE4Build(Command);
		var Agenda = new UE4Build.BuildAgenda();
		var CrashReportPlatforms = new HashSet();

		// Setup editor targets
		if (Params.HasEditorTargets && !Params.Rocket && (TargetMask & ProjectBuildTargets.Editor) == ProjectBuildTargets.Editor)
		{

编译工程运行的是这个脚本,看到了开始时候的那个BUILD COMMAND STARTED。

编译时候可以打开那个工程文件,附加到进程,就可以断点看传入的参数了。


CMD 到

UnrealEngine\Engine\Binaries\DotNET>

目录下,运行

AutomationTool.exe -help

linux mac应该是运行 mono AutomationTools.exe -help

会看到帮助信息,

AutomationTool.exe -list

可以列出所有可以用的功能。

  AnalyzeThirdPartyLibs
  BlameKeyword
  BuildCommonTools
  ZipProjectUp
  BuildCookRun
  BuildPlugin
  BuildThirdPartyLibs
  CodeSurgery
  UpdateCopyright
  FixupRedirects
  GenerateDSYM
  RebuildLightMaps
  IPhonePackager
  LauncherLocalization
  ListMobileDevices
  Localise
  MegaXGE
  TestP4_Info
  GitPullRequest
  TestFail
  TestSuccess
  TestMessage
  TestRecursion
  TestRecursionAuto
  TestMacZip
  TestP4_CreateChangelist
  TestP4_StrandCheckout
  TestP4_LabelDescription
  TestP4_ClientOps
  CleanDDC
  TestTestFarm
  TestArguments
  TestCombinePaths
  TestFileUtility
  TestLog
  TestChangeFileType
  TestGamePerf
  TestUATBuildProducts
  TestWatchdogTimer
  TestOSSCommands
  UBT
  ZeroEngineVersions
  SyncSource
  GenerateAutomationProject
  DumpBranch
  DebugSleep
  TestMcpConfigs
  TestBlame
  TestChanges
  TestKillAll
  TestCleanFormalBuilds
  TestStopProcess
  LookForOverlappingBuildProducts
  TestThreadedCopyFiles
  UE4BuildUtilDummyBuildCommand
  UnrealSyncList
  UnrealSync
  UpdateLocalVersion
  TestECJobErrorParse
  GUBP
  TestTempStorage

运行

AutomationTool.exe -help BuildCookRun

可以看到特定命令的帮助信息。可以自己写脚本去buid 或者cook,不用开编辑器了。



文件位置:
\Engine\Source\Editor\MainFrame\Private\Frame\MainFrameActions.cpp

void FMainFrameActionCallbacks::CreateUatTask( const FString& CommandLine, const FText& PlatformDisplayName, const FText& TaskName, const FText &TaskShortName, const FSlateBrush* TaskIcon )
{
	// make sure that the UAT batch file is in place
#if PLATFORM_WINDOWS
	FString RunUATScriptName = TEXT("RunUAT.bat");
	FString CmdExe = TEXT("cmd.exe");
#elif PLATFORM_LINUX
	FString RunUATScriptName = TEXT("RunUAT.sh");
	FString CmdExe = TEXT("/bin/bash");
#else
	FString RunUATScriptName = TEXT("RunUAT.command");
	FString CmdExe = TEXT("/bin/sh");
#endif

	FString UatPath = FPaths::ConvertRelativePathToFull(FPaths::EngineDir() / TEXT("Build/BatchFiles") / RunUATScriptName);
	FGameProjectGenerationModule& GameProjectModule = FModuleManager::LoadModuleChecked(TEXT("GameProjectGeneration"));

这个代码就是调用runuat的脚本,然后那个脚本再调用automationtool执行编译操作,可以在这里打断点看看到底打包特定平台时候调用了什么。













你可能感兴趣的:(虚幻4)