noseglid / atom-build

:hammer: Build your project directly from the Atom editor
https://atom.io/packages/build
MIT License
248 stars 97 forks source link

Custom variables #530

Closed trianglesis closed 6 years ago

trianglesis commented 6 years ago

Hi, Is there any chance to use custom variables in yml?

Like:

variables:
  PYTHON27: '${C:\\Python27\\python.exe}'
  PYTHON34: "{{C:\\Python34\\python.exe}}"

And then you can use each in whole build:

cmd: '{PYTHON27}'

Or sometthing. Reading yaml documentation - it gives some examples of that. But nothing worked in this case.

Thanks,

trianglesis commented 6 years ago

Some buggy workaround:

https://stackoverflow.com/questions/5484016/how-can-i-do-string-concatenation-or-string-replacement-in-yaml

PYTHON27: &PYTHON27 C:\Python27\python.exe
CHECK: &CHECK "C:\\Python34\\python.exe D:\\TPL_IDE_Module\\check_active\\check.py"

Working example:

cmd: *PYTHON27
args:
  - *PREPROC
  - '-f {FILE_ACTIVE}'

AND

  - tplpreSyntaxCheckSolo:
    cmd: *CHECK
    args:
      - '-full_path {FILE_ACTIVE}'
      - '-l info'
    cwd: '{FILE_ACTIVE_PATH}'
Cxarli commented 6 years ago

I think you could better use an (external) build script in this case, instead of trying to do it with atom-build.

trianglesis commented 6 years ago

Yes, but this is core functionalily for build system. Implementing hardcoded paths to build-programm is not a user-oriented way. In other words - those vars can be different for each user, and will be great to have them as local vars in build yml.

But anyway, yaml has this feature by default.