2016-05-12 23:43:17 +03:00
|
|
|
# This file contains macros that are shared across Eden.
|
|
|
|
|
2016-06-16 03:07:34 +03:00
|
|
|
|
2016-05-12 23:43:17 +03:00
|
|
|
def is_facebook_internal():
|
|
|
|
return read_config('codebase', 'mode') != 'public'
|
2016-06-16 03:07:34 +03:00
|
|
|
|
|
|
|
|
|
|
|
def get_fb_suffix():
|
|
|
|
'''Build rule suffix to use for Facebook-specific build targets.'''
|
|
|
|
# Internally at Facebook, it is convenient for the canonical version of an
|
|
|
|
# Eden build target to have no special suffix so that it can match the
|
|
|
|
# directory in which it is defined.
|
|
|
|
return '' if is_facebook_internal() else '-fb'
|
|
|
|
|
|
|
|
|
|
|
|
def get_oss_suffix():
|
|
|
|
'''Build rule suffix to use for open-source-specific build targets.'''
|
|
|
|
# Outside of Facebook, it is convenient for the canonical version of an
|
|
|
|
# Eden build target to have no special suffix so that it can match the
|
|
|
|
# directory in which it is defined.
|
|
|
|
return '-oss' if is_facebook_internal() else ''
|
|
|
|
|
|
|
|
|
|
|
|
def get_daemon_versions():
|
|
|
|
'''List of configurations to aid in creating dual build rules.
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
An array of tuples where the first member is a build target for the
|
|
|
|
daemon and the second member is the suffix to use for other templated
|
|
|
|
build target names.
|
|
|
|
'''
|
|
|
|
return [
|
2017-12-21 03:50:21 +03:00
|
|
|
('//eden/fs/service:edenfs%s' % suffix, suffix)
|
2016-06-16 03:07:34 +03:00
|
|
|
for suffix in [get_fb_suffix(), get_oss_suffix()]
|
|
|
|
]
|
2017-01-24 10:52:42 +03:00
|
|
|
|
|
|
|
def get_test_env_and_deps(suffix=''):
|
|
|
|
'''Returns env vars and a dep list that is useful for locating various
|
|
|
|
build products from inside our tests'''
|
|
|
|
|
2017-12-21 03:50:21 +03:00
|
|
|
daemon_target = '//eden/fs/service:edenfs%s' % suffix
|
2017-01-24 10:52:42 +03:00
|
|
|
env_to_target = {
|
2017-12-21 03:50:21 +03:00
|
|
|
'EDENFS_CLI_PATH': '//eden/cli:cli',
|
2017-01-24 10:52:42 +03:00
|
|
|
'EDENFS_SERVER_PATH': daemon_target,
|
2017-12-21 03:50:21 +03:00
|
|
|
'EDENFS_POST_CLONE_PATH': '//eden/hooks/hg:post-clone',
|
2018-01-31 08:40:53 +03:00
|
|
|
'EDENFS_FSATTR_BIN': '//eden/integration:fsattr',
|
2018-02-16 09:00:47 +03:00
|
|
|
'EDENFS_HG_IMPORT_HELPER': '//eden/fs/store/hg:hg_import_helper',
|
2018-02-15 22:37:21 +03:00
|
|
|
'EDEN_HG_BINARY': '//scm/hg:hg',
|
2017-01-24 10:52:42 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
envs = {
|
|
|
|
'EDENFS_SUFFIX': suffix,
|
|
|
|
}
|
|
|
|
deps = []
|
|
|
|
|
2017-03-23 21:08:39 +03:00
|
|
|
for name, dep in sorted(env_to_target.items()):
|
2017-01-24 10:52:42 +03:00
|
|
|
envs[name] = '$(location %s)' % dep
|
|
|
|
deps.append(dep)
|
|
|
|
|
|
|
|
return {
|
|
|
|
'env': envs,
|
|
|
|
'deps': deps
|
|
|
|
}
|