Merge "Allow adding blocks of texts to the Android.bp file." am: 089f93dcec am: 259f311b40 am: 65e333b054 am: 2b21bd3be9

Original change: https://android-review.googlesource.com/c/platform/development/+/1734013

Change-Id: I8655550e303d088c18285b54e11fc5beb951756c
This commit is contained in:
Joel Galenson
2021-06-21 20:30:43 +00:00
committed by Automerger Merge Worker

View File

@@ -659,6 +659,9 @@ class Crate(object):
self.write(' ],')
if self.runner.args.min_sdk_version and crate_type == 'lib':
self.write(' min_sdk_version: "%s",' % self.runner.args.min_sdk_version)
if self.runner.args.add_module_block:
with open(self.runner.args.add_module_block, 'r') as f:
self.write(' %s,' % f.read().replace('\n', '\n '))
self.write('}')
def dump_android_flags(self):
@@ -1377,6 +1380,9 @@ class Runner(object):
if lib_name not in dumped_libs:
dumped_libs.add(lib_name)
lib.dump()
if self.args.add_toplevel_block:
with open(self.args.add_toplevel_block, 'r') as f:
self.append_to_bp('\n' + f.read() + '\n')
if self.args.dependencies and self.dependencies:
self.dump_dependencies()
if self.errors:
@@ -1635,6 +1641,14 @@ def get_parser():
nargs='*',
default=[],
help='Do not emit the given cfg.')
parser.add_argument(
'--add-toplevel-block',
type=str,
help='Add the contents of the given file to the top level of the Android.bp.')
parser.add_argument(
'--add-module-block',
type=str,
help='Add the contents of the given file to the main module.')
parser.add_argument(
'--no-test-mapping',
action='store_true',