Override app version

  1. My goal is: I want to override the app version in order to get a unique version after each commit on github, and a dev suffix when I build in development

  2. My actions are: [describe your actions - code, commands, etc]

I have modified the mos.yml with conds to detect the build environment. It works fine and I’m able to override config schema as bellow:

conds:
  - when: build_vars.TARGET == "development"
    apply:
      version: 0.0.1-dev
      config_schema:
        - ["debug.file_level", "main.cpp:=4,=0"]
        - ["dns_sd.host_name", "wallbox-dev"]
  - when: build_vars.TARGET == "production"
    apply:
      version: "0.0.1-${build_vars.BUILD_DATE}"
      config_schema:
        - ["debug.level", 0]

But i’m not able to override the version.
The BUILD_DATE variable contains a date like BUILD_DATE=2020-05-28, but in that case the version will 0.0.1-

The vars.mk contains the variables:

APP_VERSION=0.0.1-${build_vars.BUILD_DATE}
BUILD_DATE=2020-05-28

The build command is
mos build --local --build-var BUILD_DATE=2020-05-28

Ideally, I want to define the version like “${version}-${build_vars.BUILD_DATE}”

I have also tried to set the APP_VERSION from the build command but I got this error

Build variable “APP_VERSION” should not be given in “mos.yml” since it’s set by the mos tool automatically

Thanks in advance.

Any solutions on this?

I’d like to do the same along with specifying libs_version, modules_version, mongoose_os_version and cxxflags depending on build type.