| OLD | NEW | 
| (Empty) |  | 
 |    1 # Copyright 2016 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 # pylint: disable=W0201 | 
 |    7  | 
 |    8  | 
 |    9 from recipe_engine import recipe_api | 
 |   10 import os | 
 |   11  | 
 |   12  | 
 |   13 BOTO_CHROMIUM_SKIA_GM = 'chromium-skia-gm.boto' | 
 |   14  | 
 |   15  | 
 |   16 class SkiaVarsApi(recipe_api.RecipeApi): | 
 |   17  | 
 |   18   def make_path(self, *path): | 
 |   19     """Return a Path object for the given path.""" | 
 |   20     key  = 'custom_%s' % '_'.join(path) | 
 |   21     self.m.path.c.base_paths[key] = tuple(path) | 
 |   22     return self.m.path[key] | 
 |   23  | 
 |   24   def gsutil_env(self, boto_file): | 
 |   25     """Environment variables for gsutil.""" | 
 |   26     boto_path = None | 
 |   27     if boto_file: | 
 |   28       boto_path = self.m.path.join(self.home_dir, boto_file) | 
 |   29     return {'AWS_CREDENTIAL_FILE': boto_path, | 
 |   30             'BOTO_CONFIG': boto_path} | 
 |   31  | 
 |   32   @property | 
 |   33   def home_dir(self): | 
 |   34     """Find the home directory.""" | 
 |   35     home_dir = os.path.expanduser('~') | 
 |   36     if self._test_data.enabled: | 
 |   37       home_dir = '[HOME]' | 
 |   38     return home_dir | 
 |   39  | 
 |   40   def setup(self): | 
 |   41     """Prepare the variables.""" | 
 |   42     # Setup | 
 |   43     self.builder_name = self.m.properties['buildername'] | 
 |   44     self.master_name = self.m.properties['mastername'] | 
 |   45     self.slave_name = self.m.properties['slavename'] | 
 |   46     self.build_number = self.m.properties['buildnumber'] | 
 |   47  | 
 |   48     self.slave_dir = self.m.path['slave_build'] | 
 |   49     self.checkout_root = self.slave_dir | 
 |   50     self.default_env = {} | 
 |   51     self.gclient_env = {} | 
 |   52     self.is_compile_bot = self.builder_name.startswith('Build-') | 
 |   53  | 
 |   54     self.default_env['CHROME_HEADLESS'] = '1' | 
 |   55     # The 'depot_tools' directory comes from recipe DEPS and isn't provided by | 
 |   56     # default. We have to set it manually. | 
 |   57     self.m.path.c.base_paths['depot_tools'] = ( | 
 |   58         self.m.path.c.base_paths['slave_build'] + | 
 |   59         ('skia', 'infra', 'bots', '.recipe_deps', 'depot_tools')) | 
 |   60     if 'Win' in self.builder_name: | 
 |   61       self.m.path.c.base_paths['depot_tools'] = ( | 
 |   62           'c:\\', 'Users', 'chrome-bot', 'depot_tools') | 
 |   63  | 
 |   64     # Compile bots keep a persistent checkout. | 
 |   65     self.persistent_checkout = (self.is_compile_bot or | 
 |   66                                 'RecreateSKPs' in self.builder_name) | 
 |   67     if self.persistent_checkout: | 
 |   68       if 'Win' in self.builder_name: | 
 |   69         self.checkout_root = self.make_path('C:\\', 'b', 'work') | 
 |   70         self.gclient_cache = self.make_path('C:\\', 'b', 'cache') | 
 |   71       else: | 
 |   72         self.checkout_root = self.make_path('/', 'b', 'work') | 
 |   73         self.gclient_cache = self.make_path('/', 'b', 'cache') | 
 |   74  | 
 |   75       # got_revision is filled in after checkout steps. | 
 |   76       self.got_revision = None | 
 |   77     else: | 
 |   78       # If there's no persistent checkout, then we have to asume we got the | 
 |   79       # correct revision of the files from isolate. | 
 |   80       self.got_revision = self.m.properties['revision'] | 
 |   81  | 
 |   82     self.skia_dir = self.checkout_root.join('skia') | 
 |   83     if not self.persistent_checkout: | 
 |   84       self.m.path['checkout'] = self.skia_dir | 
 |   85  | 
 |   86     self.infrabots_dir = self.skia_dir.join('infra', 'bots') | 
 |   87     self.resource_dir = self.skia_dir.join('resources') | 
 |   88     self.images_dir = self.slave_dir.join('skimage') | 
 |   89     self.skia_out = self.skia_dir.join('out', self.builder_name) | 
 |   90     self.swarming_out_dir = self.make_path(self.m.properties['swarm_out_dir']) | 
 |   91     self.local_skp_dir = self.slave_dir.join('skp') | 
 |   92     if not self.is_compile_bot: | 
 |   93       self.skia_out = self.slave_dir.join('out') | 
 |   94     self.tmp_dir = self.m.path['slave_build'].join('tmp') | 
 |   95  | 
 |   96     # Some bots also require a checkout of chromium. | 
 |   97     self.need_chromium_checkout = 'CommandBuffer' in self.builder_name | 
 |   98     if 'CommandBuffer' in self.builder_name: | 
 |   99       self.gclient_env['GYP_CHROMIUM_NO_ACTION'] = '0' | 
 |  100     if ((self.is_compile_bot and | 
 |  101          'SAN' in self.builder_name) or | 
 |  102         'RecreateSKPs' in self.builder_name): | 
 |  103       self.need_chromium_checkout = True | 
 |  104       if 'RecreateSKPs' in self.builder_name: | 
 |  105         self.gclient_env['CPPFLAGS'] = ( | 
 |  106             '-DSK_ALLOW_CROSSPROCESS_PICTUREIMAGEFILTERS=1') | 
 |  107  | 
 |  108     # Some bots also require a checkout of PDFium. | 
 |  109     self.need_pdfium_checkout = 'PDFium' in self.builder_name | 
 |  110  | 
 |  111  | 
 |  112   def update_with_builder_spec(self, builder_spec): | 
 |  113     """Set more variables based on the builder_spec.""" | 
 |  114     # Obtain the spec for this builder from the Skia repo. Use it to set more | 
 |  115     # properties. | 
 |  116     self.builder_spec = builder_spec | 
 |  117  | 
 |  118     self.builder_cfg = self.builder_spec['builder_cfg'] | 
 |  119     self.role = self.builder_cfg['role'] | 
 |  120  | 
 |  121     self.configuration = self.builder_spec['configuration'] | 
 |  122     self.default_env.update({'SKIA_OUT': self.skia_out, | 
 |  123                              'BUILDTYPE': self.configuration}) | 
 |  124     self.default_env.update(self.builder_spec['env']) | 
 |  125     self.build_targets = [str(t) for t in self.builder_spec['build_targets']] | 
 |  126     self.do_compile_steps = self.builder_spec.get('do_compile_steps', True) | 
 |  127     self.do_test_steps = self.builder_spec['do_test_steps'] | 
 |  128     self.do_perf_steps = self.builder_spec['do_perf_steps'] | 
 |  129     self.is_trybot = self.builder_cfg['is_trybot'] | 
 |  130     self.issue = None | 
 |  131     self.patchset = None | 
 |  132     self.rietveld = None | 
 |  133     if self.is_trybot: | 
 |  134       self.issue = self.m.properties['issue'] | 
 |  135       self.patchset = self.m.properties['patchset'] | 
 |  136       self.rietveld = self.m.properties['rietveld'] | 
 |  137     self.upload_dm_results = self.builder_spec['upload_dm_results'] | 
 |  138     self.upload_perf_results = self.builder_spec['upload_perf_results'] | 
 |  139     self.dm_dir = self.m.path.join( | 
 |  140         self.swarming_out_dir, 'dm') | 
 |  141     self.perf_data_dir = self.m.path.join(self.swarming_out_dir, | 
 |  142         'perfdata', self.builder_name, 'data') | 
 |  143     self.dm_flags = self.builder_spec['dm_flags'] | 
 |  144     self.nanobench_flags = self.builder_spec['nanobench_flags'] | 
| OLD | NEW |