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 'build/file', | 10 'build/file', |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 api.step('GN', | 103 api.step('GN', |
104 [gn, 'gen', out_dir], | 104 [gn, 'gen', out_dir], |
105 env={'CPPFLAGS': '-DSK_ALLOW_CROSSPROCESS_PICTUREIMAGEFILTERS=1', | 105 env={'CPPFLAGS': '-DSK_ALLOW_CROSSPROCESS_PICTUREIMAGEFILTERS=1', |
106 'GYP_GENERATORS': 'ninja'}, | 106 'GYP_GENERATORS': 'ninja'}, |
107 cwd=src_dir) | 107 cwd=src_dir) |
108 # Build Chrome. | 108 # Build Chrome. |
109 api.step('Build Chrome', | 109 api.step('Build Chrome', |
110 ['ninja', '-C', out_dir, 'chrome'], | 110 ['ninja', '-C', out_dir, 'chrome'], |
111 cwd=src_dir) | 111 cwd=src_dir) |
112 | 112 |
113 # Download boto file (needed by recreate_skps.py) to tmp dir. | |
114 boto_file = api.path['slave_build'].join('tmp', '.boto') | |
115 api.python.inline( | |
116 'download boto file', | |
117 """ | |
118 import os | |
119 import urllib2 | |
120 | |
121 BOTO_URL = 'http://metadata/computeMetadata/v1/project/attributes/boto-file' | |
122 | |
123 dest_path = '%s' | |
124 dest_dir = os.path.dirname(dest_path) | |
125 if not os.path.exists(dest_dir): | |
126 os.makedirs(dest_dir) | |
127 | |
128 req = urllib2.Request(BOTO_URL, headers={'Metadata-Flavor': 'Google'}) | |
129 contents = urllib2.urlopen(req).read() | |
130 | |
131 with open(dest_path, 'w') as f: | |
132 f.write(contents) | |
133 """ % boto_file) | |
134 | |
135 # Clean up the output dir. | 113 # Clean up the output dir. |
136 output_dir = api.path['slave_build'].join('skp_output') | 114 output_dir = api.path['slave_build'].join('skp_output') |
137 if api.path.exists(output_dir): | 115 if api.path.exists(output_dir): |
138 api.file.rmtree('skp_output', output_dir) | 116 api.file.rmtree('skp_output', output_dir) |
139 api.file.makedirs('skp_output', output_dir) | 117 api.file.makedirs('skp_output', output_dir) |
140 | 118 |
141 # Capture the SKPs. | 119 # Capture the SKPs. |
142 path_var= api.path.pathsep.join([str(api.path['depot_tools']), '%(PATH)s']) | 120 path_var= api.path.pathsep.join([str(api.path['depot_tools']), '%(PATH)s']) |
143 env = { | 121 env = { |
144 'CHROME_HEADLESS': '1', | 122 'CHROME_HEADLESS': '1', |
145 'PATH': path_var, | 123 'PATH': path_var, |
146 } | 124 } |
147 boto_env = { | |
148 'AWS_CREDENTIAL_FILE': boto_file, | |
149 'BOTO_CONFIG': boto_file, | |
150 } | |
151 recreate_skps_env = {} | |
152 recreate_skps_env.update(env) | |
153 recreate_skps_env.update(boto_env) | |
154 asset_dir = api.vars.infrabots_dir.join('assets', 'skp') | 125 asset_dir = api.vars.infrabots_dir.join('assets', 'skp') |
155 cmd = ['python', asset_dir.join('create.py'), | 126 cmd = ['python', asset_dir.join('create.py'), |
156 '--chrome_src_path', src_dir, | 127 '--chrome_src_path', src_dir, |
157 '--browser_executable', src_dir.join('out', 'Release', 'chrome'), | 128 '--browser_executable', src_dir.join('out', 'Release', 'chrome'), |
158 '--target_dir', output_dir] | 129 '--target_dir', output_dir] |
159 if 'Canary' not in api.properties['buildername']: | 130 if 'Canary' not in api.properties['buildername']: |
160 cmd.append('--upload_to_partner_bucket') | 131 cmd.append('--upload_to_partner_bucket') |
161 api.step('Recreate SKPs', | 132 api.step('Recreate SKPs', |
162 cmd=cmd, | 133 cmd=cmd, |
163 cwd=api.vars.skia_dir, | 134 cwd=api.vars.skia_dir, |
164 env=recreate_skps_env) | 135 env=env) |
165 | 136 |
166 # Upload the SKPs. | 137 # Upload the SKPs. |
167 if 'Canary' not in api.properties['buildername']: | 138 if 'Canary' not in api.properties['buildername']: |
168 cmd = ['python', | 139 cmd = ['python', |
169 api.vars.skia_dir.join('infra', 'bots', 'upload_skps.py'), | 140 api.vars.skia_dir.join('infra', 'bots', 'upload_skps.py'), |
170 '--target_dir', output_dir] | 141 '--target_dir', output_dir] |
171 with depot_tools_auth(api, UPDATE_SKPS_KEY): | 142 with depot_tools_auth(api, UPDATE_SKPS_KEY): |
172 api.step('Upload SKPs', | 143 api.step('Upload SKPs', |
173 cmd=cmd, | 144 cmd=cmd, |
174 cwd=api.vars.skia_dir, | 145 cwd=api.vars.skia_dir, |
175 env=env) | 146 env=env) |
176 | 147 |
177 | 148 |
178 def GenTests(api): | 149 def GenTests(api): |
179 for mastername, slaves in TEST_BUILDERS.iteritems(): | 150 for mastername, slaves in TEST_BUILDERS.iteritems(): |
180 for slavename, builders_by_slave in slaves.iteritems(): | 151 for slavename, builders_by_slave in slaves.iteritems(): |
181 for builder in builders_by_slave: | 152 for builder in builders_by_slave: |
182 test = ( | 153 test = ( |
183 api.test(builder) + | 154 api.test(builder) + |
184 api.properties(buildername=builder, | 155 api.properties(buildername=builder, |
185 mastername=mastername, | 156 mastername=mastername, |
186 slavename=slavename, | 157 slavename=slavename, |
187 revision='abc123', | 158 revision='abc123', |
188 buildnumber=2, | 159 buildnumber=2, |
189 path_config='kitchen', | 160 path_config='kitchen', |
190 swarm_out_dir='[SWARM_OUT_DIR]') + | 161 swarm_out_dir='[SWARM_OUT_DIR]') + |
191 api.path.exists(api.path['slave_build'].join('skp_output')) | 162 api.path.exists(api.path['slave_build'].join('skp_output')) |
192 ) | 163 ) |
193 yield test | 164 yield test |
OLD | NEW |