Emit fatal when unit takes a reference to a local superglobal
[hiphop-php.git] / hphp / DEFS.bzl
blob103f7507119807152431ec21a6d9ff3774b3187c
1 with allow_unsafe_import():
2     import subprocess
3     import platform as platmod
5 load("@fbcode_macros//build_defs:platform_utils.bzl", "platform_utils")
7 def get_fbcode_platform():
8     return platform_utils.get_platform_for_base_path(get_base_path())
10 def is_opt_hhvm_build():
11     buck_out = native.read_config('project', 'buck_out')
12     return '/opt' in buck_out
14 def is_dev_hhvm_build():
15     return '/dev' in native.read_config('project', 'buck_out')
17 def is_lto_build(platform):
18     return native.read_config("fbcode", "lto_type", "") != ""
20 def find_systemlib_files(dir, skip):
21     find_cmd = [ 'find', dir, '-type', 'f', '-name', 'ext_*.php' ]
22     proc = subprocess.Popen(find_cmd, stdout=subprocess.PIPE)
23     files = str(proc.stdout.read().decode('ascii')).split('\n')
24     return sorted(map(lambda x: x[len(dir) if skip else 0:],
25                       filter(lambda x: x[:len(dir)] == dir, files)))
27 def get_platform_machine():
28     return platmod.machine()