Copyright © https://mongoose-os.com

Mongoose OS Forum

frame
ATTENTION! This forum has moved to:

https://community.mongoose-os.com

Do not post any new messages.

testing for existence of build variables in mos.yml

I'm doing a lot of regression testing (ESP-IDF v3.2 is causing me fits, needing to do builds against 3.1), and am trying to streamline the build process. I want to specify the version of the libraries to use from the command line, instead of continually editing the mos.yml file.

in mos.yml

libs_version: ${v}
modules_version: ${v}
mongoose_os_version: ${v}

and then

mos build --local --verbose --build-var v:2.9.0

but I keep getting

Error: /build/mos-O5azp1/mos-2.10.2+67fae67~bionic0/obj-x86_64-linux-gnu/src/cesanta.com/mos/interpreter/interpreter.go:137: failed to evaluate v

same happens if I reference ${build_vars.v}, ${BUILD_VARS.v}, ${BUILD_VARS.V} in mos.yml (with matching case for 'v' in the mos build command).

How do you access the values set with --build-var?

--

The followon question is "is there a way to test for non-existence of a build variable in mos.yml?"

libs_version: 2.8.0
modules_version: 2.8.0
mongoose_os_version: 2.8.0

conds:
  - when: sti_v == ""
    apply:
      libs_version: ${sti_v}
      modules_version: ${sti_v}
      mongoose_os_version: ${sti_v}

Comments

  • rodrmigurodrmigu Fairfax, Virginia

    Hi.

    I think you could use a default build_var. In the example below, the default it's development, so when I use mos build --build-var TARGET:production, then it uses a different set of configuration.

    conds:
      - when: build_vars.TARGET == "development"
        apply:
          libs:
            - origin: https://github.com/mongoose-os-libs/rpc-service-config
            - origin: https://github.com/mongoose-os-libs/rpc-uart
          config_schema:
            - ["debug.level", 3]
            - ["wifi.sta.ssid", "my_network"]
            - ["wifi.sta.pass", "123456"]
            - ["mqtt.server", "192.168.1.40:1883"]
    
      - when: build_vars.TARGET == "production"
        apply:
          config_schema:
            - ["debug.level", 1]
    
    build_vars:
      TARGET: development
    

    Regards
    Rodrigo

Sign In or Register to comment.