Skip to content

Conversation

Bill-hbrhbr
Copy link
Contributor

@Bill-hbrhbr Bill-hbrhbr commented Apr 1, 2025

Description

Currently, multiple libraries that we depend on have the following specification:

cmake_minimum_required(3.x)

where 3.x < 3.5. This raises a CMake deprecation error if we use the newest CMake version 4.0.0 (release note), which is now installed by default if we run brew install cmake on macos-15.

Since these third-party dependencies may take some time to upgrade their CMake configurations, we are temporarily locking the CMake version to be below 4.0.0 to avoid compatibility issues with the newer release.

This PR should be reverted once we resolve issue #795 with PR #794.

Checklist

  • The PR satisfies the contribution guidelines.
  • This is a breaking change and that has been indicated in the PR title, OR this isn't a
    breaking change.
  • Necessary docs have been updated, OR no docs need to be updated.

Validation performed

  • No source code changes. Compilation succeeds and unit tests pass as usual.

Summary by CodeRabbit

  • New Features

    • Introduced a new script to verify that the installed CMake version meets compatibility requirements.
    • Updated the macOS installation process to install a specific version of CMake for better component support.
    • Added a new step to check the CMake version in installation scripts for Ubuntu and CentOS.
  • Chores

    • Streamlined installation procedures across supported operating systems with refined command syntax and additional version checks.

Copy link
Contributor

coderabbitai bot commented Apr 1, 2025

Walkthrough

This pull request updates several installation scripts to include a new check for the CMake version by invoking a newly added script, check-cmake-version.sh. For macOS, the script now installs CMake v3.31.6 using a downloaded formula rather than the default Homebrew package. The Ubuntu (focal and jammy) and CentOS (stream-9) scripts have been modified to invoke the CMake version check after executing their respective installation steps. No changes were made to exported or public entities.

Changes

File(s) Change Summary
components/core/.../centos-stream-9/install-all.sh Added a new command to execute ../check-cmake-version.sh with a comment referencing a related GitHub issue.
components/core/.../macos/install-all.sh Modified to install specific CMake version (v3.31.6) using a downloaded formula (via new variable cmake_formula_path), removed the standard brew install, and added a call to ../check-cmake-version.sh.
components/core/.../ubuntu-{focal,jammy}/install-all.sh Updated string interpolation syntax for existing script calls and added a new command to invoke ../check-cmake-version.sh with a GitHub issue comment.
components/core/.../check-cmake-version.sh New script added to check the installed CMake's major version; exits with an error if the version is 4 or higher.

Possibly related PRs

Suggested reviewers

  • kirkrodrigues

📜 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 614688d and cb88d87.

