convert metadata.Build to a subclass of dict

Like with the App class in the commit before, this makes it a lot
easier to work with this data when converting between the internal
formats and external formats like YAML, JSON, MsgPack, protobuf, etc.

The one unfortunate thing here is Build.update. It becomes
dict.update(), which is a method not an attribute.
build.get('update') or build['update'] could be used, but that would
be oddly inconsistent. So instead the field is renamed to
'androidupdate', except for in the .txt v0 metadata files. This better
describes what field does anyway, since it runs `android update`.

Build.update is only referenced in two places right next to each other
for the ant builds, so this change still seems worthwhile.
This commit is contained in:
Hans-Christoph Steiner 2016-11-29 13:26:32 +01:00
parent b7fc7f2228
commit c0bc3afda9
9 changed files with 450 additions and 552 deletions

View file

@ -1544,15 +1544,15 @@ def prepare_source(vcs, app, build, build_dir, srclib_dir, extlib_dir, onserver=
(app.id, build.version), p.output)
# Generate (or update) the ant build file, build.xml...
if build.build_method() == 'ant' and build.update != ['no']:
if build.build_method() == 'ant' and build.androidupdate != ['no']:
parms = ['android', 'update', 'lib-project']
lparms = ['android', 'update', 'project']
if build.target:
parms += ['-t', build.target]
lparms += ['-t', build.target]
if build.update:
update_dirs = build.update
if build.androidupdate:
update_dirs = build.androidupdate
else:
update_dirs = ant_subprojects(root_dir) + ['.']