mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 16:57:49 +03:00
b3bd221428
Reviewed By: wez Differential Revision: D7657564 fbshipit-source-id: 41445c2233c5ced4b4cfc48c3d1008a4a13d3bb7
71 lines
2.2 KiB
Plaintext
71 lines
2.2 KiB
Plaintext
# This file contains macros that are shared across Eden.
|
|
|
|
|
|
def is_facebook_internal():
|
|
return read_config('codebase', 'mode') != 'public'
|
|
|
|
|
|
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 [
|
|
('//eden/fs/service:edenfs%s' % suffix, suffix)
|
|
for suffix in [get_fb_suffix(), get_oss_suffix()]
|
|
]
|
|
|
|
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'''
|
|
|
|
daemon_target = '//eden/fs/service:edenfs%s' % suffix
|
|
env_to_target = {
|
|
'EDENFS_CLI_PATH': '//eden/cli:eden',
|
|
'EDENFS_SERVER_PATH': daemon_target,
|
|
'EDENFS_POST_CLONE_PATH': '//eden/hooks/hg:post-clone',
|
|
'EDENFS_FSATTR_BIN': '//eden/integration:fsattr',
|
|
'EDENFS_HG_IMPORT_HELPER': '//eden/fs/store/hg:hg_import_helper',
|
|
}
|
|
|
|
if is_facebook_internal():
|
|
env_to_target.update(
|
|
{
|
|
'EDEN_HG_BINARY': '//scm/telemetry/hg:hg',
|
|
'HG_REAL_BIN': '//scm/hg:hg',
|
|
}
|
|
)
|
|
|
|
envs = {
|
|
'EDENFS_SUFFIX': suffix,
|
|
}
|
|
deps = []
|
|
|
|
for name, dep in sorted(env_to_target.items()):
|
|
envs[name] = '$(location %s)' % dep
|
|
deps.append(dep)
|
|
|
|
return {
|
|
'env': envs,
|
|
'deps': deps
|
|
}
|