-
Notifications
You must be signed in to change notification settings - Fork 588
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Environment variables passed in command line are not evaluated until targets execution #2283
Comments
Yes, basically this part of the command line is evaluated when |
IMHO it would make sense to enable evaluation of environment variable early. Current behavior doesn't look consistent for two reasons.
I haven't inspected the implementation but what makes it delay evaluation of environment values sent via command line? It would makes things more consistent if they became available at the beginning of the script execution. |
And if it's hard to make environment variables evaluated at the very beginning of the script, at least there should be a way to evaluate them in a target dependency section, so "condition" part can be specified as a predicate, not only a boolean value. This will still leave inconsistent mismatch between OS-level variables and command line variables, as described in p.2 above. |
It's basically the split of the command line. The script arguments (which includes the
Yes that was my suggestion: Add a new API which can be called at the top of the script. At least that would be the easiest approach afaics. One other workaround/related feature now in Fake 5 is you add your very own CLI: https://fake.build/core-commandlineparsing.html |
Supporting this issue.
|
Maybe like #2288? |
Description
If I pass custom build parameters using "-e" switch they are not evaluated until targets are selected for execution. This makes it impossible to configure conditional target execution based on command line parameters.
Repro steps
Let's say I have a script that contains the following lines:
let skipTests = Environment.environVarAsBoolOrDefault "skipTests" false
I run the script:
fake run build.fsx --target All -e skipTests=true
Expected behavior
I expect "skipTests" to be evaluated at the time target execution is decided, i.e. the statement
("RunTests", not skipTests) should be evaluated as skipping "RunTests" target.
Please provide a description of the behavior you expect.
Actual behavior
At the time ("RunTests", not skipTests) is evaluated, skipTests is "false". Only inside the actual RunTests target execution "skipTests" is evaluated to "true".
Related information
The text was updated successfully, but these errors were encountered: