Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
api.py
Go to the documentation of this file.
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
9from recipe_engine import recipe_api
10
11
12CONFIG_DEBUG = 'Debug'
13CONFIG_RELEASE = 'Release'
14
15
16class SkiaVarsApi(recipe_api.RecipeApi):
17
18 def setup(self):
19 """Prepare the variables."""
20 # Hack start_dir to remove the "k" directory which is added by Kitchen.
21 # Otherwise, we can't get to the CIPD packages, caches, and isolates which
22 # were put into the task workdir.
23 if self.m.path.c.base_paths['start_dir'][-1] == 'k': # pragma: nocover
24 self.m.path.c.base_paths['start_dir'] = (
25 self.m.path.c.base_paths['start_dir'][:-1])
26
27 # Setup
28 self.builder_name = self.m.properties['buildername']
29
30 self.workdir = self.m.path['start_dir']
31
32 # Special input/output directories.
33 self.build_dir = self.workdir.join('build')
34
35 self.default_env = self.m.context.env
36 self.default_env['CHROME_HEADLESS'] = '1'
37 self.default_env['PATH'] = self.m.path.pathsep.join([
38 self.default_env.get('PATH', '%(PATH)s'),
39 str(self.m.bot_update.repo_resource()),
40 ])
41 self.cache_dir = self.workdir.join('cache')
42
43 self.swarming_out_dir = self.workdir.join(
44 self.m.properties.get('swarm_out_dir', 'tmp'))
45
46 self.tmp_dir = self.m.path['start_dir'].join('tmp')
47
48 self.builder_cfg = self.m.builder_name_schema.DictForBuilderName(
49 self.builder_name)
50 self.role = self.builder_cfg['role']
51 if self.role == self.m.builder_name_schema.BUILDER_ROLE_HOUSEKEEPER:
52 self.configuration = CONFIG_RELEASE
53 else:
54 self.configuration = self.builder_cfg.get('configuration', CONFIG_DEBUG)
55 arch = (self.builder_cfg.get('arch') or self.builder_cfg.get('target_arch'))
56 if ('Win' in self.builder_cfg.get('os', '') and arch == 'x86_64'):
57 self.configuration += '_x64'
58
59 self.extra_tokens = []
60 if len(self.builder_cfg.get('extra_config', '')) > 0:
61 if self.builder_cfg['extra_config'].startswith('SK'):
62 assert self.builder_cfg['extra_config'].isupper()
63 self.extra_tokens = [self.builder_cfg['extra_config']]
64 else:
65 self.extra_tokens = self.builder_cfg['extra_config'].split('_')
66
67 self.patch_storage = self.m.properties.get('patch_storage', 'gerrit')
68 self.issue = None
69 self.patchset = None
70 self.is_trybot = False
71 if (self.m.properties.get('patch_issue', '') and
72 self.m.properties['patch_issue'] != '0' and
73 self.m.properties.get('patch_set', '') and
74 self.m.properties['patch_set'] != '0' and
75 self.m.properties.get('patch_ref', '')):
76 self.is_trybot = True
77 self.issue = self.m.properties['patch_issue']
78 self.patchset = self.m.properties['patch_set']
79
80 self._swarming_bot_id = None
82
83 # Internal bot support.
85 self.m.properties.get('internal_hardware_label'))
87
88 @property
89 def is_linux(self):
90 return (
91 'Ubuntu' in self.builder_name
92 or 'Debian' in self.builder_name
93 or 'Housekeeper' in self.builder_name
94 )
95
96 @property
97 def swarming_bot_id(self):
98 if not self._swarming_bot_id:
99 script = self.resource('get_env_var.py')
100 step_stdout = self.m.step(
101 name='get swarming bot id',
102 cmd=['python3', script, 'SWARMING_BOT_ID'],
103 stdout=self.m.raw_io.output()).stdout.decode('utf-8')
104 self._swarming_bot_id = step_stdout.rstrip() if step_stdout else ''
105 return self._swarming_bot_id
106
107 @property
109 if not self._swarming_task_id:
110 script = self.resource('get_env_var.py')
111 step_stdout = self.m.step(
112 name='get swarming task id',
113 cmd=['python3', script, 'SWARMING_TASK_ID'],
114 stdout=self.m.raw_io.output()).stdout.decode('utf-8')
115 self._swarming_task_id = step_stdout.rstrip() if step_stdout else ''
116 return self._swarming_task_id
static int step(int x, SkScalar min, SkScalar max)
Definition BlurTest.cpp:215
swarming_task_id(self)
Definition api.py:108
swarming_bot_id(self)
Definition api.py:97
Definition setup.py:1