Skip to content

build: clean up stale entries in deploy path#2083

Merged
doodlum merged 3 commits into
community-shaders:devfrom
alandtse:stale_entries
Apr 12, 2026
Merged

build: clean up stale entries in deploy path#2083
doodlum merged 3 commits into
community-shaders:devfrom
alandtse:stale_entries

Conversation

@alandtse
Copy link
Copy Markdown
Collaborator

@alandtse alandtse commented Apr 10, 2026

Summary by CodeRabbit

  • Chores
    • Build preparation now removes stale files automatically, producing cleaner build outputs and preventing leftover artifacts.
    • File copy operations are batched and more efficient, speeding up preparation and asset copy steps.
    • Shader staging now detects and cleans removed shaders before repopulating current ones, ensuring the deployed shader set matches source.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 10, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 930a1493-6724-40e9-b22c-a80de30723ea

📥 Commits

Reviewing files that changed from the base of the PR and between 6b636ca and 3585fe0.

📒 Files selected for processing (1)
  • cmake/CleanupStaleEntries.cmake
✅ Files skipped from review due to trivial changes (1)
  • cmake/CleanupStaleEntries.cmake

📝 Walkthrough

Walkthrough

Added a reusable CMake helper to batch copy operations, replaced per-file copy loops with the helper for AIO and shader staging, introduced cmake/CleanupStaleEntries.cmake to remove stale AIO/shader files, and made the cleanup script an explicit dependency of prepare/copy stamp targets.

Changes

Cohort / File(s) Summary
CMakeLists & AIO/Shader staging
CMakeLists.txt
Added append_copy_if_different helper; replaced per-file copy loops for package/feature non-shader and shader content with batched calls; pass escaped FEATURE_PATHS / FEATURE_SHADER_PATHS into cleanup script; add cleanup script as dependency of prepare_aio.stamp and copy_shaders.stamp.
Cleanup script
cmake/CleanupStaleEntries.cmake
New CMake script validating MODE, AIO_DIR, SOURCE_DIR; computes expected relative paths for MODE=AIO or MODE=SHADERS (including optional feature paths) and removes stale files from the AIO output (excludes SKSE/Plugins/ for AIO). FATAL_ERROR on unknown/invalid inputs.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • doodlum

Poem

🐰 I hopped through cmake with nimble cheer,
Batching copies, sending stale files clear,
Feature paths kept safe, shaders rearranged,
A quiet tidy-up — nothing strange,
A happy build, carrots for a cheer.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'build: clean up stale entries in deploy path' accurately summarizes the main change: introducing cleanup functionality for stale files in deployment directories via the new CleanupStaleEntries.cmake script and its integration into the build process.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

