os.run 为什么只能在 target 域中使用 #4106
Replies: 6 comments 1 reply
-
Title: os.run can only be used in the target domain In what scenario do you need this function?Want to use os.run to execute some commands before building, such as git clone a source code subproject before building describe possible solutionsCan be used globally with os.run Describe what you think is a candidateNo response other information |
Beta Was this translation helpful? Give feedback.
-
先看下 描述域和脚本域的区别。。https://xmake.io/#/zh-cn/guide/syntax_description os.run 只能在脚本域调用,全局定义 before_run 里面执行就行了。或者定义个 phony target 。其他 targets 都依赖它 |
Beta Was this translation helpful? Give feedback.
-
@waruqi 好的,明白了,但是还有一个疑问,文档里说在描述域里面一般不建议执行耗时高的操作,但是 os.run 应该很有可能做出耗时的操作啊? |
Beta Was this translation helpful? Give feedback.
-
@waruqi Okay, I understand, but there is still a question. The document says that it is generally not recommended to perform time-consuming operations in the description field, but os.run should be likely to perform time-consuming operations? |
Beta Was this translation helpful? Give feedback.
-
所以 os.run 不是在描述域禁用的么,原本就不能用。感觉你还是没看明白什么是描述域。 |
Beta Was this translation helpful? Give feedback.
-
So isn't os.run disabled in the description domain? It can't be used in the first place. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
你在什么场景下需要该功能?
想要在构建之前使用 os.run 执行一些命令,比如在构建之前 git clone 一个源码子项目
os.run("git clone -b url ${projectdir}/src/name")
描述可能的解决方案
可以在全局使用 os.run
描述你认为的候选方案
No response
其他信息
Beta Was this translation helpful? Give feedback.
All reactions