Skip to content

build: automate ActionScript version project injection#120

Open
zndxcvbn wants to merge 2 commits intomainfrom
version-metadata
Open

build: automate ActionScript version project injection#120
zndxcvbn wants to merge 2 commits intomainfrom
version-metadata

Conversation

@zndxcvbn
Copy link
Copy Markdown
Collaborator

@zndxcvbn zndxcvbn commented Mar 27, 2026

Summary by CodeRabbit

  • Chores
    • Version metadata is centralized and now drives the app’s displayed version and build identifiers, ensuring a single source of truth.
  • Bug Fixes
    • Version and build info is consistently injected into UI components (including splash/version text) so displayed version strings match the release configuration.

@zndxcvbn zndxcvbn marked this pull request as ready for review March 28, 2026 16:37
@doodlum
Copy link
Copy Markdown
Owner

doodlum commented Mar 30, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 30, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 30, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 6a0d40b0-c474-42ee-96d0-c06cb64b078c

📥 Commits

Reviewing files that changed from the base of the PR and between 0c327be and 2b3a46c.

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

📝 Walkthrough

Walkthrough

Centralized version metadata via a new Version.cmake; CMake now sets project version from those variables. The import script conditionally injects version constants into listed ActionScript sources during build. Static version declarations were removed from 17 ActionScript class files.

Changes

Cohort / File(s) Summary
CMake version config
CMakeLists.txt, Version.cmake
Add include(Version.cmake) and set project(SkyUI VERSION ${VER_MAJOR}.${VER_MINOR}). Introduce VER_MAJOR, VER_MINOR, VER_RELEASE_IDX, VER_SUFFIX, and VERSION_METADATA_TARGETS list.
Build/import script
cmake/ImportToSWF.cmake
Pass SKYUI_RELEASE_IDX, SKYUI_VERSION_STRING, and VERSION_METADATA_TARGETS into per-SWF import step. Import script now conditionally injects/overwrites static var version fields into sources listed in VERSION_METADATA_TARGETS; falls back to copy for others. Frame/root sources are always patched for major/minor when defined.
ActionScript classes (version fields removed)
source/actionscript/.../CraftingLists.as, .../CraftingMenu.as, .../FavoritesMenu.as, .../HUDWidgets/WidgetLoader.as, .../ItemMenus/BarterMenu.as, .../ItemMenus/BottomBar.as, .../ItemMenus/ContainerMenu.as, .../ItemMenus/GiftMenu.as, .../ItemMenus/InventoryLists.as, .../ItemMenus/InventoryMenu.as, .../ItemMenus/ItemCard.as, .../ItemMenus/MagicMenu.as, source/actionscript/MapMenu/Map/MapMenu.as, .../ModConfigPanel/ConfigPanel.as, .../ModConfigPanel/SkyUISplash.as, .../PauseMenu/Quest_Journal.as, .../TweenMenu/TweenMenu.as
Removed hardcoded static version variables (SKYUI_RELEASE_IDX, SKYUI_VERSION_MAJOR, SKYUI_VERSION_MINOR, SKYUI_VERSION_STRING) from 17 ActionScript files; some consumers (e.g., SkyUISplash.onLoad) now rely on build-time injection rather than in-source constants.

Sequence Diagram(s)

sequenceDiagram
    participant CMake as CMakeLists
    participant Version as Version.cmake
    participant Import as ImportToSWF.cmake
    participant AS as ActionScript source
    participant SWF as Output SWF

    CMake->>Version: include Version.cmake (VER_MAJOR, VER_MINOR,\nVER_RELEASE_IDX, VER_SUFFIX, VERSION_METADATA_TARGETS)
    CMake->>Import: invoke per-SWF import with -DSKYUI_* and\n-VERSION_METADATA_TARGETS
    Import->>AS: for each source: compute CLASSPATH
    alt CLASSPATH in VERSION_METADATA_TARGETS
        Import->>AS: read file, inject/overwrite static vars:\nSKYUI_RELEASE_IDX, SKYUI_VERSION_MAJOR,\nSKYUI_VERSION_MINOR, SKYUI_VERSION_STRING
    else
        Import->>AS: copy file unchanged
    end
    Import->>SWF: assemble patched sources into SWF
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 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 accurately summarizes the main objective: automating the injection of ActionScript version information into project files during the build process, which is achieved through the new Version.cmake file and modifications to CMakeLists.txt and ImportToSWF.cmake.
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.


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.

@zndxcvbn
Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 31, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown

@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 (1)
Version.cmake (1)

7-25: All metadata targets resolve correctly. The audit confirms each entry matches exactly one file in the stripped-path convention with no lingering SKYUI_* declarations. Consider adding a configure-time check to prevent future mismatches if additional targets are added.

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

