build: force AIO rebuild on HEAD change or manual delete#2251
Conversation
When git HEAD changes (branch switch or new commit), wipe the entire AIO directory and clear all deploy/prepare stamps so cmake --build re-copies every file with a fresh timestamp. Without this, copy_if_different leaves content-identical files with old timestamps that a manual package install's newer timestamps beat under robocopy /XO, silently preventing deployment. Also add an always-on configure-time guard: if AIO_DIR is missing (e.g. after a manual delete), clear prepare_aio.stamp and copy_shaders.stamp so PREPARE_AIO unconditionally reruns on the next cmake --build. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
📝 WalkthroughWalkthroughCMakeLists.txt now includes proactive cache invalidation logic that removes stamp files when the AIO directory is missing or when the git HEAD changes, forcing re-execution of AIO preparation and shader copying build targets. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Review rate limit: 9/10 reviews remaining, refill in 6 minutes. Comment |
|
No actionable suggestions for changed features. |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
CMakeLists.txt (1)
613-619: ⚡ Quick winUse
${GIT_EXECUTABLE}here instead of assuminggitis onPATH.This
execute_process()bypasses the earlierfind_package(Git)result. On setups where CMake resolved Git but the shell cannot invoke plaingit, HEAD-change invalidation becomes a no-op.Proposed fix
- execute_process( - COMMAND git rev-parse --short HEAD - WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" - OUTPUT_VARIABLE _git_head - ERROR_QUIET - OUTPUT_STRIP_TRAILING_WHITESPACE - ) + set(_git_head "") + if(GIT_FOUND) + execute_process( + COMMAND "${GIT_EXECUTABLE}" rev-parse --short HEAD + WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" + OUTPUT_VARIABLE _git_head + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + endif()🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@CMakeLists.txt` around lines 613 - 619, The execute_process call that runs "git rev-parse --short HEAD" should use the Git executable discovered by find_package(Git) instead of the literal "git"; update the COMMAND in the execute_process invocation that sets OUTPUT_VARIABLE _git_head to use ${GIT_EXECUTABLE} so the logic respects the earlier find_package(Git) resolution and avoids PATH-related failures.
🤖 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 497-505: When clearing the AIO_DIR stamps, also restage the plugin
binary so PREPARE_AIO will include $<TARGET_FILE:${PROJECT_NAME}> and
$<TARGET_PDB_FILE:${PROJECT_NAME}>: alongside removing prepare_aio.stamp and
copy_shaders.stamp, delete or touch the stamp/outputs that track
${PROJECT_NAME}’s staging (so its POST_BUILD/copy step will re-run), or
explicitly remove the staged plugin files so PREPARE_AIO will re-copy them;
apply the same change for the duplicate block referenced around lines 639-648
(same PREPARE_AIO/copy_shaders handling).
---
Nitpick comments:
In `@CMakeLists.txt`:
- Around line 613-619: The execute_process call that runs "git rev-parse --short
HEAD" should use the Git executable discovered by find_package(Git) instead of
the literal "git"; update the COMMAND in the execute_process invocation that
sets OUTPUT_VARIABLE _git_head to use ${GIT_EXECUTABLE} so the logic respects
the earlier find_package(Git) resolution and avoids PATH-related failures.
🪄 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 Plus
Run ID: 35acd99d-4e65-4ffb-8853-8f24c94f24d5
📒 Files selected for processing (1)
CMakeLists.txt
| # If AIO was manually (or programmatically) deleted, the stamp is stale — | ||
| # clear it so cmake --build re-runs PREPARE_AIO to recreate the directory. | ||
| if(NOT EXISTS "${AIO_DIR}") | ||
| file( | ||
| REMOVE | ||
| "${CMAKE_CURRENT_BINARY_DIR}/prepare_aio.stamp" | ||
| "${CMAKE_CURRENT_BINARY_DIR}/copy_shaders.stamp" | ||
| ) | ||
| endif() |
There was a problem hiding this comment.
Restage the plugin binary when you invalidate ${AIO_DIR}.
Deleting ${AIO_DIR} and only clearing the stamp files reruns PREPARE_AIO, but that target does not copy $<TARGET_FILE:${PROJECT_NAME}> / $<TARGET_PDB_FILE:${PROJECT_NAME}> back into AIO. If ${PROJECT_NAME} is already up to date after a branch switch or manual delete, its POST_BUILD hook will not fire, so the recreated AIO folder/archive can be missing the plugin binary.
Proposed fix
list(
APPEND _prepare_aio_cmds
COMMAND
${CMAKE_COMMAND}
-E
make_directory
"${AIO_DIR}/SKSE/Plugins"
+ COMMAND
+ ${CMAKE_COMMAND}
+ -E
+ copy_if_different
+ "$<TARGET_FILE:${PROJECT_NAME}>"
+ "${AIO_DIR}/SKSE/Plugins/$<TARGET_FILE_NAME:${PROJECT_NAME}>"
+ COMMAND
+ ${CMAKE_COMMAND}
+ -E
+ copy_if_different
+ "$<TARGET_PDB_FILE:${PROJECT_NAME}>"
+ "${AIO_DIR}/SKSE/Plugins/$<TARGET_PDB_FILE_NAME:${PROJECT_NAME}>"
)Also applies to: 639-648
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@CMakeLists.txt` around lines 497 - 505, When clearing the AIO_DIR stamps,
also restage the plugin binary so PREPARE_AIO will include
$<TARGET_FILE:${PROJECT_NAME}> and $<TARGET_PDB_FILE:${PROJECT_NAME}>: alongside
removing prepare_aio.stamp and copy_shaders.stamp, delete or touch the
stamp/outputs that track ${PROJECT_NAME}’s staging (so its POST_BUILD/copy step
will re-run), or explicitly remove the staged plugin files so PREPARE_AIO will
re-copy them; apply the same change for the duplicate block referenced around
lines 639-648 (same PREPARE_AIO/copy_shaders handling).
|
✅ A pre-release build is available for this PR: |
…haders#2251) Adapted from PR community-shaders#2251 onto this branch's AIO/deploy stamp layout.
…haders#2251) Adapted from PR community-shaders#2251 onto this branch's AIO/deploy stamp layout.
Summary
cmake --buildre-copies every file with a fresh timestampAIO_DIRis missing (manual delete), clearprepare_aio.stampandcopy_shaders.stampsoPREPARE_AIOunconditionally reruns on the next buildProblem
copy_if_differentskips content-identical files, leaving them with old timestamps. A manual package install gives deployed files a newer timestamp than those stale AIO files, causing robocopy/XOto silently skip them — deployed shaders stay wrong even after a full rebuild.Test plan
BuildRelease.bat— AIO should be recreated and all files deployedBuildRelease.bat— AIO should be wiped and redeployed from scratch/XO🤖 Generated with Claude Code
Summary by CodeRabbit
Release Notes