OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 import json | 5 import json |
6 import os | 6 import os |
7 import sys | 7 import sys |
8 | 8 |
9 import buildbot_common | 9 import buildbot_common |
10 import build_version | 10 import build_version |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 'description': '%s Example' % desc['TITLE'], | 158 'description': '%s Example' % desc['TITLE'], |
159 'key': True, | 159 'key': True, |
160 'channel': None, | 160 'channel': None, |
161 'permissions': pretty_permissions, | 161 'permissions': pretty_permissions, |
162 'multi_platform': desc.get('MULTI_PLATFORM', False), | 162 'multi_platform': desc.get('MULTI_PLATFORM', False), |
163 'version': build_version.ChromeVersionNoTrunk() | 163 'version': build_version.ChromeVersionNoTrunk() |
164 } | 164 } |
165 RunTemplateFileIfChanged(srcpath, dstpath, replace) | 165 RunTemplateFileIfChanged(srcpath, dstpath, replace) |
166 | 166 |
167 | 167 |
168 def FindAndCopyFiles(src_files, root, search_dirs, dst_dir): | 168 def FindAndCopyFiles(src_files, root, search_dirs, dst_dir, verbose=True): |
169 buildbot_common.MakeDir(dst_dir) | 169 buildbot_common.MakeDir(dst_dir, verbose=verbose) |
170 for src_name in src_files: | 170 for src_name in src_files: |
171 src_file = FindFile(src_name, root, search_dirs) | 171 src_file = FindFile(src_name, root, search_dirs) |
172 if not src_file: | 172 if not src_file: |
173 ErrorExit('Failed to find: ' + src_name) | 173 ErrorExit('Failed to find: ' + src_name) |
174 dst_file = os.path.join(dst_dir, src_name) | 174 dst_file = os.path.join(dst_dir, src_name) |
175 if os.path.exists(dst_file): | 175 if os.path.exists(dst_file): |
176 if os.stat(src_file).st_mtime <= os.stat(dst_file).st_mtime: | 176 if os.stat(src_file).st_mtime <= os.stat(dst_file).st_mtime: |
177 Trace('Skipping "%s", destination "%s" is newer.' % ( | 177 Trace('Skipping "%s", destination "%s" is newer.' % ( |
178 src_file, dst_file)) | 178 src_file, dst_file)) |
179 continue | 179 continue |
180 dst_path = os.path.dirname(dst_file) | 180 dst_path = os.path.dirname(dst_file) |
181 if not os.path.exists(dst_path): | 181 if not os.path.exists(dst_path): |
182 buildbot_common.MakeDir(dst_path) | 182 buildbot_common.MakeDir(dst_path, verbose=verbose) |
183 buildbot_common.CopyFile(src_file, dst_file) | 183 buildbot_common.CopyFile(src_file, dst_file, verbose=verbose) |
184 | 184 |
185 | 185 |
186 def ModifyDescInPlace(desc): | 186 def ModifyDescInPlace(desc): |
187 """Perform post-load processing on .dsc file data. | 187 """Perform post-load processing on .dsc file data. |
188 | 188 |
189 Currently this consists of: | 189 Currently this consists of: |
190 - Add -Wall to CXXFLAGS | 190 - Add -Wall to CXXFLAGS |
191 - Synthesize SEL_LDR_LIBS and SEL_LDR_DEPS by stripping | 191 - Synthesize SEL_LDR_LIBS and SEL_LDR_DEPS by stripping |
192 down LIBS and DEPS (removing certain ppapi-only libs). | 192 down LIBS and DEPS (removing certain ppapi-only libs). |
193 """ | 193 """ |
(...skipping 12 matching lines...) Expand all Loading... |
206 value[key] = [v for v in value[key] if v not in ppapi_only_libs] | 206 value[key] = [v for v in value[key] if v not in ppapi_only_libs] |
207 else: | 207 else: |
208 value = [v for v in value if v not in ppapi_only_libs] | 208 value = [v for v in value if v not in ppapi_only_libs] |
209 return value | 209 return value |
210 | 210 |
211 target['SEL_LDR_LIBS'] = filter_out('LIBS') | 211 target['SEL_LDR_LIBS'] = filter_out('LIBS') |
212 target['SEL_LDR_DEPS'] = filter_out('DEPS') | 212 target['SEL_LDR_DEPS'] = filter_out('DEPS') |
213 | 213 |
214 | 214 |
215 def ProcessProject(pepperdir, srcroot, dstroot, desc, toolchains, configs=None, | 215 def ProcessProject(pepperdir, srcroot, dstroot, desc, toolchains, configs=None, |
216 first_toolchain=False): | 216 first_toolchain=False, verbose=True): |
217 if not configs: | 217 if not configs: |
218 configs = ['Debug', 'Release'] | 218 configs = ['Debug', 'Release'] |
219 | 219 |
220 name = desc['NAME'] | 220 name = desc['NAME'] |
221 out_dir = os.path.join(dstroot, desc['DEST'], name) | 221 out_dir = os.path.join(dstroot, desc['DEST'], name) |
222 buildbot_common.MakeDir(out_dir) | 222 buildbot_common.MakeDir(out_dir, verbose=verbose) |
223 srcdirs = desc.get('SEARCH', ['.', SDK_RESOURCE_DIR]) | 223 srcdirs = desc.get('SEARCH', ['.', SDK_RESOURCE_DIR]) |
224 | 224 |
225 # Copy sources to example directory | 225 # Copy sources to example directory |
226 sources = GenerateSourceCopyList(desc) | 226 sources = GenerateSourceCopyList(desc) |
227 FindAndCopyFiles(sources, srcroot, srcdirs, out_dir) | 227 FindAndCopyFiles(sources, srcroot, srcdirs, out_dir, verbose=verbose) |
228 | 228 |
229 # Copy public headers to the include directory. | 229 # Copy public headers to the include directory. |
230 for headers_set in desc.get('HEADERS', []): | 230 for headers_set in desc.get('HEADERS', []): |
231 headers = headers_set['FILES'] | 231 headers = headers_set['FILES'] |
232 header_out_dir = os.path.join(dstroot, headers_set['DEST']) | 232 header_out_dir = os.path.join(dstroot, headers_set['DEST']) |
233 FindAndCopyFiles(headers, srcroot, srcdirs, header_out_dir) | 233 FindAndCopyFiles(headers, srcroot, srcdirs, header_out_dir, verbose=verbose) |
234 | 234 |
235 make_path = os.path.join(out_dir, 'Makefile') | 235 make_path = os.path.join(out_dir, 'Makefile') |
236 | 236 |
237 outdir = os.path.dirname(os.path.abspath(make_path)) | 237 outdir = os.path.dirname(os.path.abspath(make_path)) |
238 if getos.GetPlatform() == 'win': | 238 if getos.GetPlatform() == 'win': |
239 AddMakeBat(pepperdir, outdir) | 239 AddMakeBat(pepperdir, outdir) |
240 | 240 |
241 # If this project has no TARGETS, then we don't need to generate anything. | 241 # If this project has no TARGETS, then we don't need to generate anything. |
242 if 'TARGETS' not in desc: | 242 if 'TARGETS' not in desc: |
243 return (name, desc['DEST']) | 243 return (name, desc['DEST']) |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 rel_path = os.path.relpath(pepperdir, os.path.dirname(out_path)) | 289 rel_path = os.path.relpath(pepperdir, os.path.dirname(out_path)) |
290 template_dict = { | 290 template_dict = { |
291 'projects': targets, | 291 'projects': targets, |
292 'deps' : deps, | 292 'deps' : deps, |
293 'rel_sdk' : rel_path, | 293 'rel_sdk' : rel_path, |
294 } | 294 } |
295 RunTemplateFileIfChanged(in_path, out_path, template_dict) | 295 RunTemplateFileIfChanged(in_path, out_path, template_dict) |
296 outdir = os.path.dirname(os.path.abspath(out_path)) | 296 outdir = os.path.dirname(os.path.abspath(out_path)) |
297 if getos.GetPlatform() == 'win': | 297 if getos.GetPlatform() == 'win': |
298 AddMakeBat(pepperdir, outdir) | 298 AddMakeBat(pepperdir, outdir) |
OLD | NEW |