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

Side by Side Diff: tools/BUILD_simulator.py

Issue 1414643002: Enable BUILD file compilation of skia and dm with --config=android_arm. (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: Use -mfpu=neon everywhere for Android; fold opts targets back into srcs. Created 5 years, 1 month 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 | « tools/BUILD.public.expected ('k') | tools/flags/SkCommandLineFlags.cpp » ('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 2015 Google Inc. 3 # Copyright 2015 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 # This script does a very rough simulation of BUILD file expansion, 8 # This script does a very rough simulation of BUILD file expansion,
9 # mostly to see the effects of glob(). 9 # mostly to see the effects of glob().
10 10
11 # We start by adding some symbols to our namespace that BUILD.public calls. 11 # We start by adding some symbols to our namespace that BUILD.public calls.
12 12
13 import glob 13 import glob
14 import os 14 import os
15 import pprint 15 import pprint
16 import re 16 import re
17 17
18 def noop(*args, **kwargs): 18 def noop(*args, **kwargs):
19 pass 19 pass
20 20
21 def select_simulator(d):
22 result = []
23 for k in d:
24 result.append("*** BEGIN %s ***" % k)
25 result.extend(d[k])
26 result.append("*** END %s ***" % k)
27 return result
28
21 DOUBLE_STAR_RE = re.compile(r'/\*\*/') 29 DOUBLE_STAR_RE = re.compile(r'/\*\*/')
22 STAR_RE = re.compile(r'\*') 30 STAR_RE = re.compile(r'\*')
23 DOUBLE_STAR_PLACEHOLDER = "xxxdoublestarxxx" 31 DOUBLE_STAR_PLACEHOLDER = "xxxdoublestarxxx"
24 STAR_PLACEHOLDER = "xxxstarxxx" 32 STAR_PLACEHOLDER = "xxxstarxxx"
25 33
26 # Returns a set of files that match pattern. 34 # Returns a set of files that match pattern.
27 def BUILD_glob_single(pattern): 35 def BUILD_glob_single(pattern):
28 if pattern.find('**') < 0: 36 if pattern.find('**') < 0:
29 # If pattern doesn't include **, glob.glob more-or-less does the right 37 # If pattern doesn't include **, glob.glob more-or-less does the right
30 # thing. 38 # thing.
(...skipping 25 matching lines...) Expand all
56 for pattern in include: 64 for pattern in include:
57 files.update(BUILD_glob_single(pattern)) 65 files.update(BUILD_glob_single(pattern))
58 for pattern in exclude: 66 for pattern in exclude:
59 files.difference_update(BUILD_glob_single(pattern)) 67 files.difference_update(BUILD_glob_single(pattern))
60 return list(sorted(files)) 68 return list(sorted(files))
61 69
62 # With these namespaces, we can treat BUILD.public as if it were 70 # With these namespaces, we can treat BUILD.public as if it were
63 # Python code. This pulls its variable definitions (SRCS, HDRS, 71 # Python code. This pulls its variable definitions (SRCS, HDRS,
64 # DEFINES, etc.) into local_names. 72 # DEFINES, etc.) into local_names.
65 global_names = { 73 global_names = {
66 'exports_files': noop,
67 'cc_library': noop, 74 'cc_library': noop,
68 'cc_test': noop, 75 'cc_test': noop,
76 'exports_files': noop,
69 'glob': BUILD_glob, 77 'glob': BUILD_glob,
70 'EXTERNAL_DEPS': [], 78 'select': select_simulator,
71 'BASE_DIR': "", 79 'BASE_DIR': "",
80 'CONDITION_ANDROID': "CONDITION_ANDROID",
72 'DM_EXTERNAL_DEPS': [], 81 'DM_EXTERNAL_DEPS': [],
82 'EXTERNAL_DEPS_ANDROID': [],
83 'EXTERNAL_DEPS_UNIX': [],
73 } 84 }
74 local_names = {} 85 local_names = {}
75 execfile('BUILD.public', global_names, local_names) 86 execfile('BUILD.public', global_names, local_names)
76 87
77 with open('tools/BUILD.public.expected', 'w') as out: 88 with open('tools/BUILD.public.expected', 'w') as out:
78 print >>out, "This file is auto-generated by tools/BUILD_simulator.py." 89 print >>out, "This file is auto-generated by tools/BUILD_simulator.py."
79 print >>out, "It expands BUILD.public to make it easy to see changes." 90 print >>out, "It expands BUILD.public to make it easy to see changes."
80 for name, value in sorted(local_names.items()): 91 for name, value in sorted(local_names.items()):
81 print >>out, name, '= ', 92 print >>out, name, '= ',
82 pprint.pprint(value, out) 93 pprint.pprint(value, out)
OLDNEW
« no previous file with comments | « tools/BUILD.public.expected ('k') | tools/flags/SkCommandLineFlags.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698