Asset Processor: Remove gem loading from AP (#6488)
* AssetBuilder sends builder registration network message to AP Signed-off-by: amzn-mike <80125227+amzn-mike@users.noreply.github.com> * Add AP activating status message Signed-off-by: amzn-mike <80125227+amzn-mike@users.noreply.github.com> * First builder handles registration. Fixed deadlock caused by AP and AssetBuilder waiting on each other when registering by moving AP builder start code to a thread Signed-off-by: amzn-mike <80125227+amzn-mike@users.noreply.github.com> * Clean up external builder registration Signed-off-by: amzn-mike <80125227+amzn-mike@users.noreply.github.com> * Add thread description for builder manager idle thread Signed-off-by: amzn-mike <80125227+amzn-mike@users.noreply.github.com> * Remove gem loading Signed-off-by: amzn-mike <80125227+amzn-mike@users.noreply.github.com> * Clean up builder registration and remove unused functions Signed-off-by: amzn-mike <80125227+amzn-mike@users.noreply.github.com> * Remove PostActivate call from batch application since it will be called after builders are registered Signed-off-by: amzn-mike <80125227+amzn-mike@users.noreply.github.com> * Removal external builder dependency scanning since we no longer support builder dlls Signed-off-by: amzn-mike <80125227+amzn-mike@users.noreply.github.com> * Fix missing bus disconnect Signed-off-by: amzn-mike <80125227+amzn-mike@users.noreply.github.com> * Remove unused variable Signed-off-by: amzn-mike <80125227+amzn-mike@users.noreply.github.com> * Moved AP-AssetBuilder specific types into AssetBuilder.Static library. Also removed some unused/old code Signed-off-by: amzn-mike <80125227+amzn-mike@users.noreply.github.com>
This commit is contained in:
@@ -37,6 +37,7 @@
|
||||
#include <AssetBuilderInfo.h>
|
||||
#include <AzCore/Interface/Interface.h>
|
||||
#include <Entity/EntityUtilityComponent.h>
|
||||
#include <AssetBuilderStatic.h>
|
||||
|
||||
namespace AssetBuilder
|
||||
{
|
||||
@@ -165,6 +166,7 @@ void AssetBuilderApplication::StartCommon(AZ::Entity* systemEntity)
|
||||
|
||||
AssetBuilderSDK::InitializeSerializationContext();
|
||||
AssetBuilderSDK::InitializeBehaviorContext();
|
||||
AssetBuilder::InitializeSerializationContext();
|
||||
// the asset builder app never writes source files, only assets, so there is no need to do any kind of asset upgrading
|
||||
AZ::Data::AssetManager::Instance().SetAssetInfoUpgradingEnabled(false);
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include <AzCore/Interface/Interface.h>
|
||||
#include <AzFramework/Asset/AssetSystemComponent.h>
|
||||
#include <ToolsComponents/ToolsAssetCatalogComponent.h>
|
||||
#include <AssetBuilderStatic.h>
|
||||
|
||||
// Command-line parameter options:
|
||||
static const char* const s_paramHelp = "help"; // Print help information.
|
||||
@@ -51,10 +52,10 @@ static const char* const s_paramDebugCreate = "debug_create"; // Debug mode for
|
||||
static const char* const s_paramDebugProcess = "debug_process"; // Debug mode for the process job of the specified file.
|
||||
static const char* const s_paramPlatformTags = "tags"; // Additional list of tags to add platform tag list.
|
||||
static const char* const s_paramPlatform = "platform"; // Platform to use
|
||||
static const char* const s_paramRegisterBuilders = "register"; // Indicates the AP is starting up and requesting a list of registered builders
|
||||
|
||||
// Task modes:
|
||||
static const char* const s_taskResident = "resident"; // stays up and running indefinitely, accepting jobs via network connection
|
||||
static const char* const s_taskRegisterBuilder = "register"; // outputs all the builder descriptors
|
||||
static const char* const s_taskCreateJob = "create"; // runs a builders createJobs function
|
||||
static const char* const s_taskProcessJob = "process"; // runs processJob function
|
||||
static const char* const s_taskDebug = "debug"; // runs a one shot job in a fake environment for a specified file.
|
||||
@@ -204,6 +205,40 @@ void AssetBuilderComponent::Reflect(AZ::ReflectContext* context)
|
||||
}
|
||||
}
|
||||
|
||||
bool AssetBuilderComponent::DoHelloPing()
|
||||
{
|
||||
using namespace AssetBuilder;
|
||||
|
||||
BuilderHelloRequest request;
|
||||
BuilderHelloResponse response;
|
||||
|
||||
AZStd::string id;
|
||||
|
||||
if (!GetParameter(s_paramId, id))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
request.m_uuid = AZ::Uuid::CreateString(id.c_str());
|
||||
|
||||
AZ_TracePrintf(
|
||||
"AssetBuilderComponent", "RunInResidentMode: Pinging asset processor with the builder UUID %s\n",
|
||||
request.m_uuid.ToString<AZStd::string>().c_str());
|
||||
|
||||
bool result = AzFramework::AssetSystem::SendRequest(request, response);
|
||||
|
||||
AZ_Error("AssetBuilder", result, "Failed to send hello request to Asset Processor");
|
||||
// This error is only shown if we successfully got a response AND the response explicitly indicates the AP rejected the builder
|
||||
AZ_Error("AssetBuilder", !result || response.m_accepted, "Asset Processor rejected connection request");
|
||||
|
||||
if (result)
|
||||
{
|
||||
AZ_TracePrintf("AssetBuilder", "Builder ID: %s\n", response.m_uuid.ToString<AZStd::string>().c_str());
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
bool AssetBuilderComponent::Run()
|
||||
{
|
||||
AZ_TracePrintf("AssetBuilderComponent", "Run: Parsing command line.\n");
|
||||
@@ -217,8 +252,8 @@ bool AssetBuilderComponent::Run()
|
||||
}
|
||||
|
||||
AZStd::string task;
|
||||
|
||||
AZStd::string debugFile;
|
||||
|
||||
if (GetParameter(s_paramDebug, debugFile, false))
|
||||
{
|
||||
task = s_taskDebug;
|
||||
@@ -256,11 +291,13 @@ bool AssetBuilderComponent::Run()
|
||||
AZ_TracePrintf("AssetBuilderComponent", "Run: Connecting back to Asset Processor...\n");
|
||||
bool connectedToAssetProcessor = ConnectToAssetProcessor();
|
||||
//AP connection is required to access the asset catalog
|
||||
AZ_Error("AssetBuilder", connectedToAssetProcessor, "Failed to establish a network connection to the AssetProcessor. Use -help for options.");;
|
||||
AZ_Error("AssetBuilder", connectedToAssetProcessor, "Failed to establish a network connection to the AssetProcessor. Use -help for options.");
|
||||
|
||||
bool registerBuilders = commandLine->GetNumSwitchValues(s_paramRegisterBuilders) > 0;
|
||||
|
||||
IBuilderApplication* builderApplication = AZ::Interface<IBuilderApplication>::Get();
|
||||
|
||||
if(!builderApplication)
|
||||
if (!builderApplication)
|
||||
{
|
||||
AZ_Error("AssetBuilder", false, "Failed to retreive IBuilderApplication interface");
|
||||
return false;
|
||||
@@ -274,7 +311,7 @@ bool AssetBuilderComponent::Run()
|
||||
{
|
||||
if (task == s_taskResident)
|
||||
{
|
||||
result = RunInResidentMode();
|
||||
result = RunInResidentMode(registerBuilders);
|
||||
}
|
||||
else if (task == s_taskDebug)
|
||||
{
|
||||
@@ -370,43 +407,46 @@ bool AssetBuilderComponent::ConnectToAssetProcessor()
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool AssetBuilderComponent::RunInResidentMode()
|
||||
bool AssetBuilderComponent::SendRegisteredBuildersToAp()
|
||||
{
|
||||
using namespace AssetBuilderSDK;
|
||||
AssetBuilder::BuilderRegistrationRequest registrationRequest;
|
||||
|
||||
for (const auto& [uuid, desc] : m_assetBuilderDescMap)
|
||||
{
|
||||
AssetBuilder::BuilderRegistration registration;
|
||||
|
||||
registration.m_name = desc->m_name;
|
||||
registration.m_analysisFingerprint = desc->m_analysisFingerprint;
|
||||
registration.m_flags = desc->m_flags;
|
||||
registration.m_flagsByJobKey = desc->m_flagsByJobKey;
|
||||
registration.m_version = desc->m_version;
|
||||
registration.m_busId = desc->m_busId;
|
||||
registration.m_patterns = desc->m_patterns;
|
||||
registration.m_productsToKeepOnFailure = desc->m_productsToKeepOnFailure;
|
||||
|
||||
registrationRequest.m_builders.push_back(AZStd::move(registration));
|
||||
}
|
||||
|
||||
bool result = SendRequest(registrationRequest);
|
||||
|
||||
AZ_Error("AssetBuilder", result, "Failed to send builder registration request to Asset Processor");
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
bool AssetBuilderComponent::RunInResidentMode(bool sendRegistration)
|
||||
{
|
||||
using namespace AssetBuilder;
|
||||
using namespace AZStd::placeholders;
|
||||
|
||||
AZ_TracePrintf("AssetBuilderComponent", "RunInResidentMode: Starting resident mode (waiting for commands to arrive)\n");
|
||||
|
||||
AZStd::string port, id, builderFolder;
|
||||
|
||||
if (!GetParameter(s_paramId, id)
|
||||
|| !GetParameter(s_paramModule, builderFolder))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!LoadBuilders(builderFolder))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
AzFramework::SocketConnection::GetInstance()->AddMessageHandler(CreateJobsNetRequest::MessageType(), AZStd::bind(&AssetBuilderComponent::CreateJobsResidentHandler, this, _1, _2, _3, _4));
|
||||
AzFramework::SocketConnection::GetInstance()->AddMessageHandler(ProcessJobNetRequest::MessageType(), AZStd::bind(&AssetBuilderComponent::ProcessJobResidentHandler, this, _1, _2, _3, _4));
|
||||
|
||||
BuilderHelloRequest request;
|
||||
BuilderHelloResponse response;
|
||||
bool result = DoHelloPing() && ((sendRegistration && SendRegisteredBuildersToAp()) || !sendRegistration);
|
||||
|
||||
request.m_uuid = AZ::Uuid::CreateString(id.c_str());
|
||||
|
||||
AZ_TracePrintf("AssetBuilderComponent", "RunInResidentMode: Pinging asset processor with the builder UUID %s\n", request.m_uuid.ToString<AZStd::string>().c_str());
|
||||
|
||||
bool result = AzFramework::AssetSystem::SendRequest(request, response);
|
||||
|
||||
AZ_Error("AssetBuilder", result, "Failed to send hello request to Asset Processor");
|
||||
// This error is only shown if we successfully got a response AND the response explicitly indicates the AP rejected the builder
|
||||
AZ_Error("AssetBuilder", !result || response.m_accepted, "Asset Processor rejected connection request");
|
||||
|
||||
if (result && response.m_accepted)
|
||||
if (result)
|
||||
{
|
||||
m_running = true;
|
||||
|
||||
@@ -415,7 +455,6 @@ bool AssetBuilderComponent::RunInResidentMode()
|
||||
|
||||
AzFramework::EngineConnectionEvents::Bus::Handler::BusConnect(); // Listen for disconnects
|
||||
|
||||
AZ_TracePrintf("AssetBuilder", "Builder ID: %s\n", response.m_uuid.ToString<AZStd::string>().c_str());
|
||||
AZ_TracePrintf("AssetBuilder", "Resident mode ready\n");
|
||||
m_mainEvent.acquire();
|
||||
AZ_TracePrintf("AssetBuilder", "Shutting down\n");
|
||||
@@ -736,11 +775,7 @@ bool AssetBuilderComponent::RunOneShotTask(const AZStd::string& task)
|
||||
|
||||
AZ::StringFunc::Path::Normalize(inputFilePath);
|
||||
AZ::StringFunc::Path::Normalize(outputFilePath);
|
||||
if (task == s_taskRegisterBuilder)
|
||||
{
|
||||
return HandleRegisterBuilder(inputFilePath, outputFilePath);
|
||||
}
|
||||
else if (task == s_taskCreateJob)
|
||||
if (task == s_taskCreateJob)
|
||||
{
|
||||
auto func = [this](const AssetBuilderSDK::CreateJobsRequest& request, AssetBuilderSDK::CreateJobsResponse& response)
|
||||
{
|
||||
@@ -896,7 +931,7 @@ void AssetBuilderComponent::JobThread()
|
||||
{
|
||||
case JobType::Create:
|
||||
{
|
||||
using namespace AssetBuilderSDK;
|
||||
using namespace AssetBuilder;
|
||||
|
||||
auto* netRequest = azrtti_cast<CreateJobsNetRequest*>(job->m_netRequest.get());
|
||||
auto* netResponse = azrtti_cast<CreateJobsNetResponse*>(job->m_netResponse.get());
|
||||
@@ -922,7 +957,7 @@ void AssetBuilderComponent::JobThread()
|
||||
}
|
||||
case JobType::Process:
|
||||
{
|
||||
using namespace AssetBuilderSDK;
|
||||
using namespace AssetBuilder;
|
||||
|
||||
AZ_TracePrintf("AssetBuilder", "Running processJob task\n");
|
||||
|
||||
@@ -981,14 +1016,14 @@ void AssetBuilderComponent::JobThread()
|
||||
|
||||
void AssetBuilderComponent::CreateJobsResidentHandler(AZ::u32 /*typeId*/, AZ::u32 serial, const void* data, AZ::u32 dataLength)
|
||||
{
|
||||
using namespace AssetBuilderSDK;
|
||||
using namespace AssetBuilder;
|
||||
|
||||
ResidentJobHandler<CreateJobsNetRequest, CreateJobsNetResponse>(serial, data, dataLength, JobType::Create);
|
||||
}
|
||||
|
||||
void AssetBuilderComponent::ProcessJobResidentHandler(AZ::u32 /*typeId*/, AZ::u32 serial, const void* data, AZ::u32 dataLength)
|
||||
{
|
||||
using namespace AssetBuilderSDK;
|
||||
using namespace AssetBuilder;
|
||||
|
||||
ResidentJobHandler<ProcessJobNetRequest, ProcessJobNetResponse>(serial, data, dataLength, JobType::Process);
|
||||
}
|
||||
@@ -1018,18 +1053,6 @@ bool AssetBuilderComponent::HandleTask(const AZStd::string& inputFilePath, const
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AssetBuilderComponent::HandleRegisterBuilder(const AZStd::string& /*inputFilePath*/, const AZStd::string& outputFilePath) const
|
||||
{
|
||||
AssetBuilderSDK::RegisterBuilderResponse response;
|
||||
|
||||
for (const auto& pair : m_assetBuilderDescMap)
|
||||
{
|
||||
response.m_assetBuilderDescList.push_back(*pair.second);
|
||||
}
|
||||
|
||||
return AZ::Utils::SaveObjectToFile(outputFilePath, AZ::DataStream::ST_XML, &response);
|
||||
}
|
||||
|
||||
void AssetBuilderComponent::UpdateResultCode(const AssetBuilderSDK::ProcessJobRequest& request, AssetBuilderSDK::ProcessJobResponse& response) const
|
||||
{
|
||||
if (request.m_jobDescription.m_failOnError)
|
||||
|
||||
@@ -46,6 +46,7 @@ class AssetBuilderComponent
|
||||
public:
|
||||
AZ_COMPONENT(AssetBuilderComponent, "{04332899-5d73-4d41-86b7-b1017d349673}")
|
||||
static void Reflect(AZ::ReflectContext* context);
|
||||
bool DoHelloPing();
|
||||
|
||||
AssetBuilderComponent() = default;
|
||||
~AssetBuilderComponent() override = default;
|
||||
@@ -64,7 +65,7 @@ public:
|
||||
|
||||
void RegisterBuilderInformation(const AssetBuilderSDK::AssetBuilderDesc& builderDesc) override;
|
||||
void RegisterComponentDescriptor(AZ::ComponentDescriptor* descriptor) override;
|
||||
|
||||
|
||||
//EngineConnectionEvents Handler
|
||||
void Disconnected(AzFramework::SocketConnection* connection) override;
|
||||
|
||||
@@ -98,12 +99,13 @@ protected:
|
||||
static const char* GetLibraryExtension();
|
||||
|
||||
bool ConnectToAssetProcessor();
|
||||
bool SendRegisteredBuildersToAp();
|
||||
bool LoadBuilders(const AZStd::string& builderFolder);
|
||||
bool LoadBuilder(const AZStd::string& filePath);
|
||||
void UnloadBuilders();
|
||||
|
||||
//! Hooks up net job request handling and keeps the AssetBuilder running indefinitely
|
||||
bool RunInResidentMode();
|
||||
bool RunInResidentMode(bool sendRegistration);
|
||||
bool RunDebugTask(AZStd::string&& debugFile, bool runCreateJobs, bool runProcessJob);
|
||||
bool RunOneShotTask(const AZStd::string& task);
|
||||
|
||||
@@ -120,9 +122,6 @@ protected:
|
||||
|
||||
void ProcessJob(const AssetBuilderSDK::ProcessJobFunction& job, const AssetBuilderSDK::ProcessJobRequest& request, AssetBuilderSDK::ProcessJobResponse& outResponse);
|
||||
|
||||
//! Handles a builder registration request
|
||||
bool HandleRegisterBuilder(const AZStd::string& inputFilePath, const AZStd::string& outputFilePath) const;
|
||||
|
||||
//! If needed looks at collected data and updates the result code from the job accordingly.
|
||||
void UpdateResultCode(const AssetBuilderSDK::ProcessJobRequest& request, AssetBuilderSDK::ProcessJobResponse& response) const;
|
||||
|
||||
@@ -141,7 +140,7 @@ protected:
|
||||
|
||||
//! Currently loading builder
|
||||
AssetBuilder::ExternalModuleAssetBuilderInfo* m_currentAssetBuilder = nullptr;
|
||||
|
||||
|
||||
//! Thread for running a job, so we don't block the network thread while doing work
|
||||
AZStd::thread_desc m_jobThreadDesc;
|
||||
AZStd::thread m_jobThread;
|
||||
@@ -153,7 +152,7 @@ protected:
|
||||
AZStd::binary_semaphore m_mainEvent;
|
||||
//! Use to signal a new job is ready to be processed
|
||||
AZStd::binary_semaphore m_jobEvent;
|
||||
|
||||
|
||||
//! Lock for m_queuedJob
|
||||
AZStd::mutex m_jobMutex;
|
||||
|
||||
|
||||
@@ -0,0 +1,182 @@
|
||||
/*
|
||||
* 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 <AssetBuilderStatic.h>
|
||||
#include <AzCore/Component/ComponentApplicationBus.h>
|
||||
|
||||
namespace AssetBuilder
|
||||
{
|
||||
void Reflect(AZ::ReflectContext* context)
|
||||
{
|
||||
BuilderRegistrationRequest::Reflect(context);
|
||||
|
||||
BuilderHelloRequest::Reflect(context);
|
||||
BuilderHelloResponse::Reflect(context);
|
||||
CreateJobsNetRequest::Reflect(context);
|
||||
CreateJobsNetResponse::Reflect(context);
|
||||
ProcessJobNetRequest::Reflect(context);
|
||||
ProcessJobNetResponse::Reflect(context);
|
||||
}
|
||||
|
||||
void InitializeSerializationContext()
|
||||
{
|
||||
AZ::SerializeContext* serializeContext = nullptr;
|
||||
|
||||
AZ::ComponentApplicationBus::BroadcastResult(serializeContext, &AZ::ComponentApplicationBus::Events::GetSerializeContext);
|
||||
AZ_Assert(serializeContext, "Unable to retrieve serialize context.");
|
||||
|
||||
Reflect(serializeContext);
|
||||
}
|
||||
|
||||
void BuilderHelloRequest::Reflect(AZ::ReflectContext* context)
|
||||
{
|
||||
auto serialize = azrtti_cast<AZ::SerializeContext*>(context);
|
||||
if (serialize)
|
||||
{
|
||||
serialize->Class<BuilderHelloRequest>()->Version(1)->Field("UUID", &BuilderHelloRequest::m_uuid);
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int BuilderHelloRequest::MessageType()
|
||||
{
|
||||
static unsigned int messageType = AZ_CRC("AssetBuilderSDK::BuilderHelloRequest", 0x213a7248);
|
||||
|
||||
return messageType;
|
||||
}
|
||||
|
||||
unsigned int BuilderHelloRequest::GetMessageType() const
|
||||
{
|
||||
return MessageType();
|
||||
}
|
||||
|
||||
void BuilderHelloResponse::Reflect(AZ::ReflectContext* context)
|
||||
{
|
||||
auto serialize = azrtti_cast<AZ::SerializeContext*>(context);
|
||||
if (serialize)
|
||||
{
|
||||
serialize->Class<BuilderHelloResponse>()
|
||||
->Version(1)
|
||||
->Field("Accepted", &BuilderHelloResponse::m_accepted)
|
||||
->Field("UUID", &BuilderHelloResponse::m_uuid);
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int BuilderHelloResponse::GetMessageType() const
|
||||
{
|
||||
return BuilderHelloRequest::MessageType();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void CreateJobsNetRequest::Reflect(AZ::ReflectContext* context)
|
||||
{
|
||||
auto serialize = azrtti_cast<AZ::SerializeContext*>(context);
|
||||
if (serialize)
|
||||
{
|
||||
serialize->Class<CreateJobsNetRequest>()->Version(1)->Field("Request", &CreateJobsNetRequest::m_request);
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int CreateJobsNetRequest::MessageType()
|
||||
{
|
||||
static unsigned int messageType = AZ_CRC("AssetBuilderSDK::CreateJobsNetRequest", 0xc48209c0);
|
||||
|
||||
return messageType;
|
||||
}
|
||||
|
||||
unsigned int CreateJobsNetRequest::GetMessageType() const
|
||||
{
|
||||
return MessageType();
|
||||
}
|
||||
|
||||
void CreateJobsNetResponse::Reflect(AZ::ReflectContext* context)
|
||||
{
|
||||
auto serialize = azrtti_cast<AZ::SerializeContext*>(context);
|
||||
if (serialize)
|
||||
{
|
||||
serialize->Class<CreateJobsNetResponse>()->Version(1)->Field("Response", &CreateJobsNetResponse::m_response);
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int CreateJobsNetResponse::GetMessageType() const
|
||||
{
|
||||
return CreateJobsNetRequest::MessageType();
|
||||
}
|
||||
|
||||
void ProcessJobNetRequest::Reflect(AZ::ReflectContext* context)
|
||||
{
|
||||
auto serialize = azrtti_cast<AZ::SerializeContext*>(context);
|
||||
if (serialize)
|
||||
{
|
||||
serialize->Class<ProcessJobNetRequest>()->Version(1)->Field("Request", &ProcessJobNetRequest::m_request);
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int ProcessJobNetRequest::MessageType()
|
||||
{
|
||||
static unsigned int messageType = AZ_CRC("AssetBuilderSDK::ProcessJobNetRequest", 0x479f340f);
|
||||
|
||||
return messageType;
|
||||
}
|
||||
|
||||
unsigned int ProcessJobNetRequest::GetMessageType() const
|
||||
{
|
||||
return MessageType();
|
||||
}
|
||||
|
||||
void ProcessJobNetResponse::Reflect(AZ::ReflectContext* context)
|
||||
{
|
||||
auto serialize = azrtti_cast<AZ::SerializeContext*>(context);
|
||||
if (serialize)
|
||||
{
|
||||
serialize->Class<ProcessJobNetResponse>()->Version(1)->Field("Response", &ProcessJobNetResponse::m_response);
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int ProcessJobNetResponse::GetMessageType() const
|
||||
{
|
||||
return ProcessJobNetRequest::MessageType();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
void BuilderRegistration::Reflect(AZ::ReflectContext* context)
|
||||
{
|
||||
auto serialize = azrtti_cast<AZ::SerializeContext*>(context);
|
||||
if (serialize)
|
||||
{
|
||||
serialize->Class<BuilderRegistration>()
|
||||
->Version(1)
|
||||
->Field("Name", &BuilderRegistration::m_name)
|
||||
->Field("Patterns", &BuilderRegistration::m_patterns)
|
||||
->Field("BusId", &BuilderRegistration::m_busId)
|
||||
->Field("Version", &BuilderRegistration::m_version)
|
||||
->Field("AnalysisFingerprint", &BuilderRegistration::m_analysisFingerprint)
|
||||
->Field("Flags", &BuilderRegistration::m_flags)
|
||||
->Field("FlagsByJobKey", &BuilderRegistration::m_flagsByJobKey)
|
||||
->Field("ProductsToKeepOnFailure", &BuilderRegistration::m_productsToKeepOnFailure);
|
||||
}
|
||||
}
|
||||
|
||||
void BuilderRegistrationRequest::Reflect(AZ::ReflectContext* context)
|
||||
{
|
||||
BuilderRegistration::Reflect(context);
|
||||
|
||||
auto serialize = azrtti_cast<AZ::SerializeContext*>(context);
|
||||
if (serialize)
|
||||
{
|
||||
serialize->Class<BuilderRegistrationRequest, BaseAssetProcessorMessage>()->Version(1)->Field(
|
||||
"Builders", &BuilderRegistrationRequest::m_builders);
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int BuilderRegistrationRequest::GetMessageType() const
|
||||
{
|
||||
return BuilderRegistrationRequest::MessageType;
|
||||
}
|
||||
|
||||
} // namespace AssetBuilder
|
||||
@@ -0,0 +1,140 @@
|
||||
/*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AzFramework/Asset/AssetProcessorMessages.h>
|
||||
#include <AssetBuilderSDK/AssetBuilderSDK.h>
|
||||
|
||||
namespace AssetBuilder
|
||||
{
|
||||
void Reflect(AZ::ReflectContext* context);
|
||||
|
||||
void InitializeSerializationContext();
|
||||
|
||||
//! BuilderHelloRequest is sent by an AssetBuilder that is attempting to connect to the AssetProcessor to register itself as a worker
|
||||
class BuilderHelloRequest : public AzFramework::AssetSystem::BaseAssetProcessorMessage
|
||||
{
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(BuilderHelloRequest, AZ::OSAllocator, 0);
|
||||
AZ_RTTI(BuilderHelloRequest, "{5fab5962-a1d8-42a5-bf7a-fb1a8c5a9588}", BaseAssetProcessorMessage);
|
||||
|
||||
static void Reflect(AZ::ReflectContext* context);
|
||||
static unsigned int MessageType();
|
||||
|
||||
unsigned int GetMessageType() const override;
|
||||
|
||||
//! Unique ID assigned to this builder to identify it
|
||||
AZ::Uuid m_uuid = AZ::Uuid::CreateNull();
|
||||
};
|
||||
|
||||
//! BuilderHelloResponse contains the AssetProcessor's response to a builder connection attempt, indicating if it is accepted and the ID
|
||||
//! that it was assigned
|
||||
class BuilderHelloResponse : public AzFramework::AssetSystem::BaseAssetProcessorMessage
|
||||
{
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(BuilderHelloResponse, AZ::OSAllocator, 0);
|
||||
AZ_RTTI(BuilderHelloResponse, "{5f3d7c11-6639-4c6f-980a-32be546903c2}", BaseAssetProcessorMessage);
|
||||
|
||||
static void Reflect(AZ::ReflectContext* context);
|
||||
|
||||
unsigned int GetMessageType() const override;
|
||||
|
||||
//! Indicates if the builder was accepted by the AP
|
||||
bool m_accepted = false;
|
||||
|
||||
//! Unique ID assigned to the builder. If the builder isn't a local process, this is the ID assigned by the AP
|
||||
AZ::Uuid m_uuid = AZ::Uuid::CreateNull();
|
||||
};
|
||||
|
||||
class CreateJobsNetRequest : public AzFramework::AssetSystem::BaseAssetProcessorMessage
|
||||
{
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(CreateJobsNetRequest, AZ::OSAllocator, 0);
|
||||
AZ_RTTI(CreateJobsNetRequest, "{97fa717d-3a09-4d21-95c6-b2eafd773f1c}", BaseAssetProcessorMessage);
|
||||
|
||||
static void Reflect(AZ::ReflectContext* context);
|
||||
static unsigned int MessageType();
|
||||
|
||||
unsigned int GetMessageType() const override;
|
||||
|
||||
AssetBuilderSDK::CreateJobsRequest m_request;
|
||||
};
|
||||
|
||||
class CreateJobsNetResponse : public AzFramework::AssetSystem::BaseAssetProcessorMessage
|
||||
{
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(CreateJobsNetResponse, AZ::OSAllocator, 0);
|
||||
AZ_RTTI(CreateJobsNetResponse, "{b2c7c2d3-b60e-4b27-b699-43e0ba991c33}", BaseAssetProcessorMessage);
|
||||
|
||||
static void Reflect(AZ::ReflectContext* context);
|
||||
|
||||
unsigned int GetMessageType() const override;
|
||||
|
||||
AssetBuilderSDK::CreateJobsResponse m_response;
|
||||
};
|
||||
|
||||
class ProcessJobNetRequest : public AzFramework::AssetSystem::BaseAssetProcessorMessage
|
||||
{
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(ProcessJobNetRequest, AZ::OSAllocator, 0);
|
||||
AZ_RTTI(ProcessJobNetRequest, "{05288de1-020b-48db-b9de-715f17284efa}", BaseAssetProcessorMessage);
|
||||
|
||||
static void Reflect(AZ::ReflectContext* context);
|
||||
static unsigned int MessageType();
|
||||
|
||||
unsigned int GetMessageType() const override;
|
||||
|
||||
AssetBuilderSDK::ProcessJobRequest m_request;
|
||||
};
|
||||
|
||||
class ProcessJobNetResponse : public AzFramework::AssetSystem::BaseAssetProcessorMessage
|
||||
{
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(ProcessJobNetResponse, AZ::OSAllocator, 0);
|
||||
AZ_RTTI(ProcessJobNetResponse, "{26ddf882-246c-4cfb-912f-9b8e389df4f6}", BaseAssetProcessorMessage);
|
||||
|
||||
static void Reflect(AZ::ReflectContext* context);
|
||||
|
||||
unsigned int GetMessageType() const override;
|
||||
|
||||
AssetBuilderSDK::ProcessJobResponse m_response;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
struct BuilderRegistration
|
||||
{
|
||||
AZ_CLASS_ALLOCATOR(BuilderRegistration, AZ::OSAllocator, 0);
|
||||
AZ_TYPE_INFO(BuilderRegistration, "{36E785C3-5046-4568-870A-336C8249E453}");
|
||||
|
||||
static void Reflect(AZ::ReflectContext* context);
|
||||
|
||||
AZStd::string m_name;
|
||||
AZStd::vector<AssetBuilderSDK::AssetBuilderPattern> m_patterns;
|
||||
AZ::Uuid m_busId;
|
||||
int m_version = 0;
|
||||
AZStd::string m_analysisFingerprint;
|
||||
AZ::u8 m_flags = 0;
|
||||
AZStd::unordered_map<AZStd::string, AZ::u8> m_flagsByJobKey;
|
||||
AZStd::unordered_map<AZStd::string, AZStd::unordered_set<AZ::u32>> m_productsToKeepOnFailure;
|
||||
};
|
||||
|
||||
class BuilderRegistrationRequest : public AzFramework::AssetSystem::BaseAssetProcessorMessage
|
||||
{
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(BuilderRegistrationRequest, AZ::OSAllocator, 0);
|
||||
AZ_RTTI(BuilderRegistrationRequest, "{FA9CF2D5-C847-47F3-979D-6C3AE061715C}", BaseAssetProcessorMessage);
|
||||
static void Reflect(AZ::ReflectContext* context);
|
||||
static constexpr unsigned int MessageType = AZ_CRC_CE("AssetSystem::BuilderRegistrationRequest");
|
||||
|
||||
BuilderRegistrationRequest() = default;
|
||||
unsigned int GetMessageType() const override;
|
||||
|
||||
AZStd::vector<BuilderRegistration> m_builders;
|
||||
};
|
||||
} // namespace AssetBuilder
|
||||
@@ -6,6 +6,22 @@
|
||||
#
|
||||
#
|
||||
|
||||
ly_add_target(
|
||||
NAME AssetBuilder.Static STATIC
|
||||
NAMESPACE AZ
|
||||
FILES_CMAKE
|
||||
asset_builder_static_files.cmake
|
||||
INCLUDE_DIRECTORIES
|
||||
PUBLIC
|
||||
.
|
||||
BUILD_DEPENDENCIES
|
||||
PUBLIC
|
||||
AZ::AzCore
|
||||
AZ::AzFramework
|
||||
AZ::AzToolsFramework
|
||||
AZ::AssetBuilderSDK
|
||||
)
|
||||
|
||||
ly_add_target(
|
||||
NAME AssetBuilder EXECUTABLE
|
||||
NAMESPACE AZ
|
||||
@@ -17,6 +33,7 @@ ly_add_target(
|
||||
.
|
||||
BUILD_DEPENDENCIES
|
||||
PRIVATE
|
||||
AssetBuilder.Static
|
||||
3rdParty::Qt::Core
|
||||
3rdParty::Qt::Gui
|
||||
3rdParty::Qt::Network
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
#
|
||||
# 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
|
||||
#
|
||||
#
|
||||
|
||||
set(FILES
|
||||
AssetBuilderStatic.h
|
||||
AssetBuilderStatic.cpp
|
||||
)
|
||||
Reference in New Issue
Block a user