You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 10, 2023. It is now read-only.
Gerrit Code Review supports two different modes for building plugins: in Gerrit tree and standalone modes. For this to work, we defined __standalone_mode__ variable and setting it differently in different modes. I am sure it worked already, but stopped working in recent Buck version:
Given the following BUCK file:
include_defs('//foo')
baz = 'qux' if __bar__ else 'quux'
def custom(
name,
dest):
genrule(
name = name,
cmd = 'cd $TMP;' +
('mkdir -p `dirname %s`;' % '$OUT') +
'echo %s >$OUT' % baz,
out = dest,
)
custom(
name = 'foo',
dest = 'bar/baz/qux.txt',
)
and this definition of foo:
__bar__ = True
__bar__ is not visible any more in root BUCK file, where the include file was sourced from:
$ buck build :foo
Using buckd.
Traceback (most recent call last):
[...]
File "/home/davido/projects/buck_include_problem/BUCK", line 3, in <module>
baz = 'qux' if __bar__ else 'quux'
NameError: name '__bar__' is not defined
Ah yeah, this was caused by 6064096, which made "include_defs()" behave more like "from ___ import *", which doesn't import variables with leading underscores. In this case, is it ok to change the name of the variable to not use leading underscores. Sorry for the churn here.
The fix for [1] prevents from importing python variables __foo__,
as explained in [2]. Rename standalone mode flag correspondingly.
[1] facebook/buck#182
[2] facebook/buck#221
Change-Id: If8682278e7c91df3fc18b3d623eb43950e839448
davido
added a commit
to davido/bucklets
that referenced
this issue
Mar 21, 2015
The fix for [1] prevents from importing python variables __foo__,
as explained in [2]. Rename standalone mode flag correspondingly.
[1] facebook/buck#182
[2] facebook/buck#221
Change-Id: I0ac05c80a1d5fc1b8f8bd2c5ca5dabdfeeecbe52
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Gerrit Code Review supports two different modes for building plugins: in Gerrit tree and standalone modes. For this to work, we defined
__standalone_mode__
variable and setting it differently in different modes. I am sure it worked already, but stopped working in recent Buck version:Given the following
BUCK
file:and this definition of
foo
:__bar__
is not visible any more in root BUCK file, where the include file was sourced from:Expected: it should just work and produce:
The text was updated successfully, but these errors were encountered: