From 1f2797495b6cd5d85b890e125f88c8e2d1bc986c Mon Sep 17 00:00:00 2001 From: Chris Manchester Date: Fri, 31 Aug 2018 19:18:47 +0000 Subject: [PATCH] Bug 1487180 - Upload the build graph report as a part of the tup build. r=mshal Differential Revision: https://phabricator.services.mozilla.com/D4626 --HG-- extra : moz-landing-system : lando --- python/mozbuild/mozbuild/backend/tup.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/python/mozbuild/mozbuild/backend/tup.py b/python/mozbuild/mozbuild/backend/tup.py index 52e8b9835ca7..5354c1a3d8b7 100644 --- a/python/mozbuild/mozbuild/backend/tup.py +++ b/python/mozbuild/mozbuild/backend/tup.py @@ -14,6 +14,7 @@ import shutil import mozpack.path as mozpath from mozbuild import shellutil from mozbuild.analyze.graph import Graph +from mozbuild.analyze.hg import Report from mozbuild.base import MozbuildObject from mozbuild.backend.base import PartialBackend, HybridBackend from mozbuild.backend.recursivemake import RecursiveMakeBackend @@ -317,13 +318,20 @@ class TupBackend(CommonBackend): append_env=self._get_mozconfig_env(config)) tiers.finish_tier('tup') if not status and self.environment.substs.get('MOZ_AUTOMATION'): + config.log_manager.enable_unstructured() + config._activate_virtualenv() + config.virtualenv_manager.install_pip_package('tablib==0.12.1') src = mozpath.join(self.environment.topsrcdir, '.tup') dst = os.environ['UPLOAD_PATH'] if self.environment.substs.get('UPLOAD_TUP_DB'): shutil.make_archive(mozpath.join(dst, 'tup_db'), 'zip', src) - g = Graph(mozpath.join(src, 'db')) + cost_dict = Graph(mozpath.join(src, 'db')).get_cost_dict() with gzip.open(mozpath.join(dst, 'cost_dict.gz'), 'wt') as outfile: - json.dump(g.get_cost_dict(), outfile) + json.dump(cost_dict, outfile) + # Additionally generate a report with 30 days worth of data + # for upload. + r = Report(30, cost_dict=cost_dict) + r.generate_output('html', None, dst) return status def _get_backend_file(self, relobjdir):