Closed TOMO-CAT closed 2 months ago
Bot detected the issue body's language is not English, translate it automatically.
Title: Support toolchain and opiton distribution in xmake-repo
The background is that there are many libraries in the company. Currently, in order to support cross-compilation, each library needs to add some toolchain and option definitions to the project: But the definitions of these options / toolchains should be exactly the same.
It is hoped that these toolchains and options can be distributed through xmake-repo, so that all libraries only need to be modified once in the central warehouse to take effect.
I'm thinking of an ugly way of writing that seems to work. Just put toolchain.lua directly into xmake-repo, and then add_includes(".xmake/linux/x86_64/repositories/zmake-repo-public/scripts/toolchain.lua")
Another alternative is to write an api service ourselves to deliver the Lua script, but this will introduce one more dependency.
Is it possible to add an alias, such as includes("@foo-packages/toolchain.lua"), and the script is still placed under package, similar to the issuance of rule.
No response
不考虑,实现不了。option 加载时机过早,目前的机制,不可能实现。
package 目前支持分发 rules ,只能通过这个来
Bot detected the issue body's language is not English, translate it automatically.
If you don’t think about it, you can’t achieve it. The option loading time is too early, and the current mechanism is impossible to implement.
package currently supports distribution rules, which can only be achieved through this
不考虑,实现不了。option 加载时机过早,目前的机制,不可能实现。
package 目前支持分发 rules ,只能通过这个来
那能支持类似 @pkg/xx.lua
的写法吗,@pkg 自动解析成对应 package 下的路径,例如 @gtest
就自动匹配成.xmake/linux/x86_64/repositories/zmake-repo-public/packages/g/gtest
?这样用户自己 includes 好像也不影响 option 的加载时机。
我刚刚试了一下:
includes(".xmake/linux/x86_64/repositories/zmake-repo-public/packages/z/zelos/scripts/*.lua")
这种写法是可行的,就是实在太丑了,而且没法做到自动找到 package 对应的 repo。
Bot detected the issue body's language is not English, translate it automatically.
If you don’t think about it, you can’t achieve it. The option loading time is too early, and the current mechanism is impossible to implement.
package currently supports distribution rules, which can only be achieved through this
Can it support writing methods like @pkg/xx.lua
? @pkg is automatically parsed into the path under the corresponding package. For example, @gtest
is automatically matched into .xmake/linux/x86_64/repositories/zmake-repo- public/packages/g/gtest
? In this way, the user's own includes does not seem to affect the loading timing of the option.
I just tried this:
includes(".xmake/linux/x86_64/repositories/zmake-repo-public/packages/z/zelos/scripts/*.lua")
This way of writing is feasible, but it is too ugly, and it cannot automatically find the repo corresponding to the package.
不能,首次编译安装,包都还没拉下来。。怎么 includes 。。两次编译结果状态都不一致。。
不能,首次编译安装,包都还没拉下来。。怎么 includes 。。两次编译结果状态都不一致。。
确实,之前能成功是因为本地有 .xmake 的缓存,除非显式 xmake repo -u 然后再 xmake -b,那改不了就先不管了。
Bot detected the issue body's language is not English, translate it automatically.
No, the first time you compile and install, the package has not been downloaded yet. . How includes . . The two compilation results are inconsistent. .
Bot detected the issue body's language is not English, translate it automatically.
No, it is the first time to compile and install, and the package has not been downloaded yet. . How includes . . The two compilation results are inconsistent. .
Indeed, it was successful before because there was a local cache of .
你在什么场景下需要该功能?
背景是公司里的库比较多,目前为了支持交叉编译每个库需要在项目中加一些 toolchain 和 option 的定义: 但是这些 options / toolchains 的定义应该是完全一样的。
希望可以通过 xmake-repo 来下发这些 toolchain 和 option,这样只需要在中央仓库修改一次就可以所有库生效。
描述可能的解决方案
我在想一种丑陋的写法好像能实现,直接把 toolchain.lua 放到 xmake-repo 里,然后 add_includes(".xmake/linux/x86_64/repositories/zmake-repo-public/scripts/toolchain.lua")
另一个替代的方案是我们自己写个 api 服务下发 lua 脚本,但是这样会多引入一个依赖。
描述你认为的候选方案
是不是可以加个 alias,例如 includes("@foo-packages/toolchain.lua"),脚本依然放在 package 下,类似于 rule 的下发。
其他信息
No response