Flutter Engine
The Flutter Engine
Functions | Variables
builder_name_schema.builder_name_schema Namespace Reference

Functions

def MakeBuilderName (**parts)
 
def DictForBuilderName (builder_name)
 

Variables

 BUILDER_NAME_SCHEMA = None
 
 BUILDER_NAME_SEP = None
 
string BUILDER_ROLE_BAZELBUILD = 'BazelBuild'
 
string BUILDER_ROLE_BAZELTEST = 'BazelTest'
 
string BUILDER_ROLE_BUILD = 'Build'
 
string BUILDER_ROLE_BUILDSTATS = 'BuildStats'
 
string BUILDER_ROLE_CANARY = 'Canary'
 
string BUILDER_ROLE_CODESIZE = 'CodeSize'
 
string BUILDER_ROLE_HOUSEKEEPER = 'Housekeeper'
 
string BUILDER_ROLE_INFRA = 'Infra'
 
string BUILDER_ROLE_PERF = 'Perf'
 
string BUILDER_ROLE_TEST = 'Test'
 
string BUILDER_ROLE_UPLOAD = 'Upload'
 
tuple BUILDER_ROLES
 

Function Documentation

◆ DictForBuilderName()

def builder_name_schema.builder_name_schema.DictForBuilderName (   builder_name)
Makes a dictionary containing details about the builder from its name.

Definition at line 143 of file builder_name_schema.py.

143def DictForBuilderName(builder_name):
144 """Makes a dictionary containing details about the builder from its name."""
145 split = builder_name.split(BUILDER_NAME_SEP)
146
147 def pop_front(items):
148 try:
149 return items.pop(0), items
150 except:
151 raise ValueError(
152 'Invalid builder name: %s (not enough parts)' % builder_name)
153
154 result = {}
155
156 def _parse(depth, role, parts):
157 schema = BUILDER_NAME_SCHEMA.get(role)
158 if not schema:
159 raise ValueError('Invalid builder name: %s' % builder_name)
160 if depth == 0:
161 result['role'] = str(role)
162 else:
163 result['sub-role-%d' % depth] = str(role)
164 for key in schema.get('keys', []):
165 value, parts = pop_front(parts)
166 result[key] = str(value)
167 for sub_role in schema.get('recurse_roles', []):
168 if len(parts) > 0 and sub_role == parts[0]:
169 parts = _parse(depth+1, parts[0], parts[1:])
170 for key in schema.get('optional_keys', []):
171 if parts:
172 value, parts = pop_front(parts)
173 result[key] = str(value)
174 if parts:
175 raise ValueError('Invalid builder name: %s' % builder_name)
176 return parts
177
178 _parse(0, split[0], split[1:])
179
180 return result

◆ MakeBuilderName()

def builder_name_schema.builder_name_schema.MakeBuilderName ( **  parts)

Definition at line 85 of file builder_name_schema.py.

85def MakeBuilderName(**parts):
86 for v in parts.values():
87 if BUILDER_NAME_SEP in v:
88 raise ValueError('Parts cannot contain "%s"' % BUILDER_NAME_SEP)
89
90 rv_parts = []
91
92 def process(depth, parts):
93 role_key = 'role'
94 if depth != 0:
95 role_key = 'sub-role-%d' % depth
96 role = parts.get(role_key)
97 if not role:
98 raise ValueError('Invalid parts; missing key %s' % role_key)
99 s = BUILDER_NAME_SCHEMA.get(role)
100 if not s:
101 raise ValueError('Invalid parts; unknown role %s' % role)
102 rv_parts.append(role)
103 del parts[role_key]
104
105 for key in s.get('keys', []):
106 value = parts.get(key)
107 if not value:
108 raise ValueError('Invalid parts; missing %s' % key)
109 rv_parts.append(value)
110 del parts[key]
111
112 recurse_roles = s.get('recurse_roles', [])
113 if len(recurse_roles) > 0:
114 sub_role_key = 'sub-role-%d' % (depth+1)
115 sub_role = parts.get(sub_role_key)
116 if not sub_role:
117 raise ValueError('Invalid parts; missing %s' % sub_role_key)
118
119 found = False
120 for recurse_role in recurse_roles:
121 if recurse_role == sub_role:
122 found = True
123 parts = process(depth+1, parts)
124 break
125 if not found:
126 raise ValueError('Invalid parts; unknown sub-role %s' % sub_role)
127
128 for key in s.get('optional_keys', []):
129 if parts.get(key):
130 rv_parts.append(parts[key])
131 del parts[key]
132
133 if len(parts) > 0:
134 raise ValueError('Invalid parts; too many parts: %s' % parts)
135
136 return parts
137
138 process(0, parts)
139
140 return BUILDER_NAME_SEP.join(rv_parts)
141
142
static void process(const char *inPath, const char *lexer, const char *token, const char *hPath, const char *cppPath)
Definition: Main.cpp:114

