-
-
Notifications
You must be signed in to change notification settings - Fork 484
bnm-android: add package #8374
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bnm-android: add package #8374
Conversation
Add xmake.lua for BNM-Android package with configuration options.
Summary of ChangesHello @std-microblock, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces comprehensive xmake support for the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this 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 introduces a new xmake package for BNM-Android
, which is a great addition for managing this dependency. The package is well-structured, providing options for selecting different hooking libraries. My review focuses on improving the correctness and robustness of the implementation. I've found a bug in the generated xmake.lua
file related to a configuration check, and also identified some incorrect C++ template overloads in the code that gets injected during the installation process. The suggested changes will fix the bug and make the C++ API less confusing. Overall, this is a good contribution.
Nice package, could you please create file xmake.lua inside of port folder instead of Maybe |
Add unity_version configuration and parsing logic
Yes, I've created a pr in the origin repo for that, so I think we can ignore it now: ByNameModding/BNM-Android#150 |
Can you do the change? idk how to read the file from the port file |
/gemini review |
There was a problem hiding this 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 adds a new xmake package for bnm-android
. The changes look good overall, introducing the necessary package definition and build scripts. I've identified a couple of potential bugs related to configuration checking and error handling in the hooking logic. I've also included some suggestions to improve code clarity and maintainability in the xmake scripts. Please see my detailed comments below.
if has_config("link_log") then | ||
add_syslinks("log") | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The use of has_config("link_log")
is incorrect for checking a boolean option. has_config
checks if the option was set by the user, not its value. This means that if a user explicitly sets link_log=false
, this condition would be true, which is not the intended behavior.
You should use get_config("link_log")
to correctly check the boolean value of the option.
if get_config("link_log") then
add_syslinks("log")
end
local parse_unity_version = function (version) | ||
local major, minor, patch = version:match("^(%d+)%.(%d+)%.(%d+)") | ||
if not major then | ||
major, minor = version:match("^(%d+)%.(%d+)%.%w+") | ||
if not major then | ||
return 222, 32 | ||
end | ||
patch = nil | ||
end | ||
|
||
major = tonumber(major) | ||
minor = tonumber(minor) | ||
patch = patch and tonumber(patch) or nil | ||
|
||
local unity_ver | ||
local unity_patch_ver | ||
|
||
if major == 5 then | ||
if minor == 6 then | ||
unity_ver = 56 | ||
end | ||
elseif major == 2017 then | ||
if minor == 1 then | ||
unity_ver = 171 | ||
elseif minor >= 2 and minor <= 4 then | ||
unity_ver = 172 | ||
end | ||
elseif major == 2018 then | ||
if minor == 1 then | ||
unity_ver = 181 | ||
elseif minor == 2 then | ||
unity_ver = 182 | ||
elseif minor >= 3 then | ||
unity_ver = 183 | ||
end | ||
elseif major == 2019 then | ||
if minor <= 2 then | ||
unity_ver = 191 | ||
elseif minor == 3 then | ||
unity_ver = 193 | ||
elseif minor == 4 then | ||
unity_ver = 194 | ||
end | ||
elseif major == 2020 then | ||
if minor == 1 then | ||
unity_ver = 201 | ||
elseif minor == 2 then | ||
unity_ver = 202 | ||
elseif minor == 3 then | ||
if patch and patch >= 20 then | ||
unity_ver = 203 | ||
else | ||
unity_ver = 202 | ||
end | ||
end | ||
elseif major == 2021 then | ||
if minor == 1 then | ||
unity_ver = 211 | ||
-- Need to set UNITY_PATCH_VER to 24 if x (2021.1.x) >= 24 | ||
if patch and patch >= 24 then | ||
unity_patch_ver = patch | ||
end | ||
elseif minor == 2 then | ||
unity_ver = 212 | ||
elseif minor == 3 then | ||
unity_ver = 213 | ||
end | ||
elseif major == 2022 then | ||
if minor == 1 then | ||
unity_ver = 221 | ||
elseif minor >= 2 then | ||
unity_ver = 222 | ||
unity_patch_ver = patch or 32 | ||
end | ||
elseif major == 2023 then | ||
if minor == 1 then | ||
unity_ver = 231 | ||
elseif minor >= 2 then | ||
unity_ver = 232 | ||
end | ||
end | ||
|
||
-- Fallback to default if no match found | ||
if not unity_ver then | ||
unity_ver = 222 | ||
unity_patch_ver = 32 | ||
end | ||
|
||
return unity_ver, unity_patch_ver | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is quite long and contains a large chain of if/elseif
statements, which can be difficult to read and maintain. Consider refactoring this logic to be more data-driven. You could use a table of rules to define the version mappings, or break the logic into smaller helper functions. This would make the function shorter, and adding support for new Unity versions in the future would be simpler.
} | ||
]], {plain = true}) | ||
else | ||
raise("Unknown hooking library: " .. package:config("hook_lib")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gemini-code-assist Is this redundant block of code, as it is already limited to two options there would not be third options selected anyway nothing to worry about?
Add xmake.lua for BNM-Android package with configuration options.