Skip to content

Commit

Permalink
1. Cmdlet中添加完整SingleCookerCmdlet的性能分析,可以追踪完整耗时
Browse files Browse the repository at this point in the history
2. 添加GetCookedPathByLongPackageName函数
3. 资源依赖分析,从TArray改为TSet
4. 为PatchSetting添加bAccompanyCookForShader选项
5. 多线程收集COOKED的资源路径
6. 搜索COOKED文件时,为目录添加缓存,并且多线程执行,加锁控制。
7. 允许往SingleCooker的Cmdlet里添加Pre与Post任务
8. SingleCookerProxy中添加对Accompany的支持
  • Loading branch information
hxhb committed Mar 18, 2024
1 parent aa857ea commit 8f13fd4
Show file tree
Hide file tree
Showing 15 changed files with 539 additions and 242 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,46 +31,58 @@ int32 UHotSingleCookerCommandlet::Main(const FString& Params)
{
THotPatcherTemplateHelper::TDeserializeJsonStringAsStruct(JsonContent,*ExportSingleCookerSetting);
}

TMap<FString, FString> KeyValues = THotPatcherTemplateHelper::GetCommandLineParamsMap(Params);
THotPatcherTemplateHelper::ReplaceProperty(*ExportSingleCookerSetting, KeyValues);

CommandletHelper::ModifyTargetPlatforms(Params,TARGET_PLATFORMS_OVERRIDE,ExportSingleCookerSetting->CookTargetPlatforms,true);
if(ExportSingleCookerSetting->bDisplayConfig)
bool bExportStatus = false;
{
FString FinalConfig;
THotPatcherTemplateHelper::TSerializeStructAsJsonString(*ExportSingleCookerSetting,FinalConfig);
}

// if(IsRunningCommandlet() && ExportSingleCookerSetting->bPackageTracker && ExportSingleCookerSetting->bCookPackageTrackerAssets)
// {
// SCOPED_NAMED_EVENT_TEXT("SearchAllAssets",FColor::Red);
// // load asset registry
// FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked<FAssetRegistryModule>(TEXT("AssetRegistry"));
// AssetRegistryModule.Get().SearchAllAssets(true);
// }

UE_LOG(LogHotSingleCookerCommandlet, Display, TEXT("Cooker %s Id %d,Assets Num %d"), *ExportSingleCookerSetting->MissionName,ExportSingleCookerSetting->MissionID,ExportSingleCookerSetting->CookAssets.Num());
FScopedNamedEventStatic ScopedNamedEvent_ForCooker(FColor::Blue,*ExportSingleCookerSetting->MissionName);
TMap<FString, FString> KeyValues = THotPatcherTemplateHelper::GetCommandLineParamsMap(Params);
THotPatcherTemplateHelper::ReplaceProperty(*ExportSingleCookerSetting, KeyValues);

CommandletHelper::ModifyTargetPlatforms(Params,TARGET_PLATFORMS_OVERRIDE,ExportSingleCookerSetting->CookTargetPlatforms,true);
if(ExportSingleCookerSetting->bDisplayConfig)
{
FString FinalConfig;
THotPatcherTemplateHelper::TSerializeStructAsJsonString(*ExportSingleCookerSetting,FinalConfig);
}

// if(IsRunningCommandlet() && ExportSingleCookerSetting->bPackageTracker && ExportSingleCookerSetting->bCookPackageTrackerAssets)
// {
// SCOPED_NAMED_EVENT_TEXT("SearchAllAssets",FColor::Red);
// // load asset registry
// FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked<FAssetRegistryModule>(TEXT("AssetRegistry"));
// AssetRegistryModule.Get().SearchAllAssets(true);
// }

UE_LOG(LogHotSingleCookerCommandlet, Display, TEXT("Cooker %s Id %d,Assets Num %d"), *ExportSingleCookerSetting->MissionName,ExportSingleCookerSetting->MissionID,ExportSingleCookerSetting->CookAssets.Num());
// for pre additional worker
if(ExportSingleCookerSetting->bAllowRegisteAdditionalWorker)
{
FHotPatcherCoreModule::Get().GetSingleCookerAdditionalPreWorkerRegister().Broadcast(ExportSingleCookerSetting);
GEngine->ForceGarbageCollection(false);
CollectGarbage(RF_NoFlags, false);
}
GAlwaysReportCrash = false;
USingleCookerProxy* SingleCookerProxy = NewObject<USingleCookerProxy>();
SingleCookerProxy->AddToRoot();
SingleCookerProxy->Init(ExportSingleCookerSetting.Get());
bExportStatus = SingleCookerProxy->DoExport();

CommandletHelper::MainTick([SingleCookerProxy]()->bool
{
return SingleCookerProxy->IsFinsihed();
});

SingleCookerProxy->Shutdown();
UE_LOG(LogHotSingleCookerCommandlet,Display,TEXT("Single Cook Mission %s %d is %s!"),*ExportSingleCookerSetting->MissionName,ExportSingleCookerSetting->MissionID,bExportStatus?TEXT("Successed"):TEXT("Failure"));

if(ExportSingleCookerSetting->bAllowRegisteAdditionalWorker)
{
FHotPatcherCoreModule::Get().GetSingleCookerAdditionalWorkerRegister().Broadcast(ExportSingleCookerSetting);
GEngine->ForceGarbageCollection(false);
CollectGarbage(RF_NoFlags, false);
// for post additional worker
if(ExportSingleCookerSetting->bAllowRegisteAdditionalWorker)
{
FHotPatcherCoreModule::Get().GetSingleCookerAdditionalPostWorkerRegister().Broadcast(ExportSingleCookerSetting);
GEngine->ForceGarbageCollection(false);
CollectGarbage(RF_NoFlags, false);
}
}
GAlwaysReportCrash = false;
USingleCookerProxy* SingleCookerProxy = NewObject<USingleCookerProxy>();
SingleCookerProxy->AddToRoot();
SingleCookerProxy->Init(ExportSingleCookerSetting.Get());
bool bExportStatus = SingleCookerProxy->DoExport();

CommandletHelper::MainTick([SingleCookerProxy]()->bool
{
return SingleCookerProxy->IsFinsihed();
});

SingleCookerProxy->Shutdown();
UE_LOG(LogHotSingleCookerCommandlet,Display,TEXT("Single Cook Mission %s %d is %s!"),*ExportSingleCookerSetting->MissionName,ExportSingleCookerSetting->MissionID,bExportStatus?TEXT("Successed"):TEXT("Failure"));

if(FParse::Param(FCommandLine::Get(), TEXT("wait")))
{
Expand Down
Loading

0 comments on commit 8f13fd4

Please sign in to comment.