Skip to content

Conversation

@artikell
Copy link
Contributor

@artikell artikell commented Mar 29, 2025

Summary by CodeRabbit

  • Chores
    • Enhanced third-party dependency management to improve offline build support by disabling update steps in external projects.
    • Updated build commands to leverage the Ninja build system and improved verbosity options.
    • Refined continuous integration workflows with improved tool installation and clean build processes.
    • Adjusted internal dependency declarations for better integration of key components.
    • Configured CCache for improved build performance by caching previous compilations.

@coderabbitai
Copy link

coderabbitai bot commented Mar 29, 2025

Walkthrough

This pull request updates multiple CMake configuration files to add or modify the UPDATE_COMMAND "" parameter in the ExternalProject_Add function calls for various external projects, explicitly disabling update steps. Several files also include redundant or repositioned GIT_SHALLOW true declarations. The build script is enhanced by introducing a new variable for CMake build flags, adjusting verbose output handling, and adding support for the Ninja build system. The raft library’s dependency list is expanded to include braft and brpc. The CI workflow is updated to install additional tools (clang-format, ninja-build, clang) and to run the build script with the --ninja --verbose flags.

Changes

File(s) Change Summary
cmake/braft.cmake, cmake/brpc.cmake, cmake/gtest.cmake, cmake/leveldb.cmake, cmake/rocksdb.cmake, cmake/snappy.cmake, cmake/zlib.cmake, cmake/zstd.cmake Added UPDATE_COMMAND "" to explicitly disable update commands; some files added or repositioned redundant GIT_SHALLOW true parameters.
cmake/fmt.cmake, cmake/gflags.cmake, cmake/lz4.cmake, cmake/protobuf.cmake, cmake/spdlog.cmake Added or repositioned UPDATE_COMMAND "" to disable update commands.
cmake/gtest.cmake Added UPDATE_COMMAND "", removed duplicate GIT_SHALLOW true, and extended BUILD_BYPRODUCTS to include ${GTEST_MAIN_LIBRARIES}.
cmake/protobuf.cmake Reintroduced UPDATE_COMMAND "" at a different position and updated BUILD_BYPRODUCTS from ${LIB_PROTOBUF} to ${PROTOBUF_LIBRARY}.
etc/script/build.sh Introduced CMAKE_BUILD_FLAGS variable; updated CMake invocation to include build flags and Ninja generator; changed verbose flag handling.
src/raft/CMakeLists.txt Added braft and brpc to the ADD_DEPENDENCIES list for the raft target.
.github/workflows/kiwidb.yml Added installation of clang-format (macOS), ninja-build and clang (Ubuntu); modified build steps to run build script with --ninja --verbose flags.
cmake/findTools.cmake Added detection of ccache and configured CMake to use it for compile and link commands.

Sequence Diagram(s)

sequenceDiagram
    participant CMake as CMake Config
    participant EP as ExternalProject_Add
    participant Build as Build Process
    CMake->>EP: Invoke ExternalProject_Add with parameters
    EP-->>CMake: Process GIT_SHALLOW & UPDATE_COMMAND settings
    CMake->>Build: Continue configuration and build steps
Loading
sequenceDiagram
    participant CI as GitHub Actions Runner
    participant Script as build.sh
    participant CMake as CMake
    CI->>Script: Execute build.sh with --ninja --verbose
    Script->>CMake: Configure project with "-G Ninja" and flags
    CMake->>Script: Process external dependencies and build targets
    Script-->>CI: Return build outcome
Loading

Suggested labels

✏️ Feature

Suggested reviewers

  • lqxhub
  • AlexStocks
  • marsevilspirit

Poem

I’m a little rabbit, hopping with glee,
In a maze of CMake changes, so spry and free.
Ninja builds whisper in the moonlit code,
Dependencies join where new flags are bestowed.
My whiskers twitch with every update's art,
Celebrating our code and its ever-jumping heart!
🐇💻

Tip

