Skip to content

Commit f41c024

Browse files
committed
Support specifying versions in yml config.
1 parent 908d0bd commit f41c024

File tree

2 files changed

+30
-14
lines changed

2 files changed

+30
-14
lines changed

ci/fireci/fireciplugins/macrobenchmark.py

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -126,19 +126,7 @@ async def _create_test_src(self):
126126
app_id = self.test_app_config['application-id']
127127
self.logger.info(f'Creating test app "{app_name}" with application-id "{app_id}"...')
128128

129-
mustache_context = {
130-
'application-id': app_id,
131-
'plugins': self.test_app_config['plugins'] if 'plugins' in self.test_app_config else [],
132-
'dependencies': [
133-
{
134-
'key': x,
135-
'version': self.artifact_versions[x]
136-
} for x in self.test_app_config['dependencies']
137-
] if 'dependencies' in self.test_app_config else [],
138-
}
139-
140-
if app_name != 'baseline':
141-
mustache_context['plugins'].append('com.google.gms.google-services')
129+
mustache_context = await self._prepare_mustache_context()
142130

143131
shutil.copytree('template', self.test_app_dir)
144132
with chdir(self.test_app_dir):
@@ -181,6 +169,33 @@ async def _upload_apks_to_ftl(self):
181169

182170
await self._exec_subprocess(executable, args)
183171

172+
async def _prepare_mustache_context(self):
173+
app_name = self.test_app_config['name']
174+
app_id = self.test_app_config['application-id']
175+
176+
mustache_context = {
177+
'application-id': app_id,
178+
'plugins': [],
179+
'dependencies': [],
180+
}
181+
182+
if app_name != 'baseline':
183+
mustache_context['plugins'].append('com.google.gms.google-services')
184+
185+
if 'plugins' in self.test_app_config:
186+
mustache_context['plugins'].extend(self.test_app_config['plugins'])
187+
188+
if 'dependencies' in self.test_app_config:
189+
for dep in self.test_app_config['dependencies']:
190+
if '@' in dep:
191+
key, version = dep.split('@', 1)
192+
dependency = {'key': key, 'version': version}
193+
else:
194+
dependency = {'key': dep, 'version': self.artifact_versions[dep]}
195+
mustache_context['dependencies'].append(dependency)
196+
197+
return mustache_context
198+
184199
async def _exec_subprocess(self, executable, args):
185200
command = " ".join([executable, *args])
186201
self.logger.info(f'Executing command: "{command}"...')

macrobenchmark/config.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ firebase-inappmessaging-display:
4444
name: inappmessaging
4545
application-id: com.google.firebase.benchmark.inappmessaging
4646
dependencies:
47-
- com.google.firebase:firebase-analytics-ktx
47+
- com.google.firebase:[email protected]
48+
- com.google.firebase:firebase-inappmessaging-ktx
4849
- com.google.firebase:firebase-inappmessaging-display-ktx
4950

5051
firebase-messaging:

0 commit comments

Comments
 (0)