jimporter / bfg9000

bfg9000 - build file generator
https://jimporter.github.io/bfg9000
BSD 3-Clause "New" or "Revised" License
76 stars 21 forks source link

Command-line arguments/values #67

Closed refi64 closed 8 years ago

refi64 commented 8 years ago

Is there a way to pass options to a build script? For instance, say I write a build script, and I want it to behave differently depending on whether or not the user wants to enable a certain feature. How can I have the build script read this somehow?

I noticed env.getvar, so I could do something like env.getvar('ENABLE_XYZ', ''). But is there a different way to do it?

jimporter commented 8 years ago

Currently, that's how you'd do it: have the user set environment variables. Allowing build.bfg files to define parameters that users can pass is a bit of a pain in the ass, since bfg needs to have parsed the command line already in order to even know where the build.bfg file is. It's fixable, but will require a fair bit of work.

In any case, I'm tracking this in #63 for version 0.3.