Variable Documentation

◆ BUILDER_NAME_SCHEMA

builder_name_schema.builder_name_schema.BUILDER_NAME_SCHEMA = None

Definition at line 17 of file builder_name_schema.py.

◆ BUILDER_NAME_SEP

builder_name_schema.builder_name_schema.BUILDER_NAME_SEP = None

Definition at line 20 of file builder_name_schema.py.

◆ BUILDER_ROLE_BAZELBUILD

string builder_name_schema.builder_name_schema.BUILDER_ROLE_BAZELBUILD = 'BazelBuild'

Definition at line 23 of file builder_name_schema.py.

◆ BUILDER_ROLE_BAZELTEST

string builder_name_schema.builder_name_schema.BUILDER_ROLE_BAZELTEST = 'BazelTest'

Definition at line 24 of file builder_name_schema.py.

◆ BUILDER_ROLE_BUILD

string builder_name_schema.builder_name_schema.BUILDER_ROLE_BUILD = 'Build'

Definition at line 25 of file builder_name_schema.py.

◆ BUILDER_ROLE_BUILDSTATS

string builder_name_schema.builder_name_schema.BUILDER_ROLE_BUILDSTATS = 'BuildStats'

Definition at line 26 of file builder_name_schema.py.

◆ BUILDER_ROLE_CANARY

string builder_name_schema.builder_name_schema.BUILDER_ROLE_CANARY = 'Canary'

Definition at line 27 of file builder_name_schema.py.

◆ BUILDER_ROLE_CODESIZE

string builder_name_schema.builder_name_schema.BUILDER_ROLE_CODESIZE = 'CodeSize'

Definition at line 28 of file builder_name_schema.py.

◆ BUILDER_ROLE_HOUSEKEEPER

string builder_name_schema.builder_name_schema.BUILDER_ROLE_HOUSEKEEPER = 'Housekeeper'

Definition at line 29 of file builder_name_schema.py.

◆ BUILDER_ROLE_INFRA

string builder_name_schema.builder_name_schema.BUILDER_ROLE_INFRA = 'Infra'

Definition at line 30 of file builder_name_schema.py.

◆ BUILDER_ROLE_PERF

string builder_name_schema.builder_name_schema.BUILDER_ROLE_PERF = 'Perf'

Definition at line 31 of file builder_name_schema.py.

◆ BUILDER_ROLE_TEST

string builder_name_schema.builder_name_schema.BUILDER_ROLE_TEST = 'Test'

Definition at line 32 of file builder_name_schema.py.

◆ BUILDER_ROLE_UPLOAD

string builder_name_schema.builder_name_schema.BUILDER_ROLE_UPLOAD = 'Upload'

Definition at line 33 of file builder_name_schema.py.

◆ BUILDER_ROLES

tuple builder_name_schema.builder_name_schema.BUILDER_ROLES
Initial value:
1= (BUILDER_ROLE_BAZELBUILD,
2 BUILDER_ROLE_BAZELTEST,
3 BUILDER_ROLE_BUILD,
4 BUILDER_ROLE_BUILDSTATS,
5 BUILDER_ROLE_CANARY,
6 BUILDER_ROLE_CODESIZE,
7 BUILDER_ROLE_HOUSEKEEPER,
8 BUILDER_ROLE_INFRA,
9 BUILDER_ROLE_PERF,
10 BUILDER_ROLE_TEST,
11 BUILDER_ROLE_UPLOAD)

Definition at line 34 of file builder_name_schema.py.