[LYN-7520] Wildcard Source Dependencies include files in cache/excluded files (#5349)
* Add folder exclusion for wildcard source dependencies Signed-off-by: amzn-mike <80125227+amzn-mike@users.noreply.github.com> * Exclude ignored files. Add unit tests Signed-off-by: amzn-mike <80125227+amzn-mike@users.noreply.github.com> * Add handling for ignored folders being added/removed Add unit tests Signed-off-by: amzn-mike <80125227+amzn-mike@users.noreply.github.com> * Add ExcludedFolderCacheInterface to cmake Signed-off-by: amzn-mike <80125227+amzn-mike@users.noreply.github.com> * Fix include Signed-off-by: amzn-mike <80125227+amzn-mike@users.noreply.github.com> * Add error message Signed-off-by: amzn-mike <80125227+amzn-mike@users.noreply.github.com> * Cleanup includes Signed-off-by: amzn-mike <80125227+amzn-mike@users.noreply.github.com> * Revert traits include Signed-off-by: amzn-mike <80125227+amzn-mike@users.noreply.github.com> * Fix missing include, minor cleanup Signed-off-by: amzn-mike <80125227+amzn-mike@users.noreply.github.com> * Add missing includes Signed-off-by: amzn-mike <80125227+amzn-mike@users.noreply.github.com>
This commit is contained in:
@@ -454,6 +454,8 @@ void ApplicationManagerBase::InitFileMonitor()
|
||||
QObject::connect(newFolderWatch, &FolderWatchCallbackEx::fileModified, [this](QString path) { m_fileStateCache->UpdateFile(path); });
|
||||
QObject::connect(newFolderWatch, &FolderWatchCallbackEx::fileRemoved, [this](QString path) { m_fileStateCache->RemoveFile(path); });
|
||||
|
||||
QObject::connect(newFolderWatch, &FolderWatchCallbackEx::fileAdded, [](QString path) { AZ::Interface<AssetProcessor::ExcludedFolderCacheInterface>::Get()->FileAdded(path); });
|
||||
|
||||
QObject::connect(newFolderWatch, &FolderWatchCallbackEx::fileAdded,
|
||||
m_fileProcessor.get(), &AssetProcessor::FileProcessor::AssessAddedFile);
|
||||
QObject::connect(newFolderWatch, &FolderWatchCallbackEx::fileRemoved,
|
||||
|
||||
@@ -1285,6 +1285,13 @@ namespace AssetProcessor
|
||||
return m_scanFolders[index];
|
||||
}
|
||||
|
||||
const AssetProcessor::ScanFolderInfo& PlatformConfiguration::GetScanFolderAt(int index) const
|
||||
{
|
||||
Q_ASSERT(index >= 0);
|
||||
Q_ASSERT(index < m_scanFolders.size());
|
||||
return m_scanFolders[index];
|
||||
}
|
||||
|
||||
void PlatformConfiguration::AddScanFolder(const AssetProcessor::ScanFolderInfo& source, bool isUnitTesting)
|
||||
{
|
||||
if (isUnitTesting)
|
||||
@@ -1436,7 +1443,10 @@ namespace AssetProcessor
|
||||
}
|
||||
|
||||
QStringList PlatformConfiguration::FindWildcardMatches(
|
||||
const QString& sourceFolder, QString relativeName, bool includeFolders, bool recursiveSearch) const
|
||||
const QString& sourceFolder,
|
||||
QString relativeName,
|
||||
bool includeFolders,
|
||||
bool recursiveSearch) const
|
||||
{
|
||||
if (relativeName.isEmpty())
|
||||
{
|
||||
@@ -1469,6 +1479,67 @@ namespace AssetProcessor
|
||||
return returnList;
|
||||
}
|
||||
|
||||
QStringList PlatformConfiguration::FindWildcardMatches(
|
||||
const QString& sourceFolder,
|
||||
QString relativeName,
|
||||
const AZStd::unordered_set<AZStd::string>& excludedFolders,
|
||||
bool includeFolders,
|
||||
bool recursiveSearch) const
|
||||
{
|
||||
if (relativeName.isEmpty())
|
||||
{
|
||||
return QStringList();
|
||||
}
|
||||
|
||||
QDir sourceFolderDir(sourceFolder);
|
||||
|
||||
QString posixRelativeName = QDir::fromNativeSeparators(relativeName);
|
||||
|
||||
QStringList returnList;
|
||||
QRegExp nameMatch{ posixRelativeName, Qt::CaseInsensitive, QRegExp::Wildcard };
|
||||
AZStd::stack<QString> dirs;
|
||||
dirs.push(sourceFolderDir.absolutePath());
|
||||
|
||||
while (!dirs.empty())
|
||||
{
|
||||
QString absolutePath = dirs.top();
|
||||
dirs.pop();
|
||||
|
||||
if (excludedFolders.contains(absolutePath.toUtf8().constData()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
QDirIterator dirIterator(absolutePath, QDir::AllEntries | QDir::NoSymLinks | QDir::NoDotAndDotDot);
|
||||
|
||||
while (dirIterator.hasNext())
|
||||
{
|
||||
dirIterator.next();
|
||||
|
||||
if (!dirIterator.fileInfo().isFile())
|
||||
{
|
||||
if (recursiveSearch)
|
||||
{
|
||||
dirs.push(dirIterator.filePath());
|
||||
}
|
||||
|
||||
if (!includeFolders)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
QString pathMatch{ sourceFolderDir.relativeFilePath(dirIterator.filePath()) };
|
||||
if (nameMatch.exactMatch(pathMatch))
|
||||
{
|
||||
returnList.append(QDir::fromNativeSeparators(dirIterator.filePath()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return returnList;
|
||||
}
|
||||
|
||||
const AssetProcessor::ScanFolderInfo* PlatformConfiguration::GetScanFolderForFile(const QString& fullFileName) const
|
||||
{
|
||||
QString normalized = AssetUtilities::NormalizeFilePath(fullFileName);
|
||||
|
||||
@@ -256,6 +256,9 @@ namespace AssetProcessor
|
||||
//! Retrieve the scan folder at a given index.
|
||||
AssetProcessor::ScanFolderInfo& GetScanFolderAt(int index);
|
||||
|
||||
//! Retrieve the scan folder at a given index.
|
||||
const AssetProcessor::ScanFolderInfo& GetScanFolderAt(int index) const;
|
||||
|
||||
//! Manually add a scan folder. Also used for testing.
|
||||
void AddScanFolder(const AssetProcessor::ScanFolderInfo& source, bool isUnitTesting = false);
|
||||
|
||||
@@ -298,7 +301,16 @@ namespace AssetProcessor
|
||||
QString FindFirstMatchingFile(QString relativeName) const;
|
||||
|
||||
//! given a relative name with wildcard characters (* allowed) find a set of matching files or optionally folders
|
||||
QStringList FindWildcardMatches(const QString& sourceFolder, QString relativeName, bool includeFolders = false, bool recursiveSearch = true) const;
|
||||
QStringList FindWildcardMatches(const QString& sourceFolder, QString relativeName, bool includeFolders = false,
|
||||
bool recursiveSearch = true) const;
|
||||
|
||||
//! given a relative name with wildcard characters (* allowed) find a set of matching files or optionally folders
|
||||
QStringList FindWildcardMatches(
|
||||
const QString& sourceFolder,
|
||||
QString relativeName,
|
||||
const AZStd::unordered_set<AZStd::string>& excludedFolders,
|
||||
bool includeFolders = false,
|
||||
bool recursiveSearch = true) const;
|
||||
|
||||
//! given a fileName (as a full path), return the database source name which includes the output prefix.
|
||||
//!
|
||||
|
||||
Reference in New Issue
Block a user