Bug 1487180 - Upload the build graph report as a part of the tup build. r=mshal
authorChris Manchester <cmanchester@mozilla.com>
Fri, 31 Aug 2018 19:18:47 +0000
changeset 492102 d09adc22ea7f2e233dcd06391c6234fdc5957536
parent 492101 2f10c62f513ea136b226a2ca005b0e9a96f90736
child 492103 65b36a89443f61fda759a9398f3ee0a9270fdfdf
push id1815
push userffxbld-merge
push dateMon, 15 Oct 2018 10:40:45 +0000
treeherdermozilla-release@18d4c09e9378 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1487180 - Upload the build graph report as a part of the tup build. r=mshal Differential Revision: https://phabricator.services.mozilla.com/D4626
--- a/python/mozbuild/mozbuild/backend/tup.py
+++ b/python/mozbuild/mozbuild/backend/tup.py
@@ -9,16 +9,17 @@ import gzip
 import itertools
 import json
 import sys
 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
 from mozbuild.mozconfig import MozconfigLoader
 from mozbuild.shellutil import quote as shell_quote
 from mozbuild.util import OrderedDefaultDict
 from collections import defaultdict
 import multiprocessing
@@ -312,23 +313,30 @@ class TupBackend(CommonBackend):
         status = config.run_process(args=args,
         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):
         objdir = mozpath.normpath(mozpath.join(self.environment.topobjdir, relobjdir))
         if objdir not in self._backend_files:
             self._backend_files[objdir] = \
                     BackendTupfile(objdir, self.environment,
                                    self.environment.topsrcdir, self.environment.topobjdir,