Open xlf605401969 opened 3 months ago
Bot detected the issue body's language is not English, translate it automatically.
Title: The options configured using --menu will override the results of the script setting options in option:after_check
目前 option 依赖联动,在 --menu 中不支持。。也不太好实现,,after_check 是后期检测中触发的,那个时候 menu 都退出了,展示过程中 xmake 是解析不到这个依赖状态关系的
Bot detected the issue body's language is not English, translate it automatically.
Currently option relies on linkage and is not supported in --menu. .
好的,那我看看别的解决方案,不过我有些困惑的是after_check中脚本配置的项好像没办法覆盖menu中指定的选项或者命令行中指定的选项?
Bot detected the issue body's language is not English, translate it automatically.
Okay, then I'll look at other solutions, but what I'm a little confused about is that the items configured in the script in after_check don't seem to be able to override the options specified in the menu or the options specified in the command line?
用户命令行设置的选项值,优先级最高,内部会标记成 readonly 。。脚本内默认是覆盖不了的,你要强行覆盖,只能在设置时候,加上 {force = true}
Bot detected the issue body's language is not English, translate it automatically.
The option value set by the user command line has the highest priority and will be marked as readonly internally. . It cannot be overridden by default in the script. If you want to force override, you can only add {force = true} when setting.
Xmake 版本
xmake v2.9.1+HEAD.0c79f6162
操作系统版本和架构
Windows10 1809
描述问题
我想要通过选项依赖来控制编译的行为,例如有以下三个option
A可以单独设置为true,但B或C设置为true的时候,A必须设置为true,尝试的解决方案是另A依赖于B和C,当B或C为ture时,将A设置为true
参照文档,我尝试在option:after_check中使能开关选项, 以下为xmake.lua脚本:
单独将B设置为true,输出符合预期,A选项被设置为了false:
如果在xmake f --menu中选择了B但未选择A,输出结果则为
脚本中对于A的设置并未生效
或者有没有办法在--menu的配置中就展示这个依赖关系,即选择了选项A才能够选择B和C?还是这种情况下只应该提示一个错误?
期待的结果
在after_check中脚本配置的选项能够修改命令或--menu配置时的指定项
工程配置
已附在问题描述中
附加信息和错误日志
无