// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved. #include "CustomBuildSteps.h" #include "Dom/JsonObject.h" #define LOCTEXT_NAMESPACE "ModuleDescriptor" bool FCustomBuildSteps::IsEmpty() const { return HostPlatformToCommands.Num() == 0; } void FCustomBuildSteps::Read(const FJsonObject& Object, const FString& FieldName) { TSharedPtr StepsValue = Object.TryGetField(FieldName); if(StepsValue.IsValid() && StepsValue->Type == EJson::Object) { const TSharedPtr& StepsObject = StepsValue->AsObject(); for(const TPair>& HostPlatformAndSteps : StepsObject->Values) { TArray& Commands = HostPlatformToCommands.FindOrAdd(HostPlatformAndSteps.Key); if(HostPlatformAndSteps.Value.IsValid() && HostPlatformAndSteps.Value->Type == EJson::Array) { const TArray>& CommandsArray = HostPlatformAndSteps.Value->AsArray(); for(const TSharedPtr& CommandValue: CommandsArray) { if(CommandValue->Type == EJson::String) { Commands.Add(CommandValue->AsString()); } } } } } } void FCustomBuildSteps::Write(TJsonWriter<>& Writer, const FString& FieldName) const { Writer.WriteObjectStart(FieldName); for(const TPair>& HostPlatformAndCommands: HostPlatformToCommands) { Writer.WriteArrayStart(HostPlatformAndCommands.Key); for(const FString& Command : HostPlatformAndCommands.Value) { Writer.WriteValue(*Command); } Writer.WriteArrayEnd(); } Writer.WriteObjectEnd(); } #undef LOCTEXT_NAMESPACE