gn2bp: add jni_generator.py sanitizer
Moves code for appending --javap to sanitizer. Test: none Change-Id: I5b3263ddf74a4f7561550eb9057bd54f7367c214
This commit is contained in:
@@ -623,6 +623,8 @@ def get_action_sanitizer(target):
|
|||||||
return WriteBuildFlagHeaderSanitizer(target)
|
return WriteBuildFlagHeaderSanitizer(target)
|
||||||
elif target.script == "//build/write_build_date_header.py":
|
elif target.script == "//build/write_build_date_header.py":
|
||||||
return WriteBuildDateHeaderSanitizer(target)
|
return WriteBuildDateHeaderSanitizer(target)
|
||||||
|
elif target.script == '//base/android/jni_generator/jni_generator.py':
|
||||||
|
return JniGeneratorSanitizer(target)
|
||||||
else:
|
else:
|
||||||
# TODO: throw exception here once all script hacks have been converted.
|
# TODO: throw exception here once all script hacks have been converted.
|
||||||
return BaseActionSanitizer(target)
|
return BaseActionSanitizer(target)
|
||||||
@@ -696,6 +698,13 @@ class WriteBuildFlagHeaderSanitizer(BaseActionSanitizer):
|
|||||||
self._set_arg_value('--output', '$(out)')
|
self._set_arg_value('--output', '$(out)')
|
||||||
return super().get_args()
|
return super().get_args()
|
||||||
|
|
||||||
|
class JniGeneratorSanitizer(BaseActionSanitizer):
|
||||||
|
def get_args(self):
|
||||||
|
if self._has_arg('--jar_file'):
|
||||||
|
self._append_arg('--javap', '$$(find out/.path -name javap)')
|
||||||
|
return super().get_args()
|
||||||
|
|
||||||
|
|
||||||
def create_action_foreach_modules(blueprint, target):
|
def create_action_foreach_modules(blueprint, target):
|
||||||
""" The following assumes that rebase_path exists in the args.
|
""" The following assumes that rebase_path exists in the args.
|
||||||
The args of an action_foreach contains hints about which output files are generated
|
The args of an action_foreach contains hints about which output files are generated
|
||||||
@@ -737,7 +746,6 @@ def create_action_module(blueprint, target):
|
|||||||
target.args = sanitizer.get_args()
|
target.args = sanitizer.get_args()
|
||||||
|
|
||||||
if target.script == '//base/android/jni_generator/jni_generator.py':
|
if target.script == '//base/android/jni_generator/jni_generator.py':
|
||||||
needs_javap = False
|
|
||||||
for i, val in enumerate(target.args):
|
for i, val in enumerate(target.args):
|
||||||
if val == '--output_dir':
|
if val == '--output_dir':
|
||||||
# replace --output_dir gen/jni_headers/... with --output_dir $(genDir)/...
|
# replace --output_dir gen/jni_headers/... with --output_dir $(genDir)/...
|
||||||
@@ -762,11 +770,6 @@ def create_action_module(blueprint, target):
|
|||||||
# delete leading ../../ and add path to javap
|
# delete leading ../../ and add path to javap
|
||||||
filename = re.sub('^\.\./\.\./', '', target.args[i + 1])
|
filename = re.sub('^\.\./\.\./', '', target.args[i + 1])
|
||||||
target.args[i + 1] = '$(location %s)' % filename
|
target.args[i + 1] = '$(location %s)' % filename
|
||||||
needs_javap = True
|
|
||||||
|
|
||||||
if needs_javap:
|
|
||||||
target.args.append('--javap')
|
|
||||||
target.args.append('$$(find out/.path -name javap)')
|
|
||||||
# fix target.output directory to match #include statements.
|
# fix target.output directory to match #include statements.
|
||||||
target.outputs = [re.sub('^jni_headers/', '', out) for out in target.outputs]
|
target.outputs = [re.sub('^jni_headers/', '', out) for out in target.outputs]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user