Ceedling icon indicating copy to clipboard operation
Ceedling copied to clipboard

Can not set environment variables from imported files.

Open deltalejo opened this issue 1 year ago • 5 comments

In Ceedling 0.32 it is no longer possible to set environment variables from imported configuration files. My use case is having a env.yml file which append some paths to the PATH variable and importing that file from project.yml. The env.yml is written locally according to the developer's host machine set up, by doing so the project can be cloned and used on different machines without modifying its main config file or having to manually/globally export the required paths. Do you think there is another easy way to accomplish the same? or maybe could that functionality be restored?

deltalejo avatar Apr 07 '24 11:04 deltalejo

Hi, maybe you can call ceedling project:env test:all as discussed in #845 this is how I am using specific yml in addition to my project.yml.

JuPrgn avatar Apr 07 '24 11:04 JuPrgn

Hi, @deltalejo. In fact, there's a merge pending for a whole new capability in 0.32 pre-release. We have removed a variety of features — documented and undocumented — that only partially fulfilled the sort of needs you're speaking of. In their place is a new feature called “mixins”. Mixins are simply project file configuration that are merged from any of multiple sources (command line filepath flag, environment variable filepath, or configuration file section) immediately at startup before Ceedling validates or processes anything. Mixins are what all previous attempts have tried to do but to varying degrees of success. Mixins have few restrictions, are fully documented, and provide basic checks and logging. This will be available in a new pre-release build soon (likely in the coming week).

mkarlesky avatar Apr 07 '24 13:04 mkarlesky

@deltalejo I see that you already know well what I suggested and you have interesting Ceedling shared repositories (mdb...) I will give it a try thank you. I thought I already knew your nickname we probably had previous discussions around XC settings some time ago

JuPrgn avatar Apr 07 '24 17:04 JuPrgn

Hi, @mkarlesky! I've already tried out the mixin functionality and that allows me to do what I previously did with imports, at least regarding environment variables inside a env.yml file. But now I'm missing a feature of the previous imports functionality in which you can use inline ruby execution to calculate the path of the file to be imported, with that I was able to conditionally import a file according to some project variables values.

deltalejo avatar Apr 26 '24 13:04 deltalejo

@deltalejo I see. You are a power user, aren't you?! So, I think what you're needing is Ruby string replacement inside the :mixins section of the base project configuration file? It so happens that another long open issue has requested this elsewhere in the project file. Implementing this is on deck. If I'm understanding your need correctly, I can update the backlog task to cover the :mixins section as well.

mkarlesky avatar May 15 '24 19:05 mkarlesky

@deltalejo The latest pre-release adds support for Inline Ruby string expansion in :mixins:load_paths and :mixins:enabled. I will close the issue for now. Feel free to reopen for further discussion. All the relevant documentation has been updated including a new, single section dedicated to inline Ruby string expansion.

mkarlesky avatar May 23 '24 15:05 mkarlesky