1
0
mirror of https://github.com/facebook/proxygen.git synced 2025-08-07 07:02:53 +03:00

add a ManifestContext and ContextGenerator class

Summary:
Add a ContextGenerator class so that we actually use the correct per-project
context when loading projects and computing dependencies.

Previously commands like `build` and `test` would change the contexts for each
project as they iterated through and performed the build.  However, they did
not do this when first loading the projects.  This could cause them to use
different context values when loading dependencies than when performing the
build.  For instance, this could cause issues if a project depends on
`googletest` only when testing is enabled, as the code previously did not set
the "test" parameter when evaluating dependencies.

Reviewed By: pkaush

Differential Revision: D16477396

fbshipit-source-id: c1e055f07de1cb960861d19594e3bda20a2ccd87
This commit is contained in:
Adam Simpkins
2019-07-31 20:53:07 -07:00
committed by Facebook Github Bot
parent 7844e79b03
commit f1ed28a52c
5 changed files with 113 additions and 53 deletions

View File

@@ -96,22 +96,3 @@ class HostType(object):
and self.distro == b.distro
and self.distrovers == b.distrovers
)
def context_from_host_tuple(host_tuple=None, facebook_internal=False):
""" Given an optional host tuple, construct a context appropriate
for passing to the boolean expression evaluator so that conditional
sections in manifests can be resolved. """
if host_tuple is None:
host_type = HostType()
elif isinstance(host_tuple, HostType):
host_type = host_tuple
else:
host_type = HostType.from_tuple_string(host_tuple)
return {
"os": host_type.ostype,
"distro": host_type.distro,
"distro_vers": host_type.distrovers,
"fb": "on" if facebook_internal else "off",
}