-
希望在配置工程期间调用外部工具获取信息,配置到config.h中。 请问目前是否有对应脚本域接口或其他类似实现方式?谢谢。 e.g. on_config(function (target)
local git_info = os.iorun("git rev-parse --short HEAD")
target:set_configvar("GIT_COMMIT_HASH", git_info or "null")
end or on_config(function (target)
local git_commit_hash = os.iorun("git rev-parse --short HEAD")
local git_branch_name = os.iorun("/bin/sh -c \"git describe --all | sed -e 's|heads/|branch : |g' -e 's|tags/|tags : |g'\"")
local git_commit_message = os.iorun("/bin/sh -c \"git log -1 --pretty=%B | sed ':a;N;$!ba;s/\\n/\\\\n/g'\"")
local build_date_time = os.date("%Y-%m-%d %H:%M:%S")
target:add("configvar", "GIT_COMMIT_HASH", git_commit_hash or "null")
target:add("configvar", "GIT_BRANCH_NAME", git_branch_name or "null")
target:add("configvar", "GIT_COMMIT_MESSAGE", git_commit_message or "null")
target:add("configvar", "BUILD_DATE_TIME", build_date_time)
end |
Beta Was this translation helpful? Give feedback.
Answered by
nmpassthf
Dec 5, 2024
Replies: 1 comment
-
刚发出去disscussions就发现问题了 |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
nmpassthf
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
刚发出去disscussions就发现问题了
应该使用
target:set("configvar")
而不是target:add("configvar")