| OLD | NEW |
| (Empty) |
| 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
| 2 # Use of this source code is governed by a BSD-style license that can be | |
| 3 # found in the LICENSE file. | |
| 4 | |
| 5 | |
| 6 """ Subclass of factory.SkiaFactory which builds some project other than Skia, | |
| 7 using the latest revision of Skia. """ | |
| 8 | |
| 9 import builder_name_schema | |
| 10 import factory | |
| 11 import os | |
| 12 | |
| 13 | |
| 14 class CanaryFactory(factory.SkiaFactory): | |
| 15 """ BuildFactory for a project which uses Skia; updates the project to a | |
| 16 known good revision, updates Skia to the latest revision, and verifies that | |
| 17 the project builds. | |
| 18 """ | |
| 19 def __init__(self, path_to_skia, flavor, **kwargs): | |
| 20 """ Instantiates a CanaryFactory for a given project. | |
| 21 | |
| 22 path_to_skia: list of strings; indicates the path from the root of the | |
| 23 project to the project's copy of Skia. | |
| 24 """ | |
| 25 flavor = '%s_canary' % flavor | |
| 26 factory.SkiaFactory.__init__(self, flavor=flavor, **kwargs) | |
| 27 self._path_to_skia = self.TargetPath.join(*path_to_skia) | |
| 28 | |
| 29 def Update(self): | |
| 30 self.AddFlavoredSlaveScript( | |
| 31 script=self.TargetPath.join('..', '..', '..', '..', '..', 'slave', | |
| 32 'skia_slave_scripts', | |
| 33 '%s_update.py' % self._flavor), | |
| 34 args=['--gyp_defines', | |
| 35 ' '.join('%s=%s' % (k, v) for k, v in self._gyp_defines.items())], | |
| 36 description='Update', | |
| 37 timeout=None, | |
| 38 halt_on_failure=True, | |
| 39 is_rebaseline_step=True, | |
| 40 get_props_from_stdout={'got_revision': | |
| 41 'Skia updated to (\w+)', | |
| 42 'chrome_revision': | |
| 43 'Chrome updated to (\w+)'}, | |
| 44 workdir='build') | |
| 45 | |
| 46 # pylint: disable=W0221 | |
| 47 def ApplyPatch(self): | |
| 48 # Note that, since Chrome only checks out the src, include, and gyp dirs, | |
| 49 # any patch containing changes outside of those directories will fail to | |
| 50 # apply. | |
| 51 workdir = self.TargetPath.join(self._workdir, self._path_to_skia) | |
| 52 path_to_script = [os.pardir for _ in workdir.split(self.TargetPath.sep)] | |
| 53 path_to_script.extend([os.pardir, os.pardir, os.pardir, os.pardir, | |
| 54 'slave', 'skia_slave_scripts', 'apply_patch.py']) | |
| 55 path_str = self.TargetPath.join(*path_to_script) | |
| 56 factory.SkiaFactory.ApplyPatch(self, | |
| 57 alternate_script=path_str, | |
| 58 alternate_workdir=workdir) | |
| 59 | |
| 60 def CCUnitTests(self): | |
| 61 self.AddFlavoredSlaveScript(script='cc_unittests.py', | |
| 62 description='cc_unittests') | |
| 63 | |
| 64 def Build(self, role=builder_name_schema.BUILDER_ROLE_CANARY, **kwargs): | |
| 65 """Build and return the complete BuildFactory. | |
| 66 | |
| 67 role: string; type of builder. | |
| 68 """ | |
| 69 if role != builder_name_schema.BUILDER_ROLE_CANARY: | |
| 70 raise Exception('Canary builders must have role "%s"' % | |
| 71 builder_name_schema.BUILDER_ROLE_CANARY) | |
| 72 | |
| 73 self.UpdateSteps() | |
| 74 self.Compile(clobber=False, retry_without_werr_on_failure=True) | |
| 75 self.CCUnitTests() | |
| 76 self.Validate() | |
| 77 return self | |
| OLD | NEW |