| OLD | NEW |
| 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 | 5 |
| 6 """Utility class to build the Skia master BuildFactory's. | 6 """Utility class to build the Skia master BuildFactory's. |
| 7 | 7 |
| 8 Based on gclient_factory.py and adds Skia-specific steps.""" | 8 Based on gclient_factory.py and adds Skia-specific steps.""" |
| 9 | 9 |
| 10 | 10 |
| 11 from buildbot.process.properties import WithProperties | 11 from buildbot.process.properties import WithProperties |
| 12 from config_private import AUTOGEN_SVN_BASEURL, SKIA_SVN_BASEURL | 12 from config_private import AUTOGEN_SVN_BASEURL, SKIA_SVN_BASEURL |
| 13 from master.factory import gclient_factory | 13 from master.factory import gclient_factory |
| 14 from master.factory.build_factory import BuildFactory | 14 from master.factory.build_factory import BuildFactory |
| 15 from skia_master_scripts import commands as skia_commands | 15 from skia_master_scripts import commands as skia_commands |
| 16 import config | 16 import config |
| 17 import config_private | 17 import config_private |
| 18 import ntpath | 18 import ntpath |
| 19 import posixpath | 19 import posixpath |
| 20 import utils |
| 20 | 21 |
| 21 | 22 |
| 22 # TODO(epoger): My intent is to make the build steps identical on all platforms | 23 # TODO(epoger): My intent is to make the build steps identical on all platforms |
| 23 # and thus remove the need for the whole target_platform parameter. | 24 # and thus remove the need for the whole target_platform parameter. |
| 24 # For now, these must match the target_platform values used in | 25 # For now, these must match the target_platform values used in |
| 25 # third_party/chromium_buildbot/scripts/master/factory/gclient_factory.py , | 26 # third_party/chromium_buildbot/scripts/master/factory/gclient_factory.py , |
| 26 # because we pass these values into GClientFactory.__init__() . | 27 # because we pass these values into GClientFactory.__init__() . |
| 27 TARGET_PLATFORM_LINUX = 'linux' | 28 TARGET_PLATFORM_LINUX = 'linux' |
| 28 TARGET_PLATFORM_MAC = 'mac' | 29 TARGET_PLATFORM_MAC = 'mac' |
| 29 TARGET_PLATFORM_WIN32 = 'win32' | 30 TARGET_PLATFORM_WIN32 = 'win32' |
| 30 | 31 |
| 31 CONFIG_DEBUG = 'Debug' | 32 CONFIG_DEBUG = 'Debug' |
| 32 CONFIG_RELEASE = 'Release' | 33 CONFIG_RELEASE = 'Release' |
| 33 CONFIG_BENCH = 'Bench' | |
| 34 CONFIGURATIONS = [CONFIG_DEBUG, CONFIG_RELEASE] | 34 CONFIGURATIONS = [CONFIG_DEBUG, CONFIG_RELEASE] |
| 35 | 35 |
| 36 | 36 |
| 37 class SkiaFactory(BuildFactory): | 37 class SkiaFactory(BuildFactory): |
| 38 """Encapsulates data and methods common to the Skia master.cfg files.""" | 38 """Encapsulates data and methods common to the Skia master.cfg files.""" |
| 39 | 39 |
| 40 def __init__(self, other_subdirs=None, do_upload_results=False, | 40 def __init__(self, other_subdirs=None, do_upload_results=False, |
| 41 do_patch_step=False, build_subdir='trunk', | 41 do_patch_step=False, build_subdir='trunk', |
| 42 target_platform=None, configuration=CONFIG_DEBUG, | 42 target_platform=None, configuration=CONFIG_DEBUG, |
| 43 default_timeout=8*60*60, | 43 default_timeout=8*60*60, |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 self._do_upload_results = do_upload_results | 110 self._do_upload_results = do_upload_results |
| 111 self._do_upload_bench_results = do_upload_results and \ | 111 self._do_upload_bench_results = do_upload_results and \ |
| 112 perf_output_basedir != None | 112 perf_output_basedir != None |
| 113 self._do_patch_step = do_patch_step | 113 self._do_patch_step = do_patch_step |
| 114 | 114 |
| 115 if not environment_variables: | 115 if not environment_variables: |
| 116 my_env_vars = {} | 116 my_env_vars = {} |
| 117 else: | 117 else: |
| 118 my_env_vars = dict(environment_variables) | 118 my_env_vars = dict(environment_variables) |
| 119 gyp_defines = my_env_vars.get('GYP_DEFINES', '') | 119 gyp_defines = my_env_vars.get('GYP_DEFINES', '') |
| 120 my_env_vars['GYP_DEFINES'] = gyp_defines + \ | 120 if gyp_defines: |
| 121 ' skia_warnings_as_errors=%d' % int(compile_warnings_as_errors) | 121 my_env_vars['GYP_DEFINES'] = gyp_defines + \ |
| 122 ' skia_warnings_as_errors=%d' % int(compile_warnings_as_errors) |
| 123 else: |
| 124 my_env_vars['GYP_DEFINES'] = \ |
| 125 'skia_warnings_as_errors=%d' % int(compile_warnings_as_errors) |
| 122 | 126 |
| 123 # Get an implementation of SkiaCommands as appropriate for | 127 # Get an implementation of SkiaCommands as appropriate for |
| 124 # this target_platform. | 128 # this target_platform. |
| 125 workdir = self.TargetPathJoin('build', build_subdir) | 129 workdir = self.TargetPathJoin('build', build_subdir) |
| 126 self._skia_cmd_obj = skia_commands.SkiaCommands( | 130 self._skia_cmd_obj = skia_commands.SkiaCommands( |
| 127 target_platform=target_platform, factory=self, | 131 target_platform=target_platform, factory=self, |
| 128 configuration=configuration, workdir=workdir, | 132 configuration=configuration, workdir=workdir, |
| 129 target_arch=None, default_timeout=default_timeout, | 133 target_arch=None, default_timeout=default_timeout, |
| 130 environment_variables=my_env_vars) | 134 environment_variables=my_env_vars) |
| 131 | 135 |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 self.RunBench() | 486 self.RunBench() |
| 483 self.BenchPictures() | 487 self.BenchPictures() |
| 484 self.PostBench() | 488 self.PostBench() |
| 485 self.CheckForRegressions() | 489 self.CheckForRegressions() |
| 486 self.BenchGraphs() | 490 self.BenchGraphs() |
| 487 if self._do_upload_bench_results: | 491 if self._do_upload_bench_results: |
| 488 self.UploadBenchResults() | 492 self.UploadBenchResults() |
| 489 self.UploadBenchResultsToAppEngine() | 493 self.UploadBenchResultsToAppEngine() |
| 490 self.UploadBenchGraphs() | 494 self.UploadBenchGraphs() |
| 491 | 495 |
| 492 def Build(self, clobber=None): | 496 def Build(self, role=None, clobber=None): |
| 493 """Build and return the complete BuildFactory. | 497 """Build and return the complete BuildFactory. |
| 494 | 498 |
| 499 role: string; the intended role of this builder. The role affects which |
| 500 steps are run. Known values are given in the utils module. |
| 495 clobber: boolean indicating whether we should clean before building | 501 clobber: boolean indicating whether we should clean before building |
| 496 """ | 502 """ |
| 497 self.CommonSteps(clobber) | 503 if not role: |
| 498 self.NonPerfSteps() | 504 # If no role is provide, just run everything. |
| 499 self.PerfSteps() | 505 self.CommonSteps(clobber) |
| 506 self.NonPerfSteps() |
| 507 self.PerfSteps() |
| 508 elif role == utils.BUILDER_ROLE_COMPILE: |
| 509 # Compile-only builder. |
| 510 self.UpdateSteps() |
| 511 self.Compile(clobber=clobber, build_in_one_step=False) |
| 512 else: |
| 513 self.CommonSteps(clobber) |
| 514 if role == utils.BUILDER_ROLE_TEST: |
| 515 # Test-running builder. |
| 516 self.NonPerfSteps() |
| 517 if self._configuration == CONFIG_DEBUG: |
| 518 # Debug-mode testers run all steps, but release-mode testers don't. |
| 519 self.PerfSteps() |
| 520 elif role == utils.BUILDER_ROLE_PERF: |
| 521 # Perf-only builder. |
| 522 if not self._perf_output_basedir: |
| 523 raise ValueError( |
| 524 'BuildPerfOnly requires perf_output_basedir to be defined.') |
| 525 if self._configuration != CONFIG_RELEASE: |
| 526 raise ValueError('BuildPerfOnly should run in %s configuration.' % |
| 527 CONFIG_RELEASE) |
| 528 self.PerfSteps() |
| 500 return self | 529 return self |
| 501 | |
| 502 def BuildCompileOnly(self, clobber=None): | |
| 503 """Build and return the complete BuildFactory, with only the compile step. | |
| 504 Does not build in one step; the assumption is that if we're only performing | |
| 505 the compile, we want as much information as possible about *which* compile | |
| 506 steps are passing and failing. | |
| 507 | |
| 508 clobber: boolean indicating whether we should clean before building | |
| 509 """ | |
| 510 self.UpdateSteps() | |
| 511 self.Compile(clobber=clobber, build_in_one_step=False) | |
| 512 return self | |
| 513 | |
| 514 def BuildNoPerf(self, clobber=None): | |
| 515 """Build and return the complete BuildFactory, without the benchmarking | |
| 516 steps. | |
| 517 | |
| 518 clobber: boolean indicating whether we should clean before building | |
| 519 """ | |
| 520 self.CommonSteps(clobber) | |
| 521 self.NonPerfSteps() | |
| 522 return self | |
| 523 | |
| 524 def BuildPerfOnly(self, clobber=None): | |
| 525 """Build and return the complete BuildFactory, with only the benchmarking | |
| 526 steps. | |
| 527 | |
| 528 clobber: boolean indicating whether we should clean before building | |
| 529 """ | |
| 530 if not self._perf_output_basedir: | |
| 531 raise ValueError( | |
| 532 'BuildPerfOnly requires perf_output_basedir to be defined.') | |
| 533 if self._configuration != CONFIG_RELEASE: | |
| 534 raise ValueError('BuildPerfOnly should run in %s configuration.' % | |
| 535 CONFIG_RELEASE) | |
| 536 self.CommonSteps(clobber) | |
| 537 self.PerfSteps() | |
| 538 return self | |
| OLD | NEW |