Files
UnrealEngineUWP/Engine/Source/Runtime/Projects/Private/CustomBuildSteps.cpp
ryan durand 0f0464a30e Updating copyright for Engine Runtime.
#rnx
#rb none


#ROBOMERGE-OWNER: ryan.durand
#ROBOMERGE-AUTHOR: ryan.durand
#ROBOMERGE-SOURCE: CL 10869210 via CL 10869511 via CL 10869900
#ROBOMERGE-BOT: (v613-10869866)

[CL 10870549 by ryan durand in Main branch]
2019-12-26 14:45:42 -05:00

54 lines
1.5 KiB
C++

// Copyright 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<FJsonValue> StepsValue = Object.TryGetField(FieldName);
if(StepsValue.IsValid() && StepsValue->Type == EJson::Object)
{
const TSharedPtr<FJsonObject>& StepsObject = StepsValue->AsObject();
for(const TPair<FString, TSharedPtr<FJsonValue>>& HostPlatformAndSteps : StepsObject->Values)
{
TArray<FString>& Commands = HostPlatformToCommands.FindOrAdd(HostPlatformAndSteps.Key);
if(HostPlatformAndSteps.Value.IsValid() && HostPlatformAndSteps.Value->Type == EJson::Array)
{
const TArray<TSharedPtr<FJsonValue>>& CommandsArray = HostPlatformAndSteps.Value->AsArray();
for(const TSharedPtr<FJsonValue>& 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<FString, TArray<FString>>& HostPlatformAndCommands: HostPlatformToCommands)
{
Writer.WriteArrayStart(HostPlatformAndCommands.Key);
for(const FString& Command : HostPlatformAndCommands.Value)
{
Writer.WriteValue(*Command);
}
Writer.WriteArrayEnd();
}
Writer.WriteObjectEnd();
}
#undef LOCTEXT_NAMESPACE