⚡💬 Agentic Chat (Pro Plan, General Availability)
  • We're introducing multi-step agentic chat in review comments and issue comments, within and outside of PR's. This feature enhances review and issue discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments and add commits to existing pull requests.

📜 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 7f8a981 and 519b2a8.

📒 Files selected for processing (15)
  • .github/workflows/kiwidb.yml (3 hunks)
  • cmake/braft.cmake (1 hunks)
  • cmake/brpc.cmake (1 hunks)
  • cmake/findTools.cmake (1 hunks)
  • cmake/fmt.cmake (1 hunks)
  • cmake/gflags.cmake (1 hunks)
  • cmake/gtest.cmake (2 hunks)
  • cmake/leveldb.cmake (1 hunks)
  • cmake/lz4.cmake (1 hunks)
  • cmake/protobuf.cmake (2 hunks)
  • cmake/rocksdb.cmake (1 hunks)
  • cmake/snappy.cmake (1 hunks)
  • cmake/spdlog.cmake (1 hunks)
  • cmake/zlib.cmake (1 hunks)
  • cmake/zstd.cmake (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (15)
  • cmake/fmt.cmake
  • cmake/braft.cmake
  • cmake/snappy.cmake
  • cmake/spdlog.cmake
  • cmake/findTools.cmake
  • cmake/brpc.cmake
  • cmake/gflags.cmake
  • cmake/leveldb.cmake
  • cmake/lz4.cmake
  • cmake/zlib.cmake
  • cmake/zstd.cmake
  • cmake/rocksdb.cmake
  • cmake/gtest.cmake
  • cmake/protobuf.cmake
  • .github/workflows/kiwidb.yml
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build_on_macos

🪧 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 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.

@artikell artikell changed the title Fix cmake issues and support ninja fix: cmake issues and support ninja Mar 29, 2025
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: 10

🧹 Nitpick comments (6)
cmake/gtest.cmake (1)

18-18: Remove redundant GIT_SHALLOW parameter.

This GIT_SHALLOW true declaration is redundant as it's already specified at line 16. Duplicate parameters in CMake's ExternalProject_Add can cause confusion and potential issues in future maintenance.

- GIT_SHALLOW true
cmake/braft.cmake (1)

27-27: Remove redundant GIT_SHALLOW parameter.

This GIT_SHALLOW true declaration is redundant as it's already specified at line 25. Duplicate parameters in CMake's ExternalProject_Add can cause confusion and potential issues in future maintenance.

- GIT_SHALLOW true
cmake/zlib.cmake (2)

17-17: Remove redundant GIT_SHALLOW parameter.

This GIT_SHALLOW true declaration is redundant as it's already specified at line 15. Duplicate parameters in CMake's ExternalProject_Add can cause confusion.

- GIT_SHALLOW true

18-18: Note possible redundancy with UPDATE_COMMAND.

While adding UPDATE_DISCONNECTED 1 is generally beneficial, note that line 30 already sets UPDATE_COMMAND "" which effectively disables updates completely. Consider whether both parameters are necessary in this case.

etc/script/build.sh (1)

76-76: Consider making Ninja generator optional

The script now enforces Ninja as the CMake generator, but it doesn't check if Ninja is installed on the system. This could lead to build failures if Ninja isn't available.

Consider either:

  1. Adding a check for Ninja availability
  2. Making the generator configurable via a command-line option
-          ${CMAKE_FLAGS} -G Ninja -S . -B ${PREFIX}
+          ${CMAKE_FLAGS} ${CMAKE_GENERATOR:+-G $CMAKE_GENERATOR} -S . -B ${PREFIX}

And then add a new option in the script:

+  --ninja)
+    CMAKE_GENERATOR="Ninja"
+    ;;
cmake/brpc.cmake (1)

26-27: Remove redundant GIT_SHALLOW parameter

