OLD | NEW |
1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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 import copy | 9 import copy |
10 import default_flavor | 10 import default_flavor |
(...skipping 27 matching lines...) Expand all Loading... |
38 def compile(self, target, **kwargs): | 38 def compile(self, target, **kwargs): |
39 """Build the given target.""" | 39 """Build the given target.""" |
40 cmd = [self.ios_bin.join('ios_ninja')] | 40 cmd = [self.ios_bin.join('ios_ninja')] |
41 self.m.run(self.m.step, 'build iOSShell', cmd=cmd, | 41 self.m.run(self.m.step, 'build iOSShell', cmd=cmd, |
42 cwd=self.m.path['checkout'], **kwargs) | 42 cwd=self.m.path['checkout'], **kwargs) |
43 | 43 |
44 def device_path_join(self, *args): | 44 def device_path_join(self, *args): |
45 """Like os.path.join(), but for paths on a connected iOS device.""" | 45 """Like os.path.join(), but for paths on a connected iOS device.""" |
46 return '/'.join(args) | 46 return '/'.join(args) |
47 | 47 |
48 def device_path_exists(self, path): | |
49 """Like os.path.exists(), but for paths on a connected device.""" | |
50 return self.m.run( | |
51 self.m.step, | |
52 'exists %s' % path, | |
53 cmd=[self.ios_bin.join('ios_path_exists'), path], | |
54 env=self.default_env, | |
55 infra_step=True, | |
56 ) # pragma: no cover | |
57 | |
58 def _remove_device_dir(self, path): | 48 def _remove_device_dir(self, path): |
59 """Remove the directory on the device.""" | 49 """Remove the directory on the device.""" |
60 return self.m.run( | 50 return self.m.run( |
61 self.m.step, | 51 self.m.step, |
62 'rmdir %s' % path, | 52 'rmdir %s' % path, |
63 cmd=[self.ios_bin.join('ios_rm'), path], | 53 cmd=[self.ios_bin.join('ios_rm'), path], |
64 env=self.default_env, | 54 env=self.default_env, |
65 infra_step=True, | 55 infra_step=True, |
66 ) | 56 ) |
67 | 57 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 ) | 89 ) |
100 | 90 |
101 def copy_file_to_device(self, host_path, device_path): | 91 def copy_file_to_device(self, host_path, device_path): |
102 """Like shutil.copyfile, but for copying to a connected device.""" | 92 """Like shutil.copyfile, but for copying to a connected device.""" |
103 self.m.run( | 93 self.m.run( |
104 self.m.step, | 94 self.m.step, |
105 name='push %s' % host_path, | 95 name='push %s' % host_path, |
106 cmd=[self.ios_bin.join('ios_push_file'), host_path, device_path], | 96 cmd=[self.ios_bin.join('ios_push_file'), host_path, device_path], |
107 env=self.default_env, | 97 env=self.default_env, |
108 infra_step=True, | 98 infra_step=True, |
109 ) # pragma: no cover | 99 ) |
110 | 100 |
111 def copy_extra_build_products(self, swarming_out_dir): | 101 def copy_extra_build_products(self, swarming_out_dir): |
112 xcode_dir = self.m.path.join( | 102 xcode_dir = self.m.path.join( |
113 'xcodebuild', '%s-iphoneos' % self.m.vars.configuration) | 103 'xcodebuild', '%s-iphoneos' % self.m.vars.configuration) |
114 self.m.run.copy_build_products( | 104 self.m.run.copy_build_products( |
115 self.m.vars.skia_dir.join(xcode_dir), | 105 self.m.vars.skia_dir.join(xcode_dir), |
116 swarming_out_dir.join(xcode_dir)) | 106 swarming_out_dir.join(xcode_dir)) |
117 | 107 |
118 def create_clean_device_dir(self, path): | 108 def create_clean_device_dir(self, path): |
119 """Like shutil.rmtree() + os.makedirs(), but on a connected device.""" | 109 """Like shutil.rmtree() + os.makedirs(), but on a connected device.""" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 | 157 |
168 def remove_file_on_device(self, path): | 158 def remove_file_on_device(self, path): |
169 """Remove the file on the device.""" | 159 """Remove the file on the device.""" |
170 return self.m.run( | 160 return self.m.run( |
171 self.m.step, | 161 self.m.step, |
172 'rm %s' % path, | 162 'rm %s' % path, |
173 cmd=[self.ios_bin.join('ios_rm'), path], | 163 cmd=[self.ios_bin.join('ios_rm'), path], |
174 env=self.default_env, | 164 env=self.default_env, |
175 infra_step=True, | 165 infra_step=True, |
176 ) | 166 ) |
OLD | NEW |