Chromium Code Reviews| 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 | |
| 11 from . import android_flavor | |
| 12 from . import cmake_flavor | |
| 13 from . import coverage_flavor | |
| 14 from . import default_flavor | |
| 15 from . import gn_flavor | |
| 16 from . import ios_flavor | |
| 17 from . import pdfium_flavor | |
| 18 from . import valgrind_flavor | |
| 19 from . import xsan_flavor | |
| 20 | |
| 21 | |
| 22 def is_android(builder_cfg): | |
| 23 """Determine whether the given builder is an Android builder.""" | |
| 24 return ('Android' in builder_cfg.get('extra_config', '') or | |
| 25 builder_cfg.get('os') == 'Android') | |
| 26 | |
| 27 | |
| 28 def is_cmake(builder_cfg): | |
| 29 return 'CMake' in builder_cfg.get('extra_config', '') | |
| 30 | |
| 31 | |
| 32 def is_gn(builder_cfg): | |
| 33 return 'GN' == builder_cfg.get('extra_config', '') | |
| 34 | |
| 35 | |
| 36 def is_ios(builder_cfg): | |
| 37 return ('iOS' in builder_cfg.get('extra_config', '') or | |
| 38 builder_cfg.get('os') == 'iOS') | |
| 39 | |
| 40 | |
| 41 def is_pdfium(builder_cfg): | |
| 42 return 'PDFium' in builder_cfg.get('extra_config', '') | |
| 43 | |
| 44 | |
| 45 def is_valgrind(builder_cfg): | |
| 46 return 'Valgrind' in builder_cfg.get('extra_config', '') | |
| 47 | |
| 48 | |
| 49 def is_xsan(builder_cfg): | |
| 50 return ('ASAN' in builder_cfg.get('extra_config', '') or | |
| 51 'MSAN' in builder_cfg.get('extra_config', '') or | |
| 52 'TSAN' in builder_cfg.get('extra_config', '')) | |
| 53 | |
| 54 | |
| 55 class SkiaFlavorApi(recipe_api.RecipeApi): | |
| 56 def get_flavor(self, builder_cfg): | |
| 57 """Return a flavor utils object specific to the given builder.""" | |
| 58 if is_android(builder_cfg): | |
| 59 return android_flavor.AndroidFlavorUtils(self.m) | |
| 60 elif is_cmake(builder_cfg): | |
| 61 return cmake_flavor.CMakeFlavorUtils(self.m) | |
| 62 elif is_gn(builder_cfg): | |
| 63 return gn_flavor.GNFlavorUtils(self.m) | |
| 64 elif is_ios(builder_cfg): | |
| 65 return ios_flavor.iOSFlavorUtils(self.m) | |
| 66 elif is_pdfium(builder_cfg): | |
| 67 return pdfium_flavor.PDFiumFlavorUtils(self.m) | |
| 68 elif is_valgrind(builder_cfg): | |
| 69 return valgrind_flavor.ValgrindFlavorUtils(self.m) | |
| 70 elif is_xsan(builder_cfg): | |
| 71 return xsan_flavor.XSanFlavorUtils(self.m) | |
| 72 elif builder_cfg.get('configuration') == 'Coverage': | |
| 73 return coverage_flavor.CoverageFlavorUtils(self.m) | |
| 74 else: | |
| 75 return default_flavor.DefaultFlavorUtils(self.m) | |
| 76 | |
| 77 def setup(self): | |
|
rmistry
2016/08/03 14:15:15
Could you check if using constructors in api.py in
borenet
2016/08/03 14:30:00
That doesn't work. The dependencies have not yet
rmistry
2016/08/03 14:37:36
Yea that sounds familiar, I tried it out a long ti
| |
| 78 self._f = self.get_flavor(self.m.vars.builder_cfg) | |
| 79 | |
| 80 def step(self, name, cmd, **kwargs): | |
| 81 return self._f.step(name, cmd, **kwargs) | |
| 82 | |
| 83 def compile(self, target): | |
| 84 return self._f.compile(target) | |
| 85 | |
| 86 def copy_extra_build_products(self, swarming_out_dir): | |
| 87 return self._f.copy_extra_build_products(swarming_out_dir) | |
| 88 | |
| 89 @property | |
| 90 def out_dir(self): | |
| 91 return self._f.out_dir | |
| 92 | |
| 93 def device_path_join(self, *args): | |
| 94 return self._f.device_path_join(*args) | |
| 95 | |
| 96 def device_path_exists(self, path): | |
| 97 return self._f.device_path_exists(path) # pragma: no cover | |
| 98 | |
| 99 def copy_directory_contents_to_device(self, host_dir, device_dir): | |
| 100 return self._f.copy_directory_contents_to_device(host_dir, device_dir) | |
| 101 | |
| 102 def copy_directory_contents_to_host(self, device_dir, host_dir): | |
| 103 return self._f.copy_directory_contents_to_host(device_dir, host_dir) | |
| 104 | |
| 105 def copy_file_to_device(self, host_path, device_path): | |
| 106 return self._f.copy_file_to_device(host_path, device_path) | |
| 107 | |
| 108 def create_clean_host_dir(self, path): | |
| 109 return self._f.create_clean_host_dir(path) | |
| 110 | |
| 111 def create_clean_device_dir(self, path): | |
| 112 return self._f.create_clean_device_dir(path) | |
| 113 | |
| 114 def read_file_on_device(self, path): | |
| 115 return self._f.read_file_on_device(path) | |
| 116 | |
| 117 def remove_file_on_device(self, path): | |
| 118 return self._f.remove_file_on_device(path) | |
| 119 | |
| 120 def install(self): | |
| 121 rv = self._f.install() | |
| 122 self.device_dirs = self._f.device_dirs | |
| 123 return rv | |
| 124 | |
| 125 def cleanup_steps(self): | |
| 126 return self._f.cleanup_steps() | |
| OLD | NEW |