📒 Files selected for processing (1)
  • components/core/tools/scripts/lib_install/check-cmake-version.sh (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • components/core/tools/scripts/lib_install/check-cmake-version.sh
⏰ Context from checks skipped due to timeout of 90000ms (6)
  • GitHub Check: build-macos (macos-14, true)
  • GitHub Check: build-macos (macos-15, true)
  • GitHub Check: build-macos (macos-13, false)
  • GitHub Check: build (macos-latest)
  • GitHub Check: lint-check (macos-latest)
  • GitHub Check: lint-check (ubuntu-latest)

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@Bill-hbrhbr Bill-hbrhbr changed the title fix(cmake): Fix MacOS-15 to use CMake version before 4.0.0. fix(cmake): Lock CMake version to <4.0.0 across all platforms to avoid third-party library compilation issues. Apr 1, 2025
@Bill-hbrhbr Bill-hbrhbr marked this pull request as ready for review April 1, 2025 22:49
@Bill-hbrhbr Bill-hbrhbr requested a review from a team as a code owner April 1, 2025 22:49
Copy link
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: 0

🧹 Nitpick comments (3)
components/core/tools/scripts/lib_install/check-cmake.sh (2)

1-4: Shebang and Error Settings
The script correctly specifies the Bash interpreter and uses set -e to exit on errors. For enhanced robustness, consider adding set -o pipefail so that failures in any part of a pipeline are also caught.


10-14: Version Compatibility Check
The script checks if the major version is 4 or higher and exits with an appropriate error message. As a minor improvement, consider redirecting the error message to standard error to better signal issues. For example:

-  echo "CMake version $cmake_version is not supported (>= 4.0)."
+  echo "CMake version $cmake_version is not supported (>= 4.0)." >&2
components/core/tools/scripts/lib_install/macos/install-all.sh (1)

11-15: Locking CMake Version Installation on macOS
This segment downloads a specific Homebrew formula for CMake v3.31.6 to avoid compatibility issues with yaml-cpp. This is an effective short-term solution. For better maintainability, consider defining the CMake version (e.g. CMAKE_VERSION=3.31.6) at the top of the script so that updates can be managed more easily.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c7d2072 and 0ddd87d.

📒 Files selected for processing (5)
  • components/core/tools/scripts/lib_install/centos-stream-9/install-all.sh (1 hunks)
  • components/core/tools/scripts/lib_install/check-cmake.sh (1 hunks)
  • components/core/tools/scripts/lib_install/macos/install-all.sh (2 hunks)
  • components/core/tools/scripts/lib_install/ubuntu-focal/install-all.sh (1 hunks)
  • components/core/tools/scripts/lib_install/ubuntu-jammy/install-all.sh (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (10)
  • GitHub Check: ubuntu-jammy-static-linked-bins
  • GitHub Check: ubuntu-jammy-lint
  • GitHub Check: ubuntu-jammy-dynamic-linked-bins
  • GitHub Check: centos-stream-9-dynamic-linked-bins
  • GitHub Check: centos-stream-9-static-linked-bins
  • GitHub Check: build-macos (macos-15, true)
  • GitHub Check: build-macos (macos-14, false)
  • GitHub Check: build-macos (macos-13, false)
  • GitHub Check: build-macos (macos-14, true)
  • GitHub Check: build-macos (macos-13, true)
🔇 Additional comments (5)
components/core/tools/scripts/lib_install/check-cmake.sh (1)

6-8: CMake Version Extraction
The extraction of the CMake version using awk and cut is straightforward and should work as intended. No further changes are required here.

components/core/tools/scripts/lib_install/centos-stream-9/install-all.sh (1)

13-15: Integration of CMake Version Check
The addition of the line invoking ${script_dir}/../check-cmake.sh ensures that any installed CMake version is validated before proceeding. Please confirm that the check-cmake.sh script is executable and in the expected location relative to this script.

components/core/tools/scripts/lib_install/ubuntu-focal/install-all.sh (1)

14-15: Enforcing Supported CMake Version
By calling ${script_dir}/../check-cmake.sh, the script now ensures that an unsupported CMake version will trigger an error. The inclusion of a TODO comment (referencing the GitHub issue) is noted; please update or remove it once the issue is resolved.

components/core/tools/scripts/lib_install/ubuntu-jammy/install-all.sh (1)

14-15: CMake Version Validation Added
The new script invocation for ${script_dir}/../check-cmake.sh guarantees a consistent CMake version check across platforms. Ensure that the relative path remains correct as the project evolves.

components/core/tools/scripts/lib_install/macos/install-all.sh (1)

41-43: Post-Installation CMake Version Check
The added invocation of ${script_dir}/../check-cmake.sh at the end of the script ensures that the installed CMake version is verified, maintaining consistency with other platform scripts.

Co-authored-by: kirkrodrigues <2454684+kirkrodrigues@users.noreply.github.com>
Co-authored-by: Junhao Liao <junhao@junhao.ca>
Copy link
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: 0

🧹 Nitpick comments (4)
components/core/tools/scripts/lib_install/check-cmake.sh (2)

10-11: Version Extraction and Unused Variable:
The script correctly extracts the CMake version using cmake --version. However, the variable cmake_major_version (line 11) is assigned but not used later. If the intention is to check the major version numerically, consider using it—for example:

if ! [[ "$cmake_major_version" -lt 4 ]]; then

Alternatively, remove it if it’s unnecessary.

🧰 Tools
🪛 Shellcheck (0.10.0)

[warning] 11-11: cmake_major_version appears unused. Verify use (or export if used externally).

(SC2034)


15-18: Version Comparison Logic:
The conditional uses a string comparison ([[ "$cmake_version" < "4" ]]), which leverages the ASCII-order properties of semantic versions. For improved clarity—especially if only the major version matters—it might be preferable to compare the integer value stored in cmake_major_version.

components/core/tools/scripts/lib_install/macos/install-all.sh (2)

11-16: CMake Installation via Custom Formula:
The script downloads a specific CMake formula and installs CMake v3.31.6 to maintain compatibility with ANTLR and yaml-cpp. As a good-to-have enhancement, consider adding a cleanup step to remove the temporary file (/tmp/cmake.rb) after installation to avoid leaving residual files.


43-45: TODO and Script Invocation:
The new TODO (line 43) referencing GitHub issue #795 is noted—please ensure it is tracked for resolution. The use of script_dir to locate and invoke check-cmake.sh is well executed and enhances script portability.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0ddd87d and 51d88db.

📒 Files selected for processing (2)
  • components/core/tools/scripts/lib_install/check-cmake.sh (1 hunks)
  • components/core/tools/scripts/lib_install/macos/install-all.sh (2 hunks)
🧰 Additional context used
🪛 Shellcheck (0.10.0)
components/core/tools/scripts/lib_install/check-cmake.sh

[warning] 11-11: cmake_major_version appears unused. Verify use (or export if used externally).

(SC2034)

⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: ubuntu-jammy-deps-image
  • GitHub Check: centos-stream-9-deps-image
  • GitHub Check: lint-check (macos-latest)
  • GitHub Check: lint-check (ubuntu-latest)
  • GitHub Check: build-macos (macos-14, false)
  • GitHub Check: build-macos (macos-14, true)
  • GitHub Check: build-macos (macos-13, true)
  • GitHub Check: build-macos (macos-13, false)
🔇 Additional comments (1)
components/core/tools/scripts/lib_install/check-cmake.sh (1)

1-1: Filename Suggestion:
Consider renaming the script to check-cmake-version.sh for enhanced clarity since it explicitly checks the CMake version.

Copy link
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)
components/core/tools/scripts/lib_install/check-cmake-version.sh (2)

3-7: Good Use of Error-Handling Flags.
The script appropriately uses set -e and set -u to exit on errors and to catch undefined variables. For enhanced robustness, consider adding set -o pipefail to ensure that failures in any part of a pipeline are detected.


9-11: Enhance JSON Parsing with jq.
Using jq without the -r flag outputs JSON strings with quotes. It is recommended to use jq -r to obtain raw output, which will yield cleaner version numbers. For example:

-cmake_version=$(cmake -E capabilities | jq ".version.string")
-cmake_major_version=$(cmake -E capabilities | jq ".version.major")
+cmake_version=$(cmake -E capabilities | jq -r ".version.string")
+cmake_major_version=$(cmake -E capabilities | jq -r ".version.major")

This change makes subsequent comparisons and messaging more reliable.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 51d88db and 9ecc868.

📒 Files selected for processing (5)
  • components/core/tools/scripts/lib_install/centos-stream-9/install-all.sh (1 hunks)
  • components/core/tools/scripts/lib_install/check-cmake-version.sh (1 hunks)
  • components/core/tools/scripts/lib_install/macos/install-all.sh (2 hunks)
  • components/core/tools/scripts/lib_install/ubuntu-focal/install-all.sh (1 hunks)
  • components/core/tools/scripts/lib_install/ubuntu-jammy/install-all.sh (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
  • components/core/tools/scripts/lib_install/centos-stream-9/install-all.sh
  • components/core/tools/scripts/lib_install/ubuntu-jammy/install-all.sh
  • components/core/tools/scripts/lib_install/macos/install-all.sh
  • components/core/tools/scripts/lib_install/ubuntu-focal/install-all.sh
⏰ Context from checks skipped due to timeout of 90000ms (6)
  • GitHub Check: build-macos (macos-14, false)
  • GitHub Check: build-macos (macos-13, true)
  • GitHub Check: build-macos (macos-13, false)
  • GitHub Check: lint-check (ubuntu-latest)
  • GitHub Check: lint-check (macos-latest)
  • GitHub Check: build (macos-latest)
🔇 Additional comments (1)
components/core/tools/scripts/lib_install/check-cmake-version.sh (1)

1-2: Proper Shebang Declaration.
The script begins with a correct shebang using /usr/bin/env bash, which ensures portability across systems.

junhaoliao
junhaoliao previously approved these changes Apr 2, 2025
Copy link
Member

@junhaoliao junhaoliao left a comment

Choose a reason for hiding this comment

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

cc @kirkrodrigues

for the PR title, how about

fix(cmake): Lock CMake version to `<4` across all platforms to avoid third-party library compilation issues; Add version check script (fixes #795).

@kirkrodrigues
Copy link
Member

cc @kirkrodrigues

for the PR title, how about

fix(cmake): Lock CMake version to `<4` across all platforms to avoid third-party library compilation issues; Add version check script (fixes #795).

How about

build(core): Lock CMake version to < 4 across all platforms to avoid third-party library compilation issues.
  • Using "build" since it's not really a fix, right? It's more of a mitigation. Same reason we don't include the "fixes #xxx" part.
  • The "core" scope feels more appropriate since we're not really fixing something inside the CMake scripts.
  • Adding the version check script feels like an implementation detail of the PR, so don't think we need to make the PR title that specific.

@Bill-hbrhbr Bill-hbrhbr changed the title fix(cmake): Lock CMake version to <4.0.0 across all platforms to avoid third-party library compilation issues. build(core): Lock CMake version to < 4 across all platforms to avoid third-party library compilation issues. Apr 2, 2025
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