Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Functions | Variables
tools.BUILD_simulator Namespace Reference

Functions

 noop (*args, **kwargs)
 
 select_simulator (d)
 
 BUILD_glob_single (pattern)
 
 BUILD_glob (include, exclude=())
 

Variables

 DOUBLE_STAR_RE = re.compile(r'/\*\*/')
 
 STAR_RE = re.compile(r'\*')
 
str DOUBLE_STAR_PLACEHOLDER = "xxxdoublestarxxx"
 
str STAR_PLACEHOLDER = "xxxstarxxx"
 
dict global_names
 
dict local_names = {}
 

Function Documentation

◆ BUILD_glob()

tools.BUILD_simulator.BUILD_glob (   include,
  exclude = () 
)

Definition at line 62 of file BUILD_simulator.py.

62def BUILD_glob(include, exclude=()):
63 files = set()
64 for pattern in include:
65 files.update(BUILD_glob_single(pattern))
66 for pattern in exclude:
67 files.difference_update(BUILD_glob_single(pattern))
68 return list(sorted(files))
69
70# With these namespaces, we can treat BUILD.public as if it were
71# Python code. This pulls its variable definitions (SRCS, HDRS,
72# DEFINES, etc.) into local_names.

◆ BUILD_glob_single()

tools.BUILD_simulator.BUILD_glob_single (   pattern)

Definition at line 35 of file BUILD_simulator.py.

35def BUILD_glob_single(pattern):
36 if pattern.find('**') < 0:
37 # If pattern doesn't include **, glob.glob more-or-less does the right
38 # thing.
39 return glob.glob(pattern)
40 # First transform pattern into a regexp.
41 # Temporarily remove ** and *.
42 pattern2 = DOUBLE_STAR_RE.sub(DOUBLE_STAR_PLACEHOLDER, pattern)
43 pattern3 = STAR_RE.sub(STAR_PLACEHOLDER, pattern2)
44 # Replace any regexp special characters.
45 pattern4 = re.escape(pattern3)
46 # Replace * with [^/]* and ** with .*.
47 pattern5 = pattern4.replace(STAR_PLACEHOLDER, '[^/]*')
48 pattern6 = pattern5.replace(DOUBLE_STAR_PLACEHOLDER, '.*/')
49 # Anchor the match at the beginning and end.
50 pattern7 = "^" + pattern6 + "$"
51 pattern_re = re.compile(pattern7)
52 matches = set()
53 for root, _, files in os.walk('.'):
54 for fname in files:
55 # Remove initial "./".
56 path = os.path.join(root, fname)[2:]
57 if pattern_re.match(path):
58 matches.add(path)
59 return matches
60
61# Simulates BUILD file glob().

◆ noop()

tools.BUILD_simulator.noop ( args,
**  kwargs 
)

Definition at line 18 of file BUILD_simulator.py.

18def noop(*args, **kwargs):
19 pass
20

◆ select_simulator()

tools.BUILD_simulator.select_simulator (   d)

Definition at line 21 of file BUILD_simulator.py.

21def 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

Variable Documentation

◆ DOUBLE_STAR_PLACEHOLDER

str tools.BUILD_simulator.DOUBLE_STAR_PLACEHOLDER = "xxxdoublestarxxx"

Definition at line 31 of file BUILD_simulator.py.

◆ DOUBLE_STAR_RE

tools.BUILD_simulator.DOUBLE_STAR_RE = re.compile(r'/\*\*/')

Definition at line 29 of file BUILD_simulator.py.

◆ global_names

dict tools.BUILD_simulator.global_names
Initial value:
1= {
2 'cc_library': noop,
3 'cc_test': noop,
4 'exports_files': noop,
5 'glob': BUILD_glob,
6 'select': select_simulator,
7 'BASE_DIR': '',
8 'BASE_EXTERNAL_DEPS_ANDROID': [],
9 'BASE_EXTERNAL_DEPS_IOS': [],
10 'BASE_EXTERNAL_DEPS_UNIX': [],
11 'CONDITION_ANDROID': 'CONDITION_ANDROID',
12 'CONDITION_IOS': 'CONDITION_IOS',
13 'DM_EXTERNAL_DEPS': [],
14 'EXTERNAL_DEPS_ALL': [],
15 'EXTERNAL_INCLUDES': [],
16}

Definition at line 73 of file BUILD_simulator.py.

◆ local_names

dict tools.BUILD_simulator.local_names = {}

Definition at line 89 of file BUILD_simulator.py.

◆ STAR_PLACEHOLDER

str tools.BUILD_simulator.STAR_PLACEHOLDER = "xxxstarxxx"

Definition at line 32 of file BUILD_simulator.py.

◆ STAR_RE

tools.BUILD_simulator.STAR_RE = re.compile(r'\*')

Definition at line 30 of file BUILD_simulator.py.