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

fbcode_builder: getdeps: beef up hash computation

Summary:
previously, a relatively lame hash was computed to use
for the build directory based on some hash of the source directory.
That was good enough to get things off the ground, but in the
interest of being able to cache the build outputs and safely
invalidate them we need a slightly more rigorous implementation.

This diff computes a hash based on the manifest contents and
relevant environmental factors.

The hash is used to name the build directory which will ultimately
be cached eg: using the travis/appveyor cache directory configuration
and some other means for the FB internal CI.

The hash needs to be sufficient that we change the hash when
the manifests change.  We can tolerate a false positive change
in hash (it just means that a build will take longer), but
cannot tolerate a false negative (which would result in an
incorrect build).

Reviewed By: simpkins

Differential Revision: D14710332

fbshipit-source-id: ebc2e74eafc6f3305d4412a82195bc9fb9dfa615
This commit is contained in:
Wez Furlong
2019-05-03 15:52:39 -07:00
committed by Facebook Github Bot
parent 080f2c565f
commit 4f5544674a
4 changed files with 139 additions and 23 deletions

View File

@@ -145,7 +145,9 @@ class BuildCmd(SubCmd):
manifest = load_project(opts, args.project)
ctx = context_from_host_tuple()
print("Building on %s" % ctx)
projects = manifests_in_dependency_order(opts, manifest, ctx)
manifests_by_name = {m.name: m for m in projects}
# Accumulate the install directories so that the build steps
# can find their dep installation
@@ -161,7 +163,7 @@ class BuildCmd(SubCmd):
reconfigure = change_status.build_changed()
sources_changed = change_status.sources_changed()
dirs = opts.compute_dirs(m, fetcher)
dirs = opts.compute_dirs(m, fetcher, manifests_by_name, ctx)
build_dir = dirs["build_dir"]
inst_dir = dirs["inst_dir"]
@@ -169,7 +171,7 @@ class BuildCmd(SubCmd):
if os.path.exists(built_marker):
with open(built_marker, "r") as f:
built_hash = f.read().strip()
if built_hash != hash:
if built_hash != dirs["hash"]:
# Some kind of inconsistency with a prior build,
# let's run it again to be sure
os.unlink(built_marker)
@@ -213,6 +215,7 @@ class TestCmd(SubCmd):
ctx = context_from_host_tuple()
projects = manifests_in_dependency_order(opts, manifest, ctx)
manifests_by_name = {m.name: m for m in projects}
# Accumulate the install directories so that the test steps
# can find their dep installation
@@ -221,7 +224,7 @@ class TestCmd(SubCmd):
for m in projects:
fetcher = m.create_fetcher(opts, ctx)
dirs = opts.compute_dirs(m, fetcher)
dirs = opts.compute_dirs(m, fetcher, manifests_by_name, ctx)
build_dir = dirs["build_dir"]
inst_dir = dirs["inst_dir"]