对依赖的package手动修改配置头文件后希望能触发差异构建
你在什么场景下需要该功能?
对嵌入式开发来说一般都是使用源码裁剪编译,编出来的包基本不会跨项目使用,所以都设置set_policy("package.install_locally", true)
实际项目中,像对mbedtls进行裁剪移植,会根据项目需求单独写一个mbedtls_config.h,然后通过MBEDTLS_CONFIG_FILE宏指定配置头文件。
经过一次工程编译后,mbedtls库编译好在build/.packages下,再去修改mbedtls_config.h文件,mbedtls以及依赖mbedtls的包都不会触发重新编译。
现有的解决方案:
- 删掉
build/.packages的内容再xmake clean --all后再重新编译才能引入新修改的配置 - 设置
set_policy("package.install_always", true)
但都会触发全量编译。
描述可能的解决方案
针对install_locally的场景下,--all的选项是不是也能包含依赖包。
-
xmake clean --all的时候能对依赖包也一同做clean动作 -
xmake build --all的时候能触发依赖包(及其的上游依赖)的差异检查触发包的重构
描述你认为的候选方案
No response
其他信息
No response
Bot detected the issue body's language is not English, translate it automatically.
Title: After manually modifying the configuration header file for the dependent package, I hope to trigger differential construction.
In what scenario do you need this function?
For embedded development, it is generally compiled using source code. The compiled packages are basically not used across projects, so they are set set_policy("package.install_locally", true)
In actual projects, if you crop and port mbedtls, you will write a mbedtls_config.h separately according to the project requirements, and then specify the configuration header file through the MBEDTLS_CONFIG_FILE macro.
After a project compilation, the mbedtls library is compiled under build/.packages, and then modify the mbedtls_config.h file, mbedtls and packages that depend on mbedtls will not trigger recompilation.
Existing solutions:
- Delete the content of
build/.packagesand then recompile it before re-compiling it. - Set
set_policy("package.install_always", true)
But it will trigger full compilation.
###Describe possible solutions
In the scenario of install_locally, can the option of --all also include dependency packages?
- When
xmake clean --all, you can also do clean actions on dependency packages. - When
xmake build --all, it can trigger the difference check of the dependency package (and its upstream dependencies) triggers the reconstruction of the package.
Describe what you consider to be a candidate
No response
Other information
No response
这里换其他构建系统和包管理也一样,只有做成子 target 才方便。
也可以试试 policy package.build.ccache,避免全量编译 https://github.com/xmake-io/xmake/issues/5874
xrepo install -d srcdir packagename 走本地源码调试
Bot detected the issue body's language is not English, translate it automatically.
xrepo install -d srcdir packagename Go to local source code debugging
xrepo install -d srcdir packagename走本地源码调试
这个好像只能支持官方repo,xmake.lua里add_repositories的包没法用xrepo安装吧
Bot detected the issue body's language is not English, translate it automatically.
xrepo install -d srcdir packagenameGo to local source code debugging
This seems to only support official repo. The package of add_repositories in xmake.lua cannot use xrepo
这里换其他构建系统和包管理也一样,只有做成子 target 才方便。 也可以试试 policy
package.build.ccache,避免全量编译 #5874
ccache只能加快编译速度吧,但是修改过配置文件的package还是要删掉在clean --all之后才能重新编译,没法触发差异构建。
目前想到的一个办法就是用xmake重写mbedtls的编译入口,把mbedtls_config.h里的所有配置项都加到configfiles里,这个add_requires的时候可以通过修改configs来触发差异构建,就是一个包的适配量也有点大。
最小的适配来看,通过xmake的参数选项来触发对依赖包的差异检查重构应该可以满足情景吧。
Bot detected the issue body's language is not English, translate it automatically.
One of the ways I think of at present is to rewrite the compilation portal of mbedtls using xmake and add all configuration items in mbedtls_config.h to configfiles. When adding_requires, you can trigger differential construction by modifying configs, even if the adaptation volume of a package is a bit large.
From the smallest adaptation perspective, triggering the difference check and reconstruction of the dependency package through the parameter option of xmake should satisfy the scenario.
xrepo install -d srcdir packagename走本地源码调试这个好像只能支持官方repo,xmake.lua里add_repositories的包没法用xrepo安装吧
xmake require --debugdir=srcdir packagename
Bot detected the issue body's language is not English, translate it automatically.
xrepo install -d srcdir packagenameGo to local source code debuggingThis seems to only support the official repo. The add_repositories package in xmake.lua cannot be installed with xrepo.
xmake requires --debugdir=srcdir packagename
xrepo install -d srcdir packagename走本地源码调试这个好像只能支持官方repo,xmake.lua里add_repositories的包没法用xrepo安装吧
xmake require --debugdir=srcdir packagename
这个用法相当于要提前下载包的源码,再手动指定包的srcdir?这会失去了主工程add_requires时传递给包的configs项。
这个需求想法是保留包管理,在install_locally的情况下,能检测到主工程的编译选项变化或者依赖文件的hash变化,能触发local package的重构,毕竟local package只会在当前工程下有用,不影响到~/.xmake/里全局的,这样对嵌入式跨平台的开发会更便捷些。
Bot detected the issue body's language is not English, translate it automatically.
xrepo install -d srcdir packagenameGo to local source code debuggingThis seems to only support the official repo. The add_repositories package in xmake.lua cannot be installed with xrepo
xmake requires --debugdir=srcdir packagename
This usage is equivalent to downloading the source code of the package in advance and then manually specifying the srcdir of the package? This will lose the configs item passed to the package when the main project add_requires is lost.
This requirement idea is to retain package management. In the case of install_locally, it can detect changes in the compilation options of the main project or hash changes in the dependent file, which can trigger the reconstruction of the local package. After all, local package will only be useful in the current project and will not affect the global ~/.xmake/, which will be more convenient for embedded cross-platform development.
xrepo install -d srcdir packagename走本地源码调试这个好像只能支持官方repo,xmake.lua里add_repositories的包没法用xrepo安装吧
xmake require --debugdir=srcdir packagename这个用法相当于要提前下载包的源码,再手动指定包的srcdir?这会失去了主工程
add_requires时传递给包的configs项。
xmake requires 会加载当前工程的包配置。
自己下载一份,或者直接切到已下载的那一份,源码增量调试,调通后走完整安装
包本身不可能像 target 那样,每次 build 都去触发一遍安装编译,也不可能同一个版本一直去来回改,都要有 版本和 hash校验完整性的。不管哪个包管理器都是这个逻辑。
想要不停的改代码更新包,只能走 --debugdir 切到调试安装。否则还不如你直接用 target + submodules集成编译
Bot detected the issue body's language is not English, translate it automatically.
xrepo install -d srcdir packagenameGo to local source code debuggingThis seems to only support the official repo. The add_repositories package in xmake.lua cannot be installed with xrepo
xmake requires --debugdir=srcdir packagenameThis usage is equivalent to downloading the source code of the package in advance and then manually specifying the srcdir of the package? This will lose the configs item passed to the package when the main project
add_requiresis lost.
xmake requires will load the package configuration of the current project.
Download one yourself, or directly cut to the downloaded one, debug the source code in incremental debugging, and install it after adjustment.
The package itself cannot be like target, every time it builds, it cannot be installed and compiled, and it cannot be returned back and forth. It must have version and hash verification of integrity. No matter which package manager is, this logic is.
If you want to constantly modify the code and update the package, you can only go to --debugdir to debug and install. Otherwise, it would be better to use target + submodules to integrate and compile
xmake requires --debugdir=srcdir packagename
这个方式对于编译一个project的话提前下载或者submodule的方式还好 多个工程不同的板子都需要裁剪mbedtls配置的话,就要下载很多份了;而且用xmake主要是想package可以编译时根据依赖自动下载,还能复用源码;这样传递一个xmake.lua就能直接完成编译整个工程编译,源码也都随着编译时下载了。
Bot detected the issue body's language is not English, translate it automatically.
xmake requires --debugdir=srcdir packagename
This method is good for compiling a project to download or submodule in advance If you need to cut the mbedtls configuration for multiple projects, you need to download many copies; and using xmake mainly means that package can be automatically downloaded according to the dependencies when compiling, and can also reuse the source code; in this way, passing an xmake.lua can directly complete the compilation of the entire project, and the source code is also downloaded with the compilation time.
xmake requires --debugdir=srcdir packagename这个方式对于编译一个project的话提前下载或者submodule的方式还好 多个工程不同的板子都需要裁剪mbedtls配置的话,就要下载很多份了;而且用xmake主要是想package可以编译时根据依赖自动下载,还能复用源码;这样传递一个xmake.lua就能直接完成编译整个工程编译,源码也都随着编译时下载了。
有没方案可以把package按源码的方式引入project中参与编译呢?
Bot detected the issue body's language is not English, translate it automatically.
xmake requires --debugdir=srcdir packagenameThis method is good for compiling a project to download in advance or submodule. If the boards of different projects need to be cropped with mbedtls configuration, many copies need to be downloaded; and using xmake mainly means that package can be automatically downloaded according to the dependencies during compilation, and the source code can be reused; in this way, passing an xmake.lua can directly complete the compilation of the entire project, and the source code is also downloaded with the compilation time.
Is there a solution to introduce package into project in the source code to participate in compilation?
https://xmake.io/#/zh-cn/package/local_3rd_source_library
https://xmake.io/#/zh-cn/package/local_3rd_source_library
知道有本地引入源码的功能,是想在xmake.lua里描述好的远端package,在构建时自动下载,能不能像target引入到工程里?
其实主要的还是在xmake clean --all时能把依赖项也清一下,能触发修改了mbedtls_config.h修改后的重新构建。
project/xmake.lua
project/src/main.c
project/inc/mbedtls_config.h
project的编译入口下的xmake.lua设置了set_policy("package.install_always", true),依赖packageN,
而pacakgeN..依赖mbedtls,mbedtle_config.h在project目录下(不同project对mbedtls的配置裁剪),
xmake build编译后xmake require --uninstall只能删除一个package,不能一次清除project所有的依赖和子依赖。
现在是通过rm build/.packages -rf去删除依赖,在xmake clean --all后才能重构的,
这样绕过了删除package的动作绕开了xmake,会不会有问题?能不能由xmake来接管这个清除当前project的依赖项动作?(如果能通过标记能直接触发依赖的重构会更好吧)
远程源码包引入 target 暂时不考虑,不支持,你可以直接走 submodules + includes 直接引入
Bot detected the issue body's language is not English, translate it automatically.
The target is not considered for the time being and does not support it. You can directly use submodules + include to directly import it.