OLD | NEW |
---|---|
1 # Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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 # pylint: disable=W0201 | 6 # pylint: disable=W0201 |
7 | 7 |
8 | 8 |
9 from recipe_engine import recipe_api | 9 from recipe_engine import recipe_api |
10 | 10 |
11 from . import android_flavor | |
12 from . import cmake_flavor | 11 from . import cmake_flavor |
13 from . import coverage_flavor | 12 from . import coverage_flavor |
14 from . import default_flavor | 13 from . import default_flavor |
15 from . import gn_android_flavor | 14 from . import gn_android_flavor |
16 from . import gn_flavor | 15 from . import gn_flavor |
17 from . import ios_flavor | 16 from . import ios_flavor |
18 from . import pdfium_flavor | 17 from . import pdfium_flavor |
19 from . import valgrind_flavor | 18 from . import valgrind_flavor |
20 | 19 |
21 | 20 |
22 TEST_EXPECTED_SKP_VERSION = '42' | 21 TEST_EXPECTED_SKP_VERSION = '42' |
23 TEST_EXPECTED_SVG_VERSION = '42' | 22 TEST_EXPECTED_SVG_VERSION = '42' |
24 TEST_EXPECTED_SK_IMAGE_VERSION = '42' | 23 TEST_EXPECTED_SK_IMAGE_VERSION = '42' |
25 | 24 |
26 VERSION_FILE_SK_IMAGE = 'SK_IMAGE_VERSION' | 25 VERSION_FILE_SK_IMAGE = 'SK_IMAGE_VERSION' |
27 VERSION_FILE_SKP = 'SKP_VERSION' | 26 VERSION_FILE_SKP = 'SKP_VERSION' |
28 VERSION_FILE_SVG = 'SVG_VERSION' | 27 VERSION_FILE_SVG = 'SVG_VERSION' |
29 | 28 |
30 VERSION_NONE = -1 | 29 VERSION_NONE = -1 |
31 | 30 |
32 | 31 |
33 def is_android(builder_cfg): | |
34 """Determine whether the given builder is an Android builder.""" | |
35 return ('Android' in builder_cfg.get('extra_config', '') or | |
36 builder_cfg.get('os') == 'Android') | |
37 | |
38 | |
39 def is_cmake(builder_cfg): | 32 def is_cmake(builder_cfg): |
40 return 'CMake' in builder_cfg.get('extra_config', '') | 33 return 'CMake' in builder_cfg.get('extra_config', '') |
41 | 34 |
42 | 35 |
43 def is_ios(builder_cfg): | 36 def is_ios(builder_cfg): |
44 return ('iOS' in builder_cfg.get('extra_config', '') or | 37 return ('iOS' in builder_cfg.get('extra_config', '') or |
45 builder_cfg.get('os') == 'iOS') | 38 builder_cfg.get('os') == 'iOS') |
46 | 39 |
47 | 40 |
48 def is_pdfium(builder_cfg): | 41 def is_pdfium(builder_cfg): |
49 return 'PDFium' in builder_cfg.get('extra_config', '') | 42 return 'PDFium' in builder_cfg.get('extra_config', '') |
50 | 43 |
51 | 44 |
52 def is_valgrind(builder_cfg): | 45 def is_valgrind(builder_cfg): |
53 return 'Valgrind' in builder_cfg.get('extra_config', '') | 46 return 'Valgrind' in builder_cfg.get('extra_config', '') |
54 | 47 |
55 | 48 |
56 class SkiaFlavorApi(recipe_api.RecipeApi): | 49 class SkiaFlavorApi(recipe_api.RecipeApi): |
57 def get_flavor(self, builder_cfg): | 50 def get_flavor(self, builder_cfg): |
58 """Return a flavor utils object specific to the given builder.""" | 51 """Return a flavor utils object specific to the given builder.""" |
59 gn_android = gn_android_flavor.GNAndroidFlavorUtils(self.m) | 52 gn_android = gn_android_flavor.GNAndroidFlavorUtils(self.m) |
60 if gn_android.supported(): | 53 if gn_android.supported(): |
61 return gn_android | 54 return gn_android |
62 | 55 |
63 gn = gn_flavor.GNFlavorUtils(self.m) | 56 gn = gn_flavor.GNFlavorUtils(self.m) |
64 if gn.supported(): | 57 if gn.supported(): |
65 return gn | 58 return gn |
66 | 59 |
67 if is_android(builder_cfg): | 60 if is_cmake(builder_cfg): |
68 return android_flavor.AndroidFlavorUtils(self.m) | |
69 elif is_cmake(builder_cfg): | |
70 return cmake_flavor.CMakeFlavorUtils(self.m) | 61 return cmake_flavor.CMakeFlavorUtils(self.m) |
71 elif is_ios(builder_cfg): | 62 elif is_ios(builder_cfg): |
72 return ios_flavor.iOSFlavorUtils(self.m) | 63 return ios_flavor.iOSFlavorUtils(self.m) |
73 elif is_pdfium(builder_cfg): | 64 elif is_pdfium(builder_cfg): |
74 return pdfium_flavor.PDFiumFlavorUtils(self.m) | 65 return pdfium_flavor.PDFiumFlavorUtils(self.m) |
75 elif is_valgrind(builder_cfg): | 66 elif is_valgrind(builder_cfg): |
76 return valgrind_flavor.ValgrindFlavorUtils(self.m) | 67 return valgrind_flavor.ValgrindFlavorUtils(self.m) |
77 elif builder_cfg.get('configuration') == 'Coverage': | 68 elif builder_cfg.get('configuration') == 'Coverage': |
78 return coverage_flavor.CoverageFlavorUtils(self.m) | 69 return coverage_flavor.CoverageFlavorUtils(self.m) |
79 else: | 70 else: |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
137 return self._f.cleanup_steps() | 128 return self._f.cleanup_steps() |
138 | 129 |
139 def _copy_dir(self, host_version, version_file, tmp_dir, | 130 def _copy_dir(self, host_version, version_file, tmp_dir, |
140 host_path, device_path, test_expected_version, | 131 host_path, device_path, test_expected_version, |
141 test_actual_version): | 132 test_actual_version): |
142 actual_version_file = self.m.path.join(tmp_dir, version_file) | 133 actual_version_file = self.m.path.join(tmp_dir, version_file) |
143 # Copy to device. | 134 # Copy to device. |
144 device_version_file = self.device_path_join( | 135 device_version_file = self.device_path_join( |
145 self.device_dirs.tmp_dir, version_file) | 136 self.device_dirs.tmp_dir, version_file) |
146 if str(actual_version_file) != str(device_version_file): | 137 if str(actual_version_file) != str(device_version_file): |
147 try: | 138 device_version = self.read_file_on_device(device_version_file) |
148 device_version = self.read_file_on_device(device_version_file) | |
149 except self.m.step.StepFailure: | |
150 device_version = VERSION_NONE | |
borenet
2016/09/19 13:05:15
Why is this safe to remove?
mtklein
2016/09/19 13:06:27
No bots actually fail now. I think they just retu
borenet
2016/09/19 13:13:22
Okay, I think I'd prefer to leave in this check si
| |
151 if device_version != host_version: | 139 if device_version != host_version: |
152 self.remove_file_on_device(device_version_file) | 140 self.remove_file_on_device(device_version_file) |
153 self.create_clean_device_dir(device_path) | 141 self.create_clean_device_dir(device_path) |
154 self.copy_directory_contents_to_device( | 142 self.copy_directory_contents_to_device( |
155 host_path, device_path) | 143 host_path, device_path) |
156 | 144 |
157 # Copy the new version file. | 145 # Copy the new version file. |
158 self.copy_file_to_device(actual_version_file, device_version_file) | 146 self.copy_file_to_device(actual_version_file, device_version_file) |
159 | 147 |
160 def _copy_images(self): | 148 def _copy_images(self): |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
226 version, | 214 version, |
227 VERSION_FILE_SVG, | 215 VERSION_FILE_SVG, |
228 self.m.vars.tmp_dir, | 216 self.m.vars.tmp_dir, |
229 self.m.vars.local_svg_dir, | 217 self.m.vars.local_svg_dir, |
230 self.device_dirs.svg_dir, | 218 self.device_dirs.svg_dir, |
231 test_expected_version=self.m.properties.get( | 219 test_expected_version=self.m.properties.get( |
232 'test_downloaded_svg_version', TEST_EXPECTED_SVG_VERSION), | 220 'test_downloaded_svg_version', TEST_EXPECTED_SVG_VERSION), |
233 test_actual_version=self.m.properties.get( | 221 test_actual_version=self.m.properties.get( |
234 'test_downloaded_svg_version', TEST_EXPECTED_SVG_VERSION)) | 222 'test_downloaded_svg_version', TEST_EXPECTED_SVG_VERSION)) |
235 return version | 223 return version |
OLD | NEW |