No actionable suggestions for changed features.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@CMakeLists.txt`:
- Around line 433-479: The stale-file detection currently runs at configure time
(the file(GLOB_RECURSE _existing_aio_files ...) and similar for _aio_shaders) so
deleted sources aren’t detected until reconfigure; move the globbing and
stale-list computation into a build-step script executed at build time (e.g.
create a CMake script invoked via add_custom_target or add_custom_command that
runs cmake -P) and have that script perform the file(GLOB_RECURSE ...) for
_existing_aio_files and _aio_shaders, compute _stale_aio_rels, and then call
append_remove_paths to populate _prepare_aio_cmds against AIO_DIR so cleanup
runs on every build; update the CMakeLists to call this generated/packaged cmake
-P script instead of performing the globs at configure time.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 5eda6332-a23e-4ba9-8dae-37986291a499

📥 Commits

Reviewing files that changed from the base of the PR and between 6e4cd11 and 9ea9cfc.

📒 Files selected for processing (1)
  • CMakeLists.txt

Comment thread CMakeLists.txt Outdated
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 10, 2026

✅ A pre-release build is available for this PR:
Download

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
cmake/CleanupStaleEntries.cmake (2)

1-103: PR metadata tweak: use scoped conventional title + issue keyword.

Suggested title: build(cmake): clean stale deploy entries
If this fixes a tracked bug, add Fixes #<issue> in the PR body.

As per coding guidelines: “When reviewing PRs, please provide suggestions for Conventional Commit Titles … and Issue References …”.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cmake/CleanupStaleEntries.cmake` around lines 1 - 103, Rename the PR title to
follow conventional commits (e.g., "build(cmake): clean stale deploy entries")
and, if this change fixes a tracked bug, add "Fixes #<issue>" to the PR body;
update the PR metadata for the commit(s touching CleanupStaleEntries.cmake (the
MODE/AIO/SHADERS logic) accordingly so the title and body reflect the
conventional format and include the issue reference.

29-41: Improve path matching logic for future robustness, but note: current code works correctly.

The current string(FIND) approach would fail if feature paths had overlapping substrings (e.g., /features/Feature and /features/FeatureExtra), potentially misclassifying live files as stale. However, actual feature names in the repository contain no such overlaps, so this is not a current bug. The proposed fix using file(RELATIVE_PATH) with ../ checks is still worthwhile as a robustness improvement to future-proof the code against accidental feature name additions that could introduce substring conflicts.

Suggested patch
 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()
+    file(RELATIVE_PATH _rel "${SOURCE_DIR}/package" "${_src}")
+    if(NOT _rel MATCHES "^\\.\\./")
+        list(APPEND _current_aio_rels "${_rel}")
+    else()
+        foreach(_fpath IN LISTS FEATURE_PATHS)
+            file(RELATIVE_PATH _rel "${_fpath}" "${_src}")
+            if(NOT _rel MATCHES "^\\.\\./")
+                list(APPEND _current_aio_rels "${_rel}")
+                break()
+            endif()
+        endforeach()
+    endif()
 endforeach()
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cmake/CleanupStaleEntries.cmake` around lines 29 - 41, Replace the
substring-based path detection (the string(FIND) block) with a robust
relative-path check: for each _fpath in FEATURE_PATHS call file(RELATIVE_PATH
_rel "${_fpath}" "${_src}") and treat the source as belonging to that feature
only if _rel does not start with "../" (i.e., it's not outside the feature
directory), then list(APPEND _current_aio_rels "${_rel}") and break; keep the
outer handling for SOURCE_DIR/package as-is and preserve variable names
_current_aio_sources, _current_aio_rels, FEATURE_PATHS, _src, and _fpath so the
change is localized.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@cmake/CleanupStaleEntries.cmake`:
- Around line 21-25: The FEATURE_PATHS glob is currently adding test directories
into _current_aio_sources; in the foreach over FEATURE_PATHS (variables _fpath
and _current_aio_sources, and the file(GLOB_RECURSE _tmp ...) call) filter out
any paths under a Tests directory before appending. After file(GLOB_RECURSE _tmp
...), run a list(FILTER _tmp EXCLUDE REGEX ".*/Tests/.*") (or equivalent
remove-if-contains logic) so entries matching /Tests/ are excluded, then append
the filtered _tmp into _current_aio_sources.

---

Nitpick comments:
In `@cmake/CleanupStaleEntries.cmake`:
- Around line 1-103: Rename the PR title to follow conventional commits (e.g.,
"build(cmake): clean stale deploy entries") and, if this change fixes a tracked
bug, add "Fixes #<issue>" to the PR body; update the PR metadata for the
commit(s touching CleanupStaleEntries.cmake (the MODE/AIO/SHADERS logic)
accordingly so the title and body reflect the conventional format and include
the issue reference.
- Around line 29-41: Replace the substring-based path detection (the
string(FIND) block) with a robust relative-path check: for each _fpath in
FEATURE_PATHS call file(RELATIVE_PATH _rel "${_fpath}" "${_src}") and treat the
source as belonging to that feature only if _rel does not start with "../"
(i.e., it's not outside the feature directory), then list(APPEND
_current_aio_rels "${_rel}") and break; keep the outer handling for
SOURCE_DIR/package as-is and preserve variable names _current_aio_sources,
_current_aio_rels, FEATURE_PATHS, _src, and _fpath so the change is localized.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 04879247-35a3-4464-8f39-b3d55682cce3

📥 Commits

Reviewing files that changed from the base of the PR and between 9ea9cfc and 6b636ca.

📒 Files selected for processing (2)
  • CMakeLists.txt
  • cmake/CleanupStaleEntries.cmake
🚧 Files skipped from review as they are similar to previous changes (1)
  • CMakeLists.txt

Comment thread cmake/CleanupStaleEntries.cmake
@doodlum doodlum merged commit f4a7ecc into community-shaders:dev Apr 12, 2026
17 checks passed
@coderabbitai coderabbitai Bot mentioned this pull request Apr 12, 2026
6 tasks
YtzyFvra pushed a commit to YtzyFvra/skyrim-community-shaders that referenced this pull request Apr 19, 2026
ParticleTroned pushed a commit to ParticleTroned/skyrim-community-shaders that referenced this pull request May 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants