cargo2android: Use cfgs property

Test: Run cargo2android on multiple crates, verify Android.bp
Bug: 183727250
Change-Id: I087ffb0de33db7a09735d2e9c668d991c9f5bb49
This commit is contained in:
Thiébaud Weksteen
2021-04-08 14:23:49 +02:00
parent bc2a5a25ee
commit a5a728b4c8

View File

@@ -652,14 +652,12 @@ class Crate(object):
def dump_android_flags(self):
"""Dump Android module flags property."""
if not self.cfgs and not self.codegens and not self.cap_lints:
if not self.codegens and not self.cap_lints:
return
self.write(' flags: [')
if self.cap_lints:
self.write(' "--cap-lints ' + self.cap_lints + '",')
cfg_fmt = '"--cfg %s"'
codegens_fmt = '"-C %s"'
self.dump_android_property_list_items(cfg_fmt, self.cfgs)
self.dump_android_property_list_items(codegens_fmt, self.codegens)
self.write(' ],')
@@ -667,6 +665,7 @@ class Crate(object):
if self.edition:
self.write(' edition: "' + self.edition + '",')
self.dump_android_property_list('features', '"%s"', self.features)
self.dump_android_property_list('cfgs', '"%s"', self.cfgs)
self.dump_android_flags()
if self.externs:
self.dump_android_externs()