OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 """Recipe for the Skia RecreateSKPs Bot.""" | 6 """Recipe for the Skia RecreateSKPs Bot.""" |
7 | 7 |
8 | 8 |
9 DEPS = [ | 9 DEPS = [ |
10 'depot_tools/gclient', | 10 'depot_tools/gclient', |
| 11 'file', |
11 'recipe_engine/path', | 12 'recipe_engine/path', |
12 'recipe_engine/properties', | 13 'recipe_engine/properties', |
13 'recipe_engine/python', | 14 'recipe_engine/python', |
14 'recipe_engine/raw_io', | 15 'recipe_engine/raw_io', |
15 'recipe_engine/step', | 16 'recipe_engine/step', |
16 'skia', | 17 'skia', |
17 ] | 18 ] |
18 | 19 |
19 | 20 |
20 TEST_BUILDERS = { | 21 TEST_BUILDERS = { |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 if not os.path.exists(dest_dir): | 123 if not os.path.exists(dest_dir): |
123 os.makedirs(dest_dir) | 124 os.makedirs(dest_dir) |
124 | 125 |
125 req = urllib2.Request(BOTO_URL, headers={'Metadata-Flavor': 'Google'}) | 126 req = urllib2.Request(BOTO_URL, headers={'Metadata-Flavor': 'Google'}) |
126 contents = urllib2.urlopen(req).read() | 127 contents = urllib2.urlopen(req).read() |
127 | 128 |
128 with open(dest_path, 'w') as f: | 129 with open(dest_path, 'w') as f: |
129 f.write(contents) | 130 f.write(contents) |
130 """ % boto_file) | 131 """ % boto_file) |
131 | 132 |
| 133 # Clean up the output dir. |
| 134 output_dir = api.path['slave_build'].join('skp_output') |
| 135 if api.path.exists(output_dir): |
| 136 api.file.rmtree('skp_output', output_dir) |
| 137 api.file.makedirs('skp_output', output_dir) |
| 138 |
132 # Capture the SKPs. | 139 # Capture the SKPs. |
133 with depot_tools_auth(api, UPDATE_SKPS_KEY): | 140 path_var= api.path.pathsep.join([str(api.path['depot_tools']), '%(PATH)s']) |
134 cmd = ['python', api.path['build'].join('scripts', 'slave', 'skia', | 141 env = { |
135 'recreate_skps.py'), | 142 'CHROME_HEADLESS': '1', |
136 src_dir, | 143 'PATH': path_var, |
137 src_dir.join('out', 'Release', 'chrome')] | 144 } |
138 if 'Canary' in api.properties['buildername']: | 145 boto_env = { |
139 cmd.append('--dry-run') | 146 'AWS_CREDENTIAL_FILE': boto_file, |
140 path_var= api.path.pathsep.join([str(api.path['depot_tools']), '%(PATH)s']) | 147 'BOTO_CONFIG': boto_file, |
141 api.step('Recreate SKPs', | 148 } |
142 cmd=cmd, | 149 recreate_skps_env = {} |
143 cwd=api.skia.checkout_root.join('skia'), | 150 recreate_skps_env.update(env) |
144 env={ | 151 recreate_skps_env.update(boto_env) |
145 'AWS_CREDENTIAL_FILE': boto_file, | 152 asset_dir = api.skia.infrabots_dir.join('assets', 'skp') |
146 'BOTO_CONFIG': boto_file, | 153 cmd = ['python', asset_dir.join('create.py'), |
147 'CHROME_HEADLESS': '1', | 154 '--chrome_src_path', src_dir, |
148 'PATH': path_var, | 155 '--browser_executable', src_dir.join('out', 'Release', 'chrome'), |
149 }, | 156 '--target_dir', output_dir] |
150 ) | 157 if 'Canary' not in api.properties['buildername']: |
| 158 cmd.append('--upload_to_partner_bucket') |
| 159 api.step('Recreate SKPs', |
| 160 cmd=cmd, |
| 161 cwd=api.skia.skia_dir, |
| 162 env=recreate_skps_env) |
| 163 |
| 164 # Upload the SKPs. |
| 165 if 'Canary' not in api.properties['buildername']: |
| 166 cmd = ['python', |
| 167 api.path['build'].join('scripts', 'slave', 'skia', 'upload_skps.py'), |
| 168 '--target_dir', output_dir] |
| 169 with depot_tools_auth(api, UPDATE_SKPS_KEY): |
| 170 api.step('Upload SKPs', |
| 171 cmd=cmd, |
| 172 cwd=api.skia.skia_dir, |
| 173 env=env) |
| 174 |
151 | 175 |
152 def GenTests(api): | 176 def GenTests(api): |
153 for mastername, slaves in TEST_BUILDERS.iteritems(): | 177 for mastername, slaves in TEST_BUILDERS.iteritems(): |
154 for slavename, builders_by_slave in slaves.iteritems(): | 178 for slavename, builders_by_slave in slaves.iteritems(): |
155 for builder in builders_by_slave: | 179 for builder in builders_by_slave: |
156 test = ( | 180 test = ( |
157 api.test(builder) + | 181 api.test(builder) + |
158 api.properties(buildername=builder, | 182 api.properties(buildername=builder, |
159 mastername=mastername, | 183 mastername=mastername, |
160 slavename=slavename, | 184 slavename=slavename, |
161 revision='abc123', | 185 revision='abc123', |
162 buildnumber=2, | 186 buildnumber=2, |
163 swarm_out_dir='[SWARM_OUT_DIR]') | 187 swarm_out_dir='[SWARM_OUT_DIR]') + |
| 188 api.path.exists(api.path['slave_build'].join('skp_output')) |
164 ) | 189 ) |
165 yield test | 190 yield test |
OLD | NEW |