Skip to content

Commit

Permalink
support bBackupProjectConfig in ByRelease
Browse files Browse the repository at this point in the history
  • Loading branch information
hxhb committed Dec 27, 2021
1 parent bea07e4 commit 7c64c4c
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ namespace ReleaseWorker
bool SaveReleaseAssetDependencyWorker(FHotPatcherReleaseContext& Context);
// backup Metadata
bool BakcupMetadataWorker(FHotPatcherReleaseContext& Context);
// backup config
bool BakcupProjectConfigWorker(FHotPatcherReleaseContext& Context);
// display release summary
bool ReleaseSummaryWorker(FHotPatcherReleaseContext& Context);

Expand All @@ -49,6 +51,7 @@ bool UReleaseProxy::DoExport()
ReleaseWorker.Emplace(&::ReleaseWorker::SaveReleaseConfigWorker);
ReleaseWorker.Emplace(&::ReleaseWorker::SaveReleaseAssetDependencyWorker);
ReleaseWorker.Emplace(&::ReleaseWorker::BakcupMetadataWorker);
ReleaseWorker.Emplace(&::ReleaseWorker::BakcupProjectConfigWorker);
ReleaseWorker.Emplace(&::ReleaseWorker::ReleaseSummaryWorker);
ReleaseContext.UnrealPakSlowTask->init((float)ReleaseWorker.Num());

Expand Down Expand Up @@ -228,6 +231,22 @@ namespace ReleaseWorker
}
return true;
}
// backup project config
bool BakcupProjectConfigWorker(FHotPatcherReleaseContext& Context)
{
TimeRecorder TR(TEXT("Backup Config"));
FText DiaLogMsg = FText::Format(NSLOCTEXT("BackupProjectConfig", "BackupProjectConfig", "Backup Release {0} Configs."), FText::FromString(Context.GetSettingObject()->GetVersionId()));
Context.UnrealPakSlowTask->EnterProgressFrame(1.0, DiaLogMsg);
if(Context.GetSettingObject()->IsBackupProjectConfig())
{
UFlibHotPatcherEditorHelper::BackupProjectConfigDir(
FPaths::ProjectDir(),
FPaths::Combine(Context.GetSettingObject()->GetSaveAbsPath(),Context.GetSettingObject()->GetVersionId())
);
}
return true;
}

bool ReleaseSummaryWorker(FHotPatcherReleaseContext& Context)
{
FText DiaLogMsg = NSLOCTEXT("ReleaseSummaryWorker", "ReleaseSummaryWorker", "Release Summary.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ FString UFlibHotPatcherEditorHelper::GetCookAssetsSaveDir(const FString& BaseDir
FString StandardFilename;
FName StandardFileFName = NAME_None;
// PRAGMA_DISABLE_DEPRECATION_WARNINGS
if (FPackageName::DoesPackageExist(PacakgeName, &Filename, false))
if (FPackageName::DoesPackageExist(PacakgeName,NULL, &Filename, false))
{
StandardFilename = PackageFilename = FPaths::ConvertRelativePathToFull(Filename);

Expand Down Expand Up @@ -774,6 +774,18 @@ void UFlibHotPatcherEditorHelper::BackupMetadataDir(const FString& ProjectDir, c
}
}

void UFlibHotPatcherEditorHelper::BackupProjectConfigDir(const FString& ProjectDir,const FString& OutDir)
{
IPlatformFile& PlatformFile = FPlatformFileManager::Get().GetPlatformFile();
FString ConfigDir = FPaths::ConvertRelativePathToFull(FPaths::ProjectConfigDir());
FString OutConfigdir = FPaths::Combine(OutDir,TEXT("Config"));
if(FPaths::DirectoryExists(ConfigDir))
{
PlatformFile.CreateDirectoryTree(*OutConfigdir);
PlatformFile.CopyDirectoryTree(*OutConfigdir,*ConfigDir,true);
}
}

FString UFlibHotPatcherEditorHelper::ReleaseSummary(const FHotPatcherVersion& NewVersion)
{
FString result = TEXT("\n---------------------HotPatcher Release Summary---------------------\n");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ class HOTPATCHEREDITOR_API UFlibHotPatcherEditorHelper : public UBlueprintFuncti
static FString GetMetadataDir(const FString& ProjectDir,const FString& ProjectName,ETargetPlatform Platform);

static void BackupMetadataDir(const FString& ProjectDir,const FString& ProjectName,const TArray<ETargetPlatform>& Platforms,const FString& OutDir);
static void BackupProjectConfigDir(const FString& ProjectDir,const FString& OutDir);

static FString ReleaseSummary(const FHotPatcherVersion& NewVersion);
static FString PatchSummary(const FPatchVersionDiff& DiffInfo);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ struct HOTPATCHERRUNTIME_API FExportReleaseSettings:public FHotPatcherSettingBas
FORCEINLINE bool IsIncludeHasRefAssetsOnly()const { return bIncludeHasRefAssetsOnly; }
FORCEINLINE bool IsAnalysisFilterDependencies()const { return bAnalysisFilterDependencies; }
FORCEINLINE bool IsBackupMetadata()const {return bBackupMetadata;}
FORCEINLINE bool IsBackupProjectConfig()const {return bBackupProjectConfig;}
FORCEINLINE TArray<EAssetRegistryDependencyTypeEx> GetAssetRegistryDependencyTypes()const { return AssetRegistryDependencyTypes; }
FORCEINLINE TArray<FPatcherSpecifyAsset> GetSpecifyAssets()const { return IncludeSpecifyAssets; }
FORCEINLINE bool AddSpecifyAsset(FPatcherSpecifyAsset const& InAsset){ return IncludeSpecifyAssets.AddUnique(InAsset) != INDEX_NONE; }
Expand Down Expand Up @@ -130,6 +131,8 @@ struct HOTPATCHERRUNTIME_API FExportReleaseSettings:public FHotPatcherSettingBas
bool bStorageAssetDependencies = false;
UPROPERTY(EditAnywhere,BlueprintReadWrite, Category = "SaveTo")
bool bBackupMetadata = false;
UPROPERTY(EditAnywhere,BlueprintReadWrite, Category = "SaveTo")
bool bBackupProjectConfig = false;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "SaveTo",meta=(EditCondition="bBackupMetadata"))
TArray<ETargetPlatform> BackupMetadataPlatforms;
UPROPERTY(EditAnywhere,BlueprintReadWrite,Category="Advanced")
Expand Down

0 comments on commit 7c64c4c

Please sign in to comment.