The GIT_SHALLOW true parameter is only applicable when using GIT_REPOSITORY and GIT_TAG for Git-based downloads. Since this project uses URL-based download (lines 20-24), the GIT_SHALLOW parameter has no effect and should be removed to avoid confusion.

-        GIT_SHALLOW true
         UPDATE_DISCONNECTED 1

The UPDATE_DISCONNECTED 1 parameter is appropriate as it allows builds to proceed when offline.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 04b5c06 and fd59c33.

📒 Files selected for processing (15)
  • cmake/braft.cmake (1 hunks)
  • cmake/brpc.cmake (1 hunks)
  • cmake/fmt.cmake (1 hunks)
  • cmake/gflags.cmake (1 hunks)
  • cmake/gtest.cmake (2 hunks)
  • cmake/leveldb.cmake (1 hunks)
  • cmake/lz4.cmake (1 hunks)
  • cmake/protobuf.cmake (2 hunks)
  • cmake/rocksdb.cmake (1 hunks)
  • cmake/snappy.cmake (1 hunks)
  • cmake/spdlog.cmake (1 hunks)
  • cmake/zlib.cmake (1 hunks)
  • cmake/zstd.cmake (1 hunks)
  • etc/script/build.sh (1 hunks)
  • src/raft/CMakeLists.txt (2 hunks)
🔇 Additional comments (6)
cmake/gtest.cmake (2)

19-19: LGTM! Adding UPDATE_DISCONNECTED is beneficial.

The UPDATE_DISCONNECTED 1 parameter allows builds to proceed without network connectivity after the initial download, which is great for CI environments or offline development.


30-30: LGTM! Proper declaration of all build byproducts.

Including both ${GTEST_LIBRARIES} and ${GTEST_MAIN_LIBRARIES} in BUILD_BYPRODUCTS correctly informs the build system about all artifacts generated by this target. This is particularly important for Ninja and other generators that need to know all outputs in advance.

cmake/protobuf.cmake (2)

37-37: LGTM! Adding UPDATE_DISCONNECTED is beneficial.

The UPDATE_DISCONNECTED 1 parameter allows builds to proceed without network connectivity after the initial download.


52-52: LGTM! Improved variable consistency in BUILD_BYPRODUCTS.

Using ${PROTOBUF_LIBRARY} in BUILD_BYPRODUCTS is better than using the direct path as it maintains consistency with the variable defined at line 18.

cmake/braft.cmake (1)

28-28: LGTM! Adding UPDATE_DISCONNECTED is beneficial.

The UPDATE_DISCONNECTED 1 parameter allows builds to proceed without network connectivity after the initial download, which is useful for CI environments or offline development.

src/raft/CMakeLists.txt (1)

53-53: LGTM: Dependencies properly added

Adding braft and brpc as dependencies for the raft library is appropriate if the RAFT functionality depends on these components.

GIT_SHALLOW true
UPDATE_DISCONNECTED 1
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Misplaced GIT_SHALLOW parameter for URL-based download

The GIT_SHALLOW true parameter is only applicable for git-based downloads, but this project is using URL-based download (not git clone). This parameter will have no effect here and should be removed.

The UPDATE_DISCONNECTED 1 parameter is beneficial for offline builds, but note that it may conflict with the existing UPDATE_COMMAND "" at line 44, which already effectively disables the update step.

         DOWNLOAD_DIR "${CMAKE_CURRENT_SOURCE_DIR}/download"
         DOWNLOAD_NAME "gflags-2.2.2.zip"
         SOURCE_DIR ${GFLAGS_SOURCES_DIR}
-        GIT_SHALLOW true
         UPDATE_DISCONNECTED 1
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
GIT_SHALLOW true
UPDATE_DISCONNECTED 1
DOWNLOAD_DIR "${CMAKE_CURRENT_SOURCE_DIR}/download"
DOWNLOAD_NAME "gflags-2.2.2.zip"
SOURCE_DIR ${GFLAGS_SOURCES_DIR}
UPDATE_DISCONNECTED 1

