[LYN-7774] wildcard source dependencies not refreshing with new files (#5054)
* Fix handling of absolute path dependencies when a newly added file satisfies a previously added dependency Signed-off-by: amzn-mike <80125227+amzn-mike@users.noreply.github.com> * Fixed relative path wildcard dependencies matching absolute paths Signed-off-by: amzn-mike <80125227+amzn-mike@users.noreply.github.com> * Update extra unit test to only run on windows since this problem doesn't apply to other OSes Signed-off-by: amzn-mike <80125227+amzn-mike@users.noreply.github.com>
This commit is contained in:
@@ -4027,30 +4027,43 @@ namespace AssetProcessor
|
||||
// It is generally called when a source file modified in any way, including when it is added or deleted.
|
||||
// note that this is a "reverse" dependency query - it looks up what depends on a file, not what the file depends on
|
||||
using namespace AzToolsFramework::AssetDatabase;
|
||||
QStringList absoluteSourceFilePathQueue;
|
||||
QSet<QString> absoluteSourceFilePathQueue;
|
||||
QString databasePath;
|
||||
QString scanFolder;
|
||||
|
||||
auto callbackFunction = [&](AzToolsFramework::AssetDatabase::SourceFileDependencyEntry& entry)
|
||||
auto callbackFunction = [this, &absoluteSourceFilePathQueue](SourceFileDependencyEntry& entry)
|
||||
{
|
||||
QString relativeDatabaseName = QString::fromUtf8(entry.m_source.c_str());
|
||||
QString absolutePath = m_platformConfig->FindFirstMatchingFile(relativeDatabaseName);
|
||||
if (!absolutePath.isEmpty())
|
||||
{
|
||||
absoluteSourceFilePathQueue.push_back(absolutePath);
|
||||
absoluteSourceFilePathQueue.insert(absolutePath);
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
auto callbackFunctionAbsoluteCheck = [&callbackFunction](SourceFileDependencyEntry& entry)
|
||||
{
|
||||
if (AZ::IO::PathView(entry.m_dependsOnSource.c_str()).IsAbsolute())
|
||||
{
|
||||
return callbackFunction(entry);
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
// convert to a database path so that the standard function can be called.
|
||||
|
||||
if (m_platformConfig->ConvertToRelativePath(sourcePath, databasePath, scanFolder))
|
||||
{
|
||||
m_stateData->QuerySourceDependencyByDependsOnSource(databasePath.toUtf8().constData(), nullptr, SourceFileDependencyEntry::DEP_Any, callbackFunction);
|
||||
|
||||
}
|
||||
|
||||
return absoluteSourceFilePathQueue;
|
||||
// We'll also check with the absolute path, because we support absolute path dependencies
|
||||
m_stateData->QuerySourceDependencyByDependsOnSource(
|
||||
sourcePath.toUtf8().constData(), nullptr, SourceFileDependencyEntry::DEP_Any, callbackFunctionAbsoluteCheck);
|
||||
|
||||
return absoluteSourceFilePathQueue.values();
|
||||
}
|
||||
|
||||
void AssetProcessorManager::AddSourceToDatabase(AzToolsFramework::AssetDatabase::SourceDatabaseEntry& sourceDatabaseEntry, const ScanFolderInfo* scanFolder, QString relativeSourceFilePath)
|
||||
|
||||
Reference in New Issue
Block a user