Cherrypicked fix for "Failed to find builder dependency" error message.

Cherrypicked b7f6b57e16 from stabilization branch because I knew it would have conflicts I needed to resolve.

See https://github.com/aws-lumberyard/o3de/pull/1462

This removes mostly benign (but noisy) messages about "Failed to find builder dependency".

ATOM-15136 Builder dependency errors reported in mainline
ATOM-15134 Replace GetPossibleDepenencyPaths Approach with Source Dependencies

SrgLayoutBuilder.cpp conflicted because it had been removed on development. The changes in this file are no longer relevant.
ShaderVariantAssetBuilder.cpp conflicted only because there were formatting changes inside the AddShaderAssetJobDependency() function.
This commit is contained in:
Chris Santora
2021-06-22 22:14:12 -07:00
parent 9aa44a56e7
commit eda64b2d4c
4 changed files with 93 additions and 42 deletions
@@ -103,31 +103,16 @@ namespace AZ
AZStd::vector<AZStd::string> GetPossibleDepenencyPaths(const AZStd::string& originatingSourceFilePath, const AZStd::string& referencedSourceFilePath)
{
// We potentially add the parent dependency as both a direct path and a relative path rather than use AssetUtils::ResolvePathReference
// because there is no guarantee that the Asset Processor has seen the parent file yet (which ResolvePathReference requires).
// In that case, we have to add both possible locations because we don't know where it will show up.
AZStd::vector<AZStd::string> results;
// The first dependency we add is using the referencedSourceFilePath as a relative path. This gives relative paths priority over asset-root paths.
// Use the referencedSourceFilePath as a relative path starting at originatingSourceFilePath
AZStd::string combinedPath = originatingSourceFilePath;
AzFramework::StringFunc::Path::StripFullName(combinedPath);
AzFramework::StringFunc::Path::Join(combinedPath.c_str(), referencedSourceFilePath.c_str(), combinedPath);
results.push_back(combinedPath);
// If the parent file exists at the relative path, then there is no need to report a dependency on the asset-root path.
bool assetFound = false;
AZ::Data::AssetInfo sourceInfo;
AZStd::string watchFolder;
AzToolsFramework::AssetSystemRequestBus::BroadcastResult(assetFound, &AzToolsFramework::AssetSystem::AssetSystemRequest::GetSourceInfoBySourcePath, combinedPath.c_str(), sourceInfo, watchFolder);
if (!assetFound)
{
// The parent file wasn't found at the relative path, so we need a dependency on the asset-root path in case the file
// exists there. Note, we still keep the relative path dependency above because we don't know whether it's missing because
// it doesn't exist, or just because the AP hasn't found it yet.
results.push_back(referencedSourceFilePath);
}
// Use the referencedSourceFilePath as a standard asset path
results.push_back(referencedSourceFilePath);
return results;
}