-
Notifications
You must be signed in to change notification settings - Fork 137
build: clean up stale entries in deploy path #2083
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,104 @@ | ||
| if(NOT DEFINED MODE) | ||
| message(FATAL_ERROR "CleanupStaleEntries.cmake requires MODE") | ||
| endif() | ||
|
|
||
| if(NOT DEFINED AIO_DIR) | ||
| message(FATAL_ERROR "CleanupStaleEntries.cmake requires AIO_DIR") | ||
| endif() | ||
|
|
||
| if(NOT DEFINED SOURCE_DIR) | ||
| message(FATAL_ERROR "CleanupStaleEntries.cmake requires SOURCE_DIR") | ||
| endif() | ||
|
|
||
| if(MODE STREQUAL "AIO") | ||
| if(NOT DEFINED FEATURE_PATHS) | ||
| set(FEATURE_PATHS "") | ||
| endif() | ||
|
|
||
| file(GLOB_RECURSE _current_aio_sources LIST_DIRECTORIES FALSE "${SOURCE_DIR}/package/*") | ||
| list(FILTER _current_aio_sources EXCLUDE REGEX "/Tests/") | ||
|
|
||
| foreach(_fpath IN LISTS FEATURE_PATHS) | ||
| if(EXISTS "${_fpath}") | ||
| file(GLOB_RECURSE _tmp LIST_DIRECTORIES FALSE "${_fpath}/*") | ||
| list(FILTER _tmp EXCLUDE REGEX "/Tests/") | ||
| list(APPEND _current_aio_sources ${_tmp}) | ||
| endif() | ||
| endforeach() | ||
|
|
||
| set(_current_aio_rels) | ||
| foreach(_src IN LISTS _current_aio_sources) | ||
| if(_src MATCHES "^${SOURCE_DIR}/package/") | ||
| file(RELATIVE_PATH _rel "${SOURCE_DIR}/package" "${_src}") | ||
| list(APPEND _current_aio_rels "${_rel}") | ||
| else() | ||
| foreach(_fpath IN LISTS FEATURE_PATHS) | ||
| string(FIND "${_src}" "${_fpath}" _is_feature_path) | ||
| if(NOT _is_feature_path EQUAL -1) | ||
| file(RELATIVE_PATH _rel "${_fpath}" "${_src}") | ||
| list(APPEND _current_aio_rels "${_rel}") | ||
| break() | ||
| endif() | ||
| endforeach() | ||
| endif() | ||
| endforeach() | ||
| list(REMOVE_DUPLICATES _current_aio_rels) | ||
|
|
||
| file(GLOB_RECURSE _existing_aio_files LIST_DIRECTORIES FALSE "${AIO_DIR}/*") | ||
| set(_stale_aio_files) | ||
| foreach(_existing IN LISTS _existing_aio_files) | ||
| file(RELATIVE_PATH _rel "${AIO_DIR}" "${_existing}") | ||
| if(NOT _rel MATCHES "^SKSE/Plugins/") | ||
| list(FIND _current_aio_rels "${_rel}" _idx) | ||
| if(_idx EQUAL -1) | ||
| list(APPEND _stale_aio_files "${_existing}") | ||
| endif() | ||
| endif() | ||
| endforeach() | ||
|
|
||
| foreach(_stale IN LISTS _stale_aio_files) | ||
| file(REMOVE "${_stale}") | ||
| endforeach() | ||
|
|
||
| elseif(MODE STREQUAL "SHADERS") | ||
| if(NOT DEFINED FEATURE_SHADER_PATHS) | ||
| set(FEATURE_SHADER_PATHS "") | ||
| endif() | ||
|
|
||
| file(GLOB_RECURSE _package_shaders LIST_DIRECTORIES FALSE "${SOURCE_DIR}/package/Shaders/*") | ||
| list(FILTER _package_shaders EXCLUDE REGEX "/Tests/") | ||
|
|
||
| set(_current_shader_rels) | ||
| foreach(_src IN LISTS _package_shaders) | ||
| file(RELATIVE_PATH _rel "${SOURCE_DIR}/package/Shaders" "${_src}") | ||
| list(APPEND _current_shader_rels "${_rel}") | ||
| endforeach() | ||
|
|
||
| foreach(_shader_path IN LISTS FEATURE_SHADER_PATHS) | ||
| if(EXISTS "${_shader_path}") | ||
| file(GLOB_RECURSE _feat_shaders LIST_DIRECTORIES FALSE "${_shader_path}/*") | ||
| list(FILTER _feat_shaders EXCLUDE REGEX "/Tests/") | ||
| foreach(_src IN LISTS _feat_shaders) | ||
| file(RELATIVE_PATH _rel "${_shader_path}" "${_src}") | ||
| list(APPEND _current_shader_rels "${_rel}") | ||
| endforeach() | ||
| endif() | ||
| endforeach() | ||
| list(REMOVE_DUPLICATES _current_shader_rels) | ||
|
|
||
| file(GLOB_RECURSE _aio_shaders LIST_DIRECTORIES FALSE "${AIO_DIR}/Shaders/*") | ||
| set(_stale_shader_files) | ||
| foreach(_existing IN LISTS _aio_shaders) | ||
| file(RELATIVE_PATH _rel "${AIO_DIR}/Shaders" "${_existing}") | ||
| list(FIND _current_shader_rels "${_rel}" _idx) | ||
| if(_idx EQUAL -1) | ||
| list(APPEND _stale_shader_files "${_existing}") | ||
| endif() | ||
| endforeach() | ||
|
|
||
| foreach(_stale IN LISTS _stale_shader_files) | ||
| file(REMOVE "${_stale}") | ||
| endforeach() | ||
| else() | ||
| message(FATAL_ERROR "CleanupStaleEntries.cmake MODE must be AIO or SHADERS") | ||
| endif() | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.