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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 version, | 217 version, |
227 VERSION_FILE_SVG, | 218 VERSION_FILE_SVG, |
228 self.m.vars.tmp_dir, | 219 self.m.vars.tmp_dir, |
229 self.m.vars.local_svg_dir, | 220 self.m.vars.local_svg_dir, |
230 self.device_dirs.svg_dir, | 221 self.device_dirs.svg_dir, |
231 test_expected_version=self.m.properties.get( | 222 test_expected_version=self.m.properties.get( |
232 'test_downloaded_svg_version', TEST_EXPECTED_SVG_VERSION), | 223 'test_downloaded_svg_version', TEST_EXPECTED_SVG_VERSION), |
233 test_actual_version=self.m.properties.get( | 224 test_actual_version=self.m.properties.get( |
234 'test_downloaded_svg_version', TEST_EXPECTED_SVG_VERSION)) | 225 'test_downloaded_svg_version', TEST_EXPECTED_SVG_VERSION)) |
235 return version | 226 return version |
OLD | NEW |