Skip to content

Conversation

@star-hengxing
Copy link
Collaborator

@star-hengxing star-hengxing commented Oct 27, 2025

Summary by CodeRabbit

  • New Features

    • Added a configurable build mode ("releasedbg") to control build type, archive naming, and tooling selection.
    • Switched primary package sources to use git-based versions/aliases.
  • Chores

    • CI matrices and packaging updated to use the new build mode and pass it through build steps.
    • CI workflows: increased swap space during builds, added concurrency/cancel-in-progress, improved artifact upload handling.
    • macOS packaging now exports the SDK path prior to packaging.

@coderabbitai
Copy link

coderabbitai bot commented Oct 27, 2025

Walkthrough

CI matrices replace release with releasedbg across Linux, macOS, and Windows; Linux workflow adds an "Increase Swap Space" step that creates/enables a 16G swap; macOS workflow consolidates LLVM/lld install into one brew install and comments out xmake setup while exporting SDKROOT before xmake config; Windows adds job concurrency cancellation and refines artifact upload; xmake.lua switches LLVM to git URLs, adds git-tagged versions, and replaces a boolean debug config with a string mode mapped to CMake build types.

Changes

Cohort / File(s) Summary
CI — Linux workflow
.github/workflows/linux.yml
Matrix entries changed from build_type: releasebuild_type: releasedbg; adjusted quote styles. Added step "Increase Swap Space" after Setup xmake that runs swapoff, creates a 16G /mnt/swapfile, enables it, and prints swap/disk status.
CI — macOS workflow
.github/workflows/macos.yml
Matrix entries changed from releasereleasedbg. Consolidated LLVM/lld installation into brew install llvm@20 lld@20; removed/commented dedicated Setup xmake block. Package step now exports SDKROOT=$(xcrun --sdk macosx --show-sdk-path) before PATH/xmake config.
CI — Windows workflow
.github/workflows/windows.yml
Matrix entries renamed from releasereleasedbg; added concurrency with cancel-in-progress: true. Quoting adjustments for xmake setup. Package step forwards --mode=${{ matrix.build_type }} to xmake config. Upload artifacts step extended with artifact name, path, compression level, and if-no-files-found handling.
Build system — LLVM package
xmake.lua
Replaced tarball set_urls with git add_urls (alias git) + sparse checkout; added git-tagged versions (git:21.1.4, git:20.1.5); introduced mode config (`debug

Sequence Diagram

sequenceDiagram
    participant CI as CI Matrix
    participant GH as GitHub Actions
    participant Runner as Job Runner
    participant XMake as xmake (llvm)
    participant CMake as CMake

    Note over CI,GH #E8F5E9: matrix entries use build_type = releasedbg / release / debug
    CI->>GH: select matrix entry (matrix.build_type)
    GH->>Runner: start job, pass matrix.build_type
    Runner->>Runner: Setup xmake
    alt Linux job
        Runner->>Runner: Increase Swap Space (swapoff, create /mnt/swapfile 16G, mkswap, swapon, report)
    end
    alt macOS job
        Runner->>Runner: brew install llvm@20 lld@20
        Runner->>Runner: export SDKROOT via xcrun --sdk macosx --show-sdk-path
    end
    alt Windows job
        Runner->>GH: enforce concurrency (cancel-in-progress)
        Runner->>XMake: invoke xmake config --mode=${{ matrix.build_type }}
    else non-Windows job
        Runner->>XMake: invoke xmake config (mode from get_config)
    end
    XMake->>XMake: read package:config("mode") / get_config("mode")
    XMake->>CMake: configure with -DCMAKE_BUILD_TYPE = map(mode)
    Note right of CMake #FFF3E0: Debug / Release / RelWithDebInfo
    CMake->>XMake: build artifacts
    XMake->>GH: upload artifacts (names include mode, compressed)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~30 minutes

  • Pay close attention to xmake.lua changes: git URL + sparse checkout, git-tagged versions, mode config semantics, CMake mapping, and platform-specific flag adjustments.
  • Review CI edits for correctness and safety: Linux swap step (permissions, path, size), macOS brew consolidation and SDKROOT placement, Windows concurrency and artifact upload parameters, and consistent matrix updates across workflows.

Poem

🐇 I nudged a little swap of sixteen,
Builds hum smoother, calm and keen.
Releasedbg hops into the night,
Git tags twinkle, modes set right.
The rabbit cheers — the CI's bright.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title Check ❓ Inconclusive The PR title "21.1.4" is a bare version number that appears in the changeset (specifically as the updated LLVM version in xmake.lua). While technically related to the changes, the title is extremely vague and provides no meaningful context about what the pull request actually accomplishes. A reader scanning PR history would not understand whether this PR adds support for a new LLVM version, updates dependencies, refactors build configuration, or performs other work. The title lacks descriptive information about the changeset's purpose and scope, functioning more as a label than a clear summary of changes. The title should be updated to clearly describe the main changes in the PR. A more descriptive title might be something like "Update LLVM to 21.1.4 and introduce mode-based build configuration" or "Refactor build system to support LLVM 21.1.4 with new build modes" to convey the actual work being done in the changeset.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 21.1.4

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cc1142c and 47aa93c.

📒 Files selected for processing (4)
  • .github/workflows/linux.yml (3 hunks)
  • .github/workflows/macos.yml (4 hunks)
  • .github/workflows/windows.yml (2 hunks)
  • xmake.lua (5 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • .github/workflows/macos.yml
  • .github/workflows/linux.yml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: build (releasedbg, n)
  • GitHub Check: build (debug, n)
  • GitHub Check: build (releasedbg, n)
  • GitHub Check: build (debug, n)
  • GitHub Check: build (releasedbg, MD, n)
🔇 Additional comments (15)
.github/workflows/windows.yml (6)

5-5: LGTM! Minor formatting cleanup.

The spacing change in the branch array is a minor style improvement with no functional impact.


13-18: Verify the commented-out matrix entry is intentional.

The second matrix configuration (releasedbg/MT/lto) is commented out, leaving only one active build configuration. If this is temporary for testing or a permanent reduction in the build matrix, please confirm.


20-22: LGTM! Good addition for CI efficiency.

The concurrency control with cancel-in-progress: true prevents redundant builds and is properly scoped with matrix parameters.


31-32: LGTM! Consistent YAML styling.

Adding quotes around string values is a good practice for YAML consistency.


36-36: LGTM! Critical alignment with xmake.lua mode config.

The --mode flag properly passes the build type to xmake, aligning with the new mode-based configuration system in xmake.lua.


38-44: LGTM! Enhanced artifact upload configuration.

The explicit configuration improves reliability:

  • Descriptive artifact naming with matrix parameters
  • compression-level: 0 is appropriate since files are already compressed as .7z
  • if-no-files-found: error ensures build failure is caught early
xmake.lua (9)

26-26: LGTM! Git-based URL with sparse checkout.

The switch to git-based fetching with sparse checkout is efficient and aligns with the git-based versions defined below.


28-29: LGTM! Git-based version declarations.

The git-based versions properly map to LLVM release tags and align with the git URL strategy.


31-31: LGTM! Well-defined mode configuration.

The mode config is properly declared with clear description, appropriate default ("releasedbg"), and constrained values.


90-99: LGTM! Good resource management for builds.

The configuration changes help prevent OOM issues:

  • LLVM_PARALLEL_LINK_JOBS=1 limits parallel linking
  • CMAKE_JOB_POOL_LINK=console prevents concurrent build and link jobs
  • LLVM_TARGETS_TO_BUILD=Native reduces build scope

These are appropriate for resource-constrained CI environments.


101-106: LGTM! Clean mode-to-CMake-type mapping.

The build_type mapping table cleanly translates the custom mode configuration to appropriate CMake build types. This is a maintainable approach.


110-112: LGTM! Correctly uses mode config for ASAN.

The condition properly uses package:config("mode") == "debug" to enable AddressSanitizer only in debug builds, consistent with the new mode-based configuration.


118-118: LGTM! LLD linker for better link performance.

Using the LLVM lld linker on both Linux and macOS provides faster link times and consistency across platforms.

Also applies to: 123-123


187-187: LGTM! Archive naming aligned with mode config.

Using package:config("mode") in the archive name ensures consistent naming with the new mode-based configuration and makes artifacts easily identifiable.


122-122: Review comment is based on incorrect assumptions about the PR's scope.

The review comment assumes "PR updates to LLVM 21.1.4," but the xmake.lua changes only add support for both LLVM 21.1.4 and 20.1.5—they don't mandate upgrading CI to v21. The macOS CI workflow remains unchanged, still installing llvm@20. The hardcoded path /opt/homebrew/opt/llvm@20/bin/llvm-libtool-darwin matches what the CI environment actually installs, making it correct for this PR. The conditional assumption "if the macOS CI environment installs LLVM 21 instead of LLVM 20" does not apply here.

Likely an incorrect or invalid review comment.


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

Copy link

@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: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
.github/workflows/windows.yml (1)

34-37: Missing --mode causes wrong build type on Windows

Both matrix entries currently build with the package’s default mode (releasedbg). Pass the matrix build_type explicitly.

Apply this diff:

-          xmake config --yes --verbose --runtimes=${{ matrix.runtimes }} --policies=build.optimization.lto:${{ matrix.lto }}
+          xmake config --yes --verbose --mode=${{ matrix.build_type }} --runtimes=${{ matrix.runtimes }} --policies=build.optimization.lto:${{ matrix.lto }}
xmake.lua (1)

98-103: LTO knob is referenced but never defined/passed

package:config("lto") is always nil, so LLVM is built without LTO regardless of the CI matrix. Define and pass an lto config.

Apply these diffs:

  1. Expose lto to the package (near other configs):
-    add_configs("mode", {description = "Build type", default = "releasedbg", type = "string", values = {"debug", "release", "releasedbg"}})
+    add_configs("mode", {description = "Build type", default = "releasedbg", type = "string", values = {"debug", "release", "releasedbg"}})
+    add_configs("lto",  {description = "Enable LTO for LLVM build", default = false, type = "boolean"})
  1. Pass lto from project config into add_requires (top block):
-        mode = get_config("mode"),
+        mode = get_config("mode"),
+        lto  = get_config("lto"),
  1. Update CI to propagate matrix LTO to xmake (Linux/macOS/Windows “Package” step):
- xmake config ... --policies=build.optimization.lto:${{ matrix.lto }}
+ xmake config ... --lto=${{ matrix.lto }} --policies=build.optimization.lto:${{ matrix.lto }}
🧹 Nitpick comments (3)
xmake.lua (3)

91-97: Use canonical CMake build type casing

CMake’s canonical name is RelWithDebInfo. Uppercase usually works, but prefer the standard form to avoid edge cases in tooling.

Apply this diff:

-            ["releasedbg"] = "RELWITHDEBINFO",
+            ["releasedbg"] = "RelWithDebInfo",

168-178: Avoid shadowing the global format function

local format shadows the commonly used formatting helper; it’s easy to misuse later. Rename to archive_ext.

Example change:

-        local format
+        local archive_ext
         if package:is_plat("windows") then
             abi = "msvc"
-            format = ".7z"
+            archive_ext = ".7z"
         elseif package:is_plat("linux") then
             abi = "gnu"
-            format = ".tar.xz"
+            archive_ext = ".tar.xz"
         elseif package:is_plat("macosx") then
             abi = "apple"
-            format = ".tar.xz"
+            archive_ext = ".tar.xz"
         end

And later:

local archive_file = path.join(os.scriptdir(), "build/package", archive_name .. archive_ext)

180-186: Artifact name doesn’t reflect the new “releasedbg” mode

Archive name collapses releasedbg into “release”. Include package:config("mode") to prevent ambiguity.

Minimal tweak:

local archive_name = table.concat({
    package:arch(),
    package:plat(),
    abi,
    package:config("mode")  -- debug | release | releasedbg
}, "-")
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ee743e3 and af44453.

📒 Files selected for processing (4)
  • .github/workflows/linux.yml (1 hunks)
  • .github/workflows/macos.yml (1 hunks)
  • .github/workflows/windows.yml (1 hunks)
  • xmake.lua (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
  • GitHub Check: build (release, y)
  • GitHub Check: build (release, y)
  • GitHub Check: build (releasedbg, n)
  • GitHub Check: build (debug, n)
  • GitHub Check: build (releasedbg, n)
  • GitHub Check: build (releasedbg, MD, n)
  • GitHub Check: build (release, MT, y)
  • GitHub Check: build (debug, n)
🔇 Additional comments (5)
.github/workflows/linux.yml (1)

13-18: Matrix change to releasedbg looks good

Aligns with xmake.lua’s new mode mapping; --mode=${{ matrix.build_type }} already propagates it. No further action.

.github/workflows/macos.yml (1)

13-18: Consistent switch to releasedbg

Matches the new mode-driven build; --mode=${{ matrix.build_type }} ensures correct CMake build type.

.github/workflows/windows.yml (1)

9-9: Confirm runner image availability

Please verify runs-on: windows-2025 is available in your org; fallback is commonly windows-2022.

xmake.lua (2)

6-9: Mode propagation into package configs — LGTM

mode = get_config("mode") plus add_configs("mode", ...) correctly wires debug/release/releasedbg through.


27-31: Versioning and default mode — LGTM

Git-tagged versions and default mode "releasedbg" look correct.

Copy link

@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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
xmake.lua (2)

19-22: Sparse checkout not respecting custom mode config.

The sparse checkout list uses is_mode("debug") to conditionally include runtimes and compiler-rt, but this checks the xmake mode (-m debug) rather than the custom mode config (--mode=debug). This means --mode=debug won't include these directories in the sparse checkout, which could cause build failures when ASAN is needed.

Update to use the custom mode config:

 -- Enable asan
-if is_mode("debug") then
+if get_config("mode") == "debug" then
     table.insert(sparse_checkout_list, "runtimes")
     table.insert(sparse_checkout_list, "compiler-rt")
 end

108-114: ASAN enablement not respecting custom mode config.

Line 108 uses package:is_debug() which reads the debug config set at line 7. Since line 7 uses is_mode("debug") instead of checking the custom mode config, ASAN won't be enabled when building with --mode=debug unless -m debug is also set.

This is a consequence of the inconsistency flagged at lines 6-9.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between af44453 and 2ba811b.

📒 Files selected for processing (2)
  • .github/workflows/windows.yml (2 hunks)
  • xmake.lua (4 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
  • GitHub Check: build (releasedbg, n)
  • GitHub Check: build (release, y)
  • GitHub Check: build (debug, n)
  • GitHub Check: build (release, MT, y)
  • GitHub Check: build (debug, n)
  • GitHub Check: build (releasedbg, n)
  • GitHub Check: build (release, y)
  • GitHub Check: build (releasedbg, MD, n)
🔇 Additional comments (6)
.github/workflows/windows.yml (2)

13-18: LGTM! Matrix configuration aligns with new mode-based build system.

The updated matrix correctly defines two build variants with the new releasedbg mode, and the configurations are appropriate for each variant.


36-36: LGTM! Mode flag correctly passed to xmake.

The --mode=${{ matrix.build_type }} flag properly passes the build type to xmake, which aligns with the new mode configuration in xmake.lua.

xmake.lua (4)

25-28: LGTM! Git-based versioning correctly configured.

The switch to git URLs with sparse checkout and the addition of versioned git tags is appropriate and correctly formatted.


30-30: Verify default mode choice.

The new mode config defaults to "releasedbg" (RelWithDebInfo). Most projects default to "release". While this provides better debugging experience with optimizations, ensure this aligns with your intended default build behavior.


91-96: LGTM! Build type mapping is correct.

The mapping from mode values to CMAKE_BUILD_TYPE is accurate:

  • debug → Debug
  • release → Release
  • releasedbg → RelWithDebInfo

184-185: LGTM! Archive naming correctly uses custom mode config.

The archive naming correctly references package:config("mode") to include the build type in the filename.

Copy link

@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

♻️ Duplicate comments (1)
xmake.lua (1)

6-9: Inconsistency between custom mode config and xmake mode checks.

The same issue flagged in the previous review remains: line 6 uses get_config("mode") while lines 7-8 still use is_mode("debug"). These check different things, causing debug and shared to remain false even when --mode=debug is passed.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2618381 and cc1142c.

📒 Files selected for processing (2)
  • .github/workflows/linux.yml (2 hunks)
  • xmake.lua (5 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/linux.yml
🔇 Additional comments (6)
xmake.lua (6)

26-31: LGTM!

The migration to git URLs with sparse checkout is properly configured, and the new mode config correctly defines the three build types with a sensible default of "releasedbg".


90-99: LGTM!

The OOM mitigation flags (LLVM_PARALLEL_LINK_JOBS=1 and CMAKE_JOB_POOL_LINK=console) and native-only target build are sensible additions that align with the Linux workflow's swap space increase.


101-106: LGTM!

The build type mapping correctly translates the custom mode values to CMake build types, and the implementation properly uses package:config("mode").


110-112: LGTM!

The ASAN check correctly uses package:config("mode") for consistency with the new mode-driven build approach.


186-186: LGTM!

The archive naming correctly uses package:config("mode") for consistency with the new mode-driven build approach.


119-122: Verify hardcoded libtool path is appropriate for your build environments.

The hardcoded path /opt/homebrew/opt/llvm@20/bin/llvm-libtool-darwin appears only once in the codebase with no fallback mechanism. Confirm this is:

  • Intentional for CI-only or all macOS builds
  • Documented in build/setup instructions
  • Acceptable if llvm@20 is not installed in local development environments

If this should work across different environments, consider detecting or making this path configurable.

@16bit-ykiko 16bit-ykiko merged commit de49d1f into main Nov 1, 2025
6 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Nov 1, 2025
@16bit-ykiko 16bit-ykiko deleted the 21.1.4 branch November 1, 2025 18:22
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.

3 participants