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>
This commit is contained in:
SJ
2021-10-26 09:43:03 -07:00
committed by GitHub
parent ee6ceba5ce
commit 3bdfe51fca
11 changed files with 47 additions and 43 deletions
+20 -18
View File
@@ -137,64 +137,66 @@
// Excludes files that match the pattern or glob
// if you use a pattern, remember to escape your backslashes (\\)
// The patterns are checked against a path relative to the entry's
// root scan folder.
"Exclude _LevelBackups": {
"pattern": ".*\\\\/Levels\\\\/.*\\\\/_savebackup\\\\/.*"
"pattern": "(^|.+/)Levels/.*/_savebackup(/.*)?$"
},
"Exclude _LevelAutoBackups": {
"pattern": ".*\\\\/Levels\\\\/.*\\\\/_autobackup\\\\/.*"
"pattern": "(^|.+/)Levels/.*/_autobackup(/.*)?$"
},
"Exclude HoldFiles": {
"pattern": ".*\\\\/Levels\\\\/.*_hold\\\\/.*"
"pattern": "(^|.+/)Levels/.*_hold(/.*)?$"
},
// note that $ has meaning to regex, so we escape it.
"Exclude TempFiles": {
"pattern": ".*\\\\/\\\\$tmp[0-9]*_.*"
"pattern": "(^|.+/)\\\\$tmp[0-9]*_.*"
},
"Exclude TmpAnimationCompression": {
"pattern": ".*\\\\/Editor\\\\/Tmp\\\\/AnimationCompression\\\\/.*"
"pattern": "(^|.+/)Editor/Tmp/AnimationCompression(/.*)?$"
},
"Exclude EventLog": {
"pattern": ".*\\\\/Editor\\\\/.*eventlog\\\\.xml"
"pattern": "(^|.+/)Editor/.*eventlog\\\\.xml"
},
"Exclude GameGemsCode": {
"pattern": ".*\\\\/Gem\\\\/Code\\\\/.*"
"pattern": "(^|.+/)Gem/Code(/.*)?$"
},
"Exclude GameGemsResources": {
"pattern": ".*\\\\/Gem\\\\/Resources\\\\/.*"
"pattern": "(^|.+/)Gem/Resources(/.*)?$"
},
"Exclude Private Certs": {
"pattern": ".*\\DynamicContent\\\\/Certificates\\\\/Private\\\\/.*"
"pattern": "(^|.+/)DynamicContent/Certificates/Private(/.*)?$"
},
"Exclude CMakeLists": {
"pattern": ".*\\\\/CMakeLists.txt"
"pattern": "(^|.+/)CMakeLists\\\\.txt"
},
"Exclude CMakeFiles": {
"pattern": ".*\\\\/.*\\\\.cmake"
"pattern": "(^|.+/).+\\\\.cmake"
},
"Exclude User": {
"pattern": ".*/[Uu]ser/.*"
"pattern": "^[Uu]ser(/.*)?$"
},
"Exclude Build": {
"pattern": ".*/[Bb]uild/.*"
"pattern": "^[Bb]uild(/.*)?$"
},
"Exclude Install": {
"pattern": ".*/[Ii]nstall/.*"
"pattern": "^[Ii]nstall(/.*)?$"
},
"Exclude UserSettings": {
"pattern": ".*/UserSettings.xml"
"pattern": "(^|[^/]+/)UserSettings\\\\.xml"
},
// ------------------------------------------------------------------------------
// Large Worlds Test
// ------------------------------------------------------------------------------
"Exclude Work In Progress Folders": {
"pattern": ".*\\\\/WIP\\\\/.*"
"pattern": "(^|[^/]+/)WIP(/.*)?"
},
"Exclude Content Source Folders": {
"pattern": ".*\\\\/CONTENT_SOURCE\\\\/.*"
"pattern": "(^|[^/]+/)CONTENT_SOURCE(/.*)?"
},
"Exclude Art Source Folders": {
"pattern": ".*\\\\/ArtSource\\\\/.*"
"pattern": "(^|[^/]+/)ArtSource(/.*)?"
},
//------------------------------------------------------------------------------
// Copying Files Automatically Into the Cache