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 |
(...skipping 14 matching lines...) Expand all Loading... | |
25 # and thus remove the need for the whole target_platform parameter. | 25 # and thus remove the need for the whole target_platform parameter. |
26 # For now, these must match the target_platform values used in | 26 # For now, these must match the target_platform values used in |
27 # third_party/chromium_buildbot/scripts/master/factory/gclient_factory.py , | 27 # third_party/chromium_buildbot/scripts/master/factory/gclient_factory.py , |
28 # because we pass these values into GClientFactory.__init__() . | 28 # because we pass these values into GClientFactory.__init__() . |
29 TARGET_PLATFORM_LINUX = 'linux' | 29 TARGET_PLATFORM_LINUX = 'linux' |
30 TARGET_PLATFORM_MAC = 'mac' | 30 TARGET_PLATFORM_MAC = 'mac' |
31 TARGET_PLATFORM_WIN32 = 'win32' | 31 TARGET_PLATFORM_WIN32 = 'win32' |
32 | 32 |
33 CONFIG_DEBUG = 'Debug' | 33 CONFIG_DEBUG = 'Debug' |
34 CONFIG_RELEASE = 'Release' | 34 CONFIG_RELEASE = 'Release' |
35 CONFIG_BENCH = 'Bench' | |
36 CONFIGURATIONS = [CONFIG_DEBUG, CONFIG_RELEASE] | 35 CONFIGURATIONS = [CONFIG_DEBUG, CONFIG_RELEASE] |
37 | 36 |
38 | 37 |
39 class SkiaFactory(BuildFactory): | 38 class SkiaFactory(BuildFactory): |
40 """Encapsulates data and methods common to the Skia master.cfg files.""" | 39 """Encapsulates data and methods common to the Skia master.cfg files.""" |
41 | 40 |
42 def __init__(self, other_subdirs=None, do_upload_results=False, | 41 def __init__(self, other_subdirs=None, do_upload_results=False, |
43 do_patch_step=False, build_subdir='trunk', | 42 do_patch_step=False, build_subdir='trunk', |
44 target_platform=None, configuration=CONFIG_DEBUG, | 43 target_platform=None, configuration=CONFIG_DEBUG, |
45 default_timeout=8*60*60, | 44 default_timeout=8*60*60, |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
112 self._do_upload_results = do_upload_results | 111 self._do_upload_results = do_upload_results |
113 self._do_upload_bench_results = do_upload_results and \ | 112 self._do_upload_bench_results = do_upload_results and \ |
114 perf_output_basedir != None | 113 perf_output_basedir != None |
115 self._do_patch_step = do_patch_step | 114 self._do_patch_step = do_patch_step |
116 | 115 |
117 if not environment_variables: | 116 if not environment_variables: |
118 self._env_vars = {} | 117 self._env_vars = {} |
119 else: | 118 else: |
120 self._env_vars = dict(environment_variables) | 119 self._env_vars = dict(environment_variables) |
121 gyp_defines = self._env_vars.get('GYP_DEFINES', '') | 120 gyp_defines = self._env_vars.get('GYP_DEFINES', '') |
122 self._env_vars['GYP_DEFINES'] = gyp_defines + \ | 121 if gyp_defines: |
123 ' skia_warnings_as_errors=%d' % int(compile_warnings_as_errors) | 122 self._env_vars['GYP_DEFINES'] = gyp_defines + \ |
123 ' skia_warnings_as_errors=%d' % int(compile_warnings_as_errors) | |
124 else: | |
rmistry
2013/04/29 21:02:58
Instead of the else you could remove line 123 and
borenet
2013/04/30 11:43:51
The problem is that GYP_DEFINES may not be in self
rmistry
2013/04/30 11:59:24
self._env_vars['GYP_DEFINES'] = self._env_vars.get
| |
125 self._env_vars['GYP_DEFINES'] = \ | |
126 ' skia_warnings_as_errors=%d' % int(compile_warnings_as_errors) | |
124 | 127 |
125 # Get an implementation of SkiaCommands as appropriate for | 128 # Get an implementation of SkiaCommands as appropriate for |
126 # this target_platform. | 129 # this target_platform. |
127 workdir = self.TargetPathJoin('build', build_subdir) | 130 workdir = self.TargetPathJoin('build', build_subdir) |
128 self._skia_cmd_obj = skia_commands.SkiaCommands( | 131 self._skia_cmd_obj = skia_commands.SkiaCommands( |
129 target_platform=target_platform, factory=self, | 132 target_platform=target_platform, factory=self, |
130 configuration=configuration, workdir=workdir, | 133 configuration=configuration, workdir=workdir, |
131 target_arch=None, default_timeout=default_timeout, | 134 target_arch=None, default_timeout=default_timeout, |
132 environment_variables=self._env_vars) | 135 environment_variables=self._env_vars) |
133 | 136 |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
504 self.RunBench() | 507 self.RunBench() |
505 self.BenchPictures() | 508 self.BenchPictures() |
506 self.PostBench() | 509 self.PostBench() |
507 self.CheckForRegressions() | 510 self.CheckForRegressions() |
508 self.BenchGraphs() | 511 self.BenchGraphs() |
509 if self._do_upload_bench_results: | 512 if self._do_upload_bench_results: |
510 self.UploadBenchResults() | 513 self.UploadBenchResults() |
511 self.UploadBenchResultsToAppEngine() | 514 self.UploadBenchResultsToAppEngine() |
512 self.UploadBenchGraphs() | 515 self.UploadBenchGraphs() |
513 | 516 |
514 def Build(self, clobber=None): | 517 def Build(self, role=None, clobber=None): |
515 """Build and return the complete BuildFactory. | 518 """Build and return the complete BuildFactory. |
516 | 519 |
520 role: string; the intended role of this builder. The role affects which | |
521 steps are run. Known values are given in the utils module. | |
517 clobber: boolean indicating whether we should clean before building | 522 clobber: boolean indicating whether we should clean before building |
518 """ | 523 """ |
519 self.CommonSteps(clobber) | 524 if not role: |
520 self.NonPerfSteps() | 525 # If no role is provide, just run everything. |
521 self.PerfSteps() | 526 self.CommonSteps(clobber) |
527 self.NonPerfSteps() | |
528 self.PerfSteps() | |
529 elif role == utils.BUILDER_ROLE_COMPILE: | |
530 # Compile-only builder. | |
531 self.UpdateSteps() | |
532 self.Compile(clobber=clobber, build_in_one_step=False) | |
533 else: | |
534 self.CommonSteps(clobber) | |
535 if role == utils.BUILDER_ROLE_TEST: | |
536 # Test-running builder. | |
537 self.NonPerfSteps() | |
538 if self._configuration == CONFIG_DEBUG: | |
539 # Debug-mode testers run all steps, but release-mode testers don't. | |
540 self.PerfSteps() | |
541 elif role == utils.BUILDER_ROLE_PERF: | |
542 # Perf-only builder. | |
543 if not self._perf_output_basedir: | |
544 raise ValueError( | |
545 'BuildPerfOnly requires perf_output_basedir to be defined.') | |
546 if self._configuration != CONFIG_RELEASE: | |
547 raise ValueError('BuildPerfOnly should run in %s configuration.' % | |
548 CONFIG_RELEASE) | |
549 self.PerfSteps() | |
522 self.Validate() | 550 self.Validate() |
523 return self | 551 return self |
524 | |
525 def BuildCompileOnly(self, clobber=None): | |
526 """Build and return the complete BuildFactory, with only the compile step. | |
527 Does not build in one step; the assumption is that if we're only performing | |
528 the compile, we want as much information as possible about *which* compile | |
529 steps are passing and failing. | |
530 | |
531 clobber: boolean indicating whether we should clean before building | |
532 """ | |
533 self.UpdateSteps() | |
534 self.Compile(clobber=clobber, build_in_one_step=False) | |
535 self.Validate() | |
536 return self | |
537 | |
538 def BuildNoPerf(self, clobber=None): | |
539 """Build and return the complete BuildFactory, without the benchmarking | |
540 steps. | |
541 | |
542 clobber: boolean indicating whether we should clean before building | |
543 """ | |
544 self.CommonSteps(clobber) | |
545 self.NonPerfSteps() | |
546 self.Validate() | |
547 return self | |
548 | |
549 def BuildPerfOnly(self, clobber=None): | |
550 """Build and return the complete BuildFactory, with only the benchmarking | |
551 steps. | |
552 | |
553 clobber: boolean indicating whether we should clean before building | |
554 """ | |
555 if not self._perf_output_basedir: | |
556 raise ValueError( | |
557 'BuildPerfOnly requires perf_output_basedir to be defined.') | |
558 if self._configuration != CONFIG_RELEASE: | |
559 raise ValueError('BuildPerfOnly should run in %s configuration.' % | |
560 CONFIG_RELEASE) | |
561 self.CommonSteps(clobber) | |
562 self.PerfSteps() | |
563 self.Validate() | |
564 return self | |
OLD | NEW |