Skip to content

rapidjson: fix the broken versions#9776

Open
rempas wants to merge 2 commits intoxmake-io:devfrom
rempas:rempas-patch-2
Open

rapidjson: fix the broken versions#9776
rempas wants to merge 2 commits intoxmake-io:devfrom
rempas:rempas-patch-2

Conversation

@rempas
Copy link
Copy Markdown
Contributor

@rempas rempas commented Apr 17, 2026

Fixes the broken version of rapidjson

  • Before adding new features and new modules, please go to issues to submit the relevant feature description first.
  • Write good commit messages and use the same coding conventions as the rest of the project.
  • Please commit code to dev branch and we will merge into master branch in feature
  • Ensure your edited codes with four spaces instead of TAB.

  • 增加新特性和新模块之前,请先到issues提交相关特性说明,经过讨论评估确认后,再进行相应的代码提交,避免做无用工作。
  • 编写友好可读的提交信息,并使用与工程代码相同的代码规范,代码请用4个空格字符代替tab缩进。
  • 请提交代码到dev分支,如果通过,我们会在特定时间合并到master分支上。
  • 为了规范化提交日志的格式,commit消息,不要用中文,请用英文描述。

Fixes the broken version of rapidjson
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the rapidjson package definition by modifying source URLs, updating versions, and adjusting the CMake build configuration. Several issues were identified: the cmake dependency must be declared in the on_load block rather than on_install to ensure correct dependency resolution by xmake, and the removal of the archive URL and the submodules = false option negatively impacts download efficiency and includes unnecessary submodules.

Comment on lines +17 to 21
on_load(function (package)
if package:is_plat("windows") and package:is_arch("arm.*") then
package:add("defines", "RAPIDJSON_ENDIAN=RAPIDJSON_LITTLEENDIAN")
end
end)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

The cmake dependency must be declared in on_load so that xmake's dependency solver can identify and install it before the on_install phase. Declaring it inside on_install is too late and will cause the build to fail if cmake is not already present on the system.

    on_load(function (package)
        if package:config("cmake") then
            package:add("deps", "cmake")
        end

        if package:is_plat("windows") and package:is_arch("arm.*") then
            package:add("defines", "RAPIDJSON_ENDIAN=RAPIDJSON_LITTLEENDIAN")
        end
    end)

Comment on lines 24 to 26
if package:config("cmake") then
package:add("deps", "cmake")
local configs = {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

Remove the package:add("deps", "cmake") call from on_install. As noted, this declaration belongs in the on_load block to ensure the dependency is correctly resolved by xmake before the installation starts.

        if package:config("cmake") then
            local configs = {


set_urls("https://github.com/Tencent/rapidjson/archive/refs/tags/$(version).zip",
"https://github.com/Tencent/rapidjson.git", {submodules = false})
set_urls("https://github.com/Tencent/rapidjson.git")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Removing the archive URL and the {submodules = false} option makes the installation process less efficient. For header-only libraries, downloading a ZIP archive is significantly faster than cloning the entire Git repository. Additionally, disabling submodules prevents downloading unnecessary test dependencies like gtest. xmake will automatically fall back to the Git URL if a specific version's ZIP is not found (e.g., for the new date-based versions).

    set_urls("https://github.com/Tencent/rapidjson/archive/refs/tags/$(version).zip",
             "https://github.com/Tencent/rapidjson.git", {submodules = false})

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.

1 participant