Bug 1374940 - Allow transforms to access info about tasks from kind dependencies of the current kind. r=dustin
authorMike Hommey <mh+mozilla@glandium.org>
Wed, 19 Jul 2017 07:25:26 +0900
changeset 418755 eac3bc21f3708cf404a1115c57addedcd0104bb1
parent 418754 b5390e7949af282c6709f93d382368b16512c191
child 418756 2023ee951ea672f47cb01f5df84bf72a88fcfb1b
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdustin
bugs1374940
milestone56.0a1
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 1374940 - Allow transforms to access info about tasks from kind dependencies of the current kind. r=dustin
taskcluster/taskgraph/generator.py
taskcluster/taskgraph/transforms/base.py
--- a/taskcluster/taskgraph/generator.py
+++ b/taskcluster/taskgraph/generator.py
@@ -44,25 +44,30 @@ class Kind(object):
         config = copy.deepcopy(self.config)
 
         if 'parse-commit' in self.config:
             parse_commit = find_object(config['parse-commit'])
             config['args'] = parse_commit(parameters['message'])
         else:
             config['args'] = None
 
+        kind_dependencies = config.get('kind-dependencies', [])
+        kind_dependencies_tasks = [task for task in loaded_tasks
+                                   if task.kind in kind_dependencies]
+
         inputs = loader(self.name, self.path, config, parameters, loaded_tasks)
 
         transforms = TransformSequence()
         for xform_path in config['transforms']:
             transform = find_object(xform_path)
             transforms.add(transform)
 
         # perform the transformations on the loaded inputs
-        trans_config = TransformConfig(self.name, self.path, config, parameters)
+        trans_config = TransformConfig(self.name, self.path, config, parameters,
+                                       kind_dependencies_tasks)
         tasks = [Task(self.name,
                       label=task_dict['label'],
                       attributes=task_dict['attributes'],
                       task=task_dict['task'],
                       optimizations=task_dict.get('optimizations'),
                       dependencies=task_dict.get('dependencies'))
                  for task_dict in transforms(trans_config, inputs)]
         return tasks
--- a/taskcluster/taskgraph/transforms/base.py
+++ b/taskcluster/taskgraph/transforms/base.py
@@ -4,29 +4,34 @@
 
 from __future__ import absolute_import, print_function, unicode_literals
 
 
 class TransformConfig(object):
     """A container for configuration affecting transforms.  The `config`
     argument to transforms is an instance of this class, possibly with
     additional kind-specific attributes beyond those set here."""
-    def __init__(self, kind, path, config, params):
+    def __init__(self, kind, path, config, params,
+                 kind_dependencies_tasks=None):
         # the name of the current kind
         self.kind = kind
 
         # the path to the kind configuration directory
         self.path = path
 
         # the parsed contents of kind.yml
         self.config = config
 
         # the parameters for this task-graph generation run
         self.params = params
 
+        # a list of all the tasks associated with the kind dependencies of the
+        # current kind
+        self.kind_dependencies_tasks = kind_dependencies_tasks
+
 
 class TransformSequence(object):
     """
     Container for a sequence of transforms.  Each transform is represented as a
     callable taking (config, items) and returning a generator which will yield
     transformed items.  The resulting sequence has the same interface.
 
     This is convenient to use in a file full of transforms, as it provides a