xmake icon indicating copy to clipboard operation
xmake copied to clipboard

add defaults for `VERSION_*` builtin vars

Open qudix opened this issue 1 year ago • 1 comments

Is your feature request related to a problem? Please describe.

There are several points of friction when working with some of the current defined set of api's, such as a var not existing sometimes. The current way around this is to add an if check for the existence of the var and if it doesn't exist use a default. Specifically the VERSION family of builtinvars. If the version isn't set through the set_version api these vars simply don't exist resulting in a runtime error when referred to in a config .in file.

Also, a minor thing is that the semver.org specification has always named the 3rd field PATCH but xmake named it ALTER for some reason. In the grand scheme of things this is a minor issue, but for convenience sake so as to not require string substitution in every project that uses PATCH, ALTER should be deprecated (not removed for backwards compatibility) and PATCH added to more closely follow semver (even xmake's own semver module names it patch).

Describe the solution you'd like

change _get_builtinvars_target in xmake/actions/config/configfiles.lua to always have the VERSION family of builtinvars exist with sensible defaults like 0.0.0 in the worst case.

Describe alternatives you've considered

No response

Additional context

No response

qudix avatar Aug 16 '23 18:08 qudix

? set default versions in config.h.in if no set_version? Since you added variables like %VERSION% in config.h.in, why not configure set_version in xmake.lua?

waruqi avatar Aug 17 '23 01:08 waruqi