Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(507)

Side by Side Diff: infra/bots/flavor/default_flavor.py

Issue 1791513002: Fix compile on Windows swarming bot (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Handle AccessDenied Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « infra/bots/common.py ('k') | infra/bots/skia_repo.isolate » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright 2016 Google Inc. 3 # Copyright 2016 Google Inc.
4 # 4 #
5 # Use of this source code is governed by a BSD-style license that can be 5 # Use of this source code is governed by a BSD-style license that can be
6 # found in the LICENSE file. 6 # found in the LICENSE file.
7 7
8 8
9 """Default flavor utils class, used for desktop bots.""" 9 """Default flavor utils class, used for desktop bots."""
10 10
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 work. Each build step flavor should correspond to a subclass of 62 work. Each build step flavor should correspond to a subclass of
63 DefaultFlavorUtils which may override any of these functions as appropriate 63 DefaultFlavorUtils which may override any of these functions as appropriate
64 for that flavor. 64 for that flavor.
65 65
66 For example, the AndroidFlavorUtils will override the functions for 66 For example, the AndroidFlavorUtils will override the functions for
67 copying files between the host and Android device, as well as the 67 copying files between the host and Android device, as well as the
68 'step' function, so that commands may be run through ADB. 68 'step' function, so that commands may be run through ADB.
69 """ 69 """
70 def __init__(self, bot_info, *args, **kwargs): 70 def __init__(self, bot_info, *args, **kwargs):
71 self._bot_info = bot_info 71 self._bot_info = bot_info
72 self.chrome_path = os.path.join(os.path.expanduser('~'), 'src') 72 self.chrome_path = os.path.join(self._bot_info.build_dir, 'src')
73 73
74 def run(self, cmd, **kwargs): 74 def run(self, cmd, **kwargs):
75 """Runs a step as appropriate for this flavor.""" 75 """Runs a step as appropriate for this flavor."""
76 path_to_app = os.path.join(self._bot_info.out_dir, 76 path_to_app = os.path.join(self._bot_info.out_dir,
77 self._bot_info.configuration, cmd[0]) 77 self._bot_info.configuration, cmd[0])
78 if (sys.platform == 'linux' and 78 if (sys.platform == 'linux' and
79 'x86_64' in self._bot_info.bot_name and 79 'x86_64' in self._bot_info.bot_name and
80 not 'TSAN' in self._bot_info.bot_name): 80 not 'TSAN' in self._bot_info.bot_name):
81 new_cmd = ['catchsegv', path_to_app] 81 new_cmd = ['catchsegv', path_to_app]
82 else: 82 else:
83 new_cmd = [path_to_app] 83 new_cmd = [path_to_app]
84 new_cmd.extend(cmd[1:]) 84 new_cmd.extend(cmd[1:])
85 return self._bot_info.run(new_cmd, **kwargs) 85 return self._bot_info.run(new_cmd, **kwargs)
86 86
87 def bootstrap_win_toolchain(self):
88 """Run bootstrapping script for the Windows toolchain."""
89 bootstrap_script = os.path.join(self._bot_info.infrabots_dir,
90 'bootstrap_win_toolchain_json.py')
91 win_toolchain_json = os.path.join(
92 self._bot_info.build_dir, 'src', 'build', 'win_toolchain.json')
93 self._bot_info.run([
94 'python', bootstrap_script,
95 '--win_toolchain_json', win_toolchain_json,
96 '--depot_tools_parent_dir', self._bot_info.build_dir])
87 97
88 def compile(self, target): 98 def compile(self, target):
89 """Build the given target.""" 99 """Build the given target."""
90 # The CHROME_PATH environment variable is needed for bots that use 100 # The CHROME_PATH environment variable is needed for bots that use
91 # toolchains downloaded by Chrome. 101 # toolchains downloaded by Chrome.
92 env = {'CHROME_PATH': self.chrome_path} 102 env = {}
93 if sys.platform == 'win32': 103 if sys.platform == 'win32':
94 make_cmd = ['python', 'make.py'] 104 make_cmd = ['python', 'make.py']
105 env['CHROME_PATH'] = self.chrome_path
106 self._bot_info._run_once(self.bootstrap_win_toolchain)
95 else: 107 else:
96 make_cmd = ['make'] 108 make_cmd = ['make']
97 cmd = make_cmd + [target] 109 cmd = make_cmd + [target]
98 self._bot_info.run(cmd, env=env) 110 self._bot_info.run(cmd, env=env)
99 111
100 def device_path_join(self, *args): 112 def device_path_join(self, *args):
101 """Like os.path.join(), but for paths on a connected device.""" 113 """Like os.path.join(), but for paths on a connected device."""
102 return os.path.join(*args) 114 return os.path.join(*args)
103 115
104 def device_path_exists(self, path): 116 def device_path_exists(self, path):
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 return DeviceDirs( 176 return DeviceDirs(
165 dm_dir=os.path.join(self._bot_info.swarm_out_dir, 'dm'), 177 dm_dir=os.path.join(self._bot_info.swarm_out_dir, 'dm'),
166 perf_data_dir=self._bot_info.perf_data_dir, 178 perf_data_dir=self._bot_info.perf_data_dir,
167 resource_dir=self._bot_info.resource_dir, 179 resource_dir=self._bot_info.resource_dir,
168 images_dir=join('images'), 180 images_dir=join('images'),
169 skp_dir=self._bot_info.local_skp_dir, 181 skp_dir=self._bot_info.local_skp_dir,
170 tmp_dir=join('tmp')) 182 tmp_dir=join('tmp'))
171 183
172 def __repr__(self): 184 def __repr__(self):
173 return '<%s object>' % self.__class__.__name__ # pragma: no cover 185 return '<%s object>' % self.__class__.__name__ # pragma: no cover
OLDNEW
« no previous file with comments | « infra/bots/common.py ('k') | infra/bots/skia_repo.isolate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698