You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
o3de/Gems/LmbrCentral/Code/Source/Builders/DependencyBuilder/DependencyBuilderWorker.cpp

67 lines
2.3 KiB
C++

/*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include "DependencyBuilderWorker.h"
#include <AzFramework/StringFunc/StringFunc.h>
namespace DependencyBuilder
{
DependencyBuilderWorker::DependencyBuilderWorker(AZStd::string jobKey, [[maybe_unused]] bool critical)
: m_jobKey(jobKey)
{
}
void DependencyBuilderWorker::ShutDown()
{
m_isShuttingDown = true;
}
void DependencyBuilderWorker::CreateJobs(const AssetBuilderSDK::CreateJobsRequest& request, AssetBuilderSDK::CreateJobsResponse& response)
{
if (m_isShuttingDown)
{
response.m_result = AssetBuilderSDK::CreateJobsResultCode::ShuttingDown;
return;
}
// Add source dependencies to CreateJobsResponse
auto sourceDependencesResult = GetSourceDependencies(request);
if (!sourceDependencesResult.IsSuccess())
{
AZ_Error(AssetBuilderSDK::ErrorWindow, false, sourceDependencesResult.TakeError().c_str());
response.m_result = AssetBuilderSDK::CreateJobsResultCode::Failed;
return;
}
response.m_sourceFileDependencyList = sourceDependencesResult.TakeValue();
response.m_result = AssetBuilderSDK::CreateJobsResultCode::Success;
}
AZ::Outcome<AZStd::vector<AssetBuilderSDK::SourceFileDependency>, AZStd::string> DependencyBuilderWorker::GetSourceDependencies(
const AssetBuilderSDK::CreateJobsRequest& /*request*/) const
{
return AZ::Success(AZStd::vector<AssetBuilderSDK::SourceFileDependency>{});
}
void DependencyBuilderWorker::ProcessJob([[maybe_unused]] const AssetBuilderSDK::ProcessJobRequest& request, AssetBuilderSDK::ProcessJobResponse& response)
{
AZ_TracePrintf(AssetBuilderSDK::InfoWindow, "DependencyBuilderWorker Starting Job.\n");
if (m_isShuttingDown)
{
AZ_TracePrintf(AssetBuilderSDK::WarningWindow, "Cancelled job %s because shutdown was requested.\n", request.m_fullPath.c_str());
response.m_resultCode = AssetBuilderSDK::ProcessJobResult_Cancelled;
return;
}
response.m_resultCode = AssetBuilderSDK::ProcessJobResult_Success;
}
}