In build definition (on Variables tab) I am trying to define a custom variable (Build.Repository.Clean
) using simple expression $[not(false)]
. But when I print variables during build -- regardless of expression used, Build.Repository.Clean
value is always false
.
Strangely enough, definining it with something like $(FullBuild)
(where FullBuild
is another custom variable) works just fine.
Am I missing something?
Notes:
Backstory:
Trying to set Build.Repository.Clean
variable depending on a custom variable QuickBuild
(which can be set by user when kicking off a build). Tried specifying $[not(variables.QuickBuild)]
(and other variations of same expression) -- no luck.
here is how it works right now (but I'd rather have QuickBuild
instead of FullBuild
-- just can't figure out how to negate a variable):
Expressions are not evaluated when they are used to initialize custom variables (on Variables
tab). I.e. variable value ends up being a string
with value equal to your expression (e.g. '$[not(<whatever>)]'
). Later, when that variable gets used in context that expect boolean
-- it still doesn't get evaluated, instead it gets type-casted and any non-empty string yields true
.
On the other hand variable substitution happens -- i.e. value $(MyVar)
gets replaced with value of MyVar
.
Built-in variable seem to be special in sense that if you override
them -- this process happens at the start and it's value gets immediately replaced with resulting value.
Note -- this may (or may not) be related to this.
Bottomline: you can't use expressions to override value of a built-in variable.