GIT_SHALLOW true
UPDATE_DISCONNECTED 1
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Misplaced GIT_SHALLOW parameter for URL-based download

The GIT_SHALLOW true parameter is only applicable for git-based downloads, but this project is using URL-based download as shown by the URL and URL_HASH parameters (not git clone). This parameter will have no effect here and should be removed.

The UPDATE_DISCONNECTED 1 parameter is beneficial for offline builds where network connectivity isn't available during build time.

         SOURCE_DIR ${SPDLOG_SOURCES_DIR}
         DOWNLOAD_NO_PROGRESS 1
-        GIT_SHALLOW true
         UPDATE_DISCONNECTED 1
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
GIT_SHALLOW true
UPDATE_DISCONNECTED 1
SOURCE_DIR ${SPDLOG_SOURCES_DIR}
DOWNLOAD_NO_PROGRESS 1
UPDATE_DISCONNECTED 1

cmake/zstd.cmake Outdated
GIT_SHALLOW true
UPDATE_DISCONNECTED 1
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

GIT_SHALLOW parameter is not applicable with URL downloads

The GIT_SHALLOW true parameter is only effective when using GIT_REPOSITORY to clone a Git repository. Since this ExternalProject is configured with URL to download a tarball (not a Git repository), the GIT_SHALLOW parameter will have no effect.

Additionally, the UPDATE_DISCONNECTED 1 parameter is redundant since the configuration already includes UPDATE_COMMAND "" on line 35, which prevents any updates from occurring.

-        GIT_SHALLOW true
-        UPDATE_DISCONNECTED 1
+        UPDATE_DISCONNECTED 1

Committable suggestion skipped: line range outside the PR's diff.

cmake/lz4.cmake Outdated
GIT_SHALLOW true
UPDATE_DISCONNECTED 1
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

GIT_SHALLOW parameter is not applicable with URL downloads

The GIT_SHALLOW true parameter is only effective when using GIT_REPOSITORY to clone a Git repository. Since this ExternalProject is configured with URL to download a tarball (not a Git repository), the GIT_SHALLOW parameter will have no effect.

Additionally, the UPDATE_DISCONNECTED 1 parameter is redundant since the configuration already includes UPDATE_COMMAND "" on line 35, which prevents any updates from occurring.

-        GIT_SHALLOW true
-        UPDATE_DISCONNECTED 1
+        UPDATE_DISCONNECTED 1

Committable suggestion skipped: line range outside the PR's diff.

DOWNLOAD_NAME "protobuf-3.18.0.tar.gz"
SOURCE_DIR ${PROTOBUF_SOURCES_DIR}
DOWNLOAD_NO_PROGRESS 1
GIT_SHALLOW true
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Remove inappropriate GIT_SHALLOW parameter.

The GIT_SHALLOW true parameter has no effect here and should be removed as this project is downloaded via URL (lines 30-33) rather than Git. This parameter only applies to repositories fetched with GIT_REPOSITORY.

- GIT_SHALLOW true
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
GIT_SHALLOW true

PRIVATE ${GFLAGS_LIBRARY}
PRIVATE ${ROCKSDB_LIBRARIES}
PRIVATE z
PRIVATE ${BRAFT_INCLUDE_DIR}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix incorrect linking against include directory

${BRAFT_INCLUDE_DIR} appears to be an include directory path (based on its name), not a library. It should not be included in TARGET_LINK_LIBRARIES. Include directories should be specified with TARGET_INCLUDE_DIRECTORIES instead.

-       PRIVATE ${BRAFT_INCLUDE_DIR}

If you meant to link against a specific BRAFT library, please use the correct library variable instead.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
PRIVATE ${BRAFT_INCLUDE_DIR}

@artikell artikell force-pushed the cmake_support_ninja branch 2 times, most recently from 9ab5278 to 324ee0c Compare March 29, 2025 18:29
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

🧹 Nitpick comments (1)
.github/workflows/kiwidb.yml (1)

109-112: Ninja installation for Ubuntu environment is implemented correctly, with a minor enhancement suggested.
The new "Install Ninja" step using sudo apt install -y ninja-build correctly ensures that Ninja is available in the Ubuntu CI environment. Consider adding an apt update command (e.g., sudo apt update) before the installation command to ensure the package index is current, which can help avoid potential package installation issues.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 9ab5278 and 324ee0c.

📒 Files selected for processing (16)
  • .github/workflows/kiwidb.yml (2 hunks)
  • cmake/braft.cmake (1 hunks)
  • cmake/brpc.cmake (1 hunks)
  • cmake/fmt.cmake (1 hunks)
  • cmake/gflags.cmake (1 hunks)
  • cmake/gtest.cmake (2 hunks)
  • cmake/leveldb.cmake (1 hunks)
  • cmake/lz4.cmake (1 hunks)
  • cmake/protobuf.cmake (2 hunks)
  • cmake/rocksdb.cmake (1 hunks)
  • cmake/snappy.cmake (1 hunks)
  • cmake/spdlog.cmake (1 hunks)
  • cmake/zlib.cmake (1 hunks)
  • cmake/zstd.cmake (1 hunks)
  • etc/script/build.sh (2 hunks)
  • src/raft/CMakeLists.txt (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (15)
  • cmake/zstd.cmake
  • cmake/braft.cmake
  • cmake/spdlog.cmake
  • cmake/gflags.cmake
  • cmake/snappy.cmake
  • etc/script/build.sh
  • cmake/leveldb.cmake
  • cmake/lz4.cmake
  • cmake/zlib.cmake
  • cmake/protobuf.cmake
  • cmake/brpc.cmake
  • cmake/gtest.cmake
  • cmake/rocksdb.cmake
  • src/raft/CMakeLists.txt
  • cmake/fmt.cmake
🔇 Additional comments (1)
.github/workflows/kiwidb.yml (1)

52-52: Ninja installation for MacOS environment is added correctly.
The addition of brew install ninja in the "build_on_macos" job ensures that the Ninja build system is available on macOS, which aligns with the overall PR objective to support Ninja.

@artikell artikell force-pushed the cmake_support_ninja branch 4 times, most recently from 1e44531 to 7e0d323 Compare March 29, 2025 19:12
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

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 1e44531 and 7e0d323.

📒 Files selected for processing (16)
  • .github/workflows/kiwidb.yml (3 hunks)
  • cmake/braft.cmake (1 hunks)
  • cmake/brpc.cmake (1 hunks)
  • cmake/fmt.cmake (1 hunks)
  • cmake/gflags.cmake (1 hunks)
  • cmake/gtest.cmake (2 hunks)
  • cmake/leveldb.cmake (1 hunks)
  • cmake/lz4.cmake (1 hunks)
  • cmake/protobuf.cmake (2 hunks)
  • cmake/rocksdb.cmake (1 hunks)
  • cmake/snappy.cmake (1 hunks)
  • cmake/spdlog.cmake (1 hunks)
  • cmake/zlib.cmake (1 hunks)
  • cmake/zstd.cmake (1 hunks)
  • etc/script/build.sh (2 hunks)
  • src/raft/CMakeLists.txt (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (15)
  • cmake/zstd.cmake
  • cmake/fmt.cmake
  • cmake/gflags.cmake
  • cmake/spdlog.cmake
  • cmake/braft.cmake
  • cmake/snappy.cmake
  • cmake/zlib.cmake
  • cmake/leveldb.cmake
  • cmake/protobuf.cmake
  • cmake/lz4.cmake
  • cmake/brpc.cmake
  • src/raft/CMakeLists.txt
  • cmake/rocksdb.cmake
  • etc/script/build.sh
  • .github/workflows/kiwidb.yml
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: build_on_ubuntu
  • GitHub Check: build_on_macos
🔇 Additional comments (1)
cmake/gtest.cmake (1)

30-30: LGTM! Improved Ninja compatibility with complete BUILD_BYPRODUCTS.

The addition of ${GTEST_MAIN_LIBRARIES} to the BUILD_BYPRODUCTS parameter is essential for proper dependency tracking, especially when using generators like Ninja. This ensures all build artifacts are correctly tracked during parallel builds, which directly supports the PR objective of adding Ninja compatibility.

@artikell artikell force-pushed the cmake_support_ninja branch from 7e0d323 to b5b40f5 Compare March 29, 2025 23:24
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

🧹 Nitpick comments (1)
cmake/findTools.cmake (1)

50-56: Good addition to improve build performance with CCache.

Adding CCache support is a great way to speed up builds, especially for repeated builds in development and CI environments. This implementation correctly sets up both compilation and linking to use CCache when available.

For a minor improvement, consider adding a status message to inform users when CCache is found and activated, similar to how the other tools are reported:

if(CCACHE_FOUND)
    set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
    set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
+   MESSAGE(STATUS "found ccache at ${CCACHE_FOUND}, build acceleration enabled")
endif(CCACHE_FOUND)
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between b5b40f5 and 7f8a981.

📒 Files selected for processing (14)
  • cmake/braft.cmake (1 hunks)
  • cmake/brpc.cmake (1 hunks)
  • cmake/findTools.cmake (1 hunks)
  • cmake/fmt.cmake (1 hunks)
  • cmake/gflags.cmake (1 hunks)
  • cmake/gtest.cmake (2 hunks)
  • cmake/leveldb.cmake (1 hunks)
  • cmake/lz4.cmake (1 hunks)
  • cmake/protobuf.cmake (2 hunks)
  • cmake/rocksdb.cmake (1 hunks)
  • cmake/snappy.cmake (1 hunks)
  • cmake/spdlog.cmake (1 hunks)
  • cmake/zlib.cmake (1 hunks)
  • cmake/zstd.cmake (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (13)
  • cmake/lz4.cmake
  • cmake/leveldb.cmake
  • cmake/spdlog.cmake
  • cmake/zstd.cmake
  • cmake/zlib.cmake
  • cmake/gflags.cmake
  • cmake/fmt.cmake
  • cmake/snappy.cmake
  • cmake/braft.cmake
  • cmake/rocksdb.cmake
  • cmake/brpc.cmake
  • cmake/protobuf.cmake
  • cmake/gtest.cmake
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: build_on_macos
  • GitHub Check: build_on_ubuntu

export LIBRARY_PATH=$(xcrun --show-sdk-path)/usr/lib
export DYLD_LIBRARY_PATH=$(xcrun --show-sdk-path)/usr/lib
bash ./etc/script/build.sh --verbose
bash ./etc/script/build.sh --clear
Copy link
Collaborator

Choose a reason for hiding this comment

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

bash ./etc/script/build.sh --clear 这里不应该 clear, 否则缓存的文件会失效吧

Copy link
Contributor Author

Choose a reason for hiding this comment

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

俩个阶段本来就不一样,下面是ninja编译的,就索性直接清理掉了。

Copy link
Collaborator

Choose a reason for hiding this comment

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

https://github.com/arana-db/kiwi/blob/04b5c0655b2e5b72b20bb79676222e3e314e3ca0/.github/workflows/kiwidb.yml#L53-L62

我的意思是, 如果clear, 这里使用 GitHub 的缓存会失效吧, 上面恢复的缓存文件, 这里被 clear了

@lqxhub lqxhub linked an issue Mar 30, 2025 that may be closed by this pull request
@artikell artikell force-pushed the cmake_support_ninja branch from 7f8a981 to 519b2a8 Compare April 15, 2025 14:15
@artikell artikell requested a review from lqxhub April 16, 2025 13:27
@AlexStocks AlexStocks merged commit c224da6 into arana-db:unstable Apr 18, 2025
7 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

优化编译流程

3 participants