In `@Version.cmake` around lines 7 - 25, Add a configure-time validation in
Version.cmake to verify each entry in the VERSION_METADATA_TARGETS list actually
resolves to exactly one file using the stripped-path convention and contains no
leftover SKYUI_* prefixes; specifically iterate over VERSION_METADATA_TARGETS,
check file existence/matching (e.g., with file(GLOB ...) or if(EXISTS ...)
resolution) and fail the configure with a clear error if any entry is missing,
matches multiple files, or contains "SKYUI_" so future additions are validated
at configure time.
🤖 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/ImportToSWF.cmake`:
- Around line 190-205: For targets listed in VERSION_METADATA_TARGETS (found via
CLASSPATH -> _TARGET_INDEX) do not silently fallback to file(COPY_FILE) when the
class regex fails; instead, detect the failed match of _CONTENT and replace the
else branch (the file(COPY_FILE "${SRC}" "${DST}") path) with a failing build
message (e.g., message(FATAL_ERROR "...")) that includes the SOURCE (SRC), DEST
(DST) and CLASSPATH/_TARGET_INDEX context so the build stops and developers can
fix the class declaration or file formatting rather than producing a file
missing the SKYUI_* members; update the else branch handling around the class
injection code that produces _MODIFIED_CONTENT to call message(FATAL_ERROR ...)
with a clear error string.

---

Nitpick comments:
In `@Version.cmake`:
- Around line 7-25: Add a configure-time validation in Version.cmake to verify
each entry in the VERSION_METADATA_TARGETS list actually resolves to exactly one
file using the stripped-path convention and contains no leftover SKYUI_*
prefixes; specifically iterate over VERSION_METADATA_TARGETS, check file
existence/matching (e.g., with file(GLOB ...) or if(EXISTS ...) resolution) and
fail the configure with a clear error if any entry is missing, matches multiple
files, or contains "SKYUI_" so future additions are validated at configure time.
🪄 Autofix (Beta)

✅ Autofix completed


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: e2e03cb7-9ecf-4321-839b-045039286baf

📥 Commits

Reviewing files that changed from the base of the PR and between 9fc5cb6 and 0c327be.

📒 Files selected for processing (20)
  • CMakeLists.txt
  • Version.cmake
  • cmake/ImportToSWF.cmake
  • source/actionscript/CraftingMenu/CraftingLists.as
  • source/actionscript/CraftingMenu/CraftingMenu.as
  • source/actionscript/FavoritesMenu/FavoritesMenu.as
  • source/actionscript/HUDWidgets/WidgetLoader.as
  • source/actionscript/ItemMenus/BarterMenu.as
  • source/actionscript/ItemMenus/BottomBar.as
  • source/actionscript/ItemMenus/ContainerMenu.as
  • source/actionscript/ItemMenus/GiftMenu.as
  • source/actionscript/ItemMenus/InventoryLists.as
  • source/actionscript/ItemMenus/InventoryMenu.as
  • source/actionscript/ItemMenus/ItemCard.as
  • source/actionscript/ItemMenus/MagicMenu.as
  • source/actionscript/MapMenu/Map/MapMenu.as
  • source/actionscript/ModConfigPanel/ConfigPanel.as
  • source/actionscript/ModConfigPanel/SkyUISplash.as
  • source/actionscript/PauseMenu/Quest_Journal.as
  • source/actionscript/TweenMenu/TweenMenu.as
💤 Files with no reviewable changes (17)
  • source/actionscript/CraftingMenu/CraftingLists.as
  • source/actionscript/ItemMenus/BarterMenu.as
  • source/actionscript/ModConfigPanel/SkyUISplash.as
  • source/actionscript/ItemMenus/ContainerMenu.as
  • source/actionscript/HUDWidgets/WidgetLoader.as
  • source/actionscript/ItemMenus/GiftMenu.as
  • source/actionscript/FavoritesMenu/FavoritesMenu.as
  • source/actionscript/TweenMenu/TweenMenu.as
  • source/actionscript/ItemMenus/InventoryMenu.as
  • source/actionscript/ModConfigPanel/ConfigPanel.as
  • source/actionscript/ItemMenus/ItemCard.as
  • source/actionscript/CraftingMenu/CraftingMenu.as
  • source/actionscript/MapMenu/Map/MapMenu.as
  • source/actionscript/ItemMenus/BottomBar.as
  • source/actionscript/PauseMenu/Quest_Journal.as
  • source/actionscript/ItemMenus/MagicMenu.as
  • source/actionscript/ItemMenus/InventoryLists.as

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 31, 2026

Note

Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it.

Fixes Applied Successfully

Fixed 1 file(s) based on 1 unresolved review comment.

Files modified:

  • cmake/ImportToSWF.cmake

Commit: 2b3a46c973e1f0d00e84fe6444cdd1d87e1779af

The changes have been pushed to the version-metadata branch.

Time taken: 2m 38s

Fixed 1 file(s) based on 1 unresolved review comment.

Co-authored-by: CodeRabbit <noreply@coderabbit.ai>
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