Pass relative path IsFileExcluded so that only paths relative to the root scan folder are matched against the exclude filters (#4504)

* Pass relative path IsFileExcluded so that only paths relative to the root scan folder are matched against the exclude filters.

Signed-off-by: amzn-sj <srikkant@amazon.com>

* Revert previous change. Remove the exclude filter for the Install directory.

Signed-off-by: amzn-sj <srikkant@amazon.com>

* Pass in relative path to the exclude filter as before. Fix the AssetScanner tests.

Signed-off-by: amzn-sj <srikkant@amazon.com>

* Prepend a ./ to the relative path in order to match the exclude patterns

Signed-off-by: amzn-sj <srikkant@amazon.com>

* Remove hack to prepend ./. Update the exclude patterns so that the hack is no longer required.

Signed-off-by: amzn-sj <srikkant@amazon.com>

* Add missing ? and remove whitespace

Signed-off-by: amzn-sj <srikkant@amazon.com>

* 1. IsFileExcluded() now converts the input path to a path that's relative to its corresponding scan folder.
2. Update regex patterns in gems and AutomatedTesting as well.
3. Remove unnecessary escaping for '/'.

Signed-off-by: amzn-sj <srikkant@amazon.com>

* Use ConvertToRelativePath() function to compute path relative to a scan folder.

Signed-off-by: amzn-sj <srikkant@amazon.com>

* More fixes to regex patterns

Signed-off-by: amzn-sj <srikkant@amazon.com>

* Remove test case which tests a hypothetical scenario that cannot occur. Fix another test case by adding scan folder.

Signed-off-by: amzn-sj <srikkant@amazon.com>

* Remove assert that's not needed since it's a valid scenario

Signed-off-by: amzn-sj <srikkant@amazon.com>
Signed-off-by: Gene Walters <genewalt@amazon.com>
This commit is contained in:
SJ
2021-10-26 09:43:03 -07:00
committed by Gene Walters
parent 769e2e3942
commit 104170879e
11 changed files with 47 additions and 43 deletions
@@ -347,7 +347,7 @@ namespace AssetProcessor
ExcludeAssetRecognizer excludeRecogniser;
excludeRecogniser.m_name = "backup";
excludeRecogniser.m_patternMatcher = AssetBuilderSDK::FilePatternMatcher(".*\\/savebackup\\/.*", AssetBuilderSDK::AssetBuilderPattern::Regex);
excludeRecogniser.m_patternMatcher = AssetBuilderSDK::FilePatternMatcher("(^|.+/)savebackup/.*", AssetBuilderSDK::AssetBuilderPattern::Regex);
config.AddExcludeRecognizer(excludeRecogniser);
AssetProcessorManager_Test apm(&config); // note, this will 'push' the scan folders in to the db.
@@ -1791,13 +1791,8 @@ namespace AssetProcessor
UNIT_TEST_EXPECT_TRUE((newfingerprintForPCAfterVersionChange != fingerprintForPC) || (newfingerprintForPCAfterVersionChange != newfingerprintForPC));//Fingerprints should be different
UNIT_TEST_EXPECT_TRUE((newfingerprintForANDROIDAfterVersionChange != fingerprintForANDROID) || (newfingerprintForANDROIDAfterVersionChange != newfingerprintForANDROID));//Fingerprints should be different
//------Test for Files which are excluded
processResults.clear();
absolutePath = AssetUtilities::NormalizeFilePath(tempPath.absoluteFilePath("subfolder3/savebackup/test.txt"));
QMetaObject::invokeMethod(&apm, "AssessModifiedFile", Qt::QueuedConnection, Q_ARG(QString, absolutePath));
UNIT_TEST_EXPECT_FALSE(BlockUntil(idling, 3000)); //Processing a file that will be excluded should not cause assetprocessor manager to emit the onBecameIdle signal because its state should not change
UNIT_TEST_EXPECT_TRUE(processResults.size() == 0);
// ------------- Test querying asset status -------------------
{
absolutePath = tempPath.absoluteFilePath("subfolder2/folder/ship.tiff");